Logo ROOT  
Reference Guide
RooArgSet Class Reference

RooArgSet is a container object that can hold multiple RooAbsArg objects.

The container has set semantics which means that:

  • Every object it contains must have a unique name returned by GetName().
  • Contained objects are not ordered, although the set can be traversed using an iterator returned by createIterator(). The iterator does not necessarily follow the object insertion order.
  • Objects can be retrieved by name only, and not by index.

Ownership of contents

Unowned objects are inserted with the add() method. Owned objects are added with addOwned() or addClone(). A RooArgSet either owns all of it contents, or none, which is determined by the first add call. Once an ownership status is selected, inappropriate add calls will return error status. Clearing the list via removeAll() resets the ownership status. Arguments supplied in the constructor are always added as unowned elements.

Uniquely identifying RooArgSet objects

Warning
Before v6.28, it was ensured that no RooArgSet objects on the heap were located at an address that had already been used for a RooArgSet before. With v6.28, this is not guaranteed anymore. Hence, if your code uses pointer comparisons to uniquely identify RooArgSet instances, please consider using the new RooArgSet::uniqueId().

Definition at line 56 of file RooArgSet.h.

Public Member Functions

 RooArgSet ()
 Default constructor. More...
 
 RooArgSet (const char *name)
 Empty set constructor. More...
 
template<typename... Args_t>
 RooArgSet (const RooAbsArg &arg, Args_t &&... moreArgsOrName)
 Construct a (non-owning) RooArgSet from one or more RooFit objects. More...
 
 RooArgSet (const RooAbsCollection &coll)
 Constructor from a RooArgList. More...
 
 RooArgSet (const RooAbsCollection &collection, const RooAbsArg *var1)
 Constructor from a RooArgSet / RooArgList and a pointer to another RooFit object. More...
 
 RooArgSet (const RooArgSet &other, const char *name="")
 Copy constructor. More...
 
 RooArgSet (const RooArgSet &set1, const RooArgSet &set2, const char *name="")
 Construct a set from two existing sets. More...
 
 RooArgSet (const TCollection &tcoll, const char *name="")
 Constructor from a root TCollection. More...
 
template<typename... Args_t>
 RooArgSet (double arg, Args_t &&... moreArgsOrName)
 
template<typename Iterator_t , typename value_type = typename std::remove_pointer<typename std::iterator_traits<Iterator_t>::value_type>::type, typename = std::enable_if<std::is_convertible<const value_type*, const RooAbsArg*>::value>>
 RooArgSet (Iterator_t beginIt, Iterator_t endIt, const char *name="")
 Construct a (non-owning) RooArgSet from iterators. More...
 
template<typename... Args_t>
 RooArgSet (RooAbsArg &&arg, Args_t &&... moreArgsOrName)
 This constructor will provoke a static_assert, because passing a RooAbsArg as r-value reference is not allowed. More...
 
 RooArgSet (RooArgSet &&other)
 Move constructor. More...
 
 RooArgSet (std::vector< RooAbsArgPtrOrDouble > const &vec)
 Construct a non-owning RooArgSet from a vector of RooAbsArg pointers. More...
 
 ~RooArgSet () override
 Destructor. More...
 
TObjectclone (const char *newname) const override
 
bool containsInstance (const RooAbsArg &var) const override
 Check if this exact instance is in this collection. More...
 
TObjectcreate (const char *newname) const override
 
TClassIsA () const override
 
bool isInRange (const char *rangeSpec)
 
RooArgSetoperator= (const RooArgSet &other)
 
RooAbsArgoperator[] (const TString &str) const
 Get reference to an element using its name. More...
 
bool readFromFile (const char *fileName, const char *flagReadAtt=nullptr, const char *section=nullptr, bool verbose=false)
 Read contents of the argset from specified file. More...
 
virtual bool readFromStream (std::istream &is, bool compact, bool verbose=false)
 Shortcut for readFromStream(std::istream&, bool, const char*, const char*, bool), setting flagReadAtt and section to 0. More...
 
bool readFromStream (std::istream &is, bool compact, const char *flagReadAtt, const char *section, bool verbose=false)
 Read the contents of the argset in ASCII form from given stream. More...
 
