diff --git a/src/classes/PFitter.cpp b/src/classes/PFitter.cpp index 520f1615..1dd5d747 100644 --- a/src/classes/PFitter.cpp +++ b/src/classes/PFitter.cpp @@ -118,6 +118,7 @@ bool PFitter::DoFit() SetParameters(); bool status; + bool minosUsed = false; for (unsigned int i=0; iSetMsrParamPosErrorPresent(i, false); + } + } + return true; } diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index a0215d61..d5655858 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -683,6 +683,28 @@ bool PMsrHandler::SetMsrParamStep(unsigned int i, double value) return true; } +//-------------------------------------------------------------------------- +// SetMsrParamPosErrorPresent (public) +//-------------------------------------------------------------------------- +/** + *

+ * + * \param i + * \param value + */ +bool PMsrHandler::SetMsrParamPosErrorPresent(unsigned int i, bool value) +{ + if (i > fParam.size()) { + cout << endl << "PMsrHandler::SetMsrParamPosErrorPresent(): i = " << i << " is larger than the number of parameters " << fParam.size(); + cout << endl; + return false; + } + + fParam[i].fPosErrorPresent = value; + + return true; +} + //-------------------------------------------------------------------------- // SetMsrParamPosError (public) //-------------------------------------------------------------------------- diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 554939cc..ff0838d4 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -62,7 +62,9 @@ PMusrCanvas::PMusrCanvas() /** * */ -PMusrCanvas::PMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh) +PMusrCanvas::PMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, + const PIntVector markerList, const PIntVector colorList) : + fMarkerList(markerList), fColorList(colorList) { fValid = false; diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index dbdcfe61..5a141c16 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -52,7 +52,7 @@ using namespace std; *

