29#include <unordered_map>
34 bool overrideExternalLevel)
38 if (overrideExternalLevel)
39 msg.setGlobalKillBelow(lvl);
41 for (
int i = 0; i < msg.numStreams(); ++i) {
42 fOldConf.push_back(msg.getStream(i));
43 if (overrideExternalLevel)
44 msg.getStream(i).minLevel = lvl;
46 msg.setStreamStatus(i,
true);
49 if (extraTopics != 0) {
59 for (
int i = 0; i < msg.numStreams(); ++i) {
60 if (i <
static_cast<int>(
fOldConf.size()))
77 msg.setGlobalKillBelow(level);
79 std::vector<RooMsgService::StreamConfig> tmpStreams;
80 for (
int i = 0; i < msg.numStreams(); ++i) {
81 _oldConf.push_back(msg.getStream(i));
82 if (msg.getStream(i).match(level, topics,
static_cast<RooAbsArg *
>(
nullptr))) {
83 tmpStreams.push_back(msg.getStream(i));
84 msg.setStreamStatus(i,
false);
103 for (
unsigned int i = 0; i <
_oldConf.size(); ++i) {
119 double max,
bool limitsInAllowedRange, std::string
const &extraMessage)
121 const char openBr = limitsInAllowedRange ?
'[' :
'(';
122 const char closeBr = limitsInAllowedRange ?
']' :
')';
124 for (
auto parameter : pars) {
126 if (par && ((par->getMin() < min || par->getMax() > max) ||
127 (!limitsInAllowedRange && (par->getMin() == min || par->getMax() == max)))) {
128 std::stringstream rangeMsg;
130 if (min > -std::numeric_limits<double>::max()) {
131 rangeMsg << min <<
", ";
133 rangeMsg <<
"-inf, ";
136 if (max < std::numeric_limits<double>::max()) {
137 rangeMsg << max << closeBr;
139 rangeMsg <<
"inf" << closeBr;
142 oocoutW(callingClass, InputArguments)
143 <<
"The parameter '" << par->GetName() <<
"' with range [" << par->getMin(
"") <<
", " << par->getMax()
144 <<
"] of the " << callingClass->
ClassName() <<
" '" << callingClass->
GetName()
145 <<
"' exceeds the safe range of " << rangeMsg.str() <<
". Advise to limit its range."
146 << (!extraMessage.empty() ?
"\n" :
"") << extraMessage << std::endl;
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
Named container for two doubles, two integers two object points and three string pointers that can be...
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
~HijackMessageStream()
Deregister the hijacked stream and restore the stream state of all previous streams.
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.
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
RooCmdArg ClassName(const char *name)
RooCmdArg OutputStream(std::ostream &os)
RooCmdArg Topic(Int_t topic)
RooCmdArg TagName(const char *name)
RooCmdArg BaseClassName(const char *name)
RooCmdArg ObjectName(const char *name)
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
MsgTopic
Topics for a RooMsgService::StreamConfig in RooMsgService.
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 const &extraMessage="")
Check if the parameters have a range, and warn if the range extends below / above the set limits.