Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooCollectionProxy< RooCollection_t > Class Template Reference

template<class RooCollection_t>
class RooCollectionProxy< RooCollection_t >

Concrete proxy for RooArgSet or RooArgList objects.

A RooCollectionProxy is the general mechanism to store a RooArgSet or RooArgList with RooAbsArgs in a RooAbsArg. Creating a RooCollectionProxy adds all members of the proxied RooArgSet to the proxy owners server list (thus receiving value/shape dirty flags from it) and registers itself with the owning class. The latter allows the owning class to update the pointers of RooArgSet or RooArgList contents to reflect the serverRedirect changes.

Definition at line 40 of file RooCollectionProxy.h.

Public Member Functions

 RooCollectionProxy ()
 
 RooCollectionProxy (const char *inName, const char *, RooAbsArg *owner, bool defValueServer=true, bool defShapeServer=false)
 Construct proxy with given name and description, with given owner The default value and shape dirty propagation of the set contents to the set owner is controlled by flags defValueServer and defShapeServer.
 
template<class Other_t >
 RooCollectionProxy (const char *inName, RooAbsArg *owner, const Other_t &other)
 Copy constructor.
 
 ~RooCollectionProxy () override
 
virtual bool add (const RooAbsArg &var, bool silent=false)
 Add the specified argument to list.
 
bool add (const RooAbsArg &var, bool silent=false) override
 Overloaded RooCollection_t::add() method inserts 'var' into set and registers 'var' as server to owner with default value and shape dirty flag propagation.
 
bool add (const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
 Overloaded RooCollection_t::add() method insert object into set and registers object as server to owner with given value and shape dirty flag propagation requests.
 
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 RooAbsArgaddClone (const RooAbsArg &var, bool silent=false)
 Add a clone of the specified argument to list.
 
RooAbsArgaddClone (const RooAbsArg &var, bool silent=false) override
 Overloaded RooCollection_t::addClone() method insert clone of object into owning set and registers cloned object as server to owner with default value and shape dirty flag propagation.
 
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 (RooAbsArg &var, bool silent=false) override
 Overloaded RooCollection_t::addOwned() method insert object into owning set and registers object as server to owner with default value and shape dirty flag propagation.
 
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.
 
bool defShapeServer () const
 
bool defValueServer () const
 
template<class Other_t >
void initializeAfterIOConstructor (RooAbsArg *owner, const Other_t &other)
 Initializes this RooCollection proxy from another proxy.
 
TClassIsA () const override
 
const char * name () const override
 
RooCollectionProxyoperator= (const RooCollection_t &other)
 Assign values of arguments on other set to arguments in this set.
 
RooCollectionProxyoperator= (RooCollectionProxy &&other)=delete
 
RooCollectionProxyoperator= (RooCollectionProxy const &other)=delete
 
void print (std::ostream &os, bool addContents=false) const override
 Printing name of proxy on ostream.
 
bool remove (const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false) override
 Remove object 'var' from set and deregister 'var' as server to owner.
 
bool remove (const RooAbsCollection &list, bool silent=false, bool matchByNameOnly=false)
 Remove each argument in the input list from our list using remove(const RooAbsArg&).
 
void removeAll () override
 Remove all argument inset using remove(const RooAbsArg&).
 
bool replace (const RooAbsArg &var1, const RooAbsArg &var2) override
 Replace object 'var1' in set with 'var2'.
 
void Streamer (TBuffer &) override
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from RooAbsProxy
 RooAbsProxy ()
 
 RooAbsProxy (const char *name, const RooAbsProxy &other)
 Copy constructor.
 
virtual ~RooAbsProxy ()
 
const RooArgSetnset () const
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from RooAbsProxy
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 

Private Member Functions

bool changePointer (const RooAbsCollection &newServerSet, bool nameChange=false, bool factoryInitMode=false) override
 Process server change operation on owner.
 
bool changePointer (std::unordered_map< RooAbsArg *, RooAbsArg * > const &replacements) override
 
void checkValid () const
 

Private Attributes

bool _defShapeServer = false
 
bool _defValueServer = false
 
RooAbsArg_owner = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from RooAbsProxy
virtual void changeNormSet (const RooArgSet *newNormSet)
 Destructor.
 
- Protected Attributes inherited from RooAbsProxy
RooArgSet_nset = nullptr
 ! Normalization set to be used for evaluation of RooAbsPdf contents
 

#include <RooCollectionProxy.h>

Inheritance diagram for RooCollectionProxy< RooCollection_t >:
[legend]

Constructor & Destructor Documentation

◆ RooCollectionProxy() [1/3]

Definition at line 43 of file RooCollectionProxy.h.

◆ RooCollectionProxy() [2/3]

template<class RooCollection_t >
RooCollectionProxy< RooCollection_t >::RooCollectionProxy ( const char *  inName,
const char *  ,
RooAbsArg owner,
bool  defValueServer = true,
bool  defShapeServer = false 
)
inline

Construct proxy with given name and description, with given owner The default value and shape dirty propagation of the set contents to the set owner is controlled by flags defValueServer and defShapeServer.

Definition at line 48 of file RooCollectionProxy.h.

◆ RooCollectionProxy() [3/3]

template<class RooCollection_t >
template<class Other_t >
RooCollectionProxy< RooCollection_t >::RooCollectionProxy ( const char *  inName,
RooAbsArg owner,
const Other_t &  other 
)
inline

Copy constructor.

Definition at line 57 of file RooCollectionProxy.h.

◆ ~RooCollectionProxy()

template<class RooCollection_t >
RooCollectionProxy< RooCollection_t >::~RooCollectionProxy ( )
inlineoverride

Definition at line 97 of file RooCollectionProxy.h.

Member Function Documentation

◆ add() [1/5]

template<class RooCollection_t >
bool RooAbsCollection::add ( const RooAbsArg var,
bool  silent = false 
)

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).

