diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 357672ae..2dfad30a 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -602,17 +602,7 @@ Bool_t PRunAsymmetry::PrepareData() return false; } } - if (forwardHistoNo.size() != backwardHistoNo.size()) { - std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; - std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms."; - std::cerr << std::endl << ">> Will quit :-("; - std::cerr << std::endl; - // clean up - forwardHistoNo.clear(); - backwardHistoNo.clear(); - return false; - } - + // keep the time resolution in (us) fTimeResolution = runData->GetTimeResolution()/1.0e3; std::cout.precision(10); @@ -626,11 +616,13 @@ Bool_t PRunAsymmetry::PrepareData() // keep the histo of each group at this point (addruns handled below) std::vector forward, backward; forward.resize(forwardHistoNo.size()); // resize to number of groups - backward.resize(backwardHistoNo.size()); // resize to numer of groups for (UInt_t i=0; iGetDataBin(forwardHistoNo[i])->size()); - backward[i].resize(runData->GetDataBin(backwardHistoNo[i])->size()); forward[i] = *runData->GetDataBin(forwardHistoNo[i]); + } + backward.resize(backwardHistoNo.size()); // resize to number of groups + for (UInt_t i=0; iGetDataBin(backwardHistoNo[i])->size()); backward[i] = *runData->GetDataBin(backwardHistoNo[i]); } @@ -676,9 +668,11 @@ Bool_t PRunAsymmetry::PrepareData() // set forward/backward histo data of the first group fForward.resize(forward[0].size()); - fBackward.resize(backward[0].size()); for (UInt_t i=0; iGet the proper t0 for the single histogram run. - * -# the t0 vector size = number of detectors (grouping) for forward. + * -# the t0 vector size = number of detectors (grouping) for forward + backward. * -# initialize t0's with -1 * -# fill t0's from RUN block * -# if t0's are missing (i.e. t0 == -1), try to fill from the GLOBAL block. @@ -1698,7 +1692,11 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB // feed all T0's // first init T0's, T0's are stored as (forward T0, backward T0, etc.) fT0s.clear(); - fT0s.resize(2*forwardHistoNo.size()); + // this strange fT0 size estimate is needed in case #forw histos != #back histos + size_t size = 2*forwardHistoNo.size(); + if (backwardHistoNo.size() > forwardHistoNo.size()) + size = 2*backwardHistoNo.size(); + fT0s.resize(size); for (UInt_t i=0; i static_cast(runData->GetDataBin(backwardHistoNo[i])->size()))) { std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!"; std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i]; diff --git a/src/classes/PRunAsymmetryBNMR.cpp b/src/classes/PRunAsymmetryBNMR.cpp index 7d533e6d..7946717e 100644 --- a/src/classes/PRunAsymmetryBNMR.cpp +++ b/src/classes/PRunAsymmetryBNMR.cpp @@ -640,6 +640,7 @@ Bool_t PRunAsymmetryBNMR::PrepareData() return false; } } +/* //as35 if (forwardHistoNo.size() != backwardHistoNo.size()) { std::cerr << std::endl << ">> PRunAsymmetryBNMR::PrepareData(): **PANIC ERROR**:"; std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms."; @@ -650,7 +651,8 @@ Bool_t PRunAsymmetryBNMR::PrepareData() backwardHistoNo.clear(); return false; } - +*/ //as35 + // keep the time resolution in (s) fTimeResolution = runData->GetTimeResolution()/1.0e3; std::cout.precision(10); @@ -664,11 +666,13 @@ Bool_t PRunAsymmetryBNMR::PrepareData() // keep the histo of each group at this point (addruns handled below) std::vector forward, backward; forward.resize(forwardHistoNo.size()); // resize to number of groups - backward.resize(backwardHistoNo.size()); // resize to numer of groups for (UInt_t i=0; iGetDataBin(forwardHistoNo[i])->size()); - backward[i].resize(runData->GetDataBin(backwardHistoNo[i])->size()); forward[i] = *runData->GetDataBin(forwardHistoNo[i]); + } + backward.resize(backwardHistoNo.size()); // resize to number of groups + for (UInt_t i=0; iGetDataBin(backwardHistoNo[i])->size()); backward[i] = *runData->GetDataBin(backwardHistoNo[i]); } @@ -712,15 +716,18 @@ Bool_t PRunAsymmetryBNMR::PrepareData() } } - // set forward/backward histo data of the first group + // set forward histo data of the first group fForwardp.resize(forward[0].size()); - fBackwardp.resize(backward[0].size()); fForwardm.resize(forward[0].size()); - fBackwardm.resize(backward[0].size()); for (UInt_t i=0; i forwardHistoNo.size()) + size = 2*backwardHistoNo.size(); + fT0s.resize(size); for (UInt_t i=0; i static_cast(runData->GetDataBin(backwardHistoNo[i])->size()))) { std::cerr << std::endl << ">> PRunAsymmetryBNMR::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!"; std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i];