Abstract container object that can hold multiple RooAbsArg objects.
Collections are ordered and can contain multiple objects of the same name, (but a derived implementation can enforce unique names). The storage of objects is implemented using the container denoted by RooAbsCollection::Storage_t.
Some member functions of RooAbsCollection that take a RooCmdArg as argument also support keyword arguments. So far, this applies to RooAbsCollection::printLatex. For example, the following code is equivalent in PyROOT:
Definition at line 65 of file RooAbsCollection.h.
Classes | |
struct | RooAbsArgPtrOrDouble |
Public Types | |
using | const_iterator = Storage_t::const_iterator |
using | Storage_t = std::vector< RooAbsArg * > |
Public Types inherited from TObject | |
enum | { kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 , kBitMask = 0x00ffffff } |
enum | { kSingleKey = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) } |
enum | EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) } |
enum | EStatusBits { kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) , kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 )) } |
Public Types inherited from RooPrintable | |
enum | ContentsOption { kName =1 , kClassName =2 , kValue =4 , kArgs =8 , kExtras =16 , kAddress =32 , kTitle =64 , kCollectionHeader =128 } |
enum | StyleOption { kInline =1 , kSingleLine =2 , kStandard =3 , kVerbose =4 , kTreeStructure =5 } |
Public Member Functions | |
RooAbsCollection () | |
Default constructor. | |
RooAbsCollection (const char *name) | |
Empty collection constructor. | |
RooAbsCollection (const RooAbsCollection &other, const char *name="") | |
Copy constructor. | |
RooAbsCollection (RooAbsCollection &&other) | |
Move constructor. | |
~RooAbsCollection () override | |
Destructor. | |
virtual bool | add (const RooAbsArg &var, bool silent=false) |
Add the specified argument to list. | |
bool | add (const RooAbsCollection &list, bool silent=false) |
Add a collection of arguments to this collection by calling add() for each element in the source collection. | |
template<typename Iterator_t , typename value_type = typename std::remove_pointer<typename std::iterator_traits<Iterator_t>::value_type>, typename = std::enable_if<std::is_convertible<const value_type*, const RooAbsArg*>::value>> | |
bool | add (Iterator_t beginIt, Iterator_t endIt, bool silent=false) |
virtual RooAbsArg * | addClone (const RooAbsArg &var, bool silent=false) |
Add a clone of the specified argument to list. | |
virtual void | addClone (const RooAbsCollection &list, bool silent=false) |
Add a collection of arguments to this collection by calling addOwned() for each element in the source collection. | |
virtual bool | addOwned (const RooAbsCollection &list, bool silent=false) |
for each element in the source collection. | |
virtual bool | addOwned (RooAbsArg &var, bool silent=false) |
Add an argument and transfer the ownership to the collection. | |
bool | addOwned (RooAbsCollection &&list, bool silent=false) |
Add a collection of arguments to this collection by calling addOwned() for each element in the source collection. | |
bool | addOwned (std::unique_ptr< RooAbsArg > var, bool silent=false) |
Add an argument and transfer the ownership to the collection from a std::unique_ptr . | |
template<class Arg_t > | |
bool | addTyped (const RooAbsCollection &list, bool silent=false) |
Adds elements of a given RooAbsCollection to the container if they match the specified type. | |
bool | allInRange (const char *rangeSpec) const |
Return true if all contained object report to have their value inside the specified range. | |
void | assign (const RooAbsCollection &other) const |
Sets the value, cache and constant attribute of any argument in our set that also appears in the other set. | |
void | assignFast (const RooAbsCollection &other, bool setValDirty=true) const |
Functional equivalent of assign() but assumes this and other collection have same layout. | |
RooAbsCollection & | assignValueOnly (const RooAbsCollection &other, bool forceIfSizeOne=false) |
Sets the value of any argument in our set that also appears in the other set. | |
const_iterator | begin () const |
void | clear () |
Clear contents. If the collection is owning, it will also delete the contents. | |
virtual TObject * | clone (const char *newname) const =0 |
TObject * | Clone (const char *newname=nullptr) const override |
Make a clone of an object using the Streamer facility. | |
bool | contains (const RooAbsArg &var) const |
Check if collection contains an argument with the same name as var. | |
virtual bool | containsInstance (const RooAbsArg &var) const |
Check if this exact instance is in this collection. | |
std::string | contentsString () const |
Return comma separated list of contained object names as STL string. | |
virtual TObject * | create (const char *newname) const =0 |
Int_t | defaultPrintContents (Option_t *opt) const override |
Define default RooPrinable print options for given Print() flag string For inline printing only show value of objects, for default print show name,class name value and extras of each object. | |
void | dump () const |
Base contents dumper for debugging purposes. | |
bool | empty () const |
const_iterator | end () const |
bool | equals (const RooAbsCollection &otherColl) const |
Check if this and other collection have identically-named contents. | |
RooAbsArg * | find (const char *name) const |
Find object with given name in list. | |
RooAbsArg * | find (const RooAbsArg &) const |
Find object with given name in list. | |
TObject * | FindObject (const char *name) const override |
Find object by name in the collection. | |
TObject * | FindObject (const TObject *obj) const override |
Find object in the collection, Note: matching by object name, like the find() method. | |
RooAbsArg * | first () const |
Storage_t const & | get () const |
Const access to the underlying stl container. | |
Int_t | getCatIndex (const char *name, Int_t defVal=0, bool verbose=false) const |
Get index value of a RooAbsCategory stored in set with given name. | |
const char * | getCatLabel (const char *name, const char *defVal="", bool verbose=false) const |
Get state name of a RooAbsCategory stored in set with given name. | |
Int_t | getHashTableSize () const |
Query the size at which the collection will automatically start using an extra lookup table instead of performing a linear search. | |
const char * | GetName () const override |
Returns name of object. | |
double | getRealValue (const char *name, double defVal=0.0, bool verbose=false) const |
Get value of a RooAbsReal stored in set with given name. | |
Int_t | getSize () const |
Return the number of elements in the collection. | |
const char * | getStringValue (const char *name, const char *defVal="", bool verbose=false) const |
Get string value of a RooStringVar stored in set with given name. | |
bool | hasSameLayout (const RooAbsCollection &other) const |
Check that all entries where the collections overlap have the same name. | |
Int_t | index (const char *name) const |
Return index of item with given name, or -1 in case it's not in the collection. | |
Int_t | index (const RooAbsArg &arg) const |
Returns index of given arg, or -1 if arg is not in the collection. | |
Int_t | index (const RooAbsArg *arg) const |
Returns index of given arg, or -1 if arg is not in the collection. | |
TClass * | IsA () const override |
bool | isOwning () const |
RooAbsCollection & | operator= (const RooAbsCollection &other) |
Assign values from the elements in other to our elements. | |
RooAbsArg * | operator[] (Storage_t::size_type i) const |
bool | overlaps (const RooAbsCollection &otherColl) const |
Check if this and other collection have common entries. | |
template<typename Iterator_t , typename value_type = typename std::remove_pointer<typename std::iterator_traits<Iterator_t>::value_type>, typename = std::enable_if<std::is_convertible<const value_type*, const RooAbsArg*>::value>> | |
bool | overlaps (Iterator_t otherCollBegin, Iterator_t otherCollEnd) const |
void | Print (Option_t *options=nullptr) const override |
This method must be overridden when a class wants to print itself. | |
void | printClassName (std::ostream &os) const override |
Return collection class name. | |
void | printLatex (const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const |
Output content of collection as LaTex table. | |
void | printLatex (std::ostream &ofs, Int_t ncol, const char *option="NEYU", Int_t sigDigit=1, const RooLinkedList &siblingLists=RooLinkedList(), const RooCmdArg *formatCmd=nullptr) const |
Internal implementation function of printLatex. | |
void | printMultiline (std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override |
Implement multiline printing of collection, one line for each contained object showing the requested content. | |
void | printName (std::ostream &os) const override |
Return collection name. | |
void | printTitle (std::ostream &os) const override |
Return collection title. | |
void | printValue (std::ostream &os) const override |
Print value of collection, i.e. | |
Storage_t::const_reverse_iterator | rbegin () const |
void | RecursiveRemove (TObject *obj) override |
If one of the TObject we have a referenced to is deleted, remove the reference. | |
void | releaseOwnership () |
virtual bool | remove (const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false) |
Remove the specified argument from our list. | |
bool | remove (const RooAbsCollection &list, bool silent=false, bool matchByNameOnly=false) |
Remove each argument in the input list from our list. | |
template<class forwardIt > | |
void | remove (forwardIt rangeBegin, forwardIt rangeEnd, bool silent=false, bool matchByNameOnly=false) |
virtual void | removeAll () |
Remove all arguments from our set, deleting them if we own them. | |
Storage_t::const_reverse_iterator | rend () const |
virtual bool | replace (const RooAbsArg &var1, const RooAbsArg &var2) |
Replace var1 with var2 and return true for success. | |
bool | replace (const RooAbsCollection &other) |
Replace any args in our set with args of the same name from the other set and return true for success. | |
bool | replace (RooAbsArg *var1, std::unique_ptr< RooAbsArg > var2) |
Replace var1 with var2 and return true for success. | |
void | reserve (Storage_t::size_type count) |
RooAbsCollection * | selectByAttrib (const char *name, bool value) const |
Create a subset of the current collection, consisting only of those elements with the specified attribute set. | |
RooAbsCollection * | selectByName (const char *nameList, bool verbose=false) const |
Create a subset of the current collection, consisting only of those elements with names matching the wildcard expressions in nameList, supplied as a comma separated list. | |
RooAbsCollection * | selectCommon (const RooAbsCollection &refColl) const |
Create a subset of the current collection, consisting only of those elements that are contained as well in the given reference collection. | |
bool | selectCommon (const RooAbsCollection &refColl, RooAbsCollection &outColl) const |
Create a subset of the current collection, consisting only of those elements that are contained as well in the given reference collection. | |
void | setAttribAll (const Text_t *name, bool value=true) |
Set given attribute in each element of the collection by calling each elements setAttribute() function. | |
bool | setCatIndex (const char *name, Int_t newVal=0, bool verbose=false) |
Set index value of a RooAbsCategoryLValue stored in set with given name to newVal. | |
bool | setCatLabel (const char *name, const char *newVal="", bool verbose=false) |
Set state name of a RooAbsCategoryLValue stored in set with given name to newVal. | |
void | setHashTableSize (Int_t number) |
Set the size at which the collection will automatically start using an extra lookup table instead of performing a linear search. | |
void | setName (const char *name) |
bool | setRealValue (const char *name, double newVal=0.0, bool verbose=false) |
Set value of a RooAbsRealLValue stored in set with given name to newVal No error messages are printed unless the verbose flag is set. | |
bool | setStringValue (const char *name, const char *newVal="", bool verbose=false) |
Set string value of a RooStringVar stored in set with given name to newVal. | |
Storage_t::size_type | size () const |
RooAbsCollection * | snapshot (bool deepCopy=true) const |
Take a snap shot of current collection contents. | |
bool | snapshot (RooAbsCollection &output, bool deepCopy=true) const |
Take a snap shot of current collection contents: A collection that owns its elements is returned containing clones of. | |
void | sort (bool reverse=false) |
Sort collection using std::sort and name comparison. | |
void | sortTopologically () |
Sort collection topologically: the servers of any RooAbsArg will be before that RooAbsArg in the collection. | |
void | Streamer (TBuffer &) override |
Stream an object of class TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
void | takeOwnership () |
RooFit::UniqueId< RooAbsCollection > const & | uniqueId () const |
Returns a unique ID that is different for every instantiated RooAbsCollection. | |
void | useHashMapForFind (bool flag) const |
Public Member Functions inherited from TObject | |
TObject () | |
TObject constructor. | |
TObject (const TObject &object) | |
TObject copy ctor. | |
virtual | ~TObject () |
TObject destructor. | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. | |
ULong_t | CheckedHash () |
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. | |
virtual void | Clear (Option_t *="") |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. | |
virtual void | Copy (TObject &object) const |
Copy this to obj. | |
virtual void | Delete (Option_t *option="") |
Delete this object. | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1) . | |
virtual void | Dump () const |
Dump contents of object on stdout. | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. | |
virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
Execute method on this object with the given parameter string, e.g. | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
Execute method on this object with parameters stored in the TObjArray. | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. | |
virtual const char * | GetIconName () const |
Returns mime type name of object. | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). | |
virtual Option_t * | GetOption () const |
virtual const char * | GetTitle () const |
Returns title of object. | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. | |
virtual ULong_t | Hash () const |
Return hash value for this object. | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. | |
void | InvertBit (UInt_t f) |
Bool_t | IsDestructed () const |
IsDestructed. | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
virtual Bool_t | IsSortable () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
virtual void | ls (Option_t *option="") const |
The ls function lists the contents of a class on stdout. | |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification (the base implementation is no-op). | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. | |
void | operator delete (void *ptr) |
Operator delete. | |
void | operator delete (void *ptr, void *vp) |
Only called by placement new when throwing an exception. | |
void | operator delete[] (void *ptr) |
Operator delete []. | |
void | operator delete[] (void *ptr, void *vp) |
Only called by placement new[] when throwing an exception. | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. | |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". | |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. | |
Public Member Functions inherited from RooPrintable | |
RooPrintable () | |
virtual | ~RooPrintable () |
virtual StyleOption | defaultPrintStyle (Option_t *opt) const |
virtual void | printAddress (std::ostream &os) const |
Print class name of object. | |
virtual void | printArgs (std::ostream &os) const |
Interface for printing of object arguments. | |
virtual void | printExtras (std::ostream &os) const |
Interface to print extras of object. | |
virtual void | printStream (std::ostream &os, Int_t contents, StyleOption style, TString indent="") const |
Print description of object on ostream, printing contents set by contents integer, which is interpreted as an OR of 'enum ContentsOptions' values and in the style given by 'enum StyleOption'. | |
virtual void | printTree (std::ostream &os, TString indent="") const |
Interface for tree structure printing of object. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TObject | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_t | GetDtorOnly () |
Return destructor only flag. | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. | |
Static Public Member Functions inherited from RooPrintable | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static std::ostream & | defaultPrintStream (std::ostream *os=nullptr) |
Return a reference to the current default stream to use in Print(). | |
static void | nameFieldLength (Int_t newLen) |
Set length of field reserved from printing name of RooAbsArgs in multi-line collection printing to given amount. | |
Protected Types | |
using | LegacyIterator_t = TIteratorToSTLInterface< Storage_t > |
Protected Types inherited from TObject | |
enum | { kOnlyPrepStep = (1ULL << ( 3 )) } |
Protected Member Functions | |
virtual bool | canBeAdded (const RooAbsArg &arg, bool silent) const =0 |
Determine whether it's possible to add a given RooAbsArg to the collection or not. | |
void | clearStructureTags () |
void | deleteList () |
Delete contents of the list. | |
void | makeStructureTag () |
void | makeTypedStructureTag () |
TNamed * | structureTag () |
TNamed * | typedStructureTag () |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). | |
void | MakeZombie () |
Static Protected Member Functions | |
template<class T > | |
static void | assert_is_no_temporary (T &&) |
Protected Attributes | |
bool | _allRRV = true |
All contents are RRV. | |
Storage_t | _list |
Actual object storage. | |
TString | _name |
Our name. | |
bool | _ownCont = false |
Flag to identify a list that owns its contents. | |
TNamed * | _structureTag {nullptr} |
! Structure tag | |
TNamed * | _typedStructureTag {nullptr} |
! Typed structure tag | |
Private Types | |
using | HashAssistedFind = RooFit::Detail::HashAssistedFind |
Private Member Functions | |
void | insert (RooAbsArg *) |
Insert an element into the owned collections. | |
bool | replaceImpl (const RooAbsArg &var1, const RooAbsArg &var2) |
Static Private Member Functions | |
static void | throwAddTypedException (TClass *klass, RooAbsArg *arg) |
Private Attributes | |
HashAssistedFind * | _hashAssistedFind = nullptr |
! | |
std::size_t | _sizeThresholdForMapSearch = 100 |
! | |
const RooFit::UniqueId< RooAbsCollection > | _uniqueId |
Additional Inherited Members | |
Static Protected Attributes inherited from RooPrintable | |
static Int_t | _nameLength |
#include <RooAbsCollection.h>
using RooAbsCollection::const_iterator = Storage_t::const_iterator |
Definition at line 68 of file RooAbsCollection.h.
|
private |
Definition at line 413 of file RooAbsCollection.h.
|
protected |
Definition at line 378 of file RooAbsCollection.h.
using RooAbsCollection::Storage_t = std::vector<RooAbsArg*> |
Definition at line 67 of file RooAbsCollection.h.
RooAbsCollection::RooAbsCollection | ( | ) |
Default constructor.
Definition at line 117 of file RooAbsCollection.cxx.
RooAbsCollection::RooAbsCollection | ( | const char * | name | ) |
Empty collection constructor.
Definition at line 127 of file RooAbsCollection.cxx.
|
override |
Destructor.
Definition at line 175 of file RooAbsCollection.cxx.
RooAbsCollection::RooAbsCollection | ( | const RooAbsCollection & | other, |
const char * | name = "" |
||
) |
Copy constructor.
Note that a copy of a collection is always non-owning, even the source collection is owning. To create an owning copy of a collection (owning or not), use the snapshot() method.
Definition at line 140 of file RooAbsCollection.cxx.
RooAbsCollection::RooAbsCollection | ( | RooAbsCollection && | other | ) |
Move constructor.
Definition at line 160 of file RooAbsCollection.cxx.
Add the specified argument to list.
Returns true if successful, or else false if a variable of the same name is already in the list or the list owns its variables (in this case, try addClone() or addOwned() instead).
Reimplemented in RooCollectionProxy< RooArgList >, RooCollectionProxy< RooArgSet >, RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 443 of file RooAbsCollection.cxx.
|
inline |
Add a collection of arguments to this collection by calling add() for each element in the source collection.
Definition at line 151 of file RooAbsCollection.h.
|
inline |
Definition at line 140 of file RooAbsCollection.h.
Add a clone of the specified argument to list.
Returns a pointer to the clone if successful, or else zero if a variable of the same name is already in the list or the list does not own its variables (in this case, try add() instead.) Calling addClone() on an empty list forces it to take ownership of all its subsequent variables.
Reimplemented in RooCollectionProxy< RooArgList >, RooCollectionProxy< RooArgSet >, RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 416 of file RooAbsCollection.cxx.
|
virtual |
Add a collection of arguments to this collection by calling addOwned() for each element in the source collection.
Reimplemented in RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 531 of file RooAbsCollection.cxx.
|
virtual |
for each element in the source collection.
The input list can't be an owning collection itself, otherwise the arguments would be owned by two collections.
If you want to transfer arguments from one owning collection to another, you have two options:
std::move
the input collection and use RooAbsCollection::addOwned(RooAbsCollection&&, bool) (preferred)Reimplemented in RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 473 of file RooAbsCollection.cxx.
Add an argument and transfer the ownership to the collection.
Returns true
if successful, or false
if the argument could not be added to the collection (e.g. in the RooArgSet case when an argument with the same name is already in the list). This method can only be called on a list that is flagged as owning all of its contents, or else on an empty list (which will force the list into that mode).
If the argument you want to add is owned by a std::unique_ptr
, you should prefer RooAbsCollection::addOwned(std::unique_ptr<RooAbsArg>, bool).
Reimplemented in RooCollectionProxy< RooArgList >, RooCollectionProxy< RooArgSet >, RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 367 of file RooAbsCollection.cxx.
bool RooAbsCollection::addOwned | ( | RooAbsCollection && | list, |
bool | silent = false |
||
) |
Add a collection of arguments to this collection by calling addOwned() for each element in the source collection.
Unlike RooAbsCollection::addOwned(const RooAbsCollection&, bool), this function also accepts owning source collections because their content will be moved out.
Definition at line 501 of file RooAbsCollection.cxx.
Add an argument and transfer the ownership to the collection from a std::unique_ptr
.
Always returns true
. If the argument can not be added to the collection (e.g. in the RooArgSet case when an argument with the same name is already in the list), a std::runtime_exception
will be thrown, as nobody is owning the argument anymore. This method can only be called on a list that is flagged as owning all of its contents, or else on an empty list (which will force the list into that mode).
If you want to pass an argument that is not owned by a std::unique_ptr
, you can use RooAbsCollection::addOwned(RooAbsArg&, bool).
Definition at line 396 of file RooAbsCollection.cxx.
|
inline |
Adds elements of a given RooAbsCollection to the container if they match the specified type.
This function iterates through the elements of the provided RooAbsCollection and checks if each element matches the specified type. If any element doesn't match the type, it throws an exception.
Arg_t | The type to match for elements in the collection. Must inherit from RooAbsArg. |
list | The RooAbsCollection containing elements to be added. |
silent | Forwarded to the non-typed add function. If true, suppresses error messages when adding elements, e.g. when the collection is a RooArgSet and the element is already in the set. |
std::invalid_argument | if an element in the collection doesn't match the specified type. |
Definition at line 171 of file RooAbsCollection.h.
bool RooAbsCollection::allInRange | ( | const char * | rangeSpec | ) | const |
Return true if all contained object report to have their value inside the specified range.
Definition at line 1483 of file RooAbsCollection.cxx.
|
inlinestaticprotected |
Definition at line 401 of file RooAbsCollection.h.
void RooAbsCollection::assign | ( | const RooAbsCollection & | other | ) | const |
Sets the value, cache and constant attribute of any argument in our set that also appears in the other set.
Note that this function changes the values of the elements in this collection, but is still marked const
as it does not change which elements this collection points to.
Definition at line 283 of file RooAbsCollection.cxx.
void RooAbsCollection::assignFast | ( | const RooAbsCollection & | other, |
bool | setValDirty = true |
||
) | const |
Functional equivalent of assign() but assumes this and other collection have same layout.
Also no attributes are copied
Definition at line 331 of file RooAbsCollection.cxx.
RooAbsCollection & RooAbsCollection::assignValueOnly | ( | const RooAbsCollection & | other, |
bool | forceIfSizeOne = false |
||
) |
Sets the value of any argument in our set that also appears in the other set.
[in] | other | Collection holding the arguments to synchronize values with. |
[in] | forceIfSizeOne | If set to true and both our collection and the other collection have a size of one, the arguments are always synchronized without checking if they have the same name. |
Definition at line 305 of file RooAbsCollection.cxx.
|
inline |
Definition at line 253 of file RooAbsCollection.h.
|
protectedpure virtual |
Determine whether it's possible to add a given RooAbsArg to the collection or not.
Implemented in RooArgSet, and RooArgList.
|
static |
|
inlinestaticconstexpr |
Definition at line 423 of file RooAbsCollection.h.
|
inline |
Clear contents. If the collection is owning, it will also delete the contents.
Definition at line 282 of file RooAbsCollection.h.
|
inlineprotected |
Definition at line 392 of file RooAbsCollection.h.
|
pure virtual |
Implemented in RooArgList, and RooArgSet.
|
inlineoverridevirtual |
Make a clone of an object using the Streamer facility.
If the object derives from TNamed, this function is called by TNamed::Clone. TNamed::Clone uses the optional argument to set a new name to the newly created object.
If the object class has a DirectoryAutoAdd function, it will be called at the end of the function with the parameter gDirectory. This usually means that the object will be appended to the current ROOT directory.
Reimplemented from TObject.
Definition at line 76 of file RooAbsCollection.h.
Check if collection contains an argument with the same name as var.
To check for a specific instance, use containsInstance().
Definition at line 221 of file RooAbsCollection.h.
Check if this exact instance is in this collection.
Reimplemented in RooArgSet.
Definition at line 225 of file RooAbsCollection.h.
std::string RooAbsCollection::contentsString | ( | ) | const |
Return comma separated list of contained object names as STL string.
Definition at line 1148 of file RooAbsCollection.cxx.
|
pure virtual |
Implemented in RooArgList, and RooArgSet.
|
inlinestatic |
Definition at line 423 of file RooAbsCollection.h.
Define default RooPrinable print options for given Print() flag string For inline printing only show value of objects, for default print show name,class name value and extras of each object.
In verbose mode also add object address, argument and title
Reimplemented from RooPrintable.
Definition at line 1199 of file RooAbsCollection.cxx.
|
protected |
Delete contents of the list.
The RooAbsArg destructor ensures clients and servers can be deleted in any order. Also cleans the hash-map for fast lookups if present.
Definition at line 194 of file RooAbsCollection.cxx.
void RooAbsCollection::dump | ( | ) | const |
Base contents dumper for debugging purposes.
Definition at line 1278 of file RooAbsCollection.cxx.
|
inline |
Definition at line 273 of file RooAbsCollection.h.
|
inline |
Definition at line 257 of file RooAbsCollection.h.
bool RooAbsCollection::equals | ( | const RooAbsCollection & | otherColl | ) | const |
Check if this and other collection have identically-named contents.
Definition at line 887 of file RooAbsCollection.cxx.
RooAbsArg * RooAbsCollection::find | ( | const char * | name | ) | const |
Find object with given name in list.
A null pointer is returned if no object with the given name is found.
Definition at line 922 of file RooAbsCollection.cxx.
Find object with given name in list.
A null pointer is returned if no object with the given name is found.
Definition at line 947 of file RooAbsCollection.cxx.
|
inlineoverridevirtual |
Find object by name in the collection.
Reimplemented from TObject.
Definition at line 214 of file RooAbsCollection.h.
Find object in the collection, Note: matching by object name, like the find() method.
Reimplemented from TObject.
Definition at line 217 of file RooAbsCollection.h.
|
inline |
Definition at line 291 of file RooAbsCollection.h.
|
inline |
Const access to the underlying stl container.
Definition at line 116 of file RooAbsCollection.h.
Int_t RooAbsCollection::getCatIndex | ( | const char * | name, |
Int_t | defVal = 0 , |
||
bool | verbose = false |
||
) | const |
Get index value of a RooAbsCategory stored in set with given name.
If none is found, value of defVal is returned. No error messages are printed unless the verbose flag is set
Definition at line 1064 of file RooAbsCollection.cxx.
const char * RooAbsCollection::getCatLabel | ( | const char * | name, |
const char * | defVal = "" , |
||
bool | verbose = false |
||
) | const |
Get state name of a RooAbsCategory stored in set with given name.
If none is found, value of defVal is returned. No error messages are printed unless the verbose flag is set
Definition at line 1021 of file RooAbsCollection.cxx.
|
inline |
Query the size at which the collection will automatically start using an extra lookup table instead of performing a linear search.
Definition at line 111 of file RooAbsCollection.h.
|
inlineoverridevirtual |
Returns name of object.
This default method returns the class name. Classes that give objects a name should override this method.
Reimplemented from TObject.
Definition at line 342 of file RooAbsCollection.h.
double RooAbsCollection::getRealValue | ( | const char * | name, |
double | defVal = 0.0 , |
||
bool | verbose = false |
||
) | const |
Get value of a RooAbsReal stored in set with given name.
If none is found, value of defVal is returned. No error messages are printed unless the verbose flag is set
Definition at line 978 of file RooAbsCollection.cxx.
|
inline |
Return the number of elements in the collection.
Definition at line 287 of file RooAbsCollection.h.
const char * RooAbsCollection::getStringValue | ( | const char * | name, |
const char * | defVal = "" , |
||
bool | verbose = false |
||
) | const |
Get string value of a RooStringVar stored in set with given name.
If none is found, value of defVal is returned. No error messages are printed unless the verbose flag is set
Definition at line 1107 of file RooAbsCollection.cxx.
bool RooAbsCollection::hasSameLayout | ( | const RooAbsCollection & | other | ) | const |
Check that all entries where the collections overlap have the same name.
Definition at line 1630 of file RooAbsCollection.cxx.
Int_t RooAbsCollection::index | ( | const char * | name | ) | const |
Return index of item with given name, or -1 in case it's not in the collection.
Definition at line 965 of file RooAbsCollection.cxx.
Returns index of given arg, or -1 if arg is not in the collection.
Definition at line 309 of file RooAbsCollection.h.
Returns index of given arg, or -1 if arg is not in the collection.
Definition at line 303 of file RooAbsCollection.h.
|
private |
Insert an element into the owned collections.
Definition at line 1587 of file RooAbsCollection.cxx.
|
inlineoverridevirtual |
Reimplemented from TObject.
Reimplemented in RooArgList, RooArgSet, RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 423 of file RooAbsCollection.h.
|
inline |
Definition at line 346 of file RooAbsCollection.h.
|
inlineprotected |
Definition at line 394 of file RooAbsCollection.h.
|
inlineprotected |
Definition at line 395 of file RooAbsCollection.h.
RooAbsCollection & RooAbsCollection::operator= | ( | const RooAbsCollection & | other | ) |
Assign values from the elements in other
to our elements.
Definition at line 270 of file RooAbsCollection.cxx.
|
inline |
Definition at line 297 of file RooAbsCollection.h.
|
inline |
Check if this and other collection have common entries.
Definition at line 249 of file RooAbsCollection.h.
|
inline |
Definition at line 238 of file RooAbsCollection.h.
|
inlineoverridevirtual |
This method must be overridden when a class wants to print itself.
Reimplemented from TObject.
Definition at line 315 of file RooAbsCollection.h.
|
overridevirtual |
Return collection class name.
Reimplemented from RooPrintable.
Definition at line 1186 of file RooAbsCollection.cxx.
RooAbsCollection::printLatex | ( | const RooCmdArg & | arg1 = {} , |
const RooCmdArg & | arg2 = {} , |
||
const RooCmdArg & | arg3 = {} , |
||
const RooCmdArg & | arg4 = {} , |
||
const RooCmdArg & | arg5 = {} , |
||
const RooCmdArg & | arg6 = {} , |
||
const RooCmdArg & | arg7 = {} , |
||
const RooCmdArg & | arg8 = {} |
||
) | const |
Output content of collection as LaTex table.
By default a table with two columns is created: the left column contains the name of each variable, the right column the value.
The following optional named arguments can be used to modify the default behavior
Argument | Effect | ||||||||
---|---|---|---|---|---|---|---|---|---|
Columns(Int_t ncol) | Fold table into multiple columns, i.e. ncol=3 will result in 3 x 2 = 6 total columns | ||||||||
Sibling(const RooAbsCollection& other) | Define sibling list. The sibling list is assumed to have objects with the same name in the same order. If this is not the case warnings will be printed. If a single sibling list is specified, 3 columns will be output: the (common) name, the value of this list and the value in the sibling list. Multiple sibling lists can be specified by repeating the Sibling() command. | ||||||||
Format(const char* str) | Classic format string, provided for backward compatibility | ||||||||
Format() | Formatting arguments.
| ||||||||
OutputFile(const char* fname) | Send output to file with given name rather than standard output |
Example use:
The RooAbsCollection::printLatex() function is pythonized with the command argument pythonization. The keywords must correspond to the CmdArgs of the function.
Definition at line 1320 of file RooAbsCollection.cxx.
void RooAbsCollection::printLatex | ( | std::ostream & | ofs, |
Int_t | ncol, | ||
const char * | option = "NEYU" , |
||
Int_t | sigDigit = 1 , |
||
const RooLinkedList & | siblingLists = RooLinkedList() , |
||
const RooCmdArg * | formatCmd = nullptr |
||
) | const |
Internal implementation function of printLatex.
Definition at line 1377 of file RooAbsCollection.cxx.
|
overridevirtual |
Implement multiline printing of collection, one line for each contained object showing the requested content.
Reimplemented from RooPrintable.
Definition at line 1243 of file RooAbsCollection.cxx.
|
overridevirtual |
Return collection name.
Reimplemented from RooPrintable.
Definition at line 1166 of file RooAbsCollection.cxx.
|
overridevirtual |
Return collection title.
Reimplemented from RooPrintable.
Definition at line 1176 of file RooAbsCollection.cxx.
|
overridevirtual |
Print value of collection, i.e.
a comma separated list of contained object names
Reimplemented from RooPrintable.
Definition at line 1218 of file RooAbsCollection.cxx.
|
inline |
Definition at line 261 of file RooAbsCollection.h.
|
overridevirtual |
If one of the TObject we have a referenced to is deleted, remove the reference.
Reimplemented from TObject.
Definition at line 1528 of file RooAbsCollection.cxx.
|
inline |
Definition at line 355 of file RooAbsCollection.h.
|
virtual |
Remove the specified argument from our list.
Return false if the specified argument is not found in our list. An exact pointer match is required, not just a match by name. If matchByNameOnly
is set, items will be looked up by name. In this case, if the collection also owns the item, it will delete it.
Reimplemented in RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 656 of file RooAbsCollection.cxx.
bool RooAbsCollection::remove | ( | const RooAbsCollection & | list, |
bool | silent = false , |
||
bool | matchByNameOnly = false |
||
) |
Remove each argument in the input list from our list.
An exact pointer match is required, not just a match by name. If matchByNameOnly
is set, items will be looked up by name. In this case, if the collection also owns the items, it will delete them. Return false in case of problems.
Definition at line 700 of file RooAbsCollection.cxx.
|
inline |
Definition at line 186 of file RooAbsCollection.h.
|
virtual |
Remove all arguments from our set, deleting them if we own them.
This effectively restores our object to the state it would have just after calling the RooAbsCollection(const char*) constructor.
Reimplemented in RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 756 of file RooAbsCollection.cxx.
|
inline |
Definition at line 265 of file RooAbsCollection.h.
Replace var1 with var2 and return true for success.
Fails if this list is a copy of another, if var1 is not already in this set, or if var2 is already in this set. var1 and var2 do not need to have the same name.
Reimplemented in RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
Definition at line 610 of file RooAbsCollection.cxx.
bool RooAbsCollection::replace | ( | const RooAbsCollection & | other | ) |
Replace any args in our set with args of the same name from the other set and return true for success.
Fails if this list is a copy of another.
Definition at line 546 of file RooAbsCollection.cxx.
Replace var1 with var2 and return true for success.
Fails if this list is a copy of another, if var1 is not already in this set, or if var2 is already in this set. var1 and var2 do not need to have the same name.
Definition at line 628 of file RooAbsCollection.cxx.
Definition at line 567 of file RooAbsCollection.cxx.
|
inline |
Definition at line 277 of file RooAbsCollection.h.
RooAbsCollection * RooAbsCollection::selectByAttrib | ( | const char * | name, |
bool | value | ||
) | const |
Create a subset of the current collection, consisting only of those elements with the specified attribute set.
The caller is responsible for deleting the returned collection
Definition at line 793 of file RooAbsCollection.cxx.
RooAbsCollection * RooAbsCollection::selectByName | ( | const char * | nameList, |
bool | verbose = false |
||
) | const |
Create a subset of the current collection, consisting only of those elements with names matching the wildcard expressions in nameList, supplied as a comma separated list.
Definition at line 850 of file RooAbsCollection.cxx.
RooAbsCollection * RooAbsCollection::selectCommon | ( | const RooAbsCollection & | refColl | ) | const |
Create a subset of the current collection, consisting only of those elements that are contained as well in the given reference collection.
The caller is responsible for deleting the returned collection
Definition at line 837 of file RooAbsCollection.cxx.
bool RooAbsCollection::selectCommon | ( | const RooAbsCollection & | refColl, |
RooAbsCollection & | outColl | ||
) | const |
Create a subset of the current collection, consisting only of those elements that are contained as well in the given reference collection.
Returns true
only if something went wrong. The complement of this function is getParameters().
[in] | refColl | The collection to check for common elements. |
[out] | outColl | Output collection. |
Definition at line 817 of file RooAbsCollection.cxx.
Set given attribute in each element of the collection by calling each elements setAttribute() function.
Definition at line 778 of file RooAbsCollection.cxx.
Set index value of a RooAbsCategoryLValue stored in set with given name to newVal.
No error messages are printed unless the verbose flag is set
Definition at line 1085 of file RooAbsCollection.cxx.
bool RooAbsCollection::setCatLabel | ( | const char * | name, |
const char * | newVal = "" , |
||
bool | verbose = false |
||
) |
Set state name of a RooAbsCategoryLValue stored in set with given name to newVal.
No error messages are printed unless the verbose flag is set
Definition at line 1042 of file RooAbsCollection.cxx.
|
inline |
Set the size at which the collection will automatically start using an extra lookup table instead of performing a linear search.
Definition at line 106 of file RooAbsCollection.h.
|
inline |
Definition at line 338 of file RooAbsCollection.h.
bool RooAbsCollection::setRealValue | ( | const char * | name, |
double | newVal = 0.0 , |
||
bool | verbose = false |
||
) |
Set value of a RooAbsRealLValue stored in set with given name to newVal No error messages are printed unless the verbose flag is set.
Definition at line 999 of file RooAbsCollection.cxx.
bool RooAbsCollection::setStringValue | ( | const char * | name, |
const char * | newVal = "" , |
||
bool | verbose = false |
||
) |
Set string value of a RooStringVar stored in set with given name to newVal.
No error messages are printed unless the verbose flag is set
Definition at line 1129 of file RooAbsCollection.cxx.
|
inline |
Definition at line 269 of file RooAbsCollection.h.
RooAbsCollection * RooAbsCollection::snapshot | ( | bool | deepCopy = true | ) | const |
Take a snap shot of current collection contents.
An owning collection is returned containing clones of
This is useful to save the values of variables or parameters. It doesn't require deep copying if the parameters are direct members of the collection.
If deepCopy is specified, the client-server links between the cloned list elements and the cloned external dependents are reconnected to each other, making the snapshot a completely self-contained entity.
Definition at line 226 of file RooAbsCollection.cxx.
bool RooAbsCollection::snapshot | ( | RooAbsCollection & | output, |
bool | deepCopy = true |
||
) | const |
Take a snap shot of current collection contents: A collection that owns its elements is returned containing clones of.
If deepCopy is specified, the client-server links between the cloned list elements and the cloned external dependents are reconnected to each other, making the snapshot a completely self-contained entity.
Definition at line 260 of file RooAbsCollection.cxx.
void RooAbsCollection::sort | ( | bool | reverse = false | ) |
Sort collection using std::sort and name comparison.
Definition at line 1536 of file RooAbsCollection.cxx.
void RooAbsCollection::sortTopologically | ( | ) |
Sort collection topologically: the servers of any RooAbsArg will be before that RooAbsArg in the collection.
Definition at line 1560 of file RooAbsCollection.cxx.
|
overridevirtual |
Stream an object of class TObject.
Reimplemented from TObject.
Reimplemented in RooArgList, RooArgSet, RooCollectionProxy< RooArgList >, and RooCollectionProxy< RooArgSet >.
|
inline |
Definition at line 423 of file RooAbsCollection.h.
|
inlineprotected |
Definition at line 386 of file RooAbsCollection.h.
|
inline |
Definition at line 356 of file RooAbsCollection.h.
Definition at line 1639 of file RooAbsCollection.cxx.
|
inlineprotected |
Definition at line 387 of file RooAbsCollection.h.
|
inline |
Returns a unique ID that is different for every instantiated RooAbsCollection.
This ID can be used to check whether two collections are the same object, which is safer than memory address comparisons that might result in false positives when memory is recycled.
Definition at line 98 of file RooAbsCollection.h.
void RooAbsCollection::useHashMapForFind | ( | bool | flag | ) | const |
[in] | flag | Switch hash map on or off. |
Definition at line 1602 of file RooAbsCollection.cxx.
|
protected |
All contents are RRV.
Definition at line 382 of file RooAbsCollection.h.
|
mutableprivate |
!
Definition at line 414 of file RooAbsCollection.h.
|
protected |
Actual object storage.
Definition at line 377 of file RooAbsCollection.h.
|
protected |
Our name.
Definition at line 381 of file RooAbsCollection.h.
|
protected |
Flag to identify a list that owns its contents.
Definition at line 380 of file RooAbsCollection.h.
|
private |
!
Definition at line 415 of file RooAbsCollection.h.
|
mutableprotected |
! Structure tag
Definition at line 389 of file RooAbsCollection.h.
|
mutableprotected |
! Typed structure tag
Definition at line 390 of file RooAbsCollection.h.
|
private |
Definition at line 421 of file RooAbsCollection.h.