* */ -PRunDataHandler::PRunDataHandler(PMsrHandler *msrInfo) +PRunDataHandler::PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataPath) : fDataPath(dataPath) { // cout << endl << "in PRunDataHandler::PRunDataHandler()"; @@ -63,6 +63,10 @@ PRunDataHandler::PRunDataHandler(PMsrHandler *msrInfo) fAllDataAvailable = false; else fAllDataAvailable = true; + +/*for (unsigned int i=0; iAccessPathName(str.Data())!=true) { // found + pathName = str; + break; + } + } + } // check if the file is found in the directories given by WKMFULLDATAPATH const char *wkmpath = gSystem->Getenv("WKMFULLDATAPATH"); - if (pathName.CompareTo("???") == 0) { // not found in local directory search + if (pathName.CompareTo("???") == 0) { // not found in local directory and xml path str = TString(wkmpath); // WKMFULLDATAPATH has the structure: path_1:path_2:...:path_n TObjArray *tokens = str.Tokenize(":"); TObjString *ostr; for (int i=0; iGetEntries(); i++) { ostr = dynamic_cast(tokens->At(i)); - str = ostr->GetString() + "/" + runInfo.fRunName + TString(".") + ext; + str = ostr->GetString() + TString("/") + runInfo.fRunName + TString(".") + ext; if (gSystem->AccessPathName(str.Data())!=true) { // found pathName = str; break; @@ -276,7 +288,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo) // no proper path name found if (pathName.CompareTo("???") == 0) { - cout << endl << "ERROR: Couldn't find '" << runInfo.fRunName << "' in any standard path."; + cout << endl << "**ERROR** Couldn't find '" << runInfo.fRunName << "' in any standard path."; cout << endl << " standard search pathes are:"; cout << endl << " 1. the local directory"; cout << endl << " 2. the data directory given in the startup XML file"; diff --git a/src/classes/PStartupHandler.cpp b/src/classes/PStartupHandler.cpp index 34d8e581..d722d882 100644 --- a/src/classes/PStartupHandler.cpp +++ b/src/classes/PStartupHandler.cpp @@ -154,6 +154,7 @@ void PStartupHandler::OnCharacters(const char *str) case eDataPath: // check that str is a valid path // add str to the path list + fDataPathList.push_back(str); break; case eMarker: // check that str is a number diff --git a/src/include/PMsrHandler.h b/src/include/PMsrHandler.h index 156b6d82..90538db1 100644 --- a/src/include/PMsrHandler.h +++ b/src/include/PMsrHandler.h @@ -32,11 +32,6 @@ #ifndef _PMSRHANDLER_H_ #define _PMSRHANDLER_H_ -/* -#include -using namespace std; -*/ - #include #include @@ -72,6 +67,7 @@ class PMsrHandler virtual bool SetMsrParamValue(unsigned int i, double value); virtual bool SetMsrParamStep(unsigned int i, double value); + virtual bool SetMsrParamPosErrorPresent(unsigned int i, bool value); virtual bool SetMsrParamPosError(unsigned int i, double value); virtual void SetMsrStatisticMin(double min) { fStatistic.fMin = min; } diff --git a/src/include/PMusr.h b/src/include/PMusr.h index ea2586b2..91ae6ccd 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -110,6 +110,12 @@ typedef vector PDoubleVector; */ typedef vector PComplexVector; +//------------------------------------------------------------- +/** + *

typedef to make to code more readable. + */ +typedef vector PStringVector; + //------------------------------------------------------------------------------------------ /** *

Predominantly used in PRunBase. diff --git a/src/include/PMusrCanvas.h b/src/include/PMusrCanvas.h index 8688607e..d3f236db 100644 --- a/src/include/PMusrCanvas.h +++ b/src/include/PMusrCanvas.h @@ -52,7 +52,8 @@ class PMusrCanvas : public TObject, public TQObject { public: PMusrCanvas(); - PMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh); + PMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, + const PIntVector markerList, const PIntVector colorList); virtual ~PMusrCanvas(); virtual Bool_t IsValid() { return fValid; } @@ -82,6 +83,9 @@ class PMusrCanvas : public TObject, public TQObject PMsrLines fTheoryList; PMsrLines fFunctionList; + PIntVector fMarkerList; + PIntVector fColorList; + ClassDef(PMusrCanvas, 1) }; diff --git a/src/include/PRunDataHandler.h b/src/include/PRunDataHandler.h index ac0160be..e390184b 100644 --- a/src/include/PRunDataHandler.h +++ b/src/include/PRunDataHandler.h @@ -43,14 +43,15 @@ using namespace std; class PRunDataHandler { public: - PRunDataHandler(PMsrHandler *msrInfo); + PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataPath); virtual ~PRunDataHandler(); virtual bool IsAllDataAvailable() { return fAllDataAvailable; } virtual PRawRunData* GetRunData(TString runName); private: - PMsrHandler *fMsrInfo; + PMsrHandler *fMsrInfo; + PStringVector fDataPath; bool fAllDataAvailable; ///< flag indicating if all data sets could be read TString fRunName; ///< current run name diff --git a/src/include/PStartupHandler.h b/src/include/PStartupHandler.h index c008a011..97729e1e 100644 --- a/src/include/PStartupHandler.h +++ b/src/include/PStartupHandler.h @@ -56,13 +56,17 @@ class PStartupHandler : public TObject, public TQObject virtual void OnFatalError(const char*); // SLOT virtual void OnCdataBlock(const char*, Int_t); // SLOT + virtual const PStringVector GetDataPathList() const { return fDataPathList; } + virtual const PIntVector GetMarkerList() const { return fMarkerList; } + virtual const PIntVector GetColorList() const { return fColorList; } + private: enum EKeyWords {eEmpty, eComment, eDataPath, eRootSettings, eMarkerList, eMarker, eColorList, eColor}; EKeyWords fKey; - vector fDataPathList; + PStringVector fDataPathList; PIntVector fMarkerList; PIntVector fColorList; diff --git a/src/musrfit.cpp b/src/musrfit.cpp index 90f69b56..f7432086 100644 --- a/src/musrfit.cpp +++ b/src/musrfit.cpp @@ -33,10 +33,11 @@ #include using namespace std; -#include "TString.h" -#include "TFile.h" -#include "TCanvas.h" -#include "TH1.h" +#include +#include +#include +#include +#include #include "PMusr.h" #include "PStartupHandler.h" @@ -501,7 +502,25 @@ int main(int argc, char *argv[]) } // read startup file + TSAXParser *saxParser = new TSAXParser(); PStartupHandler *startupHandler = new PStartupHandler(); + saxParser->ConnectToHandler("PStartupHandler", startupHandler); + status = saxParser->ParseFile("musrfit_startup.xml"); + // check for parse errors + if (status) { // error + cout << endl << "**ERROR** reading/parsing musrfit_startup.xml. Fix it."; + cout << endl; + // clean up + if (saxParser) { + delete saxParser; + saxParser = 0; + } + if (startupHandler) { + delete startupHandler; + startupHandler = 0; + } + return PMUSR_WRONG_STARTUP_SYNTAX; + } // read msr-file PMsrHandler *msrHandler = new PMsrHandler(argv[1]); @@ -524,7 +543,7 @@ int main(int argc, char *argv[]) musrfit_debug_info(msrHandler); // read all the necessary runs (raw data) - PRunDataHandler *dataHandler = new PRunDataHandler(msrHandler); + PRunDataHandler *dataHandler = new PRunDataHandler(msrHandler, startupHandler->GetDataPathList()); bool success = dataHandler->IsAllDataAvailable(); if (!success) { cout << endl << "Couldn't read all data files, will quit ..." << endl; diff --git a/src/musrfit_startup.xml b/src/musrfit_startup.xml index 20eebbe9..bf3b8264 100644 --- a/src/musrfit_startup.xml +++ b/src/musrfit_startup.xml @@ -4,8 +4,8 @@ $Id$ Defines default settings for the musrfit package - - + /mnt/data/nemu/his + /mnt/data/nemu/wkm diff --git a/src/musrview.cpp b/src/musrview.cpp index 690148c7..7c690cc6 100644 --- a/src/musrview.cpp +++ b/src/musrview.cpp @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) } // read all the necessary runs (raw data) - PRunDataHandler *dataHandler = new PRunDataHandler(msrHandler); + PRunDataHandler *dataHandler = new PRunDataHandler(msrHandler, startupHandler->GetDataPathList()); success = dataHandler->IsAllDataAvailable(); if (!success) { cout << endl << "**ERROR** Couldn't read all data files, will quit ..." << endl; @@ -157,7 +157,8 @@ int main(int argc, char *argv[]) // generate Root application needed for PMusrCanvas TApplication app("App", &argc, argv); - PMusrCanvas *musrCanvas = new PMusrCanvas(msrHandler->GetMsrTitle()->Data(), 10, 10, 800, 600); + PMusrCanvas *musrCanvas = new PMusrCanvas(msrHandler->GetMsrTitle()->Data(), 10, 10, 800, 600, + startupHandler->GetMarkerList(), startupHandler->GetColorList()); if (!musrCanvas->IsValid()) { cout << endl << "**SEVERE ERROR** Couldn't invoke all necessary objects, will quit."; cout << endl;