Definition at line 119 of file RooAbsCollection.cxx.

◆ add() [2/5]

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::add ( const RooAbsArg var,
bool  silent = false 
)
inlineoverride

Overloaded RooCollection_t::add() method inserts 'var' into set and registers 'var' as server to owner with default value and shape dirty flag propagation.

Definition at line 112 of file RooCollectionProxy.h.

◆ add() [3/5]

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::add ( const RooAbsArg var,
bool  valueServer,
bool  shapeServer,
bool  silent 
)

Overloaded RooCollection_t::add() method insert object into set and registers object as server to owner with given value and shape dirty flag propagation requests.

Definition at line 189 of file RooCollectionProxy.h.

◆ add() [4/5]

template<class RooCollection_t >
bool RooAbsCollection::add ( const RooAbsCollection list,
bool  silent = false 
)
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.

◆ add() [5/5]

template<class RooCollection_t >
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 RooAbsCollection::add ( Iterator_t  beginIt,
Iterator_t  endIt,
bool  silent = false 
)
inline

Definition at line 140 of file RooAbsCollection.h.

◆ addClone() [1/3]

template<class RooCollection_t >
RooAbsArg * RooAbsCollection::addClone ( const RooAbsArg var,
bool  silent = false 
)

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.

Definition at line 131 of file RooAbsCollection.cxx.

◆ addClone() [2/3]

template<class RooCollection_t >
RooAbsArg * RooCollectionProxy< RooCollection_t >::addClone ( const RooAbsArg var,
bool  silent = false 
)
override

Overloaded RooCollection_t::addClone() method insert clone of object into owning set and registers cloned object as server to owner with default value and shape dirty flag propagation.

Definition at line 221 of file RooCollectionProxy.h.

◆ addClone() [3/3]

template<class RooCollection_t >
void RooAbsCollection::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.

Definition at line 182 of file RooAbsCollection.cxx.

◆ addOwned() [1/5]

template<class RooCollection_t >
bool RooAbsCollection::addOwned ( const RooAbsCollection list,
bool  silent = false 
)

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:

  1. std::move the input collection and use RooAbsCollection::addOwned(RooAbsCollection&&, bool) (preferred)
  2. release the ownership of the input collection first, using RooAbsCollection::releaseOwnership()

Definition at line 180 of file RooAbsCollection.cxx.

◆ addOwned() [2/5]

template<class RooCollection_t >
bool RooAbsCollection::addOwned ( RooAbsArg var,
bool  silent = false 
)

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).

Definition at line 126 of file RooAbsCollection.cxx.

◆ addOwned() [3/5]

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::addOwned ( RooAbsArg var,
bool  silent = false 
)
override

Overloaded RooCollection_t::addOwned() method insert object into owning set and registers object as server to owner with default value and shape dirty flag propagation.

Definition at line 205 of file RooCollectionProxy.h.

◆ addOwned() [4/5]

template<class RooCollection_t >
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 181 of file RooAbsCollection.cxx.

◆ addOwned() [5/5]

template<class RooCollection_t >
bool RooAbsCollection::addOwned ( std::unique_ptr< RooAbsArg var,
bool  silent = false 
)

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 130 of file RooAbsCollection.cxx.

◆ changePointer() [1/2]

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::changePointer ( const RooAbsCollection newServerList,
bool  nameChange = false,
bool  factoryInitMode = false 
)
overrideprivatevirtual

Process server change operation on owner.

Replace elements in set with equally named objects in 'newServerList'

Implements RooAbsProxy.

Definition at line 284 of file RooCollectionProxy.h.

◆ changePointer() [2/2]

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::changePointer ( std::unordered_map< RooAbsArg *, RooAbsArg * > const &  replacements)
overrideprivatevirtual

Implements RooAbsProxy.

Definition at line 309 of file RooCollectionProxy.h.

◆ checkValid()

