Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooCmdConfig.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17
18/**
19\file RooCmdConfig.cxx
20\class RooCmdConfig
21\ingroup Roofitcore
22
23Configurable parser for RooCmdArg named
24arguments. It maps the contents of named arguments named to integers,
25doubles, strings and TObjects that can be retrieved after processing
26a set of RooCmdArgs. The parser also has options to enforce syntax
27rules such as (conditionally) required arguments, mutually exclusive
28arguments and dependencies between arguments.
29**/
30
31#include <RooCmdConfig.h>
32#include <RooMsgService.h>
33
34#include <ROOT/StringUtils.hxx>
35
36#include <iostream>
37
38
39namespace {
40
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; });
44}
45
46}
47
48
49using std::cout, std::endl;
50
52
53
54////////////////////////////////////////////////////////////////////////////////
55/// Constructor taking descriptive name of owner/user which
56/// is used as prefix for any warning or error messages
57/// generated by this parser
58
59RooCmdConfig::RooCmdConfig(RooStringView methodName) : _name(methodName)
60{
66}
67
68
69namespace {
70
71void cloneList(TList const& inList, TList & outList) {
72 outList.SetOwner(true);
73 for(auto * elem : inList) {
74 outList.Add(elem->Clone()) ;
75 }
76}
77
78} // namespace
79
80
81////////////////////////////////////////////////////////////////////////////////
82/// Copy constructor
83
85 : TObject(other),
86 _name(other._name),
87 _verbose(other._verbose),
88 _error(other._error),
89 _allowUndefined(other._allowUndefined),
90 _iList(other._iList),
91 _dList(other._dList),
92 _sList(other._sList),
93 _oList(other._oList),
94 _cList(other._cList)
95{
96 cloneList(other._rList, _rList); // Required cmd list
97 cloneList(other._fList, _fList); // Forbidden cmd list
98 cloneList(other._mList, _mList); // Mutex cmd list
99 cloneList(other._yList, _yList); // Dependency cmd list
100 cloneList(other._pList, _pList); // Processed cmd list
101}
102
103
104
105////////////////////////////////////////////////////////////////////////////////
106/// Return string with names of arguments that were required, but not
107/// processed
108
109std::string RooCmdConfig::missingArgs() const
110{
111 std::string ret;
112
113 bool first = true;
114 for(TObject * s : _rList) {
115 if (first) {
116 first=false ;
117 } else {
118 ret += ", ";
119 }
120 ret += static_cast<TObjString*>(s)->String();
121 }
122
123 return ret;
124}
125
126
127
128////////////////////////////////////////////////////////////////////////////////
129/// Define that processing argument name refArgName requires processing
130/// of argument named neededArgName to successfully complete parsing
131
132void RooCmdConfig::defineDependency(const char* refArgName, const char* neededArgName)
133{
134 _yList.Add(new TNamed(refArgName,neededArgName)) ;
135}
136
137
138
139////////////////////////////////////////////////////////////////////////////////
140/// Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName
141/// Define default value for this int property to be defVal in case named argument is not processed
142
143bool RooCmdConfig::defineInt(const char* name, const char* argName, int intNum, int defVal)
144{
145 if (findVar(_iList, name) != _iList.end()) {
146 coutE(InputArguments) << "RooCmdConfig::defineInt: name '" << name << "' already defined" << endl ;
147 return true ;
148 }
149
150 _iList.emplace_back();
151 auto& ri = _iList.back();
152 ri.name = name;
153 ri.argName = argName;
154 ri.val = defVal;
155 ri.num = intNum;
156 return false ;
157}
158
159
160
161////////////////////////////////////////////////////////////////////////////////
162/// Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argName
163/// Define default value for this double property to be defVal in case named argument is not processed
164
165bool RooCmdConfig::defineDouble(const char* name, const char* argName, int doubleNum, double defVal)
166{
167 if (findVar(_dList, name) != _dList.end()) {
168 coutE(InputArguments) << "RooCmdConfig::defineDouble: name '" << name << "' already defined" << endl ;
169 return true ;
170 }
171
172 _dList.emplace_back();
173 auto& rd = _dList.back();
174 rd.name = name;
175 rd.argName = argName;
176 rd.val = defVal;
177 rd.num = doubleNum;
178 return false ;
179}
180
181
182
183////////////////////////////////////////////////////////////////////////////////
184/// Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argName
185/// Define default value for this double property to be defVal in case named argument is not processed
186/// If appendMode is true, values found in multiple matching RooCmdArg arguments will be concatenated
187/// in the output string. If it is false, only the value of the last processed instance is retained
188
189bool RooCmdConfig::defineString(const char* name, const char* argName, int stringNum, const char* defVal, bool appendMode)
190{
191 if (findVar(_sList, name) != _sList.end()) {
192 coutE(InputArguments) << "RooCmdConfig::defineString: name '" << name << "' already defined" << endl ;
193 return true ;
194 }
195
196 _sList.emplace_back();
197 auto& rs = _sList.back();
198 rs.name = name;
199 rs.argName = argName;
200 rs.val = defVal;
201 rs.appendMode = appendMode;
202 rs.num = stringNum;
203 return false ;
204}
205
206
207
208////////////////////////////////////////////////////////////////////////////////
209/// Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName
210/// Define default value for this TObject property to be defVal in case named argument is not processed.
211/// If isArray is true, an array of TObjects is harvested in case multiple matching named arguments are processed.
212/// If isArray is false, only the TObject in the last processed named argument is retained
213
214bool RooCmdConfig::defineObject(const char* name, const char* argName, int setNum, const TObject* defVal, bool isArray)
215{
216
217 if (findVar(_oList, name) != _oList.end()) {
218 coutE(InputArguments) << "RooCmdConfig::defineObject: name '" << name << "' already defined" << endl ;
219 return true ;
220 }
221
222 _oList.emplace_back();
223 auto& os = _oList.back();
224 os.name = name;
225 os.argName = argName;
226 os.val.Add(const_cast<TObject*>(defVal));
227 os.appendMode = isArray;
228 os.num = setNum;
229 return false ;
230}
231
232
233
234////////////////////////////////////////////////////////////////////////////////
235/// Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName
236/// Define default value for this TObject property to be defVal in case named argument is not processed.
237/// If isArray is true, an array of TObjects is harvested in case multiple matching named arguments are processed.
238/// If isArray is false, only the TObject in the last processed named argument is retained
239
240bool RooCmdConfig::defineSet(const char* name, const char* argName, int setNum, const RooArgSet* defVal)
241{
242
243 if (findVar(_cList, name) != _cList.end()) {
244 coutE(InputArguments) << "RooCmdConfig::defineObject: name '" << name << "' already defined" << endl ;
245 return true ;
246 }
247
248 _cList.emplace_back();
249 auto& cs = _cList.back();
250 cs.name = name;
251 cs.argName = argName;
252 cs.val = const_cast<RooArgSet*>(defVal);
253 cs.num = setNum;
254 return false ;
255}
256
257
258
259////////////////////////////////////////////////////////////////////////////////
260/// Print configuration of parser
261
263{
264 // Find registered integer fields for this opcode
265 for(auto const& ri : _iList) {
266 cout << ri.name << "[int] = " << ri.val << endl ;
267 }
268
269 // Find registered double fields for this opcode
270 for(auto const& rd : _dList) {
271 cout << rd.name << "[double] = " << rd.val << endl ;
272 }
273
274 // Find registered string fields for this opcode
275 for(auto const& rs : _sList) {
276 cout << rs.name << "[string] = \"" << rs.val << "\"" << endl ;
277 }
278
279 // Find registered argset fields for this opcode
280 for(auto const& ro : _oList) {
281 cout << ro.name << "[TObject] = " ;
282 auto const * obj = ro.val.At(0);
283 if (obj) {
284 cout << obj->GetName() << endl ;
285 } else {
286
287 cout << "(null)" << endl ;
288 }
289 }
290}
291
292
293
294////////////////////////////////////////////////////////////////////////////////
295/// Process given list with RooCmdArgs
296
298{
299 bool ret(false) ;
300 for(auto * arg : static_range_cast<RooCmdArg*>(argList)) {
301 ret |= process(*arg) ;
302 }
303 return ret ;
304}
305
306
307
308////////////////////////////////////////////////////////////////////////////////
309/// Process given RooCmdArg
310
312{
313 // Retrieve command code
314 const char* opc = arg.opcode() ;
315
316 // Ignore empty commands
317 if (!opc) return false ;
318
319 // Check if not forbidden
320 if (_fList.FindObject(opc)) {
321 coutE(InputArguments) << _name << " ERROR: argument " << opc << " not allowed in this context" << endl ;
322 _error = true ;
323 return true ;
324 }
325
326 // Check if this code generates any dependencies
327 TObject* dep = _yList.FindObject(opc) ;
328 if (dep) {
329 // Dependent command found, add to required list if not already processed
330 if (!_pList.FindObject(dep->GetTitle())) {
331 _rList.Add(new TObjString(dep->GetTitle())) ;
332 if (_verbose) {
333 cout << "RooCmdConfig::process: " << opc << " has unprocessed dependent " << dep->GetTitle()
334 << ", adding to required list" << endl ;
335 }
336 } else {
337 if (_verbose) {
338 cout << "RooCmdConfig::process: " << opc << " dependent " << dep->GetTitle() << " is already processed" << endl ;
339 }
340 }
341 }
342
343 // Check for mutexes
344 TObject * mutex = _mList.FindObject(opc) ;
345 if (mutex) {
346 if (_verbose) {
347 cout << "RooCmdConfig::process: " << opc << " excludes " << mutex->GetTitle()
348 << ", adding to forbidden list" << endl ;
349 }
350 _fList.Add(new TObjString(mutex->GetTitle())) ;
351 }
352
353
354 bool anyField(false) ;
355
356 // Find registered integer fields for this opcode
357 for(auto& ri : _iList) {
358 if (!TString(opc).CompareTo(ri.argName)) {
359 ri.val = arg.getInt(ri.num) ;
360 anyField = true ;
361 if (_verbose) {
362 cout << "RooCmdConfig::process " << ri.name << "[int]" << " set to " << ri.val << endl ;
363 }
364 }
365 }
366
367 // Find registered double fields for this opcode
368 for(auto& rd : _dList) {
369 if (!TString(opc).CompareTo(rd.argName)) {
370 rd.val = arg.getDouble(rd.num) ;
371 anyField = true ;
372 if (_verbose) {
373 cout << "RooCmdConfig::process " << rd.name << "[double]" << " set to " << rd.val << endl ;
374 }
375 }
376 }
377
378 // Find registered string fields for this opcode
379 for(auto& rs : _sList) {
380 if (rs.argName == opc) {
381
382 // RooCmdArg::getString can return nullptr, so we have to protect against this
383 auto const * newStr = arg.getString(rs.num);
384
385 if (!rs.val.empty() && rs.appendMode) {
386 rs.val += ",";
387 rs.val += newStr ? newStr : "(null)";
388 } else {
389 if(newStr) rs.val = newStr;
390 }
391 anyField = true ;
392 if (_verbose) {
393 std::cout << "RooCmdConfig::process " << rs.name << "[string]" << " set to " << rs.val << std::endl ;
394 }
395 }
396 }
397
398 // Find registered TObject fields for this opcode
399 for(auto& os : _oList) {
400 if (!TString(opc).CompareTo(os.argName)) {
401 if(!os.appendMode) os.val.Clear();
402 os.val.Add(const_cast<TObject*>(arg.getObject(os.num)));
403 anyField = true ;
404 if (_verbose) {
405 cout << "RooCmdConfig::process " << os.name << "[TObject]" << " set to " ;
406 if (os.val.At(0)) {
407 cout << os.val.At(0)->GetName() << endl ;
408 } else {
409 cout << "(null)" << endl ;
410 }
411 }
412 }
413 }
414
415 // Find registered RooArgSet fields for this opcode
416 for(auto& cs : _cList) {
417 if (!TString(opc).CompareTo(cs.argName)) {
418 cs.val = const_cast<RooArgSet*>(arg.getSet(cs.num));
419 anyField = true ;
420 if (_verbose) {
421 cout << "RooCmdConfig::process " << cs.name << "[RooArgSet]" << " set to " ;
422 if (cs.val) {
423 cout << cs.val->GetName() << endl ;
424 } else {
425 cout << "(null)" << endl ;
426 }
427 }
428 }
429 }
430
431 bool multiArg = !TString("MultiArg").CompareTo(opc) ;
432
433 if (!anyField && !_allowUndefined && !multiArg) {
434 coutE(InputArguments) << _name << " ERROR: unrecognized command: " << opc << endl ;
435 }
436
437
438 // Remove command from required-args list (if it was there)
439 TObject* obj;
440 while ( (obj = _rList.FindObject(opc)) ) {
441 _rList.Remove(obj);
442 }
443
444 // Add command the processed list
445 TNamed *pcmd = new TNamed(opc,opc) ;
446 _pList.Add(pcmd) ;
447
448 bool depRet = false ;
449 if (arg.procSubArgs()) {
450 for (int ia=0 ; ia<arg.subArgs().GetSize() ; ia++) {
451 RooCmdArg* subArg = static_cast<RooCmdArg*>(arg.subArgs().At(ia)) ;
452 if (strlen(subArg->GetName())>0) {
453 RooCmdArg subArgCopy(*subArg) ;
454 if (arg.prefixSubArgs()) {
455 subArgCopy.SetName(Form("%s::%s",arg.GetName(),subArg->GetName())) ;
456 }
457 depRet |= process(subArgCopy) ;
458 }
459 }
460 }
461
462 return ((anyField||_allowUndefined)?false:true)||depRet ;
463}
464
465
466
467////////////////////////////////////////////////////////////////////////////////
468/// Return true if RooCmdArg with name 'cmdName' has been processed
469
470bool RooCmdConfig::hasProcessed(const char* cmdName) const
471{
472 return _pList.FindObject(cmdName) ? true : false ;
473}
474
475
476
477////////////////////////////////////////////////////////////////////////////////
478/// Return integer property registered with name 'name'. If no
479/// property is registered, return defVal
480
481int RooCmdConfig::getInt(const char* name, int defVal) const
482{
483 auto found = findVar(_iList, name);
484 return found != _iList.end() ? found->val : defVal;
485}
486
487
488
489////////////////////////////////////////////////////////////////////////////////
490/// Return double property registered with name 'name'. If no
491/// property is registered, return defVal
492
493double RooCmdConfig::getDouble(const char* name, double defVal) const
494{
495 auto found = findVar(_dList, name);
496 return found != _dList.end() ? found->val : defVal;
497}
498
499
500
501////////////////////////////////////////////////////////////////////////////////
502/// Return string property registered with name 'name'. If no
503/// property is registered, return defVal. If convEmptyToNull
504/// is true, empty string will be returned as null pointers
505
506const char* RooCmdConfig::getString(const char* name, const char* defVal, bool convEmptyToNull) const
507{
508 auto found = findVar(_sList, name);
509 if(found == _sList.end()) return defVal;
510 return (convEmptyToNull && found->val.empty()) ? nullptr : found->val.c_str();
511}
512
513
514
515////////////////////////////////////////////////////////////////////////////////
516/// Return TObject property registered with name 'name'. If no
517/// property is registered, return defVal
518
519TObject* RooCmdConfig::getObject(const char* name, TObject* defVal) const
520{
521 auto found = findVar(_oList, name);
522 return found != _oList.end() ? found->val.At(0) : defVal ;
523}
524
525
526////////////////////////////////////////////////////////////////////////////////
527/// Return RooArgSet property registered with name 'name'. If no
528/// property is registered, return defVal
529
530RooArgSet* RooCmdConfig::getSet(const char* name, RooArgSet* defVal) const
531{
532 auto found = findVar(_cList, name);
533 return found != _cList.end() ? found->val : defVal ;
534}
535
536
537
538////////////////////////////////////////////////////////////////////////////////
539/// Return list of objects registered with name 'name'
540
542{
543 const static RooLinkedList defaultDummy ;
544 auto found = findVar(_oList, name);
545 return found != _oList.end() ? found->val : defaultDummy ;
546}
547
548
549
550////////////////////////////////////////////////////////////////////////////////
551/// Return true of parsing was successful
552
553bool RooCmdConfig::ok(bool verbose) const
554{
555 if (_rList.GetSize()==0 && !_error) return true ;
556
557 if (verbose) {
558 std::string margs = missingArgs() ;
559 if (!margs.empty()) {
560 coutE(InputArguments) << _name << " ERROR: missing arguments: " << margs << endl ;
561 } else {
562 coutE(InputArguments) << _name << " ERROR: illegal combination of arguments and/or missing arguments" << endl ;
563 }
564 }
565 return false ;
566}
567
568
569
570////////////////////////////////////////////////////////////////////////////////
571/// Utility function that strips command names listed (comma separated) in cmdsToPurge from cmdList
572
573void RooCmdConfig::stripCmdList(RooLinkedList& cmdList, const char* cmdsToPurge)
574{
575 // Sanity check
576 if (!cmdsToPurge) return ;
577
578 // Copy command list for parsing
579 for(auto const& name : ROOT::Split(cmdsToPurge, ",")) {
580 if (TObject* cmd = cmdList.FindObject(name.c_str())) {
581 cmdList.Remove(cmd);
582 }
583 }
584
585}
586
587
588
589////////////////////////////////////////////////////////////////////////////////
590/// Utility function to filter commands listed in cmdNameList from cmdInList. Filtered arguments are put in the returned list.
591/// If removeFromInList is true then these commands are removed from the input list
592
593RooLinkedList RooCmdConfig::filterCmdList(RooLinkedList& cmdInList, const char* cmdNameList, bool removeFromInList) const
594{
595 RooLinkedList filterList ;
596 if (!cmdNameList) return filterList ;
597
598 // Copy command list for parsing
599 for(auto const& name : ROOT::Split(cmdNameList, ",")) {
600 if (TObject* cmd = cmdInList.FindObject(name.c_str())) {
601 if (removeFromInList) {
602 cmdInList.Remove(cmd) ;
603 }
604 filterList.Add(cmd) ;
605 }
606 }
607 return filterList ;
608}
609
610
611
612////////////////////////////////////////////////////////////////////////////////
613/// Find a given double in a list of RooCmdArg.
614/// Should only be used to initialise base classes in constructors.
615double RooCmdConfig::decodeDoubleOnTheFly(const char* callerID, const char* cmdArgName, int idx, double defVal,
616 std::initializer_list<std::reference_wrapper<const RooCmdArg>> args) {
617 RooCmdConfig pc(callerID);
618 pc.allowUndefined();
619 pc.defineDouble("theDouble", cmdArgName, idx, defVal);
620 pc.process(args.begin(), args.end());
621 return pc.getDouble("theDouble");
622}
#define coutE(a)
#define ClassImp(name)
Definition Rtypes.h:377
char name[80]
Definition TGX11.cxx:110
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
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.
Definition RooCmdArg.h:91
RooLinkedList const & subArgs() const
Return list of sub-arguments in this RooCmdArg.
Definition RooCmdArg.h:52
Int_t getInt(Int_t idx) const
Definition RooCmdArg.h:86
bool procSubArgs() const
Definition RooCmdArg.h:107
bool prefixSubArgs() const
Definition RooCmdArg.h:108
const char * opcode() const
Definition RooCmdArg.h:67
const char * getString(Int_t idx) const
Return string stored in slot idx.
Definition RooCmdArg.h:95
const TObject * getObject(Int_t idx) const
Return TObject stored in slot idx.
Definition RooCmdArg.h:99
Configurable parser for RooCmdArg named arguments.
std::vector< Var< RooArgSet * > > _cList
RooArgSet list.
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.
std::vector< Var< int > > _iList
Integer list.
std::vector< Var< double > > _dList
Double list.
double getDouble(const char *name, double defaultValue=0.0) const
Return double property 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...
bool defineDouble(const char *name, const char *argName, int doubleNum, double defValue=0.0)
Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argNam...
static void stripCmdList(RooLinkedList &cmdList, const char *cmdsToPurge)
Utility function that strips command names listed (comma separated) in cmdsToPurge from cmdList.
std::string _name
RooArgSet * getSet(const char *name, RooArgSet *set=nullptr) const
Return RooArgSet property registered with name 'name'.
bool defineSet(const char *name, const char *argName, int setNum, const RooArgSet *set=nullptr)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
std::vector< Var< std::string > > _sList
String list.
TList _yList
Dependency cmd list.
TList _fList
Forbidden cmd list.
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...
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.
const RooLinkedList & getObjectList(const char *name) const
Return list of objects registered with name 'name'.
TList _mList
Mutex cmd list.
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...
void allowUndefined(bool flag=true)
If flag is true the processing of unrecognized RooCmdArgs is not considered an error.
int getInt(const char *name, int defaultValue=0) const
Return integer property registered with name 'name'.
RooCmdConfig(RooStringView methodName)
Constructor taking descriptive name of owner/user which is used as prefix for any warning or error me...
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.
TObject * getObject(const char *name, TObject *obj=nullptr) const
Return TObject property registered with name 'name'.
TList _rList
Required cmd list.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
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 object with given name.
virtual bool Remove(TObject *arg)
Remove object from collection.
The RooStringView is a wrapper around a C-style string that can also be constructed from a std::strin...
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.
A doubly linked list.
Definition TList.h:38
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:576
void Add(TObject *obj) override
Definition TList.h:83
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:820
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
Collectable string class.
Definition TObjString.h:28
Mother of all ROOT objects.
Definition TObject.h:41
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:482
Basic string class.
Definition TString.h:139
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition TString.cxx:457
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.