fixed wrong data start time. Added slightly more flexibile startup path file handling

This commit is contained in:
nemu
2008-04-08 06:06:34 +00:00
parent a5d079d0a1
commit 5d363ce953
5 changed files with 42 additions and 12 deletions

View File

@@ -29,6 +29,10 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
@@ -93,11 +97,24 @@ int main(int argc, char *argv[])
return PMUSR_WRONG_STARTUP_SYNTAX;
}
// get default path (for the moment only linux like)
char *pmusrpath;
char musrpath[128];
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath == 0) { // not set, will try default one
strcpy(musrpath, "/home/nemu/analysis/bin");
cout << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
} else {
strncpy(musrpath, pmusrpath, sizeof(musrpath));
}
// read startup file
char startup_path_name[128];
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
TSAXParser *saxParser = new TSAXParser();
PStartupHandler *startupHandler = new PStartupHandler();
saxParser->ConnectToHandler("PStartupHandler", startupHandler);
status = saxParser->ParseFile("musrfit_startup.xml");
status = saxParser->ParseFile(startup_path_name);
// check for parse errors
if (status) { // error
cout << endl << "**ERROR** reading/parsing musrfit_startup.xml. Fix it.";
@@ -144,7 +161,7 @@ int main(int argc, char *argv[])
// feed all the necessary histogramms for the view
runListCollection = new PRunListCollection(msrHandler, dataHandler);
for (unsigned int i=0; i < msrHandler->GetMsrRunList()->size(); i++) {
success = runListCollection->Add(i);
success = runListCollection->Add(i, kView);
if (!success) {
cout << endl << "**ERROR** Couldn't handle run no " << i << " ";
cout << (*msrHandler->GetMsrRunList())[i].fRunName.Data();
@@ -174,13 +191,6 @@ int main(int argc, char *argv[])
break;
}
// ugly but rootcint cannot handle the spirit-parser framework
// musrCanvas->SetParamInfo(*msrHandler->GetMsrParamList());
// musrCanvas->SetTheoryInfo(*msrHandler->GetMsrTheory());
// musrCanvas->SetFunctionsInfo(*msrHandler->GetMsrFunctions());
// musrCanvas->SetRunsInfo(*msrHandler->GetMsrRunList());
// musrCanvas->SetPlotInfo(msrHandler->GetMsrPlotList()->at(i));
// musrCanvas->SetStatisticsInfo(*msrHandler->GetMsrStatistic());
musrCanvas->SetMsrHandler(msrHandler);
musrCanvas->SetRunListCollection(runListCollection);