Fixed crash of musrview in case the XML startup file is present but cannot be parsed correctly

This commit is contained in:
Bastian M. Wojek 2011-06-14 17:53:33 +00:00
parent f75194750c
commit 8dc31cad54
11 changed files with 66 additions and 24 deletions

View File

@ -10,6 +10,7 @@ NEW the chi^2 calculation in single-histogram and asymmetry fits is parallelized
if musrfit is built using a compiler supporting OpenMP (e.g. GCC >= 4.2)
Using --disable-omp this feature can be disabled on the configure level.
NEW any2many: force the user to define the exact NeXus ouput format (HDF4,HDF5,XML)
FIXED crash of musrview in case the XML startup file is present but cannot be parsed correctly
FIXED crash in case a non-existing userFcn is called from an existing library (MUSR-159)
FIXED slightly wrong chisq since the 0-bin entries were treated wrongly for scaled N0/Bkg data (MUSR-193)
FIXED the evaluation of the LF depolarization functions (before numerous unnecessary calculations were performed)

View File

@ -370,6 +370,22 @@ else
AC_MSG_ERROR([MathMore is not included in the ROOT installation... Please configure ROOT with the --enable-mathmore option and check that the feature is actually built!])
fi
AC_MSG_CHECKING([for XML support in ROOT])
if test "x$(${ROOTCONF} --has-xml)" == "xyes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([XML support is not included in the ROOT installation... Please configure ROOT with the --enable-xml option and check that the feature is actually built!])
fi
AC_MSG_CHECKING([for image processing support in ROOT])
if test "x$(${ROOTCONF} --has-asimage)" == "xyes"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([image processing support is not included in the ROOT installation... Please configure ROOT with the --enable-asimage option and check that the feature is actually built!])
fi
AC_SUBST(ROOT_LIBS)
AC_SUBST(ROOT_CFLAGS)

View File

@ -439,7 +439,7 @@ int main(int argc, char *argv[])
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> any2many **WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl << ">> any2many **WARNING** Reading/parsing musrfit_startup.xml failed.";
cerr << endl;
// clean up
if (saxParser) {
@ -454,7 +454,11 @@ int main(int argc, char *argv[])
}
// read all the necessary runs (raw data)
PRunDataHandler *dataHandler = new PRunDataHandler(&info, startupHandler->GetDataPathList());
PRunDataHandler *dataHandler;
if (startupHandler)
dataHandler = new PRunDataHandler(&info, startupHandler->GetDataPathList());
else
dataHandler = new PRunDataHandler(&info);
bool success = dataHandler->IsAllDataAvailable();
if (!success) {

View File

@ -427,7 +427,7 @@ int PMsr2Data::ParseXmlStartupFile()
status = fSaxParser->ParseFile(startup_path_name.c_str());
// check for parse errors
if (status) { // error
cerr << endl << ">> msr2data: **WARNING** reading/parsing musrfit_startup.xml." << endl;
cerr << endl << ">> msr2data: **WARNING** Reading/parsing musrfit_startup.xml failed." << endl;
// clean up
if (fSaxParser) {
delete fSaxParser;

View File

@ -73,6 +73,24 @@ using namespace std;
#define A2M_WKM 6
#define A2M_ASCII 7
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
/**
* <p>Constructor, reading the data histogramm files.
*
* \param msrInfo pointer to the msr-file handler
*/
PRunDataHandler::PRunDataHandler(PAny2ManyInfo *any2ManyInfo) : fAny2ManyInfo(any2ManyInfo)
{
fDataPath.clear();
// read files
if (!ReadWriteFilesList()) // couldn't read file
fAllDataAvailable = false;
else
fAllDataAvailable = true;
}
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------

View File

@ -156,7 +156,7 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -304,7 +304,7 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -487,7 +487,7 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -657,7 +657,7 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -804,7 +804,7 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -973,7 +973,7 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -1142,7 +1142,7 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
// int status (saxParser->ParseFile(startup_path_name.c_str()));
// // check for parse errors
// if (status) { // error
// cout << endl << "**WARNING** reading/parsing " << startup_path_name << " failed." << endl;
// cout << endl << "**WARNING** Reading/parsing " << startup_path_name << " failed." << endl;
// }
//
// fNSteps = startupHandler->GetNSteps();

View File

@ -168,7 +168,7 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -225,7 +225,7 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true)
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -452,7 +452,7 @@ TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -588,7 +588,7 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -723,7 +723,7 @@ TBulkTriVortexAGLII::TBulkTriVortexAGLII() : fCalcNeeded(true), fFirstCall(true)
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -871,7 +871,7 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -1023,7 +1023,7 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() :
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -1262,7 +1262,7 @@ TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNe
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -1501,7 +1501,7 @@ TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalc
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);

View File

@ -204,7 +204,7 @@ TLFDynGssKT::TLFDynGssKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0) {
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);
@ -526,7 +526,7 @@ TLFDynExpKT::TLFDynExpKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0), f
int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors
if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl;
assert(false);

View File

@ -46,6 +46,7 @@ using namespace std;
class PRunDataHandler
{
public:
PRunDataHandler(PAny2ManyInfo *any2ManyInfo);
PRunDataHandler(PAny2ManyInfo *any2ManyInfo, const PStringVector dataPath);
PRunDataHandler(PMsrHandler *msrInfo);
PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataPath);

View File

@ -445,7 +445,7 @@ int main(int argc, char *argv[])
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> musrfit **WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl << ">> musrfit **WARNING** Reading/parsing musrfit_startup.xml failed.";
cerr << endl;
// clean up
if (saxParser) {

View File

@ -179,7 +179,8 @@ int main(int argc, char *argv[])
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cerr << endl << ">> musrview **WARNING** reading/parsing musrfit_startup.xml.";
cerr << endl << ">> musrview **WARNING** Reading/parsing musrfit_startup.xml failed.";
cerr << endl << ">> Any graph will appear with random symbols and colors!";
cerr << endl;
// clean up
if (saxParser) {
@ -190,8 +191,9 @@ int main(int argc, char *argv[])
delete startupHandler;
startupHandler = 0;
}
} else {
startupHandler->CheckLists();
}
startupHandler->CheckLists();
}
// read msr-file