RooArgSetsnapshot (bool deepCopy=true) const
 Use RooAbsCollection::snapshot(), but return as RooArgSet. More...
 
bool snapshot (RooAbsCollection &output, bool deepCopy=true) const
 Take a snap shot of current collection contents. More...
 
void Streamer (TBuffer &) override
 Stream an object of class TObject. More...
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
RooFit::UniqueId< RooArgSet > const & uniqueId () const
 Returns a unique ID that is different for every instantiated RooArgSet. More...
 
void writeToFile (const char *fileName) const
 Write contents of the argset to specified file. More...
 
virtual void writeToStream (std::ostream &os, bool compact, const char *section=nullptr) const
 Write the contents of the argset in ASCII form to given stream. More...
 
- Public Member Functions inherited from RooAbsCollection
 RooAbsCollection ()
 Default constructor. More...
 
 RooAbsCollection (const char *name)
 Empty collection constructor. More...
 
 RooAbsCollection (const RooAbsCollection &other, const char *name="")
 Copy constructor. More...
 
 RooAbsCollection (RooAbsCollection &&other)
 Move constructor. More...
 
 ~RooAbsCollection () override
 Destructor. More...
 
virtual bool add (const RooAbsArg &var, bool silent=false)
 Add the specified argument to list. More...
 
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. More...
 
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 RooAbsArgaddClone (const RooAbsArg &var, bool silent=false)
 Add a clone of the specified argument to list. More...
 
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. More...
 
virtual bool addOwned (const RooAbsCollection &list, bool silent=false)
 for each element in the source collection. More...
 
virtual bool addOwned (RooAbsArg &var, bool silent=false)
 Add an argument and transfer the ownership to the collection. More...
 
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. More...
 
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. More...
 
bool allInRange (const char *rangeSpec) const
 Return true if all contained object report to have their value inside the specified range. More...
 
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. More...
 
void assignFast (const RooAbsCollection &other, bool setValDirty=true) const
 Functional equivalent of assign() but assumes this and other collection have same layout. More...
 
RooAbsCollectionassignValueOnly (const RooAbsCollection &other, bool forceIfSizeOne=false)
 Sets the value of any argument in our set that also appears in the other set. More...
 
const_iterator begin () const
 
void clear ()
 Clear contents. If the collection is owning, it will also delete the contents. More...
 
virtual TObjectclone (const char *newname) const =0
 
TObjectClone (const char *newname=nullptr) const override
 Make a clone of an object using the Streamer facility. More...
 
bool contains (const RooAbsArg &var) const
 Check if collection contains an argument with the same name as var. More...
 
virtual bool containsInstance (const RooAbsArg &var) const
 Check if this exact instance is in this collection. More...
 
std::string contentsString () const
 Return comma separated list of contained object names as STL string. More...
 
virtual TObjectcreate (const char *newname) const =0
 
TIteratorcreateIterator (bool dir=kIterForward) const
 TIterator-style iteration over contained elements. More...
 
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. More...
 
void dump () const
 Base contents dumper for debugging purposes. More...
 
bool empty () const
 
const_iterator end () const
 
bool equals (const RooAbsCollection &otherColl) const
 Check if this and other collection have identically-named contents. More...
 
RooAbsArgfind (const char *name) const
 Find object with given name in list. More...
 
RooAbsArgfind (const RooAbsArg &) const
 Find object with given name in list. More...
 
TObjectFindObject (const char *name) const override
 Find object by name in the collection. More...
 
TObjectFindObject (const TObject *obj) const override
 Find object in the collection, Note: matching by object name, like the find() method. More...
 
RooAbsArgfirst () const
 
RooFIter fwdIterator () const
 One-time forward iterator. More...
 
Storage_t const & get () const
 Const access to the underlying stl container. More...
 
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. More...
 
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. More...
 
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. More...
 
const char * GetName () const override
 Returns name of object. More...
 
double getRealValue (const char *name, double defVal=0.0, bool verbose=false) const
 Get value of a RooAbsReal stored in set with given name. More...
 
Int_t getSize () const
 Return the number of elements in the collection. More...
 
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. More...
 
bool hasSameLayout (const RooAbsCollection &other) const
 Check that all entries where the collections overlap have the same name. More...
 
