|
ROOT
Reference Guide |
|
Go to the documentation of this file.
200 const char* argName3,
const char* argName4,
201 const char* argName5,
const char* argName6,
202 const char* argName7,
const char* argName8)
296 void RooCmdConfig::defineMutex(
const char* argName1,
const char* argName2,
const char* argName3,
const char* argName4,
const char* argName5)
440 cout << ri->
GetName() <<
"[Int_t] = " << *ri << endl ;
447 cout << rd->
GetName() <<
"[Double_t] = " << *rd << endl ;
454 cout << rs->
GetName() <<
"[string] = \"" << rs->
getVal() <<
"\"" << endl ;
461 cout << ro->
GetName() <<
"[TObject] = " ;
466 cout <<
"(null)" << endl ;
516 const char* opc = arg.
opcode() ;
535 cout <<
"RooCmdConfig::process: " << opc <<
" has unprocessed dependent " << dep->
GetTitle()
536 <<
", adding to required list" << endl ;
540 cout <<
"RooCmdConfig::process: " << opc <<
" dependent " << dep->
GetTitle() <<
" is already processed" << endl ;
549 cout <<
"RooCmdConfig::process: " << opc <<
" excludes " << mutex->
GetTitle()
550 <<
", adding to forbidden list" << endl ;
566 cout <<
"RooCmdConfig::process " << ri->
GetName() <<
"[Int_t]" <<
" set to " << *ri << endl ;
579 cout <<
"RooCmdConfig::process " << rd->
GetName() <<
"[Double_t]" <<
" set to " << *rd << endl ;
590 const char* oldStr = rs->
getVal() ;
592 if (oldStr && strlen(oldStr)>0 && rs->
getAttribute(
"RooCmdConfig::AppendMode")) {
599 cout <<
"RooCmdConfig::process " << rs->
GetName() <<
"[string]" <<
" set to " << rs->
getVal() << endl ;
612 cout <<
"RooCmdConfig::process " << os->
GetName() <<
"[TObject]" <<
" set to " ;
616 cout <<
"(null)" << endl ;
630 cout <<
"RooCmdConfig::process " << cs->
GetName() <<
"[RooArgSet]" <<
" set to " ;
634 cout <<
"(null)" << endl ;
661 if (strlen(subArg->
GetName())>0) {
666 depRet |=
process(subArgCopy) ;
693 return ri ? (
Int_t)(*ri) : defVal ;
705 return rd ? (
Double_t)(*rd) : defVal ;
718 return rs ? ((convEmptyToNull && strlen(rs->
getVal())==0) ? 0 : ((
const char*)rs->
getVal()) ) : defVal ;
730 return ro ? ro->
obj() : defVal ;
753 return ro ? ro->
objList() : defaultDummy ;
784 if (!cmdsToPurge) return ;
788 strlcpy(buf,cmdsToPurge,1024) ;
790 char*
name = strtok(buf,
",") ;
793 if (cmd) cmdList.
Remove(cmd) ;
794 name = strtok(0,
",") ;
808 if (!cmdNameList)
return filterList ;
812 strlcpy(buf,cmdNameList,1024) ;
814 char*
name = strtok(buf,
",") ;
818 if (removeFromInList) {
821 filterList.
Add(cmd) ;
823 name = strtok(0,
",") ;
840 pc.allowUndefined() ;
841 pc.defineInt(
"theInt",cmdArgName,intIdx,defVal) ;
842 pc.process(arg1) ;
pc.process(arg2) ;
pc.process(arg3) ;
843 pc.process(arg4) ;
pc.process(arg5) ;
pc.process(arg6) ;
844 pc.process(arg7) ;
pc.process(arg8) ;
pc.process(arg9) ;
845 return pc.getInt(
"theInt") ;
860 pc.allowUndefined() ;
861 pc.defineString(
"theString",cmdArgName,strIdx,defVal) ;
862 pc.process(arg1) ;
pc.process(arg2) ;
pc.process(arg3) ;
863 pc.process(arg4) ;
pc.process(arg5) ;
pc.process(arg6) ;
864 pc.process(arg7) ;
pc.process(arg8) ;
pc.process(arg9) ;
865 const char* ret =
pc.getString(
"theString",0,
kTRUE) ;
868 return std::string(ret);
870 return std::string();
885 pc.allowUndefined() ;
886 pc.defineObject(
"theObj",cmdArgName,objIdx,defVal) ;
887 pc.process(arg1) ;
pc.process(arg2) ;
pc.process(arg3) ;
888 pc.process(arg4) ;
pc.process(arg5) ;
pc.process(arg6) ;
889 pc.process(arg7) ;
pc.process(arg8) ;
pc.process(arg9) ;
890 return (
TObject*)
pc.getObject(
"theObj") ;
898 std::initializer_list<std::reference_wrapper<const RooCmdArg>> args) {
901 pc.defineDouble(
"theDouble", cmdArgName, idx, defVal);
902 pc.process(args.begin(), args.end());
903 return pc.getDouble(
"theDouble");
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
void print()
Print configuration of parser.
TIterator * MakeIterator(Bool_t forward=kTRUE) const
Create a TIterator for this list.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
const char * getVal() const
const RooArgSet * getSet(Int_t idx) const
Return RooArgSet stored in slot idx.
Bool_t hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name 'cmdName' has been processed.
Int_t getInt(Int_t idx) const
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
const char * Data() const
void setObj(TObject *inObj)
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 TObject * getObject(Int_t idx) const
char * Form(const char *fmt,...)
virtual const char * GetTitle() const
Returns title of object.
Bool_t process(const RooCmdArg &arg)
Process given RooCmdArg.
RooLinkedList filterCmdList(RooLinkedList &cmdInList, const char *cmdNameList, Bool_t removeFromInList=kTRUE)
Utility function to filter commands listed in cmdNameList from cmdInList.
RooInt is a minimal implementation of a TNamed holding a TObject.
static constexpr double s
TObject * At(Int_t index) const
Return object stored in sequential position given by index.
virtual UInt_t GetUniqueID() const
Return the unique object id.
RooCmdConfig(const char *methodName)
Constructor taking descriptive name of owner/user which is used as prefix for any warning or error me...
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...
static constexpr double pc
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.
const char * getString(Int_t idx) const
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 ...
virtual const char * GetTitle() const
Returns title of object.
Double_t getDouble(Int_t idx) const
TObject * FindObject(const char *name) const
Return pointer to obejct with given name.
const char * getString(const char *name, const char *defaultValue="", Bool_t convEmptyToNull=kFALSE)
Return string property registered with name 'name'.
Iterator abstract base class.
void defineMutex(const char *argName1, const char *argName2)
Define arguments named argName1 and argName2 mutually exclusive.
RooInt is a minimal implementation of a TObject holding a Int_t value.
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
~RooCmdConfig()
Destructor.
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
Collectable string class.
const RooLinkedList & objList() const
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
virtual const char * GetName() const
Returns name of object.
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...
RooDouble is a minimal implementation of a TObject holding a Double_t value.
RooArgSet * getSet(const char *name, RooArgSet *set=0)
Return RooArgSet property registered with name 'name'.
static double decodeDoubleOnTheFly(const char *callerID, const char *cmdArgName, int idx, double defVal, std::initializer_list< std::reference_wrapper< const RooCmdArg >> args)
Find a given double in a list of RooCmdArg.
TObject * getObject(const char *name, TObject *obj=0)
Return TObject property registered with name 'name'.
void setVal(const char *newVal)
The TNamed class is the base class for all named ROOT classes.
TString & Append(const char *cs)
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
void stripCmdList(RooLinkedList &cmdList, const char *cmdsToPurge)
Utility function that strips command names listed (comma separated) in cmdsToPurge from cmdList.
const RooLinkedList & getObjectList(const char *name)
Return list of objects registered with name 'name'.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
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...
virtual void Add(TObject *arg)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
static constexpr double mm
void defineDependency(const char *refArgName, const char *neededArgName)
Define that processing argument name refArgName requires processing of argument named neededArgName t...
virtual TObject * Next()=0
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...
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
static std::string 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...
RooStringVar is a RooAbsArg implementing string values.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual void Add(TObject *obj)
Mother of all ROOT objects.
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
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 ok(Bool_t verbose) const
Return true of parsing was successful.
const char * opcode() const
virtual const char * GetName() const
Returns name of object.
Double_t getDouble(const char *name, Double_t defaultValue=0)
Return Double_t property registered with name 'name'.
const char * missingArgs() const
Return string with names of arguments that were required, but not processed.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual Bool_t Remove(TObject *arg)
Remove object from collection.
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.