diff --git a/src/classes/PMsr2Data.cpp b/src/classes/PMsr2Data.cpp index 55e9ef1c..f264d2df 100644 --- a/src/classes/PMsr2Data.cpp +++ b/src/classes/PMsr2Data.cpp @@ -1345,7 +1345,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const std::string & } } tempPar = msrRunList->at(i).GetAlphaParamNo(); - if (tempPar > 0) { + if ((tempPar > 0) && (tempPar < MSR_PARAM_FUN_OFFSET)) { // if alpha is given by a function we do not have to care about it here! if (msrParamList->at(tempPar-1).fIsGlobal) { // alpha of RUN block i is global msrRunList->at(i).SetParGlobal(alpha, 1); } else { @@ -1353,7 +1353,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const std::string & } } tempPar = msrRunList->at(i).GetBetaParamNo(); - if (tempPar > 0) { + if ((tempPar > 0) && (tempPar < MSR_PARAM_FUN_OFFSET)) { // if beta is given by a function we do not have to care about it here! if (msrParamList->at(tempPar-1).fIsGlobal) { // beta of RUN block i is global msrRunList->at(i).SetParGlobal(beta, 1); } else { diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 6c3b2038..a5eb857e 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -161,6 +161,15 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn Bool_t betaFixedToOne = false; if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1 betaFixedToOne = true; + } else if (fRunInfo->GetBetaParamNo() >= MSR_PARAM_FUN_OFFSET) { // beta seems to be a function + if ((fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET < 0) || + (fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET > msrInfo->GetNoOfFuncs())) { + std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter is a function with no = " << fRunInfo->GetBetaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << msrInfo->GetNoOfFuncs() << " functions."; + std::cerr << std::endl; + fValid = false; + return; + } } else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > static_cast(param->size()))) { // check if beta parameter is within proper bounds std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo(); std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; diff --git a/src/classes/PRunAsymmetryBNMR.cpp b/src/classes/PRunAsymmetryBNMR.cpp index 353ac9e3..84d374ea 100644 --- a/src/classes/PRunAsymmetryBNMR.cpp +++ b/src/classes/PRunAsymmetryBNMR.cpp @@ -136,6 +136,15 @@ PRunAsymmetryBNMR::PRunAsymmetryBNMR(PMsrHandler *msrInfo, PRunDataHandler *rawD // fValid = false; // return; alphaSetDefault = true; + } else if (fRunInfo->GetAlphaParamNo() >= MSR_PARAM_FUN_OFFSET) { // alpha seems to be a function + if ((fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET < 0) || + (fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET > msrInfo->GetNoOfFuncs())) { + std::cerr << std::endl << ">> PRunAsymmetryBNMR::PRunAsymmetryBNMR(): **ERROR** alpha parameter is a function with no = " << fRunInfo->GetAlphaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << msrInfo->GetNoOfFuncs() << " functions."; + std::cerr << std::endl; + fValid = false; + return; + } } else if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > (Int_t)param->size())) { // check if alpha parameter is within proper bounds std::cerr << std::endl << ">> PRunAsymmetryBNMR::PRunAsymmetryBNMR(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo(); std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; @@ -147,11 +156,20 @@ PRunAsymmetryBNMR::PRunAsymmetryBNMR(PMsrHandler *msrInfo, PRunDataHandler *rawD ((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0)) alphaFixedToOne = true; } - + // check if beta is given Bool_t betaFixedToOne = false; if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1 betaFixedToOne = true; + } else if (fRunInfo->GetBetaParamNo() >= MSR_PARAM_FUN_OFFSET) { // beta seems to be a function + if ((fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET < 0) || + (fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET > msrInfo->GetNoOfFuncs())) { + std::cerr << std::endl << ">> PRunAsymmetryBNMR::PRunAsymmetryBNMR(): **ERROR** beta parameter is a function with no = " << fRunInfo->GetBetaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << msrInfo->GetNoOfFuncs() << " functions."; + std::cerr << std::endl; + fValid = false; + return; + } } else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > (Int_t)param->size())) { // check if beta parameter is within proper bounds std::cerr << std::endl << ">> PRunAsymmetryBNMR::PRunAsymmetryBNMR(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo(); std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; diff --git a/src/classes/PRunAsymmetryRRF.cpp b/src/classes/PRunAsymmetryRRF.cpp index c961f951..6e2635d6 100644 --- a/src/classes/PRunAsymmetryRRF.cpp +++ b/src/classes/PRunAsymmetryRRF.cpp @@ -128,7 +128,16 @@ PRunAsymmetryRRF::PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawDat return; } // check if alpha parameter is within proper bounds - if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > static_cast(param->size()))) { + if (fRunInfo->GetAlphaParamNo() >= MSR_PARAM_FUN_OFFSET) { // alpha seems to be a function + if ((fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET < 0) || + (fRunInfo->GetAlphaParamNo()-MSR_PARAM_FUN_OFFSET > msrInfo->GetNoOfFuncs())) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** alpha parameter is a function with no = " << fRunInfo->GetAlphaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << msrInfo->GetNoOfFuncs() << " functions."; + std::cerr << std::endl; + fValid = false; + return; + } + } else if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > static_cast(param->size()))) { std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo(); std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; std::cerr << std::endl; @@ -137,14 +146,25 @@ PRunAsymmetryRRF::PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawDat } // check if alpha is fixed Bool_t alphaFixedToOne = false; - if (((*param)[fRunInfo->GetAlphaParamNo()-1].fStep == 0.0) && - ((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0)) - alphaFixedToOne = true; + if (fRunInfo->GetAlphaParamNo() < MSR_PARAM_FUN_OFFSET) { // alpha is a parameter + if (((*param)[fRunInfo->GetAlphaParamNo()-1].fStep == 0.0) && + ((*param)[fRunInfo->GetAlphaParamNo()-1].fValue == 1.0)) + alphaFixedToOne = true; + } // check if beta is given Bool_t betaFixedToOne = false; if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1 betaFixedToOne = true; + } else if (fRunInfo->GetBetaParamNo() >= MSR_PARAM_FUN_OFFSET) { // beta seems to be a function + if ((fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET < 0) || + (fRunInfo->GetBetaParamNo()-MSR_PARAM_FUN_OFFSET > msrInfo->GetNoOfFuncs())) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** beta parameter is a function with no = " << fRunInfo->GetBetaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << msrInfo->GetNoOfFuncs() << " functions."; + std::cerr << std::endl; + fValid = false; + return; + } } else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > static_cast(param->size()))) { // check if beta parameter is within proper bounds std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo(); std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters.";