Int_t index (const char *name) const
 Return index of item with given name, or -1 in case it's not in the collection. More...
 
Int_t index (const RooAbsArg &arg) const
 Returns index of given arg, or -1 if arg is not in the collection. More...
 
Int_t index (const RooAbsArg *arg) const
 Returns index of given arg, or -1 if arg is not in the collection. More...
 
TClassIsA () const override
 
bool isOwning () const
 
RooLinkedListIter iterator (bool dir=kIterForward) const
 TIterator-style iteration over contained elements. More...
 
RooAbsCollectionoperator= (const RooAbsCollection &other)
 Assign values from the elements in other to our elements. More...
 
RooAbsArgoperator[] (Storage_t::size_type i) const
 
bool overlaps (const RooAbsCollection &otherColl) const
 Check if this and other collection have common entries. More...
 
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. More...
 
void printClassName (std::ostream &os) const override
 Return collection class name. More...
 
void printLatex (const RooCmdArg &arg1=RooCmdArg(), 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
 Output content of collection as LaTex table. More...
 
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. More...
 
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. More...
 
void printName (std::ostream &os) const override
 Return collection name. More...
 
void printTitle (std::ostream &os) const override
 Return collection title. More...
 
void printValue (std::ostream &os) const override
 Print value of collection, i.e. More...
 
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. More...
 
void releaseOwnership ()
 
virtual bool remove (const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
 Remove the specified argument from our list. More...
 
bool remove (const RooAbsCollection &list, bool silent=false, bool matchByNameOnly=false)
 Remove each argument in the input list from our list. More...
 
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. More...
 
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. More...
 
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. More...
 
void reserve (Storage_t::size_type count)
 
RooAbsCollectionselectByAttrib (const char *name, bool value) const
 Create a subset of the current collection, consisting only of those elements with the specified attribute set. More...
 
RooAbsCollectionselectByName (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. More...
 
RooAbsCollectionselectCommon (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. More...
 
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. More...
 
void setAttribAll (const Text_t *name, bool value=true)
 Set given attribute in each element of the collection by calling each elements setAttribute() function. More...
 
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. More...
 
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. More...
 
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. More...
 
void setName (const char *name)
 
bool setRealValue (const char *name, double newVal=0.0, bool verbose=false)
 Set value of a RooAbsRealLValye stored in set with given name to newVal No error messages are printed unless the verbose flag is set. More...
 
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. More...
 
Storage_t::size_type size () const
 
RooAbsCollectionsnapshot (bool deepCopy=true) const
 Take a snap shot of current collection contents. More...
 
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. More...
 
void sort (bool reverse=false)
 Sort collection using std::sort and name comparison. More...
 
void sortTopologically ()
 Sort collection topologically: the servers of any RooAbsArg will be before that RooAbsArg in the collection. More...
 
void Streamer (TBuffer &) override
 Stream an object of class TObject. More...
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
void takeOwnership ()
 
void useHashMapForFind (bool flag) const
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor. More...
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
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. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad). More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
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. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
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. More...
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
void InvertBit (UInt_t f)
 
virtual TClassIsA () const
 
Bool_t IsDestructed () const
 IsDestructed. More...
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
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. More...
 
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). More...
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
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)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void Streamer (TBuffer &)
 Stream an object of class TObject. More...
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
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. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 
- Public Member Functions inherited from RooPrintable
 RooPrintable ()
 
virtual ~RooPrintable ()
 
virtual Int_t defaultPrintContents (Option_t *opt) const
 Default choice of contents to be printed (name and value) More...
 
virtual StyleOption defaultPrintStyle (Option_t *opt) const
 
virtual TClassIsA () const
 
virtual void printAddress (std::ostream &os) const
 Print class name of object. More...
 
virtual void printArgs (std::ostream &os) const
 Interface for printing of object arguments. More...
 
virtual void printClassName (std::ostream &os) const
 Print class name of object. More...
 
virtual void printExtras (std::ostream &os) const
 Interface to print extras of object. More...
 
virtual void printMultiline (std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const
 Interface for detailed printing of object. More...
 
virtual void printName (std::ostream &os) const
 Print name of object. More...
 
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'. More...
 
virtual void printTitle (std::ostream &os) const
 Print title of object. More...
 
virtual void printTree (std::ostream &os, TString indent="") const
 Interface for tree structure printing of object. More...
 
virtual void printValue (std::ostream &os) const
 Interface to print value of object. More...
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static Version_t Class_Version ()
 
static void cleanup ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from RooAbsCollection
static TClassClass ()
 
static const char * Class_Name ()
 
static Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TObject
static TClassClass ()
 
static const char * Class_Name ()
 
static Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Longptr_t GetDtorOnly ()
 Return destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 
- Static Public Member Functions inherited from RooPrintable
static TClassClass ()
 
static const char * Class_Name ()
 
static 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(). More...
 
static void nameFieldLength (Int_t newLen)
 Set length of field reserved from printing name of RooAbsArgs in multi-line collection printing to given amount. More...
 

Protected Member Functions

bool canBeAdded (const RooAbsArg &arg, bool silent) const override
 Determine whether it's possible to add a given RooAbsArg to the collection or not. More...
 
bool checkForDup (const RooAbsArg &arg, bool silent) const
 Check if element with var's name is already in set. More...
 
- Protected Member Functions inherited from RooAbsCollection
bool addServerClonesToList (const RooAbsArg &var)
 Add clones of servers of given argument to end of list. More...
 
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. More...
 
void clearStructureTags ()
 
void deleteList ()
 Delete contents of the list. More...
 
void makeStructureTag ()
 
void makeTypedStructureTag ()
 
TNamedstructureTag ()
 
TNamedtypedStructureTag ()
 
- 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). More...
 
void MakeZombie ()
 

Private Member Functions

template<class Arg_t >
void processArg (Arg_t &&arg)
 
void processArg (const char *name)
 
void processArg (const RooAbsArg &arg)
 
void processArg (const RooAbsArg *arg)
 
void processArg (const RooAbsCollection &coll)
 
void processArg (const RooArgList &list)
 
void processArg (double value)
 
void processArg (RooAbsArg *var)
 
void processArg (RooAbsCollection &&coll)
 
template<typename... Args_t>
void processArgs (Args_t &&... args)
 

Private Attributes

const RooFit::UniqueId< RooArgSet_uniqueId
 

Additional Inherited Members

- Public Types inherited from RooAbsCollection
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
}
 
