32 unsigned int extraTopics,
unsigned int removeTopics,
bool overrideExternalLevel) {
35 if (overrideExternalLevel) msg.setGlobalKillBelow(lvl);
37 for (
int i = 0; i < msg.numStreams(); ++i) {
38 fOldConf.push_back(msg.getStream(i));
39 if (overrideExternalLevel) msg.getStream(i).minLevel = lvl;
41 msg.setStreamStatus(i,
true);
44 if (extraTopics != 0) {
53 for (
int i=0; i < msg.numStreams(); ++i) {
54 if (i <
static_cast<int>(
fOldConf.size()))
72 msg.setGlobalKillBelow(level);
74 std::vector<RooMsgService::StreamConfig> tmpStreams;
75 for (
int i = 0; i < msg.numStreams(); ++i) {
76 _oldConf.push_back(msg.getStream(i));
77 if (msg.getStream(i).match(level, topics,
static_cast<RooAbsArg*
>(
nullptr))) {
78 tmpStreams.push_back(msg.getStream(i));
79 msg.setStreamStatus(i,
false);
89 msg.addStream(st.minLevel,
103 for (
unsigned int i = 0; i <
_oldConf.size(); ++i) {
120 double min,
double max,
bool limitsInAllowedRange, std::string
const& extraMessage) {
121 const char openBr = limitsInAllowedRange ?
'[' :
'(';
122 const char closeBr = limitsInAllowedRange ?
']' :
')';
124 for (
auto parameter : pars) {
127 (par->getMin() < min || par->getMax() > max)
128 || (!limitsInAllowedRange && (par->getMin() == min || par->getMax() == max)) )) {
129 std::stringstream rangeMsg;
131 if (min > -std::numeric_limits<double>::max())
132 rangeMsg << min <<
", ";
134 rangeMsg <<
"-inf, ";
136 if (max < std::numeric_limits<double>::max())
137 rangeMsg << max << closeBr;
139 rangeMsg <<
"inf" << closeBr;
141 oocoutW(callingClass,
InputArguments) <<
"The parameter '" << par->GetName() <<
"' with range [" << par->getMin(
"") <<
", "
142 << par->getMax() <<
"] of the " << callingClass->
ClassName() <<
" '" << callingClass->
GetName()
143 <<
"' exceeds the safe range of " << rangeMsg.str() <<
". Advise to limit its range."
144 << (!extraMessage.empty() ?
"\n" :
"") << extraMessage << std::endl;
151 std::pair<double, double> getBinningInterval(
RooAbsBinning const& binning) {
171 if (rangeName && rlv->hasRange(rangeName)) {
172 return {rlv->
getMin(rangeName), rlv->getMax(rangeName)};
173 }
else if (
auto binning = rlv->getBinningPtr(rangeName)) {
174 return getBinningInterval(*binning);
177 return {-std::numeric_limits<double>::infinity(), +std::numeric_limits<double>::infinity()};
194 return getBinningInterval(*binning);
203 return std::pair<double, double>{rlv.
getMin(rangeName), rlv.
getMax(rangeName)};
206 return std::pair<double, double>{rlv.
getMin(), rlv.
getMax()};
210 std::vector<std::pair<double,double>> limits;
211 limits.reserve(rangeNames.size() * observables.size());
213 for (
auto const& range : rangeNames) {
214 for (
auto const& obs : observables) {
218 limits.push_back(getLimits(*rlv, range.c_str()));
220 throw std::logic_error(
"Classes that represent observables are expected to inherit from RooAbsRealLValue or RooAbsCategory!");
225 auto nRanges = rangeNames.size();
226 auto nObs = limits.size() / nRanges;
229 for(
size_t ir1 = 0; ir1 < nRanges; ++ir1) {
230 for(
size_t ir2 = ir1 + 1; ir2 < nRanges; ++ir2) {
236 for(
size_t io1 = 0; io1 < nObs; ++io1) {
237 auto r1 = limits[ir1 * nObs + io1];
238 auto r2 = limits[ir2 * nObs + io1];
239 overlaps += (r1.second > r2.first && r1.first < r2.second)
240 || (r2.second > r1.first && r2.first < r1.second);
242 if(overlaps == nObs)
return true;
258 for(
auto const& arg : tmp) {
259 content += arg->GetName();
262 if(!content.empty()) {
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
RooArgSet * getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual bool isParameterized() const
Interface function.
virtual double highBound() const =0
virtual double lowBound() const =0
virtual RooAbsReal * highBoundFunc() const
Return pointer to RooAbsReal parameterized upper bound, if any.
virtual RooAbsReal * lowBoundFunc() const
Return pointer to RooAbsReal parameterized lower bound, if any.
A space to attach TBranches.
void sort(bool reverse=false)
Sort collection using std::sort and name comparison.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual double getMax(const char *name=0) const
Get maximum of currently defined range.
virtual double getMin(const char *name=0) const
Get minimum of currently defined range.
const RooAbsBinning * getBinningPtr(const char *rangeName) const override
bool hasRange(const char *name) const override
Check if variable has a binning with given name.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
The RooDataHist is a container class to hold N-dimensional binned data.
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)
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
MsgTopic
Topics for a RooMsgService::StreamConfig in RooMsgService.
bool checkIfRangesOverlap(RooAbsPdf const &pdf, RooAbsData const &data, std::vector< std::string > const &rangeNames)
Check if there is any overlap when a list of ranges is applied to a set of observables.
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.
RooArgSet selectFromArgSet(RooArgSet const &, std::string const &names)
Construct a RooArgSet of objects in a RooArgSet whose names match to those in the names string.
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.
std::string getColonSeparatedNameString(RooArgSet const &argSet)
Create a string with all sorted names of RooArgSet elements separated by colons.