template<class RooCollection_t >
void RooCollectionProxy< RooCollection_t >::checkValid ( ) const
inlineprivate

Definition at line 171 of file RooCollectionProxy.h.

◆ Class()

template<class RooCollection_t >
static TClass * RooCollectionProxy< RooCollection_t >::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

template<class RooCollection_t >
static const char * RooCollectionProxy< RooCollection_t >::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

template<class RooCollection_t >
static constexpr Version_t RooCollectionProxy< RooCollection_t >::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 180 of file RooCollectionProxy.h.

◆ DeclFileName()

template<class RooCollection_t >
static const char * RooCollectionProxy< RooCollection_t >::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 180 of file RooCollectionProxy.h.

◆ defShapeServer()

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::defShapeServer ( ) const
inline

Definition at line 159 of file RooCollectionProxy.h.

◆ defValueServer()

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::defValueServer ( ) const
inline

Definition at line 158 of file RooCollectionProxy.h.

◆ initializeAfterIOConstructor()

template<class RooCollection_t >
template<class Other_t >
void RooCollectionProxy< RooCollection_t >::initializeAfterIOConstructor ( RooAbsArg owner,
const Other_t &  other 
)
inline

Initializes this RooCollection proxy from another proxy.

Should not be considered part of the public interface, only to be used by IO.

Definition at line 69 of file RooCollectionProxy.h.

◆ IsA()

template<class RooCollection_t >
TClass * RooCollectionProxy< RooCollection_t >::IsA ( ) const
inlineoverridevirtual
Returns
TClass describing current object

Reimplemented from RooAbsProxy.

Definition at line 180 of file RooCollectionProxy.h.

◆ name()

template<class RooCollection_t >
const char * RooCollectionProxy< RooCollection_t >::name ( ) const
inlineoverridevirtual

Reimplemented from RooAbsProxy.

Definition at line 103 of file RooCollectionProxy.h.

◆ operator=() [1/3]

template<class RooCollection_t >
RooCollectionProxy & RooCollectionProxy< RooCollection_t >::operator= ( const RooCollection_t other)
inline

Assign values of arguments on other set to arguments in this set.

Definition at line 152 of file RooCollectionProxy.h.

◆ operator=() [2/3]

◆ operator=() [3/3]

template<class RooCollection_t >
RooCollectionProxy & RooCollectionProxy< RooCollection_t >::operator= ( RooCollectionProxy< RooCollection_t > const &  other)
delete

◆ print()

template<class RooCollection_t >
void RooCollectionProxy< RooCollection_t >::print ( std::ostream &  os,
bool  addContents = false 
) const
overridevirtual

Printing name of proxy on ostream.

If addContents is true also print names of objects in set

Reimplemented from RooAbsProxy.

Definition at line 327 of file RooCollectionProxy.h.

◆ remove() [1/2]

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::remove ( const RooAbsArg var,
bool  silent = false,
bool  matchByNameOnly = false 
)
override

Remove object 'var' from set and deregister 'var' as server to owner.

Definition at line 252 of file RooCollectionProxy.h.

◆ remove() [2/2]

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::remove ( const RooAbsCollection list,
bool  silent = false,
bool  matchByNameOnly = false 
)
inline

Remove each argument in the input list from our list using remove(const RooAbsArg&).

and remove each argument as server to owner

Definition at line 138 of file RooCollectionProxy.h.

◆ removeAll()

template<class RooCollection_t >
void RooCollectionProxy< RooCollection_t >::removeAll
override

Remove all argument inset using remove(const RooAbsArg&).

and remove each argument as server to owner

Definition at line 266 of file RooCollectionProxy.h.

◆ replace()

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::replace ( const RooAbsArg var1,
const RooAbsArg var2 
)
override

Replace object 'var1' in set with 'var2'.

Deregister var1 as server from owner and register var2 as server to owner with default value and shape dirty propagation flags

Definition at line 237 of file RooCollectionProxy.h.

◆ Streamer()

template<class RooCollection_t >
void RooCollectionProxy< RooCollection_t >::Streamer ( TBuffer )
overridevirtual

Reimplemented from RooAbsProxy.

◆ StreamerNVirtual()

template<class RooCollection_t >
void RooCollectionProxy< RooCollection_t >::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 180 of file RooCollectionProxy.h.

Member Data Documentation

◆ _defShapeServer

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::_defShapeServer = false
private

Definition at line 164 of file RooCollectionProxy.h.

◆ _defValueServer

template<class RooCollection_t >
bool RooCollectionProxy< RooCollection_t >::_defValueServer = false
private

Definition at line 163 of file RooCollectionProxy.h.

◆ _owner

template<class RooCollection_t >
RooAbsArg* RooCollectionProxy< RooCollection_t >::_owner = nullptr
private

Definition at line 162 of file RooCollectionProxy.h.

  • roofit/roofitcore/inc/RooAbsArg.h
  • roofit/roofitcore/inc/RooCollectionProxy.h