- Protected Types inherited from RooAbsCollection
using LegacyIterator_t = TIteratorToSTLInterface< Storage_t >
 
- Protected Types inherited from TObject
enum  { kOnlyPrepStep = (1ULL << ( 3 )) }
 
- Static Protected Member Functions inherited from RooAbsCollection
template<class T >
static void assert_is_no_temporary (T &&)
 
- Protected Attributes inherited from RooAbsCollection
bool _allRRV = true
 All contents are RRV. More...
 
Storage_t _list
 Actual object storage. More...
 
TString _name
 Our name. More...
 
bool _ownCont = false
 Flag to identify a list that owns its contents. More...
 
TNamed_structureTag {nullptr}
 ! Structure tag More...
 
TNamed_typedStructureTag {nullptr}
 ! Typed structure tag More...
 
- Static Protected Attributes inherited from RooPrintable
static Int_t _nameLength
 

#include <RooArgSet.h>

Inheritance diagram for RooArgSet:
[legend]

Constructor & Destructor Documentation

◆ RooArgSet() [1/13]

RooArgSet::RooArgSet ( )

Default constructor.

Definition at line 153 of file RooArgSet.cxx.

◆ RooArgSet() [2/13]

template<typename... Args_t>
RooArgSet::RooArgSet ( const RooAbsArg arg,
Args_t &&...  moreArgsOrName 
)
inline

Construct a (non-owning) RooArgSet from one or more RooFit objects.

The set will not own its contents.

Template Parameters
TsParameter pack of objects that derive from RooAbsArg or RooFit collections; or a name.
Parameters
argA RooFit object. Note that you can also pass a double as first argument when constructing a RooArgSet, and another templated constructor will be used where a RooConstVar is implicitly created from the double value.
moreArgsOrNameArbitrary number of

Definition at line 82 of file RooArgSet.h.

◆ RooArgSet() [3/13]

