From 519c1e585ec72972190d8f2dd5ebd108505cb3f8 Mon Sep 17 00:00:00 2001 From: Andre Holzner Date: Wed, 3 Jun 2015 17:41:02 +0200 Subject: [PATCH 1/3] split method utils::isParameterAtBoundary(..) into two methods utils::isParameterAtLowerBoundary(..) and utils::isParameterAtUpperBoundary(..); method utils::anyParameterAtBoundaries(..) now prints more details about why a parameter is at a boundary --- interface/utils.h | 6 ++++++ src/utils.cc | 48 ++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/interface/utils.h b/interface/utils.h index 61c2eb71f6a..8d250a2986d 100644 --- a/interface/utils.h +++ b/interface/utils.h @@ -94,6 +94,12 @@ namespace utils { // Set range of physics model parameters void setModelParameterRanges( const std::string & setPhysicsModelParameterRangeExpression, const RooArgSet & params); + /** @return true if the parameter's value is less than one sigma away from the lower end of the range */ + bool isParameterAtLowerBoundary( const RooRealVar &); + + /** @return true if the parameter's value is less than one sigma away from the upper end of the range */ + bool isParameterAtUpperBoundary( const RooRealVar &); + bool isParameterAtBoundary( const RooRealVar &); bool anyParameterAtBoundaries( const RooArgSet &, int verbosity); diff --git a/src/utils.cc b/src/utils.cc index cddad242ebc..f00ed42664b 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -712,26 +712,43 @@ std::vector > utils::generateCombinations(const std::vector= 9 || (timesFoundAtBoundary[varName] < 3 && verbosity > -1) ){ - fprintf(CloseCoutSentry::trueStdOutGlobal()," [WARNING] Found [%s] at boundary. \n", (*a).GetName()); + + fprintf(CloseCoutSentry::trueStdOutGlobal()," [WARNING] Found [%s] at ", (*a).GetName()); + + if (atLowerBoundary && atUpperBoundary) + fprintf(CloseCoutSentry::trueStdOutGlobal(),"both boundaries"); + else if (atLowerBoundary) + fprintf(CloseCoutSentry::trueStdOutGlobal(),"lower boundary"); + else + // must be at upper boundary + fprintf(CloseCoutSentry::trueStdOutGlobal(),"upper boundary"); + + fprintf(CloseCoutSentry::trueStdOutGlobal()," (value: %f %+f%+f range: %f..%f)", a->getVal(), a->getErrorHi(), a->getErrorLo(), + a->getMin(), a->getMax()); + + fprintf(CloseCoutSentry::trueStdOutGlobal(),". \n"); + std::cout << " "; (*a).Print(); } From e023baa2be31bbba81e423c558babea0cf28c11d Mon Sep 17 00:00:00 2001 From: ah Date: Thu, 27 Aug 2015 17:35:00 +0200 Subject: [PATCH 2/3] fix in utils::anyParameterAtBoundaries(..) (of proposed patch): second isParameterAtLowerBoundary(..) replaced by isParameterAtUpperBoundary(..) --- src/utils.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.cc b/src/utils.cc index f00ed42664b..dbbc8789b73 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -759,7 +759,7 @@ bool utils::anyParameterAtBoundaries( const RooArgSet ¶ms, int verbosity ){ for (RooRealVar *a = (RooRealVar *) iter.Next(); a != 0; a = (RooRealVar *) iter.Next(), ++i) { bool atLowerBoundary = isParameterAtLowerBoundary(*a); - bool atUpperBoundary = isParameterAtLowerBoundary(*a); + bool atUpperBoundary = isParameterAtUpperBoundary(*a); bool isBad = atLowerBoundary || atUpperBoundary; if(isBad){ From b594f553c54daeebded8822bd9766236fd6ab073 Mon Sep 17 00:00:00 2001 From: ah Date: Thu, 27 Aug 2015 17:42:05 +0200 Subject: [PATCH 3/3] made case distinction for printout regarding a parameter being at the upper/lower/both boundaries more explicit --- src/utils.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils.cc b/src/utils.cc index dbbc8789b73..d9df162b86b 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -771,11 +771,15 @@ bool utils::anyParameterAtBoundaries( const RooArgSet ¶ms, int verbosity ){ if (atLowerBoundary && atUpperBoundary) fprintf(CloseCoutSentry::trueStdOutGlobal(),"both boundaries"); - else if (atLowerBoundary) + else if (atLowerBoundary && !atUpperBoundary) fprintf(CloseCoutSentry::trueStdOutGlobal(),"lower boundary"); - else - // must be at upper boundary + else if (!atLowerBoundary && atUpperBoundary) fprintf(CloseCoutSentry::trueStdOutGlobal(),"upper boundary"); + else + { + // we can't come here (as long as we are inside if(isBad) { .. } ) + // because isBad = atLowerBoundary || atUpperBoundary + } fprintf(CloseCoutSentry::trueStdOutGlobal()," (value: %f %+f%+f range: %f..%f)", a->getVal(), a->getErrorHi(), a->getErrorLo(), a->getMin(), a->getMax());