only handle runs which are needed in the plot

This commit is contained in:
nemu 2008-06-13 05:35:21 +00:00
parent ce3078db6d
commit 2e61a0f5b6

View File

@ -149,6 +149,32 @@ int main(int argc, char *argv[])
} }
return status; return status;
} }
// make a plot list vector
PMsrPlotList *msrPlotList = msrHandler->GetMsrPlotList();
PIntVector plotList;
bool runPresent;
for (unsigned int i=0; i<msrPlotList->size(); i++) {
for (unsigned int j=0; j<msrPlotList->at(i).fRuns.size(); j++) {
// check that run is not already in the plotList
runPresent = false;
for (unsigned int k=0; k<plotList.size(); k++) {
if (msrPlotList->at(i).fRuns[j].Re() == static_cast<int>(plotList[k])) {
runPresent = true;
break;
}
}
if (!runPresent) {
plotList.push_back(static_cast<int>(msrPlotList->at(i).fRuns[j].Re()));
}
}
}
/*
cout << endl << ">> plotList:" << endl;
for(unsigned int i=0; i<plotList.size(); i++){
cout << plotList[i] << ", ";
}
cout << endl;
*/
// read all the necessary runs (raw data) // read all the necessary runs (raw data)
PRunDataHandler *dataHandler; PRunDataHandler *dataHandler;
@ -162,12 +188,22 @@ int main(int argc, char *argv[])
cout << endl << "**ERROR** 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 view // generate the necessary histogramms for the view
PRunListCollection *runListCollection = 0; PRunListCollection *runListCollection = 0;
if (success) { if (success) {
// feed all the necessary histogramms for the view // feed all the necessary histogramms for the view
runListCollection = new PRunListCollection(msrHandler, dataHandler); runListCollection = new PRunListCollection(msrHandler, dataHandler);
for (unsigned int i=0; i < msrHandler->GetMsrRunList()->size(); i++) { for (unsigned int i=0; i<msrHandler->GetMsrRunList()->size(); i++) {
// if run is in plotList add it, otherwise go to the next
runPresent = false;
for (unsigned int j=0; j<plotList.size(); j++) {
if (static_cast<unsigned int>(plotList[j]) == i+1) {
runPresent = true;
break;
}
}
if (runPresent) {
//cout << endl << ">> Will add run " << i << endl;
success = runListCollection->Add(i, kView); success = runListCollection->Add(i, kView);
if (!success) { if (!success) {
cout << endl << "**ERROR** Couldn't handle run no " << i << " "; cout << endl << "**ERROR** Couldn't handle run no " << i << " ";
@ -176,6 +212,7 @@ int main(int argc, char *argv[])
} }
} }
} }
}
if (success) { if (success) {
// generate Root application needed for PMusrCanvas // generate Root application needed for PMusrCanvas
@ -236,6 +273,7 @@ cout << endl << "clean up canvas vector ...";
cout << endl; cout << endl;
// clean up // clean up
plotList.clear();
if (saxParser) { if (saxParser) {
delete saxParser; delete saxParser;
saxParser = 0; saxParser = 0;