32#include <unordered_map>
37 bool overrideExternalLevel)
41 if (overrideExternalLevel)
42 msg.setGlobalKillBelow(lvl);
44 for (
int i = 0; i < msg.numStreams(); ++i) {
45 fOldConf.push_back(msg.getStream(i));
46 if (overrideExternalLevel)
47 msg.getStream(i).minLevel = lvl;
49 msg.setStreamStatus(i,
true);
52 if (extraTopics != 0) {
62 for (
int i = 0; i < msg.numStreams(); ++i) {
63 if (i <
static_cast<int>(
fOldConf.size()))
80 msg.setGlobalKillBelow(level);
82 std::vector<RooMsgService::StreamConfig> tmpStreams;
83 for (
int i = 0; i < msg.numStreams(); ++i) {
84 _oldConf.push_back(msg.getStream(i));
85 if (msg.getStream(i).match(level, topics,
static_cast<RooAbsArg *
>(
nullptr))) {
86 tmpStreams.push_back(msg.getStream(i));
87 msg.setStreamStatus(i,
false);
106 for (
unsigned int i = 0; i <
_oldConf.size(); ++i) {
122 double max,
bool limitsInAllowedRange, std::string
const &extraMessage)
124 const char openBr = limitsInAllowedRange ?
'[' :
'(';
125 const char closeBr = limitsInAllowedRange ?
']' :
')';
127 for (
auto parameter : pars) {
129 if (par && ((par->getMin() < min || par->getMax() > max) ||
130 (!limitsInAllowedRange && (par->getMin() == min || par->getMax() == max)))) {
131 std::stringstream rangeMsg;
133 if (min > -std::numeric_limits<double>::max()) {
134 rangeMsg << min <<
", ";
136 rangeMsg <<
"-inf, ";
139 if (max < std::numeric_limits<double>::max()) {
140 rangeMsg << max << closeBr;
142 rangeMsg <<
"inf" << closeBr;
145 oocoutW(callingClass, InputArguments)
146 <<
"The parameter '" << par->GetName() <<
"' with range [" << par->getMin(
"") <<
", " << par->getMax()
147 <<
"] of the " << callingClass->
ClassName() <<
" '" << callingClass->
GetName()
148 <<
"' exceeds the safe range of " << rangeMsg.str() <<
". Advise to limit its range."
149 << (!extraMessage.empty() ?
"\n" :
"") << extraMessage << std::endl;
156 bool changed =
false;
160 if (
v && (
v->isConstant() != constant)) {
162 v->setConstant(constant);
163 }
else if (cv && (cv->
isConstant() != constant)) {
Common abstract base class for objects that represent a value and a "shape" in RooFit.
bool isConstant() const
Check if the "Constant" attribute is set.
void setConstant(bool value=true)
Abstract container object that can hold multiple RooAbsArg objects.
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...
Object to represent discrete states.
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.
Variable that can be changed from the outside.
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.
bool setAllConstant(const RooAbsCollection &coll, bool constant=true)
set all RooRealVars to constants. return true if at least one changed status