25 unsigned int extraTopics,
unsigned int removeTopics,
bool overrideExternalLevel) {
28 if (overrideExternalLevel) msg.setGlobalKillBelow(lvl);
30 for (
int i = 0; i < msg.numStreams(); ++i) {
31 fOldConf.push_back(msg.getStream(i));
32 if (overrideExternalLevel) msg.getStream(i).minLevel = lvl;
34 msg.setStreamStatus(i,
true);
37 if (extraTopics != 0) {
46 for (
int i=0; i < msg.numStreams(); ++i) {
47 if (i <
static_cast<int>(
fOldConf.size()))
62std::vector<std::string>
tokenise(
const std::string &str,
const std::string &delims,
bool returnEmptyToken ) {
64 return std::vector<std::string>(returnEmptyToken ? 1 : 0);
66 std::vector<std::string> tokens;
68 auto beg = str.find_first_not_of(delims, 0);
69 auto end = str.find_first_of(delims, beg);
71 tokens.emplace_back(str.substr(beg, end-beg));
72 beg = str.find_first_not_of(delims, end);
73 end = str.find_first_of(delims, beg);
74 }
while (beg != std::string::npos);
88 msg.setGlobalKillBelow(level);
89 for (
int i = 0; i < msg.numStreams(); ++i) {
90 _oldConf.push_back(msg.getStream(i));
91 msg.getStream(i).removeTopic(topics);
92 msg.setStreamStatus(i,
true);
104 for (
unsigned int i = 0; i <
_oldConf.size(); ++i) {
118 double min,
double max,
bool limitsInAllowedRange, std::string extraMessage) {
119 const char openBr = limitsInAllowedRange ?
'[' :
'(';
120 const char closeBr = limitsInAllowedRange ?
']' :
')';
122 for (
auto parameter : pars) {
125 (par->getMin() < min || par->getMax() > max)
126 || (!limitsInAllowedRange && (par->getMin() == min || par->getMax() == max)) )) {
127 std::stringstream rangeMsg;
129 if (min > -std::numeric_limits<double>::max())
130 rangeMsg << min <<
", ";
132 rangeMsg <<
"-inf, ";
134 if (max < std::numeric_limits<double>::max())
135 rangeMsg << max << closeBr;
137 rangeMsg <<
"inf" << closeBr;
139 oocoutW(callingClass, InputArguments) <<
"The parameter '" << par->
GetName() <<
"' with range [" << par->getMin(
"") <<
", "
140 << par->getMax() <<
"] of the " << callingClass->IsA()->
GetName() <<
" '" << callingClass->
GetName()
141 <<
"' exceeds the safe range of " << rangeMsg.str() <<
". Advise to limit its range."
142 << (!extraMessage.empty() ?
"\n" :
"") << extraMessage << std::endl;
158 const RooAbsBinning* binning = rlv->getBinningPtr(rangeName);
159 if (rangeName && rlv->hasRange(rangeName)) {
160 return {rlv->getMin(rangeName), rlv->getMax(rangeName)};
161 }
else if (binning) {
169 return {-std::numeric_limits<double>::infinity(), +std::numeric_limits<double>::infinity()};
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual Bool_t isParameterized() const
Interface function.
virtual Double_t highBound() const =0
virtual RooAbsReal * highBoundFunc() const
Return pointer to RooAbsReal parameterized upper bound, if any.
virtual Double_t lowBound() const =0
virtual RooAbsReal * lowBoundFunc() const
Return pointer to RooAbsReal parameterized lower bound, if any.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
RooFit::MsgLevel _oldKillBelow
HijackMessageStream(RooFit::MsgLevel level, RooFit::MsgTopic topics, const char *objectName=nullptr)
Hijack all messages with given level and topics while this object is alive.
std::vector< RooMsgService::StreamConfig > _oldConf
RooFit::MsgLevel fOldKillBelow
LocalChangeMsgLevel(RooFit::MsgLevel lvl=RooFit::DEBUG, unsigned int extraTopics=0u, unsigned int removeTopics=0u, bool overrideExternalLevel=true)
Change message level (and topics) while this object is alive, reset when it goes out of scope.
std::vector< RooMsgService::StreamConfig > fOldConf
static RooMsgService & instance()
Return reference to singleton instance.
virtual const char * GetName() const
Returns name of object.
RooCmdArg OutputStream(std::ostream &os)
RooCmdArg Topic(Int_t topic)
RooCmdArg ObjectName(const char *name)
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
MsgTopic
Topics for a RooMsgService::StreamConfig in RooMsgService.
std::vector< std::string > tokenise(const std::string &str, const std::string &delims, bool returnEmptyToken=true)
Tokenise the string by splitting at the characters in delims.
void checkRangeOfParameters(const RooAbsReal *callingClass, std::initializer_list< const RooAbsReal * > pars, double min=-std::numeric_limits< double >::max(), double max=std::numeric_limits< double >::max(), bool limitsInAllowedRange=false, std::string extraMessage="")
Check if the parameters have a range, and warn if the range extends below / above the set limits.
std::pair< double, double > getRangeOrBinningInterval(RooAbsArg const *arg, const char *rangeName)
Get the lower and upper bound of parameter range if arg can be casted to RooAbsRealLValue.