template<typename... Args_t>
RooArgSet::RooArgSet ( RooAbsArg &&  arg,
Args_t &&...  moreArgsOrName 
)
inline

This constructor will provoke a static_assert, because passing a RooAbsArg as r-value reference is not allowed.

Definition at line 100 of file RooArgSet.h.

◆ RooArgSet() [4/13]

template<typename... Args_t>
RooArgSet::RooArgSet ( double  arg,
Args_t &&...  moreArgsOrName 
)
inlineexplicit

Definition at line 104 of file RooArgSet.h.

◆ RooArgSet() [5/13]

template<typename Iterator_t , typename value_type = typename std::remove_pointer<typename std::iterator_traits<Iterator_t>::value_type>::type, typename = std::enable_if<std::is_convertible<const value_type*, const RooAbsArg*>::value>>
RooArgSet::RooArgSet ( Iterator_t  beginIt,
Iterator_t  endIt,
const char *  name = "" 
)
inline

Construct a (non-owning) RooArgSet from iterators.

Template Parameters
Iterator_tAn iterator pointing to RooFit objects or to pointers/references of those.
Parameters
beginItIterator to first element to add.
endItIterator to end of range to be added.
nameOptional name of the collection.

Definition at line 116 of file RooArgSet.h.

◆ RooArgSet() [6/13]

RooArgSet::RooArgSet ( std::vector< RooAbsArgPtrOrDouble > const &  vec)
inline

Construct a non-owning RooArgSet from a vector of RooAbsArg pointers.

This constructor is mainly intended for pyROOT. With cppyy, a Python list or tuple can be implicitly converted to an std::vector, and by enabling implicit construction of a RooArgSet from a std::vector, we indirectly enable implicit conversion from a Python list/tuple to RooArgSets.

Parameters
vecA vector with pointers to the arguments or doubles for RooFit::RooConst().

Definition at line 129 of file RooArgSet.h.

◆ RooArgSet() [7/13]

RooArgSet::RooArgSet ( const RooArgSet other,
const char *  name = "" 
)

Copy constructor.

Note that a copy of a set is always non-owning, even if the source set owns its contents. To create an owning copy of a set (owning or not), use the snapshot() method.

Definition at line 235 of file RooArgSet.cxx.

◆ RooArgSet() [8/13]

RooArgSet::RooArgSet ( RooArgSet &&  other)
inline

Move constructor.

Definition at line 138 of file RooArgSet.h.

◆ RooArgSet() [9/13]

RooArgSet::RooArgSet ( const RooArgSet set1,
const RooArgSet set2,
const char *  name = "" 
)

Construct a set from two existing sets.

The new set will not own its contents.

Definition at line 203 of file RooArgSet.cxx.

◆ RooArgSet() [10/13]

RooArgSet::RooArgSet ( const RooAbsCollection coll)

Constructor from a RooArgList.

If the list contains multiple objects with the same name, only the first is store in the set. Warning messages will be printed for dropped items.

Definition at line 164 of file RooArgSet.cxx.

◆ RooArgSet() [11/13]

RooArgSet::RooArgSet ( const RooAbsCollection collection,
const RooAbsArg var1 
)

Constructor from a RooArgSet / RooArgList and a pointer to another RooFit object.

Parameters
[in]collectionCollection of RooFit objects to be added. If a list contains multiple objects with the same name, only the first is stored in the set. Warning messages will be printed for dropped items.
[in]var1Further object to be added. If it is already in collection, nothing happens, and the warning message is suppressed.

Definition at line 180 of file RooArgSet.cxx.

◆ RooArgSet() [12/13]

RooArgSet::RooArgSet ( const TCollection tcoll,
const char *  name = "" 
)
explicit

Constructor from a root TCollection.

Elements in the collection that do not inherit from RooAbsArg will be skipped. A warning message will be printed for every skipped item.

Definition at line 216 of file RooArgSet.cxx.

◆ RooArgSet() [13/13]

RooArgSet::RooArgSet ( const char *  name)
explicit

Empty set constructor.

Definition at line 193 of file RooArgSet.cxx.

◆ ~RooArgSet()

RooArgSet::~RooArgSet ( )
override

Destructor.

