From 2e61a0f5b68272b05204c5c2d86696e0edb97793 Mon Sep 17 00:00:00 2001 From: nemu Date: Fri, 13 Jun 2008 05:35:21 +0000 Subject: [PATCH] only handle runs which are needed in the plot --- src/musrview.cpp | 56 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/src/musrview.cpp b/src/musrview.cpp index ce3e93db..8cf90b75 100644 --- a/src/musrview.cpp +++ b/src/musrview.cpp @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) if (status) { // error cout << endl << "**WARNING** reading/parsing musrfit_startup.xml failed."; cout << endl; -/* +/* // clean up if (saxParser) { delete saxParser; @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) delete startupHandler; startupHandler = 0; } -*/ +*/ } startupHandler->CheckLists(); @@ -149,6 +149,32 @@ int main(int argc, char *argv[]) } return status; } + // make a plot list vector + PMsrPlotList *msrPlotList = msrHandler->GetMsrPlotList(); + PIntVector plotList; + bool runPresent; + for (unsigned int i=0; isize(); i++) { + for (unsigned int j=0; jat(i).fRuns.size(); j++) { + // check that run is not already in the plotList + runPresent = false; + for (unsigned int k=0; kat(i).fRuns[j].Re() == static_cast(plotList[k])) { + runPresent = true; + break; + } + } + if (!runPresent) { + plotList.push_back(static_cast(msrPlotList->at(i).fRuns[j].Re())); + } + } + } +/* +cout << endl << ">> plotList:" << endl; +for(unsigned int i=0; iGetMsrRunList()->size(); i++) { - success = runListCollection->Add(i, kView); - if (!success) { - cout << endl << "**ERROR** Couldn't handle run no " << i << " "; - cout << (*msrHandler->GetMsrRunList())[i].fRunName.Data(); - break; + for (unsigned int i=0; iGetMsrRunList()->size(); i++) { + // if run is in plotList add it, otherwise go to the next + runPresent = false; + for (unsigned int j=0; j(plotList[j]) == i+1) { + runPresent = true; + break; + } + } + if (runPresent) { +//cout << endl << ">> Will add run " << i << endl; + success = runListCollection->Add(i, kView); + if (!success) { + cout << endl << "**ERROR** Couldn't handle run no " << i << " "; + cout << (*msrHandler->GetMsrRunList())[i].fRunName.Data(); + break; + } } } } @@ -236,6 +273,7 @@ cout << endl << "clean up canvas vector ..."; cout << endl; // clean up + plotList.clear(); if (saxParser) { delete saxParser; saxParser = 0;