25std::vector<std::string>
tokenise(
const std::string &str,
const std::string &delims) {
26 std::vector<std::string> tokens;
28 auto beg = str.find_first_not_of(delims, 0);
29 auto end = str.find_first_of(delims, beg);
31 tokens.emplace_back(str.substr(beg, end-beg));
32 beg = str.find_first_not_of(delims, end);
33 end = str.find_first_of(delims, beg);
34 }
while (beg != std::string::npos);
46 msg.setGlobalKillBelow(level);
47 for (
int i = 0; i < msg.numStreams(); ++i) {
48 _oldConf.push_back(msg.getStream(i));
49 msg.getStream(i).removeTopic(topics);
50 msg.setStreamStatus(i,
true);
62 for (
unsigned int i = 0; i <
_oldConf.size(); ++i) {
76 double min,
double max,
bool limitsInAllowedRange, std::string extraMessage) {
77 const char openBr = limitsInAllowedRange ?
'[' :
'(';
78 const char closeBr = limitsInAllowedRange ?
']' :
')';
80 for (
auto parameter : pars) {
83 (par->getMin() < min || par->getMax() > max)
84 || (!limitsInAllowedRange && (par->getMin() == min || par->getMax() == max)) )) {
85 std::stringstream rangeMsg;
87 if (min > -std::numeric_limits<double>::max())
88 rangeMsg << min <<
", ";
92 if (max < std::numeric_limits<double>::max())
93 rangeMsg << max << closeBr;
95 rangeMsg <<
"inf" << closeBr;
97 oocoutW(callingClass,
InputArguments) <<
"The parameter '" << par->GetName() <<
"' with range [" << par->getMin(
"") <<
", "
98 << par->getMax() <<
"] of the " << callingClass->IsA()->
GetName() <<
" '" << callingClass->
GetName()
99 <<
"' exceeds the safe range of " << rangeMsg.str() <<
". Advise to limit its range."
100 << (!extraMessage.empty() ?
"\n" :
"") << extraMessage << std::endl;
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...
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)
std::vector< RooMsgService::StreamConfig > _oldConf
virtual ~HijackMessageStream()
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)
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
MsgTopic
Topics for a RooMsgService::StreamConfig in RooMsgService.
RooCmdArg ObjectName(const char *name)
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::vector< std::string > tokenise(const std::string &str, const std::string &delims)
Tokenise the string by splitting at the characters in delims.