82 _devnull =
new ofstream(
"/dev/null") ;
123 for (
auto &item :
_files) {
142 map<string,ostream*>::iterator iter =
_files.begin() ;
143 for (; iter !=
_files.end() ; ++iter) {
144 delete iter->second ;
210 pc.defineInt(
"prefix",
"Prefix",0,
true) ;
212 pc.defineInt(
"topic",
"Topic",0,0xFFFFF) ;
213 pc.defineString(
"objName",
"ObjectName",0,
"") ;
214 pc.defineString(
"className",
"ClassName",0,
"") ;
215 pc.defineString(
"baseClassName",
"BaseClassName",0,
"") ;
216 pc.defineString(
"tagName",
"LabelName",0,
"") ;
217 pc.defineString(
"outFile",
"OutputFile",0,
"") ;
218 pc.defineObject(
"outStream",
"OutputStream",0,0) ;
219 pc.defineMutex(
"OutputFile",
"OutputStream") ;
229 const char* objName =
pc.getString(
"objName") ;
230 const char* className =
pc.getString(
"className") ;
231 const char* baseClassName =
pc.getString(
"baseClassName") ;
232 const char* tagName =
pc.getString(
"tagName") ;
233 const char* outFile =
pc.getString(
"outFile") ;
234 bool prefix =
pc.getInt(
"prefix") ;
237 ostream* os =
nullptr;
250 newStream.
topic = topic ;
251 newStream.
objectName = (objName ? objName :
"" ) ;
252 newStream.
className = (className ? className :
"" ) ;
253 newStream.
baseClassName = (baseClassName ? baseClassName :
"" ) ;
254 newStream.
tagName = (tagName ? tagName :
"" ) ;
255 newStream.
color = color ;
256 newStream.
prefix = prefix ;
270 }
else if (
string(outFile).size()>0) {
273 ostream* os2 =
_files[
"outFile"] ;
278 os2 =
new ofstream(outFile) ;
281 cout <<
"RooMsgService::addReportingStream ERROR: cannot open output log file " << outFile <<
" reverting stream to stdout" << endl ;
283 newStream.
os = &cout ;
297 newStream.
os = &cout ;
316 vector<StreamConfig>::iterator iter =
_streams.begin() ;
320 if (iter->minLevel==
DEBUG) {
335 cout <<
"RooMsgService::setStreamStatus() ERROR: invalid stream ID " <<
id << endl ;
355 cout <<
"RooMsgService::getStreamStatus() ERROR: invalid stream ID " <<
id << endl ;
420 if (
_streams[i].match(level,topic,self)) {
435 if (
_streams[i].match(level,topic,self)) {
448 if (!
active)
return false ;
450 if (!(
topic&top))
return false ;
454 if (!obj)
return false;
469 if (!active)
return false ;
470 if (level<minLevel)
return false ;
471 if (!(topic&top))
return false ;
473 if (universal)
return true ;
475 if (!obj)
return false;
476 if (objectName.size()>0 && objectName != obj->
GetName())
return false ;
477 if (className.size()>0 && className != obj->
ClassName())
return false ;
478 if (baseClassName.size()>0 && !obj->
IsA()->
InheritsFrom(baseClassName.c_str()))
return false ;
558 bool activeOnly = true ;
559 if (
TString(options).Contains(
"V") ||
TString(options).Contains(
"v")) {
563 cout << (activeOnly?
"Active Message streams":
"All Message streams") << endl ;
567 if (activeOnly && !
_streams[i].active) {
573 cout <<
"[" << i <<
"] MinLevel = " << is->second ;
575 cout <<
" Topic = " ;
577 map<int,string>::const_iterator iter =
_topicNames.begin() ;
579 if (iter->first &
_streams[i].topic) {
580 cout << iter->second <<
" " ;
589 if (
_streams[i].objectName.size()>0) {
590 cout <<
" ObjectName = " <<
_streams[i].objectName ;
592 if (
_streams[i].className.size()>0) {
593 cout <<
" ClassName = " <<
_streams[i].className ;
595 if (
_streams[i].baseClassName.size()>0) {
596 cout <<
" BaseClassName = " <<
_streams[i].baseClassName ;
599 cout <<
" TagLabel = " <<
_streams[i].tagName ;
603 if (!activeOnly && !
_streams[i].active) {
604 cout <<
" (NOT ACTIVE)" ;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
The class RooMsgService is a singleton that organizes messages generated in RooFit.
std::vector< StreamConfig > _streams
void restoreState()
Restore last saved state of message service.
std::ostream & log(const RooAbsArg *self, RooFit::MsgLevel level, RooFit::MsgTopic facility, bool forceSkipPrefix=false)
Log error message associated with RooAbsArg object self at given level and topic.
static RooMsgService & instance()
Return reference to singleton instance.
static bool anyDebug()
Returns true if any debug level stream is active.
RooFit::MsgLevel _globMinLevel
std::stack< std::vector< StreamConfig > > _streamsSaved
RooMsgService()
Constructor.
RooWorkspace * debugWorkspace()
void Print(Option_t *options=nullptr) const override
Print configuration of message service.
void setStreamStatus(Int_t id, bool active)
(De)Activate stream with given unique ID
void saveState()
Save current state of message service.
std::map< int, std::string > _topicNames
~RooMsgService() override
Destructor.
RooWorkspace * _debugWorkspace
bool isActive(const RooAbsArg *self, RooFit::MsgTopic facility, RooFit::MsgLevel level)
Check if logging is active for given object/topic/RooFit::MsgLevel combination.
Int_t activeStream(const RooAbsArg *self, RooFit::MsgTopic facility, RooFit::MsgLevel level)
Find appropriate logging stream for message from given object with given topic and message level.
bool getStreamStatus(Int_t id) const
Get activation status of stream with given unique ID.
void deleteStream(Int_t id)
Delete stream with given unique ID code.
std::map< std::string, std::ostream * > _files
std::map< int, std::string > _levelNames
Int_t addStream(RooFit::MsgLevel level, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg())
Add a message logging stream for message with given RooFit::MsgLevel or higher.
RooFit::MsgLevel _lastMsgLevel
The RooWorkspace is a persistable container for RooFit projects.
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
const char * GetName() const override
Returns name of object.
TClass * IsA() const override
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual TClass * IsA() const
virtual int GetPid()
Get process id.
RooCmdArg Topic(Int_t topic)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
MsgTopic
Topics for a RooMsgService::StreamConfig in RooMsgService.
static constexpr double pc
Wrap an object into a TObject. Sometimes needed to avoid reinterpret_cast or enable RTTI.
RooFit::MsgLevel minLevel
bool match(RooFit::MsgLevel level, RooFit::MsgTopic facility, const RooAbsArg *obj)
Determine if message from given object at given level on given topic is logged.
std::string baseClassName