From 88c7978ab982b98cfbeb225447958ef2f17ad0f7 Mon Sep 17 00:00:00 2001 From: nemu Date: Thu, 10 Dec 2009 15:54:16 +0000 Subject: [PATCH] fix issue MUSR-110 --- src/classes/PRunAsymmetry.cpp | 20 ++++++++++++++++++-- src/classes/PRunSingleHisto.cpp | 19 +++++++++++++------ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index f8379546..8e2703d6 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -340,13 +340,29 @@ Bool_t PRunAsymmetry::PrepareData() fT0s.push_back(fRunInfo->GetT0(1)); // backward t0 } + // first check if forward/backward given in the msr-file are valid + if (fRunInfo->GetForwardHistoNo() <= 0) { + cerr << endl << "PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; + cerr << endl << " forward histoNo found = " << fRunInfo->GetForwardHistoNo() << ". Only histoNo > 0 are allowed."; + cerr << endl << " Will quit :-("; + cerr << endl; + return false; + } + if (fRunInfo->GetBackwardHistoNo() <= 0) { + cerr << endl << "PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; + cerr << endl << " backward histoNo found = " << fRunInfo->GetBackwardHistoNo() << ". Only histoNo > 0 are allowed."; + cerr << endl << " Will quit :-("; + cerr << endl; + return false; + } + // check if post pile up data shall be used UInt_t histoNo[2]; // forward/backward histoNo[0] = fRunInfo->GetForwardHistoNo()-1; histoNo[1] = fRunInfo->GetBackwardHistoNo()-1; // first check if forward/backward given in the msr-file are valid - if ((runData->GetNoOfHistos() < histoNo[0]+1) || (histoNo[0] < 0) || - (runData->GetNoOfHistos() < histoNo[1]+1) || (histoNo[1] < 0)) { + if ((runData->GetNoOfHistos() < histoNo[0]+1) || + (runData->GetNoOfHistos() < histoNo[1]+1)) { cerr << endl << "PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; cerr << endl << " forward/backward histo no found = " << histoNo[0]+1; cerr << ", " << histoNo[1]+1 << ", but there are only " << runData->GetNoOfHistos() << " histo sets!?!?"; diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index c55285ad..38f89a02 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -307,13 +307,20 @@ Bool_t PRunSingleHisto::PrepareData() } // check if post pile up data shall be used - UInt_t histoNo; - histoNo = fRunInfo->GetForwardHistoNo()-1; - - if ((runData->GetNoOfHistos() < histoNo) || (histoNo < 0)) { + if (fRunInfo->GetForwardHistoNo() <= 0) { cerr << endl << "PRunSingleHisto::PrepareData(): **PANIC ERROR**:"; - cerr << endl << " histoNo found = " << histoNo << ", but there are only " << runData->GetNoOfHistos() << " runs!?!?"; - cerr << endl << " Will quite :-("; + cerr << endl << " histoNo found = " << fRunInfo->GetForwardHistoNo() << ". Only histoNo > 0 are allowed."; + cerr << endl << " Will quit :-("; + cerr << endl; + return false; + } + + UInt_t histoNo = fRunInfo->GetForwardHistoNo()-1; + + if (runData->GetNoOfHistos() <= histoNo) { + cerr << endl << "PRunSingleHisto::PrepareData(): **PANIC ERROR**:"; + cerr << endl << " histoNo found = " << histoNo+1 << ", but there are only " << runData->GetNoOfHistos() << " runs!?!?"; + cerr << endl << " Will quit :-("; cerr << endl; return false; }