Template class RooCacheManager manages the storage of any type of data indexed on the choice of normalization and optionally the set of integrated observables.
The purpose of this class is to facilitate storage of intermediate results in operator p.d.f.s whose value and inner working are often highly dependent on the user provided choice of normalization in getVal().
For efficiency reasons these normalization set pointer are dereferenced as little as possible. This class contains a lookup table for RooArgSet pointer pairs -> normalization lists. Distinct pointer pairs that represent the same normalization/projection are recognized and will all point to the same normalization list. Lists for up to 'maxSize' different normalization/ projection configurations can be cached.
Definition at line 35 of file RooCacheManager.h.
Public Member Functions | |
RooCacheManager (const RooCacheManager &other, RooAbsArg *owner=nullptr) | |
Copy constructor. | |
RooCacheManager (Int_t maxSize=2) | |
Constructor for simple caches without RooAbsArg payload. | |
RooCacheManager (RooAbsArg *owner, Int_t maxSize=2) | |
Constructor for simple caches with RooAbsArg derived payload. | |
~RooCacheManager () override | |
Destructor. | |
Int_t | cacheSize () const |
Return size of cache. | |
T * | getObj (const RooArgSet *nset, const RooArgSet *iset, Int_t *sterileIdx, const char *isetRangeName) |
T * | getObj (const RooArgSet *nset, const RooArgSet *iset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr) |
Retrieve payload object indexed on nset,uset amd isetRangeName If sterileIdx is not null, it is set to the index of the sterile slot in cacse such a slot is recycled. | |
T * | getObj (const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr) |
Getter function without integration set. | |
T * | getObjByIndex (Int_t index) const |
Retrieve payload object by slot index. | |
virtual void | insertObjectHook (T &) |
Interface function to perform post-insert operations on cached object. | |
TClass * | IsA () const override |
Int_t | lastIndex () const |
Return index of slot used in last get or set operation. | |
void | operModeHook () override |
Interface function to intercept cache operation mode changes. | |
void | printCompactTreeHook (std::ostream &, const char *) override |
Interface function to cache add contents to output in tree printing mode. | |
bool | redirectServersHook (const RooAbsCollection &, bool, bool, bool) override |
Interface function to intercept server redirects. | |
void | reset () |
Clear the cache. | |
RooArgSet | selectFromSet1 (RooArgSet const &argSet, int index) const |
Create RooArgSet containing the objects that are both in the cached set 1 with a given index and an input argSet. | |
RooArgSet | selectFromSet2 (RooArgSet const &argSet, int index) const |
Create RooArgSet containing the objects that are both in the cached set 2 with a given index and an input argSet. | |
Int_t | setObj (const RooArgSet *nset, const RooArgSet *iset, T *obj, const TNamed *isetRangeName=nullptr) |
Insert payload object 'obj' in cache indexed on nset,iset and isetRangeName. | |
Int_t | setObj (const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr) |
Setter function without integration set. | |
virtual void | sterilize () |
Clear the cache payload but retain slot mapping w.r.t to normalization and integration sets. | |
void | Streamer (TBuffer &) override |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
void | wireCache () override |
![]() | |
RooAbsCache (const RooAbsCache &, RooAbsArg *owner=nullptr) | |
Copy constructor. Takes owner as argument and registers cache with owne. | |
RooAbsCache (RooAbsArg *owner=nullptr) | |
Constructor. Takes owner as argument and register cache with owner. | |
virtual | ~RooAbsCache () |
Destructor. Unregisters cache with owner. | |
virtual void | findConstantNodes (const RooArgSet &, RooArgSet &, RooLinkedList &) |
Interface for constant term node finding calls. | |
virtual void | optimizeCacheMode (const RooArgSet &, RooArgSet &, RooLinkedList &) |
Interface for processing of cache mode optimization calls. | |
void | setOwner (RooAbsArg *owner) |
Reset the owner, triggering the owner to register this cache in its list of caches. | |
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 TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Protected Attributes | |
Int_t | _lastIndex |
! Last slot accessed | |
Int_t | _maxSize |
! Maximum size | |
std::vector< RooNormSetCache > | _nsetCache |
! Normalization/Integration set manager | |
std::vector< T * > | _object |
! Payload | |
Int_t | _size |
! Actual use | |
bool | _wired |
! In wired mode, there is a single payload which is returned always | |
![]() | |
RooAbsArg * | _owner |
Pointer to owning RooAbsArg. | |
#include <RooCacheManager.h>
RooCacheManager< T >::RooCacheManager | ( | Int_t | maxSize = 2 | ) |
Constructor for simple caches without RooAbsArg payload.
A cache made with this constructor is not registered with its owner and will not receive information on server redirects and cache operation mode changes.
Definition at line 124 of file RooCacheManager.h.
RooCacheManager< T >::RooCacheManager | ( | RooAbsArg * | owner, |
Int_t | maxSize = 2 |
||
) |
Constructor for simple caches with RooAbsArg derived payload.
A cache made with this constructor is registered with its owner and will receive information on server redirects and cache operation mode changes.
Definition at line 138 of file RooCacheManager.h.
RooCacheManager< T >::RooCacheManager | ( | const RooCacheManager< T > & | other, |
RooAbsArg * | owner = nullptr |
||
) |
Copy constructor.
Definition at line 157 of file RooCacheManager.h.
|
override |
Destructor.
Definition at line 182 of file RooCacheManager.h.
|
inline |
Return size of cache.
Definition at line 70 of file RooCacheManager.h.
|
static |
|
static |
|
inlinestaticconstexpr |
Definition at line 115 of file RooCacheManager.h.
|
inlinestatic |
Definition at line 115 of file RooCacheManager.h.
|
inline |
Definition at line 54 of file RooCacheManager.h.
T * RooCacheManager< T >::getObj | ( | const RooArgSet * | nset, |
const RooArgSet * | iset, | ||
Int_t * | sterileIndex = nullptr , |
||
const TNamed * | isetRangeName = nullptr |
||
) |
Retrieve payload object indexed on nset,uset amd isetRangeName If sterileIdx is not null, it is set to the index of the sterile slot in cacse such a slot is recycled.
Definition at line 278 of file RooCacheManager.h.
|
inline |
Getter function without integration set.
Definition at line 45 of file RooCacheManager.h.
T * RooCacheManager< T >::getObjByIndex | ( | Int_t | index | ) | const |
Retrieve payload object by slot index.
Definition at line 309 of file RooCacheManager.h.
|
inlinevirtual |
Interface function to perform post-insert operations on cached object.
Reimplemented in RooObjCacheManager.
Definition at line 91 of file RooCacheManager.h.
|
inlineoverridevirtual |
Reimplemented from RooAbsCache.
Reimplemented in RooObjCacheManager.
Definition at line 115 of file RooCacheManager.h.
|
inline |
Return index of slot used in last get or set operation.
Definition at line 66 of file RooCacheManager.h.
|
inlineoverridevirtual |
Interface function to intercept cache operation mode changes.
Reimplemented from RooAbsCache.
Reimplemented in RooObjCacheManager.
Definition at line 80 of file RooCacheManager.h.
|
inlineoverridevirtual |
Interface function to cache add contents to output in tree printing mode.
Reimplemented from RooAbsCache.
Reimplemented in RooObjCacheManager.
Definition at line 83 of file RooCacheManager.h.
|
inlineoverridevirtual |
Interface function to intercept server redirects.
Reimplemented from RooAbsCache.
Reimplemented in RooObjCacheManager.
Definition at line 75 of file RooCacheManager.h.
void RooCacheManager< T >::reset |
Clear the cache.
Definition at line 192 of file RooCacheManager.h.
RooArgSet RooCacheManager< T >::selectFromSet1 | ( | RooArgSet const & | argSet, |
int | index | ||
) | const |
Create RooArgSet containing the objects that are both in the cached set 1 with a given index and an input argSet.
Definition at line 323 of file RooCacheManager.h.
RooArgSet RooCacheManager< T >::selectFromSet2 | ( | RooArgSet const & | argSet, |
int | index | ||
) | const |
Create RooArgSet containing the objects that are both in the cached set 2 with a given index and an input argSet.
Definition at line 337 of file RooCacheManager.h.
Int_t RooCacheManager< T >::setObj | ( | const RooArgSet * | nset, |
const RooArgSet * | iset, | ||
T * | obj, | ||
const TNamed * | isetRangeName = nullptr |
||
) |
Insert payload object 'obj' in cache indexed on nset,iset and isetRangeName.
Definition at line 219 of file RooCacheManager.h.
|
inline |
Setter function without integration set.
Definition at line 50 of file RooCacheManager.h.
|
virtual |
Clear the cache payload but retain slot mapping w.r.t to normalization and integration sets.
Reimplemented in RooObjCacheManager.
Definition at line 207 of file RooCacheManager.h.
|
overridevirtual |
Reimplemented from RooAbsCache.
Reimplemented in RooObjCacheManager.
|
inline |
Definition at line 115 of file RooCacheManager.h.
|
inlineoverridevirtual |
Reimplemented from RooAbsCache.
Definition at line 94 of file RooCacheManager.h.
|
protected |
! Last slot accessed
Definition at line 109 of file RooCacheManager.h.
|
protected |
! Maximum size
Definition at line 107 of file RooCacheManager.h.
|
protected |
! Normalization/Integration set manager
Definition at line 111 of file RooCacheManager.h.
|
protected |
! Payload
Definition at line 112 of file RooCacheManager.h.
|
protected |
! Actual use
Definition at line 108 of file RooCacheManager.h.
|
protected |
! In wired mode, there is a single payload which is returned always
Definition at line 113 of file RooCacheManager.h.