From dd8603219ccad3f0b0c3db67eedf9263a022707f Mon Sep 17 00:00:00 2001 From: nemu Date: Wed, 12 May 2010 16:00:22 +0000 Subject: [PATCH] fixed error when combining grouping and addrun, etc. --- src/classes/PRunAsymmetry.cpp | 42 +++++++++++++++++---------------- src/classes/PRunSingleHisto.cpp | 28 ++++++++++++---------- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index d3b9b3cd..99210986 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -432,7 +432,7 @@ Bool_t PRunAsymmetry::PrepareData() // get T0's of the to be added run PUIntVector t0Add; // check if the t0's are given in the msr-file - if (i >= fRunInfo->GetAddT0Entries()) { // t0's are NOT in the msr-file + if (i > fRunInfo->GetAddT0Entries()) { // t0's are NOT in the msr-file // check if the t0's are in the data file if (addRunData->GetT0Size() != 0) { // t0's in the run data // keep the proper t0's. For asymmetry runs, forward/backward are holding the histo no @@ -446,7 +446,7 @@ Bool_t PRunAsymmetry::PrepareData() t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1)); t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(j)-1)); cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> addRun: " << fRunInfo->GetRunName()->Data(); + cerr << endl << ">> addRun: " << fRunInfo->GetRunName(i)->Data(); cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1); cerr << endl << ">> will try the estimated one: backward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(j)-1); cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; @@ -458,35 +458,37 @@ Bool_t PRunAsymmetry::PrepareData() // check if t0's are given in the data file if (addRunData->GetT0Size() != 0) { // compare t0's of the msr-file with the one in the data file - if (fabs(fRunInfo->GetAddT0(i,2*j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!! - cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:"; - cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,2*j)+1; // +1 since vector starts at 0 + if (fabs(fRunInfo->GetAddT0(i-1,2*j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!! + cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**:"; + cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i-1,2*j)+1; // +1 since vector starts at 0 cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1); cerr << endl << ">> This is quite a deviation! Is this done intentionally??"; cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data(); cerr << endl; } - if (fabs(fRunInfo->GetAddT0(i,2*j+1)-addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1))>5.0) { // given in bins!! - cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:"; - cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,2*j+1)+1; // +1 since vector starts at 0 + if (fabs(fRunInfo->GetAddT0(i-1,2*j+1)-addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1))>5.0) { // given in bins!! + cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**:"; + cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i-1,2*j+1)+1; // +1 since vector starts at 0 cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1); cerr << endl << ">> This is quite a deviation! Is this done intentionally??"; cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data(); cerr << endl; } } - if (i < fRunInfo->GetAddT0Entries()) { - t0Add.push_back(fRunInfo->GetAddT0(i,2*j)); - t0Add.push_back(fRunInfo->GetAddT0(i,2*j+1)); - } else { - cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data ("; - cerr << fRunInfo->GetRunName(i)->Data(); - cerr << "), nor in the msr-file! Will try to use the T0 of the run data ("; - cerr << fRunInfo->GetRunName(i)->Data(); - cerr << ") without any warranty!"; - cerr << endl; - t0Add.push_back(fRunInfo->GetT0(2*j)); - t0Add.push_back(fRunInfo->GetT0(2*j+1)); + if (i <= fRunInfo->GetAddT0Entries()) { + if (2*j+1 < static_cast(fRunInfo->GetAddT0Size(i-1))) { + t0Add.push_back(fRunInfo->GetAddT0(i-1,2*j)); + t0Add.push_back(fRunInfo->GetAddT0(i-1,2*j+1)); + } else { + cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data ("; + cerr << fRunInfo->GetRunName(i)->Data(); + cerr << "), nor in the msr-file! Will try to use the T0 of the run data ("; + cerr << fRunInfo->GetRunName(i)->Data(); + cerr << ") without any warranty!"; + cerr << endl; + t0Add.push_back(fRunInfo->GetT0(2*j)); + t0Add.push_back(fRunInfo->GetT0(2*j+1)); + } } } } diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index c01a963f..5fd46a81 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -395,7 +395,7 @@ Bool_t PRunSingleHisto::PrepareData() // get T0's of the to be added run PUIntVector t0Add; // check if the t0's are given in the msr-file - if (i >= fRunInfo->GetAddT0Entries()) { // t0's are NOT in the msr-file + if (i > fRunInfo->GetAddT0Entries()) { // t0's are NOT in the msr-file // check if the t0's are in the data file if (addRunData->GetT0Size() != 0) { // t0's in the run data // keep the proper t0's. For single histo runs, forward is holding the histo no @@ -417,25 +417,27 @@ Bool_t PRunSingleHisto::PrepareData() // check if t0's are given in the data file if (addRunData->GetT0Size() != 0) { // compare t0's of the msr-file with the one in the data file - if (fabs(fRunInfo->GetAddT0(i,j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!! + if (fabs(fRunInfo->GetAddT0(i-1,j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!! cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:"; - cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,j); + cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i-1,j); cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1); cerr << endl << ">> This is quite a deviation! Is this done intentionally??"; cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data(); cerr << endl; } } - if (i < fRunInfo->GetAddT0Entries()) { - t0Add.push_back(fRunInfo->GetAddT0(i,j)); - } else { - cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data ("; - cerr << fRunInfo->GetRunName(i)->Data(); - cerr << "), nor in the msr-file! Will try to use the T0 of the run data ("; - cerr << fRunInfo->GetRunName(i)->Data(); - cerr << ") without any warranty!"; - cerr << endl; - t0Add.push_back(fRunInfo->GetT0(j)); + if (i <= fRunInfo->GetAddT0Entries()) { + if (j < static_cast(fRunInfo->GetAddT0Size(i-1))) { + t0Add.push_back(fRunInfo->GetAddT0(i-1,j)); + } else { + cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data ("; + cerr << fRunInfo->GetRunName(i)->Data(); + cerr << "), nor in the msr-file! Will try to use the T0 of the run data ("; + cerr << fRunInfo->GetRunName(i)->Data(); + cerr << ") without any warranty!"; + cerr << endl; + t0Add.push_back(fRunInfo->GetT0(j)); + } } } }