Definition at line 245 of file RooArgSet.cxx.

Member Function Documentation

◆ canBeAdded()

bool RooArgSet::canBeAdded ( const RooAbsArg arg,
bool  silent 
) const
inlineoverrideprotectedvirtual

Determine whether it's possible to add a given RooAbsArg to the collection or not.

Implements RooAbsCollection.

Definition at line 196 of file RooArgSet.h.

◆ checkForDup()

bool RooArgSet::checkForDup ( const RooAbsArg arg,
bool  silent 
) const
protected

Check if element with var's name is already in set.

Definition at line 278 of file RooArgSet.cxx.

◆ Class()

static TClass * RooArgSet::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * RooArgSet::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static Version_t RooArgSet::Class_Version ( )
inlinestatic
Returns
Version of this class

Definition at line 233 of file RooArgSet.h.

◆ cleanup()

void RooArgSet::cleanup ( )
static

Definition at line 80 of file RooArgSet.cxx.

◆ clone()

TObject * RooArgSet::clone ( const char *  newname) const
inlineoverridevirtual

Implements RooAbsCollection.

Definition at line 149 of file RooArgSet.h.

◆ containsInstance()

bool RooArgSet::containsInstance ( const RooAbsArg var) const
inlineoverridevirtual

Check if this exact instance is in this collection.

Reimplemented from RooAbsCollection.

Definition at line 170 of file RooArgSet.h.

◆ create()

TObject * RooArgSet::create ( const char *  newname) const
inlineoverridevirtual

Implements RooAbsCollection.

Definition at line 150 of file RooArgSet.h.

◆ DeclFileName()

static const char * RooArgSet::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 233 of file RooArgSet.h.

◆ IsA()

TClass * RooArgSet::IsA ( ) const
inlineoverridevirtual
Returns
TClass describing current object

Reimplemented from RooAbsCollection.

Reimplemented in RooCollectionProxy< RooArgSet >.

Definition at line 233 of file RooArgSet.h.

◆ isInRange()

bool RooArgSet::isInRange ( const char *  rangeSpec)

Definition at line 619 of file RooArgSet.cxx.

◆ operator=()

RooArgSet & RooArgSet::operator= ( const RooArgSet other)
inline

Definition at line 151 of file RooArgSet.h.

◆ operator[]()

RooAbsArg & RooArgSet::operator[] ( const TString name) const

Get reference to an element using its name.

Named element must exist in set.

Exceptions
invalid_argumentif an element with the given name is not in the set.

Note that since most RooFit objects use an assignment operator that copies values, an expression like

mySet["x"] = y;
Double_t y[n]
Definition: legend1.C:17

will not replace the element "x", it just assigns the values of y.

Definition at line 263 of file RooArgSet.cxx.

◆ processArg() [1/9]

template<class Arg_t >
void RooArgSet::processArg ( Arg_t &&  arg)
inlineprivate

Definition at line 212 of file RooArgSet.h.

◆ processArg() [2/9]

void RooArgSet::processArg ( const char *  name)
inlineprivate

Definition at line 216 of file RooArgSet.h.

◆ processArg() [3/9]

void RooArgSet::processArg ( const RooAbsArg arg)
inlineprivate

Definition at line 208 of file RooArgSet.h.

◆ processArg() [4/9]

void RooArgSet::processArg ( const RooAbsArg arg)
inlineprivate

Definition at line 209 of file RooArgSet.h.

◆ processArg() [5/9]

void RooArgSet::processArg ( const RooAbsCollection coll)
inlineprivate

Definition at line 218 of file RooArgSet.h.

◆ processArg() [6/9]

void RooArgSet::processArg ( const RooArgList list)
private

◆ processArg() [7/9]

void RooArgSet::processArg ( double  value)
private

Definition at line 648 of file RooArgSet.cxx.

◆ processArg() [8/9]

void RooArgSet::processArg ( RooAbsArg var)
inlineprivate

Definition at line 210 of file RooArgSet.h.

◆ processArg() [9/9]

void RooArgSet::processArg ( RooAbsCollection &&  coll)
inlineprivate

Definition at line 221 of file RooArgSet.h.

◆ processArgs()

