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 ;
212 pc.
defineInt(
"topic",
"Topic",0,0xFFFFF) ;
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") ;
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)) {
468 if (!active)
return kFALSE ;
469 if (level<minLevel)
return kFALSE ;
470 if (!(topic&top))
return kFALSE ;
472 if (universal)
return kTRUE ;
474 if (objectName.size()>0 && objectName != obj->
GetName())
return kFALSE ;
475 if (className.size()>0 && className != obj->IsA()->
GetName())
return kFALSE ;
476 if (baseClassName.size()>0 && !obj->IsA()->
InheritsFrom(baseClassName.c_str()))
return kFALSE ;
509 if (
_streams[as].prefix && !skipPrefix) {
539 if (
_streams[as].prefix && !skipPrefix) {
557 if (
TString(options).Contains(
"V") ||
TString(options).Contains(
"v")) {
561 cout << (activeOnly?
"Active Message streams":
"All Message streams") << endl ;
565 if (activeOnly && !
_streams[i].active) {
571 cout <<
"[" << i <<
"] MinLevel = " << is->second ;
573 cout <<
" Topic = " ;
575 map<int,string>::const_iterator iter =
_topicNames.begin() ;
577 if (iter->first &
_streams[i].topic) {
578 cout << iter->second <<
" " ;
587 if (
_streams[i].objectName.size()>0) {
588 cout <<
" ObjectName = " <<
_streams[i].objectName ;
590 if (
_streams[i].className.size()>0) {
591 cout <<
" ClassName = " <<
_streams[i].className ;
593 if (
_streams[i].baseClassName.size()>0) {
594 cout <<
" BaseClassName = " <<
_streams[i].baseClassName ;
597 cout <<
" TagLabel = " <<
_streams[i].tagName ;
601 if (!activeOnly && !
_streams[i].active) {
602 cout <<
" (NOT ACTIVE)" ;
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Bool_t 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.
TObject * getObject(const char *name, TObject *obj=0)
Return TObject property registered with name 'name'.
Bool_t defineInt(const char *name, const char *argName, Int_t intNum, Int_t defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
void defineMutex(const char *argName1, const char *argName2)
Define arguments named argName1 and argName2 mutually exclusive.
Bool_t defineObject(const char *name, const char *argName, Int_t setNum, const TObject *obj=0, Bool_t isArray=kFALSE)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
const char * getString(const char *name, const char *defaultValue="", Bool_t convEmptyToNull=kFALSE)
Return string property registered with name 'name'.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
Bool_t defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", Bool_t appendMode=kFALSE)
Define Double_t property name 'name' mapped to Double_t in slot 'stringNum' in RooCmdArg with name ar...
Bool_t ok(Bool_t verbose) const
Return true of parsing was successful.
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
virtual void Add(TObject *arg)
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.
void setStreamStatus(Int_t id, Bool_t active)
(De)Activate stream with given unique ID
Bool_t getStreamStatus(Int_t id) const
Get activation status of stream with given unique ID.
static RooMsgService & instance()
Return reference to singleton instance.
RooFit::MsgLevel _globMinLevel
Bool_t isActive(const RooAbsArg *self, RooFit::MsgTopic facility, RooFit::MsgLevel level)
Check if logging is active for given object/topic/RooFitMsgLevel combination.
std::stack< std::vector< StreamConfig > > _streamsSaved
RooMsgService()
Constructor.
RooWorkspace * debugWorkspace()
void saveState()
Save current state of message service.
std::map< int, std::string > _topicNames
std::ostream & log(const RooAbsArg *self, RooFit::MsgLevel level, RooFit::MsgTopic facility, Bool_t forceSkipPrefix=kFALSE)
Log error message associated with RooAbsArg object self at given level and topic.
RooWorkspace * _debugWorkspace
static Bool_t anyDebug()
Returns true if any debug level stream is active.
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.
virtual ~RooMsgService()
Destructor.
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.
void Print(Option_t *options=0) const
Print configuration of message service.
RooFit::MsgLevel _lastMsgLevel
The RooWorkspace is a persistable container for RooFit projects.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
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.
Wrap an object into a TObject. Sometimes needed to avoid reinterpret_cast or enable RTTI.
RooFit::MsgLevel minLevel
std::string baseClassName
Bool_t match(RooFit::MsgLevel level, RooFit::MsgTopic facility, const RooAbsArg *obj)
Determine if message from given object at given level on given topic is logged.