67using std::cout, std::endl, std::ofstream, std::ostream, std::string, std::vector, std::map;
82 _devnull = std::make_unique<ofstream>(
"/dev/null") ;
191 pc.
defineInt(
"topic",
"Topic",0,0xFFFFF) ;
208 const char* objName = pc.
getString(
"objName") ;
209 const char* className = pc.
getString(
"className") ;
210 const char* baseClassName = pc.
getString(
"baseClassName") ;
211 const char* tagName = pc.
getString(
"tagName") ;
212 const char* outFile = pc.
getString(
"outFile") ;
213 bool prefix = pc.
getInt(
"prefix") ;
216 ostream* os =
nullptr;
229 newStream.
topic = topic ;
230 newStream.
objectName = (objName ? objName :
"" ) ;
231 newStream.
className = (className ? className :
"" ) ;
232 newStream.
baseClassName = (baseClassName ? baseClassName :
"" ) ;
233 newStream.
tagName = (tagName ? tagName :
"" ) ;
234 newStream.
color = color ;
235 newStream.
prefix = prefix ;
249 }
else if (!
string(outFile).empty()) {
252 ostream* os2 =
_files[
"outFile"].get();
257 os2 =
new ofstream(outFile) ;
260 cout <<
"RooMsgService::addReportingStream ERROR: cannot open output log file " << outFile <<
" reverting stream to stdout" << endl ;
262 newStream.
os = &cout ;
269 _files[
"outFile"] = std::unique_ptr<std::ostream>{os2};
276 newStream.
os = &cout ;
295 vector<StreamConfig>::iterator iter =
_streams.begin() ;
299 if (iter->minLevel==
DEBUG) {
314 cout <<
"RooMsgService::setStreamStatus() ERROR: invalid stream ID " <<
id << endl ;
334 cout <<
"RooMsgService::getStreamStatus() ERROR: invalid stream ID " <<
id << endl ;
378 if (!
active)
return false ;
380 if (!(
topic&top))
return false ;
384 if (!obj)
return false;
399 if (!active)
return false ;
400 if (level<minLevel)
return false ;
401 if (!(topic&top))
return false ;
403 if (universal)
return true ;
405 if (!obj)
return false;
406 if (!objectName.empty() && objectName != obj->
GetName())
return false ;
407 if (!className.empty() && className != obj->
ClassName())
return false ;
408 if (!baseClassName.empty() && !obj->
IsA()->
InheritsFrom(baseClassName.c_str()))
return false ;
441 if (
_streams[as].prefix && !skipPrefix) {
471 if (
_streams[as].prefix && !skipPrefix) {
488 bool activeOnly = true ;
489 if (
TString(options).Contains(
"V") ||
TString(options).Contains(
"v")) {
493 cout << (activeOnly?
"Active Message streams":
"All Message streams") << endl ;
497 if (activeOnly && !
_streams[i].active) {
503 cout <<
"[" << i <<
"] MinLevel = " << is->second ;
505 cout <<
" Topic = " ;
507 map<int,string>::const_iterator iter =
_topicNames.begin() ;
509 if (iter->first &
_streams[i].topic) {
510 cout << iter->second <<
" " ;
519 if (!
_streams[i].objectName.empty()) {
520 cout <<
" ObjectName = " <<
_streams[i].objectName ;
522 if (!
_streams[i].className.empty()) {
523 cout <<
" ClassName = " <<
_streams[i].className ;
525 if (!
_streams[i].baseClassName.empty()) {
526 cout <<
" BaseClassName = " <<
_streams[i].baseClassName ;
529 cout <<
" TagLabel = " <<
_streams[i].tagName ;
533 if (!activeOnly && !
_streams[i].active) {
534 cout <<
" (NOT ACTIVE)" ;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
R__EXTERN TSystem * gSystem
Common abstract base class for objects that represent a value and a "shape" in RooFit.
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
Named container for two doubles, two integers two object points and three string pointers that can be...
Configurable parser for RooCmdArg named arguments.
void defineMutex(const char *head, Args_t &&... tail)
Define arguments where any pair is mutually exclusive.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
bool ok(bool verbose) const
Return true of parsing was successful.
bool defineObject(const char *name, const char *argName, int setNum, const TObject *obj=nullptr, bool isArray=false)
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 convEmptyToNull=false) const
Return string property registered with name 'name'.
bool defineString(const char *name, const char *argName, int stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
bool defineInt(const char *name, const char *argName, int intNum, int defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
int getInt(const char *name, int defaultValue=0) const
Return integer property registered with name 'name'.
TObject * getObject(const char *name, TObject *obj=nullptr) const
Return TObject property registered with name 'name'.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
Singleton class 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.
Int_t activeStream(T self, RooFit::MsgTopic topic, RooFit::MsgLevel level)
Find appropriate logging stream for message from given object with given topic and message level.
static RooMsgService & instance()
Return reference to singleton instance.
std::unique_ptr< RooWorkspace > _debugWorkspace
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.
Int_t addStream(RooFit::MsgLevel level, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={})
Add a message logging stream for message with given RooFit::MsgLevel or higher.
std::map< int, std::string > _topicNames
~RooMsgService() override
std::map< std::string, std::unique_ptr< std::ostream > > _files
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::unique_ptr< std::ofstream > _devnull
std::map< int, std::string > _levelNames
RooFit::MsgLevel _lastMsgLevel
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.
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