template<typename... Args_t>
void RooArgSet::processArgs ( Args_t &&...  args)
inlineprivate

Definition at line 203 of file RooArgSet.h.

◆ readFromFile()

bool RooArgSet::readFromFile ( const char *  fileName,
const char *  flagReadAtt = nullptr,
const char *  section = nullptr,
bool  verbose = false 
)

Read contents of the argset from specified file.

See readFromStream() for details

Definition at line 321 of file RooArgSet.cxx.

◆ readFromStream() [1/2]

virtual bool RooArgSet::readFromStream ( std::istream &  is,
bool  compact,
bool  verbose = false 
)
inlinevirtual

Shortcut for readFromStream(std::istream&, bool, const char*, const char*, bool), setting flagReadAtt and section to 0.

Definition at line 159 of file RooArgSet.h.

◆ readFromStream() [2/2]

bool RooArgSet::readFromStream ( std::istream &  is,
bool  compact,
const char *  flagReadAtt,
const char *  section,
bool  verbose = false 
)

Read the contents of the argset in ASCII form from given stream.

The stream is read to end-of-file and each line is assumed to be of the form

<argName> = <argValue>

Lines starting with argNames not matching any element in the list will be ignored with a warning message. In addition limited C++ style preprocessing and flow control is provided. The following constructions are recognized:

include "include.file"

Include given file, recursive inclusion OK

if (<boolean_expression>)
<name> = <value>
....
else if (<boolean_expression>)
....
else
....
endif
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition: TGX11.cxx:110

All expressions are evaluated by RooFormula, and may involve any of the sets variables.

echo <Message>

Print console message while reading from stream

abort

Force termination of read sequence with error status

The value of each argument is read by the arguments readFromStream function.

Definition at line 411 of file RooArgSet.cxx.

◆ snapshot() [1/2]

RooArgSet * RooArgSet::snapshot ( bool  deepCopy = true) const
inline

Use RooAbsCollection::snapshot(), but return as RooArgSet.

Definition at line 179 of file RooArgSet.h.

◆ snapshot() [2/2]

bool RooArgSet::snapshot ( RooAbsCollection output,
bool  deepCopy = true 
) const
inline

Take a snap shot of current collection contents.

An owning collection is returned containing clones of

  • Elements in this collection
  • External dependents of all elements and recursively any dependents of those dependents (if deepCopy flag is set)

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 184 of file RooArgSet.h.

◆ Streamer()

void RooArgSet::Streamer ( TBuffer R__b)
overridevirtual

Stream an object of class TObject.

Reimplemented from RooAbsCollection.

Reimplemented in RooCollectionProxy< RooArgSet >.

◆ StreamerNVirtual()

void RooArgSet::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 233 of file RooArgSet.h.

◆ uniqueId()

RooFit::UniqueId< RooArgSet > const & RooArgSet::uniqueId ( ) const
inline

Returns a unique ID that is different for every instantiated RooArgSet.

This ID can be used to check whether two RooAbsData are the same object, which is safer than memory address comparisons that might result in false positives when memory is recycled.

Definition at line 192 of file RooArgSet.h.

◆ writeToFile()

void RooArgSet::writeToFile ( const char *  fileName) const

Write contents of the argset to specified file.

See writeToStream() for details

Definition at line 305 of file RooArgSet.cxx.

◆ writeToStream()

void RooArgSet::writeToStream ( std::ostream &  os,
bool  compact,
const char *  section = nullptr 
) const
virtual

Write the contents of the argset in ASCII form to given stream.

A line is written for each element contained in the form <argName> = <argValue>

The <argValue> part of each element is written by the arguments' writeToStream() function.

Parameters
osThe stream to write to.
compactWrite only the bare values, separated by ' '.
Note
In compact mode, the stream cannot be read back into a RooArgSet, but only into a RooArgList, because the variable names are lost.
Parameters
sectionIf non-null, add a section header like [<section>].

Definition at line 347 of file RooArgSet.cxx.

Member Data Documentation

◆ _uniqueId

const RooFit::UniqueId<RooArgSet> RooArgSet::_uniqueId
private

Definition at line 231 of file RooArgSet.h.

Libraries for RooArgSet:
[legend]

The documentation for this class was generated from the following files: