41template<
class Collection>
 
   42typename Collection::const_iterator findVar(Collection 
const& coll, 
const char * 
name) {
 
   43  return std::find_if(coll.begin(), coll.end(), [
name](
auto const& 
v){ return v.name == name; });
 
   73void cloneList(
TList const& inList, 
TList & outList) {
 
   75  for(
auto * elem : inList) {
 
   76    outList.
Add(elem->Clone()) ;
 
   87  : 
TObject(other), _iList(other._iList), _dList(other._dList),
 
   88    _sList(other._sList), _oList(other._oList), _cList(other._cList)
 
  110  std::string ret = 
"";
 
  145    coutE(InputArguments) << 
"RooCmdConfig::defintInt: name '" << 
name << 
"' already defined" << endl ;
 
  152  ri.argName = argName;
 
  167    coutE(InputArguments) << 
"RooCmdConfig::defineDouble: name '" << 
name << 
"' already defined" << endl ;
 
  174  rd.argName = argName;
 
  191    coutE(InputArguments) << 
"RooCmdConfig::defineString: name '" << 
name << 
"' already defined" << endl ;
 
  198  rs.argName = argName;
 
  200  rs.appendMode = appendMode;
 
  217    coutE(InputArguments) << 
"RooCmdConfig::defineObject: name '" << 
name << 
"' already defined" << endl ;
 
  224  os.argName = argName;
 
  225  os.val.Add(
const_cast<TObject*
>(defVal));
 
  226  os.appendMode = isArray;
 
  243    coutE(InputArguments) << 
"RooCmdConfig::defineObject: name '" << 
name << 
"' already defined" << endl ;
 
  250  cs.argName = argName;
 
  264  for(
auto const& ri : 
_iList) {
 
  265    cout << ri.name << 
"[Int_t] = " << ri.val << endl ;
 
  269  for(
auto const& rd : 
_dList) {
 
  270    cout << rd.name << 
"[double] = " << rd.val << endl ;
 
  274  for(
auto const& rs : 
_sList) {
 
  275    cout << rs.name << 
"[string] = \"" << rs.val << 
"\"" << endl ;
 
  279  for(
auto const& ro : 
_oList) {
 
  280    cout << ro.name << 
"[TObject] = " ;
 
  281    auto const * obj = ro.val.At(0);
 
  283      cout << obj->GetName() << endl ;
 
  286      cout << 
"(null)" << endl ;
 
  299  for(
auto * arg : static_range_cast<RooCmdArg*>(argList)) {
 
  313  const char* opc = arg.
opcode() ;
 
  316  if (!opc) 
return false ;
 
  320    coutE(InputArguments) << 
_name << 
" ERROR: argument " << opc << 
" not allowed in this context" << endl ;
 
  332   cout << 
"RooCmdConfig::process: " << opc << 
" has unprocessed dependent " << dep->
GetTitle()
 
  333        << 
", adding to required list" << endl ;
 
  337   cout << 
"RooCmdConfig::process: " << opc << 
" dependent " << dep->
GetTitle() << 
" is already processed" << endl ;
 
  346      cout << 
"RooCmdConfig::process: " << opc << 
" excludes " << mutex->
GetTitle()
 
  347      << 
", adding to forbidden list" << endl ;
 
  353  bool anyField(
false) ;
 
  358      ri.val = arg.
getInt(ri.num) ;
 
  361   cout << 
"RooCmdConfig::process " << ri.name << 
"[Int_t]" << 
" set to " << ri.val << endl ;
 
  372   cout << 
"RooCmdConfig::process " << rd.name << 
"[double]" << 
" set to " << rd.val << endl ;
 
  379    if (rs.argName == opc) {
 
  382      auto const * newStr = arg.
getString(rs.num);
 
  384      if (!rs.val.empty() && rs.appendMode) {
 
  386        rs.val += newStr ? newStr : 
"(null)";
 
  388        if(newStr) rs.val = newStr;
 
  392        std::cout << 
"RooCmdConfig::process " << rs.name << 
"[string]" << 
" set to " << rs.val << std::endl ;
 
  400      if(!os.appendMode) os.val.Clear();
 
  404   cout << 
"RooCmdConfig::process " << os.name << 
"[TObject]" << 
" set to " ;
 
  406     cout << os.val.At(0)->GetName() << endl ;
 
  408     cout << 
"(null)" << endl ;
 
  420   cout << 
"RooCmdConfig::process " << cs.name << 
"[RooArgSet]" << 
" set to " ;
 
  422     cout << cs.val->GetName() << endl ;
 
  424     cout << 
"(null)" << endl ;
 
  433    coutE(InputArguments) << 
_name << 
" ERROR: unrecognized command: " << opc << endl ;
 
  447  bool depRet = false ;
 
  451      if (strlen(subArg->
GetName())>0) {
 
  456   depRet |= 
process(subArgCopy) ;
 
  483  return found != 
_iList.end() ? found->val : defVal;
 
  495  return found != 
_dList.end() ? found->val : defVal;
 
  508  if(found == 
_sList.end()) 
return defVal;
 
  509  return (convEmptyToNull && found->val.empty()) ? nullptr : found->val.c_str();
 
  521  return found != 
_oList.end() ? found->val.At(0) : defVal ;
 
  532  return found != 
_cList.end() ? found->val : defVal ;
 
  544  return found != 
_oList.end() ? found->val : defaultDummy ;
 
  558    if (!margs.empty()) {
 
  559      coutE(InputArguments) << 
_name << 
" ERROR: missing arguments: " << margs << endl ;
 
  561      coutE(InputArguments) << 
_name << 
" ERROR: illegal combination of arguments and/or missing arguments" << endl ;
 
  575  if (!cmdsToPurge) return ;
 
  595  if (!cmdNameList) 
return filterList ;
 
  600      if (removeFromInList) {
 
  603      filterList.
Add(cmd) ;
 
  615    std::initializer_list<std::reference_wrapper<const RooCmdArg>> args) {
 
  619  pc.
process(args.begin(), args.end());
 
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
 
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...
 
const RooArgSet * getSet(Int_t idx) const
Return RooArgSet stored in slot idx.
 
double getDouble(Int_t idx) const
Return double stored in slot idx.
 
RooLinkedList const & subArgs() const
Return list of sub-arguments in this RooCmdArg.
 
Int_t getInt(Int_t idx) const
 
bool prefixSubArgs() const
 
const char * opcode() const
 
const char * getString(Int_t idx) const
Return string stored in slot idx.
 
const TObject * getObject(Int_t idx) const
Return TObject stored in slot idx.
 
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
 
bool defineObject(const char *name, const char *argName, Int_t setNum, const TObject *obj=nullptr, bool isArray=false)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
 
std::vector< Var< RooArgSet * > > _cList
RooArgSet list.
 
double getDouble(const char *name, double defaultValue=0.0)
Return double property registered with name 'name'.
 
RooArgSet * getSet(const char *name, RooArgSet *set=nullptr)
Return RooArgSet property registered with name 'name'.
 
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
 
TList _pList
Processed cmd list.
 
bool hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name 'cmdName' has been processed.
 
std::vector< Var< RooLinkedList > > _oList
Object list.
 
Int_t getInt(const char *name, Int_t defaultValue=0)
Return integer property registered with name 'name'.
 
std::vector< Var< int > > _iList
Integer list.
 
std::vector< Var< double > > _dList
Double list.
 
const RooLinkedList & getObjectList(const char *name)
Return list of objects registered with name 'name'.
 
void print() const
Print configuration of parser.
 
void defineDependency(const char *refArgName, const char *neededArgName)
Define that processing argument name refArgName requires processing of argument named neededArgName t...
 
static void stripCmdList(RooLinkedList &cmdList, const char *cmdsToPurge)
Utility function that strips command names listed (comma separated) in cmdsToPurge from cmdList.
 
bool 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...
 
std::vector< Var< std::string > > _sList
String list.
 
TList _yList
Dependency cmd list.
 
TList _fList
Forbidden cmd list.
 
bool defineString(const char *name, const char *argName, Int_t stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
 
bool ok(bool 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...
 
TObject * getObject(const char *name, TObject *obj=nullptr)
Return TObject 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.
 
TList _mList
Mutex cmd list.
 
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false)
Return string property registered with name 'name'.
 
void allowUndefined(bool flag=true)
If flag is true the processing of unrecognized RooCmdArgs is not considered an error.
 
bool defineSet(const char *name, const char *argName, Int_t setNum, const RooArgSet *set=nullptr)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
 
RooLinkedList filterCmdList(RooLinkedList &cmdInList, const char *cmdNameList, bool removeFromInList=true) const
Utility function to filter commands listed in cmdNameList from cmdInList.
 
std::string missingArgs() const
Return string with names of arguments that were required, but not processed.
 
bool defineDouble(const char *name, const char *argName, Int_t doubleNum, double defValue=0.0)
Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argNam...
 
TList _rList
Required cmd list.
 
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
 
TObject * At(int index) const
Return object stored in sequential position given by index.
 
virtual void Add(TObject *arg)
 
TObject * FindObject(const char *name) const override
Return pointer to obejct with given name.
 
virtual bool Remove(TObject *arg)
Remove object from collection.
 
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
 
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
 
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
 
void Add(TObject *obj) override
 
TObject * Remove(TObject *obj) override
Remove object from the list.
 
The TNamed class is the base class for all named ROOT classes.
 
const char * GetName() const override
Returns name of object.
 
virtual void SetName(const char *name)
Set the name of the TNamed.
 
Collectable string class.
 
Mother of all ROOT objects.
 
virtual const char * GetTitle() const
Returns title of object.
 
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
 
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.