201 const char* argName3,
const char* argName4,
202 const char* argName5,
const char* argName6,
203 const char* argName7,
const char* argName8)
235 ret.Append(
s->String()) ;
238 return ret.Length() ? ret.Data() : 0 ;
297void RooCmdConfig::defineMutex(
const char* argName1,
const char* argName2,
const char* argName3,
const char* argName4,
const char* argName5)
441 cout << ri->
GetName() <<
"[Int_t] = " << *ri << endl ;
448 cout << rd->
GetName() <<
"[Double_t] = " << *rd << endl ;
455 cout << rs->
GetName() <<
"[string] = \"" << rs->
getVal() <<
"\"" << endl ;
462 cout << ro->
GetName() <<
"[TObject] = " ;
467 cout <<
"(null)" << endl ;
517 const char* opc = arg.
opcode() ;
536 cout <<
"RooCmdConfig::process: " << opc <<
" has unprocessed dependent " << dep->
GetTitle()
537 <<
", adding to required list" << endl ;
541 cout <<
"RooCmdConfig::process: " << opc <<
" dependent " << dep->
GetTitle() <<
" is already processed" << endl ;
550 cout <<
"RooCmdConfig::process: " << opc <<
" excludes " << mutex->
GetTitle()
551 <<
", adding to forbidden list" << endl ;
563 if (!TString(opc).CompareTo(ri->
GetTitle())) {
567 cout <<
"RooCmdConfig::process " << ri->
GetName() <<
"[Int_t]" <<
" set to " << *ri << endl ;
576 if (!TString(opc).CompareTo(rd->
GetTitle())) {
580 cout <<
"RooCmdConfig::process " << rd->
GetName() <<
"[Double_t]" <<
" set to " << *rd << endl ;
589 if (!TString(opc).CompareTo(rs->
GetTitle())) {
591 const char* oldStr = rs->
getVal() ;
593 if (oldStr && strlen(oldStr)>0 && rs->
getAttribute(
"RooCmdConfig::AppendMode")) {
600 cout <<
"RooCmdConfig::process " << rs->
GetName() <<
"[string]" <<
" set to " << rs->
getVal() << endl ;
609 if (!TString(opc).CompareTo(os->
GetTitle())) {
613 cout <<
"RooCmdConfig::process " << os->
GetName() <<
"[TObject]" <<
" set to " ;
617 cout <<
"(null)" << endl ;
627 if (!TString(opc).CompareTo(cs->
GetTitle())) {
631 cout <<
"RooCmdConfig::process " << cs->
GetName() <<
"[RooArgSet]" <<
" set to " ;
635 cout <<
"(null)" << endl ;
641 Bool_t multiArg = !TString(
"MultiArg").CompareTo(opc) ;
662 if (strlen(subArg->
GetName())>0) {
667 depRet |=
process(subArgCopy) ;
694 return ri ? (
Int_t)(*ri) : defVal ;
706 return rd ? (
Double_t)(*rd) : defVal ;
719 return rs ? ((convEmptyToNull && strlen(rs->
getVal())==0) ? 0 : ((
const char*)rs->
getVal()) ) : defVal ;
731 return ro ? ro->
obj() : defVal ;
754 return ro ? ro->
objList() : defaultDummy ;
785 if (!cmdsToPurge) return ;
789 strlcpy(buf,cmdsToPurge,1024) ;
791 char*
name = strtok(buf,
",") ;
794 if (cmd) cmdList.
Remove(cmd) ;
795 name = strtok(0,
",") ;
809 if (!cmdNameList)
return filterList ;
813 strlcpy(buf,cmdNameList,1024) ;
815 char*
name = strtok(buf,
",") ;
819 if (removeFromInList) {
822 filterList.
Add(cmd) ;
824 name = strtok(0,
",") ;
841 pc.allowUndefined() ;
842 pc.defineInt(
"theInt",cmdArgName,intIdx,defVal) ;
843 pc.process(arg1) ;
pc.process(arg2) ;
pc.process(arg3) ;
844 pc.process(arg4) ;
pc.process(arg5) ;
pc.process(arg6) ;
845 pc.process(arg7) ;
pc.process(arg8) ;
pc.process(arg9) ;
846 return pc.getInt(
"theInt") ;
860 static string retBuf =
"" ;
863 pc.allowUndefined() ;
864 pc.defineString(
"theString",cmdArgName,strIdx,defVal) ;
865 pc.process(arg1) ;
pc.process(arg2) ;
pc.process(arg3) ;
866 pc.process(arg4) ;
pc.process(arg5) ;
pc.process(arg6) ;
867 pc.process(arg7) ;
pc.process(arg8) ;
pc.process(arg9) ;
868 const char* ret =
pc.getString(
"theString",0,
kTRUE) ;
875 return retBuf.c_str() ;
890 pc.allowUndefined() ;
891 pc.defineObject(
"theObj",cmdArgName,objIdx,defVal) ;
892 pc.process(arg1) ;
pc.process(arg2) ;
pc.process(arg3) ;
893 pc.process(arg4) ;
pc.process(arg5) ;
pc.process(arg6) ;
894 pc.process(arg7) ;
pc.process(arg8) ;
pc.process(arg9) ;
895 return (
TObject*)
pc.getObject(
"theObj") ;
char * Form(const char *fmt,...)
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
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...
Double_t getDouble(Int_t idx) const
const RooArgSet * getSet(Int_t idx) const
Return RooArgSet stored in slot idx.
Int_t getInt(Int_t idx) const
const char * opcode() const
const char * getString(Int_t idx) const
const TObject * getObject(Int_t idx) const
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'.
~RooCmdConfig()
Destructor.
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.
static TObject * decodeObjOnTheFly(const char *callerID, const char *cmdArgName, Int_t objIdx, TObject *defVal, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Static decoder function allows to retrieve object property from set of RooCmdArgs For use in base mem...
static Int_t decodeIntOnTheFly(const char *callerID, const char *cmdArgName, Int_t intIdx, Int_t defVal, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Static decoder function allows to retrieve integer property from set of RooCmdArgs For use in base me...
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'.
const RooLinkedList & getObjectList(const char *name)
Return list of objects registered with name 'name'.
Bool_t defineDouble(const char *name, const char *argName, Int_t doubleNum, Double_t defValue=0.)
Define Double_t property name 'name' mapped to Double_t in slot 'doubleNum' in RooCmdArg with name ar...
void defineDependency(const char *refArgName, const char *neededArgName)
Define that processing argument name refArgName requires processing of argument named neededArgName t...
Double_t getDouble(const char *name, Double_t defaultValue=0)
Return Double_t property registered with name 'name'.
void stripCmdList(RooLinkedList &cmdList, const char *cmdsToPurge)
Utility function that strips command names listed (comma separated) in cmdsToPurge from cmdList.
Bool_t defineSet(const char *name, const char *argName, Int_t setNum, const RooArgSet *set=0)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
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...
RooArgSet * getSet(const char *name, RooArgSet *set=0)
Return RooArgSet property registered with name 'name'.
Bool_t ok(Bool_t verbose) const
Return true of parsing was successful.
RooCmdConfig(const char *methodName)
Constructor taking descriptive name of owner/user which is used as prefix for any warning or error me...
static const char * decodeStringOnTheFly(const char *callerID, const char *cmdArgName, Int_t intIdx, const char *defVal, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Static decoder function allows to retrieve string property from set of RooCmdArgs For use in base mem...
RooLinkedList filterCmdList(RooLinkedList &cmdInList, const char *cmdNameList, Bool_t removeFromInList=kTRUE)
Utility function to filter commands listed in cmdNameList from cmdInList.
void defineRequiredArgs(const char *argName1, const char *argName2=0, const char *argName3=0, const char *argName4=0, const char *argName5=0, const char *argName6=0, const char *argName7=0, const char *argName8=0)
Add condition that any of listed arguments must be processed for parsing to be declared successful.
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
const char * missingArgs() const
Return string with names of arguments that were required, but not processed.
void print()
Print configuration of parser.
Bool_t hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name 'cmdName' has been processed.
RooDouble is a minimal implementation of a TObject holding a Double_t value.
RooInt is a minimal implementation of a TObject holding a Int_t value.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
TObject * FindObject(const char *name) const
Return pointer to obejct with given name.
TIterator * MakeIterator(Bool_t dir=kTRUE) const
Return an iterator over this list.
TObject * At(Int_t index) const
Return object stored in sequential position given by index.
virtual void Add(TObject *arg)
virtual Bool_t Remove(TObject *arg)
Remove object from collection.
RooStringVar implements a string values RooAbsArg.
virtual void setVal(const char *newVal)
Set value to given TString.
virtual const char * getVal() const
Return value of object. Calculated if dirty, otherwise cached value is returned.
RooInt is a minimal implementation of a TNamed holding a TObject.
const RooLinkedList & objList() const
void setObj(TObject *inObj)
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Iterator abstract base class.
virtual TObject * Next()=0
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * GetName() const
Returns name of object.
Collectable string class.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual UInt_t GetUniqueID() const
Return the unique object id.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual const char * GetTitle() const
Returns title of object.
static constexpr double s
static constexpr double pc
static constexpr double mm