some even more flexible startup handler scheme
This commit is contained in:
parent
5d363ce953
commit
676043cb81
@ -46,9 +46,7 @@ short term:
|
||||
|
||||
* at the moment that startup handler is looked for in the directory where musrfit/musrview
|
||||
is executed, this is stupid. Define a place where to look for it.
|
||||
|
||||
* check concept to get bin data for musrview on single histo (fBinData in PRunBase).
|
||||
If it is ok, implement it for the others.
|
||||
**DONE** 08-04-08
|
||||
|
||||
* do I need to cleanup AddText() objects from TPaveText etc myself? **CHECK**
|
||||
|
||||
|
@ -57,6 +57,19 @@ PMusrCanvas::PMusrCanvas()
|
||||
fKeyboardHandlerText = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
*
|
||||
*/
|
||||
PMusrCanvas::PMusrCanvas(const int number, const char* title,
|
||||
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh) :
|
||||
fPlotNumber(number)
|
||||
{
|
||||
InitMusrCanvas(title, wtopx, wtopy, ww, wh);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
@ -67,6 +80,59 @@ PMusrCanvas::PMusrCanvas(const int number, const char* title,
|
||||
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
|
||||
const PIntVector markerList, const PIntVector colorList) :
|
||||
fPlotNumber(number), fMarkerList(markerList), fColorList(colorList)
|
||||
{
|
||||
InitMusrCanvas(title, wtopx, wtopy, ww, wh);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Destructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
*
|
||||
*/
|
||||
PMusrCanvas::~PMusrCanvas()
|
||||
{
|
||||
cout << "~PMusrCanvas() called" << endl;
|
||||
// cleanup
|
||||
if (fKeyboardHandlerText) {
|
||||
delete fKeyboardHandlerText;
|
||||
fKeyboardHandlerText = 0;
|
||||
}
|
||||
if (fTitlePad) {
|
||||
delete fTitlePad;
|
||||
fTitlePad = 0;
|
||||
}
|
||||
if (fDataTheoryPad) {
|
||||
delete fDataTheoryPad;
|
||||
fDataTheoryPad = 0;
|
||||
}
|
||||
if (fParameterTheoryPad) {
|
||||
delete fParameterTheoryPad;
|
||||
fParameterTheoryPad = 0;
|
||||
}
|
||||
if (fInfoPad) {
|
||||
delete fInfoPad;
|
||||
fInfoPad = 0;
|
||||
}
|
||||
if (fMainCanvas) {
|
||||
delete fMainCanvas;
|
||||
fMainCanvas = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// InitMusrCanvas
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param title
|
||||
* \param wtopx
|
||||
* \param wtopy
|
||||
* \param ww
|
||||
* \param wh
|
||||
*/
|
||||
void PMusrCanvas::InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
|
||||
{
|
||||
fValid = false;
|
||||
|
||||
@ -158,43 +224,6 @@ cout << canvasName.Data() << " = " << fMainCanvas << endl;
|
||||
// cout << "fParameterTheoryPad " << fParameterTheoryPad << endl;
|
||||
// cout << "fInfoPad " << fInfoPad << endl;
|
||||
// cout << "fKeyboardHandlerText " << fKeyboardHandlerText << endl;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Destructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
*
|
||||
*/
|
||||
PMusrCanvas::~PMusrCanvas()
|
||||
{
|
||||
cout << "~PMusrCanvas() called" << endl;
|
||||
// cleanup
|
||||
if (fKeyboardHandlerText) {
|
||||
delete fKeyboardHandlerText;
|
||||
fKeyboardHandlerText = 0;
|
||||
}
|
||||
if (fTitlePad) {
|
||||
delete fTitlePad;
|
||||
fTitlePad = 0;
|
||||
}
|
||||
if (fDataTheoryPad) {
|
||||
delete fDataTheoryPad;
|
||||
fDataTheoryPad = 0;
|
||||
}
|
||||
if (fParameterTheoryPad) {
|
||||
delete fParameterTheoryPad;
|
||||
fParameterTheoryPad = 0;
|
||||
}
|
||||
if (fInfoPad) {
|
||||
delete fInfoPad;
|
||||
fInfoPad = 0;
|
||||
}
|
||||
if (fMainCanvas) {
|
||||
delete fMainCanvas;
|
||||
fMainCanvas = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -52,11 +52,28 @@ using namespace std;
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
PRunDataHandler::PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataPath) : fDataPath(dataPath)
|
||||
PRunDataHandler::PRunDataHandler(PMsrHandler *msrInfo) : fMsrInfo(msrInfo)
|
||||
{
|
||||
// cout << endl << "in PRunDataHandler::PRunDataHandler()";
|
||||
|
||||
fMsrInfo = msrInfo;
|
||||
// read files
|
||||
if (!ReadFile()) // couldn't read file
|
||||
fAllDataAvailable = false;
|
||||
else
|
||||
fAllDataAvailable = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*/
|
||||
PRunDataHandler::PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataPath) :
|
||||
fMsrInfo(msrInfo), fDataPath(dataPath)
|
||||
{
|
||||
// cout << endl << "in PRunDataHandler::PRunDataHandler()";
|
||||
|
||||
// read files
|
||||
if (!ReadFile()) // couldn't read file
|
||||
|
@ -87,6 +87,8 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
{
|
||||
public:
|
||||
PMusrCanvas();
|
||||
PMusrCanvas(const int number, const char* title,
|
||||
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
|
||||
PMusrCanvas(const int number, const char* title,
|
||||
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
|
||||
const PIntVector markerList, const PIntVector colorList);
|
||||
@ -128,6 +130,7 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
PIntVector fMarkerList;
|
||||
PIntVector fColorList;
|
||||
|
||||
virtual void InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh);
|
||||
virtual void InitDataSet(PMusrCanvasDataSet &dataSet);
|
||||
virtual void CleanupDataSet(PMusrCanvasDataSet &dataSet);
|
||||
virtual void HandleSingleHistoDataSet(unsigned int runNo, PRunData *data);
|
||||
|
@ -43,6 +43,7 @@ using namespace std;
|
||||
class PRunDataHandler
|
||||
{
|
||||
public:
|
||||
PRunDataHandler(PMsrHandler *msrInfo);
|
||||
PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataPath);
|
||||
virtual ~PRunDataHandler();
|
||||
|
||||
|
@ -527,7 +527,7 @@ int main(int argc, char *argv[])
|
||||
status = saxParser->ParseFile(startup_path_name);
|
||||
// check for parse errors
|
||||
if (status) { // error
|
||||
cout << endl << "**ERROR** reading/parsing musrfit_startup.xml. Fix it.";
|
||||
cout << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
|
||||
cout << endl;
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
@ -538,7 +538,6 @@ int main(int argc, char *argv[])
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
return PMUSR_WRONG_STARTUP_SYNTAX;
|
||||
}
|
||||
|
||||
// read msr-file
|
||||
@ -547,12 +546,12 @@ int main(int argc, char *argv[])
|
||||
if (status != PMUSR_SUCCESS) {
|
||||
switch (status) {
|
||||
case PMUSR_MSR_FILE_NOT_FOUND:
|
||||
cout << endl << "couldn't find " << argv[1] << endl << endl;
|
||||
cout << endl << "**ERROR** couldn't find " << argv[1] << endl << endl;
|
||||
break;
|
||||
case PMUSR_MSR_SYNTAX_ERROR:
|
||||
cout << endl << "syntax error in file " << argv[1] << ", full stop here." << endl << endl;
|
||||
cout << endl << "**SYNTAX ERROR** in file " << argv[1] << ", full stop here." << endl << endl;
|
||||
default:
|
||||
cout << endl << "unkown error when trying to read the msr-file" << endl << endl;
|
||||
cout << endl << "**UNKOWN ERROR** when trying to read the msr-file" << endl << endl;
|
||||
break;
|
||||
}
|
||||
return status;
|
||||
@ -562,10 +561,15 @@ int main(int argc, char *argv[])
|
||||
musrfit_debug_info(msrHandler);
|
||||
|
||||
// read all the necessary runs (raw data)
|
||||
PRunDataHandler *dataHandler = new PRunDataHandler(msrHandler, startupHandler->GetDataPathList());
|
||||
PRunDataHandler *dataHandler;
|
||||
if (startupHandler)
|
||||
dataHandler = new PRunDataHandler(msrHandler, startupHandler->GetDataPathList());
|
||||
else
|
||||
dataHandler = new PRunDataHandler(msrHandler);
|
||||
|
||||
bool success = dataHandler->IsAllDataAvailable();
|
||||
if (!success) {
|
||||
cout << endl << "Couldn't read all data files, will quit ..." << endl;
|
||||
cout << endl << "**ERROR** Couldn't read all data files, will quit ..." << endl;
|
||||
}
|
||||
|
||||
// generate the necessary fit histogramms for the fit
|
||||
@ -576,7 +580,7 @@ int main(int argc, char *argv[])
|
||||
for (unsigned int i=0; i < msrHandler->GetMsrRunList()->size(); i++) {
|
||||
success = runListCollection->Add(i, kFit);
|
||||
if (!success) {
|
||||
cout << endl << "Couldn't handle run no " << i << " ";
|
||||
cout << endl << "**ERROR** Couldn't handle run no " << i << " ";
|
||||
cout << (*msrHandler->GetMsrRunList())[i].fRunName.Data();
|
||||
break;
|
||||
}
|
||||
@ -598,13 +602,13 @@ int main(int argc, char *argv[])
|
||||
if (status != PMUSR_SUCCESS) {
|
||||
switch (status) {
|
||||
case PMUSR_MSR_LOG_FILE_WRITE_ERROR:
|
||||
cout << endl << "couldn't write mlog-file" << endl << endl;
|
||||
cout << endl << "**ERROR** couldn't write mlog-file" << endl << endl;
|
||||
break;
|
||||
case PMUSR_TOKENIZE_ERROR:
|
||||
cout << endl << "couldn't generate mlog-file name" << endl << endl;
|
||||
cout << endl << "**ERROR** couldn't generate mlog-file name" << endl << endl;
|
||||
break;
|
||||
default:
|
||||
cout << endl << "unkown error when trying to write the mlog-file" << endl << endl;
|
||||
cout << endl << "**UNKOWN ERROR** when trying to write the mlog-file" << endl << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ int main(int argc, char *argv[])
|
||||
status = saxParser->ParseFile(startup_path_name);
|
||||
// check for parse errors
|
||||
if (status) { // error
|
||||
cout << endl << "**ERROR** reading/parsing musrfit_startup.xml. Fix it.";
|
||||
cout << endl << "**WARNING** reading/parsing musrfit_startup.xml.";
|
||||
cout << endl;
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
@ -128,7 +128,6 @@ int main(int argc, char *argv[])
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
return PMUSR_WRONG_STARTUP_SYNTAX;
|
||||
}
|
||||
|
||||
// read msr-file
|
||||
@ -149,7 +148,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// read all the necessary runs (raw data)
|
||||
PRunDataHandler *dataHandler = new PRunDataHandler(msrHandler, startupHandler->GetDataPathList());
|
||||
PRunDataHandler *dataHandler;
|
||||
if (startupHandler)
|
||||
dataHandler = new PRunDataHandler(msrHandler, startupHandler->GetDataPathList());
|
||||
else
|
||||
dataHandler = new PRunDataHandler(msrHandler);
|
||||
|
||||
success = dataHandler->IsAllDataAvailable();
|
||||
if (!success) {
|
||||
cout << endl << "**ERROR** Couldn't read all data files, will quit ..." << endl;
|
||||
@ -180,10 +184,15 @@ int main(int argc, char *argv[])
|
||||
bool ok = true;
|
||||
for (unsigned int i=0; i<msrHandler->GetMsrPlotList()->size(); i++) {
|
||||
|
||||
if (startupHandler)
|
||||
musrCanvas = new PMusrCanvas(i, msrHandler->GetMsrTitle()->Data(),
|
||||
10+i*100, 10+i*100, 800, 600,
|
||||
startupHandler->GetMarkerList(),
|
||||
startupHandler->GetColorList());
|
||||
else
|
||||
musrCanvas = new PMusrCanvas(i, msrHandler->GetMsrTitle()->Data(),
|
||||
10+i*100, 10+i*100, 800, 600);
|
||||
|
||||
if (!musrCanvas->IsValid()) {
|
||||
cout << endl << "**SEVERE ERROR** Couldn't invoke all necessary objects, will quit.";
|
||||
cout << endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user