16#ifndef ROO_CACHE_MANAGER
17#define ROO_CACHE_MANAGER
64 return getObj(nset,
nullptr,sterileIndex,isetRangeName) ;
69 return setObj(nset,
nullptr,obj,isetRangeName) ;
94 bool ,
bool )
override {
114 oocoutI(
_owner,Optimization) <<
"RooCacheManager::wireCache(" <<
_owner->GetName() <<
") no cached elements!" << std::endl ;
115 }
else if (
_size==1) {
116 oocoutI(
_owner,Optimization) <<
"RooCacheManager::wireCache(" <<
_owner->GetName() <<
") now wiring cache" << std::endl ;
118 }
else if (
_size>1) {
119 oocoutI(
_owner,Optimization) <<
"RooCacheManager::wireCache(" <<
_owner->GetName() <<
") cache cannot be wired because it contains more than one element" << std::endl ;
181 for (i=0 ; i<other.
_size ; i++) {
187 _object[i] = nullptr ;
195 for (
int i=0 ; i<
_size ; i++) {
233 Int_t sterileIdx(-1) ;
234 if (
getObj(nset,iset,&sterileIdx,isetRangeName)) {
293 if(
_object[0]==
nullptr && sterileIdx) *sterileIdx=0 ;
298 for (i=0 ; i<
_size ; i++) {
301 if(
_object[i]==
nullptr && sterileIdx) *sterileIdx=i ;
306 for (i=0 ; i<
_size ; i++) {
309 if(
_object[i]==
nullptr && sterileIdx) *sterileIdx=i ;
322 if (index<0||index>=
_size) {
323 oocoutE(
_owner,ObjectHandling) <<
"RooCacheManager::getNormListByIndex: ERROR index ("
324 << index <<
") out of range [0," <<
_size-1 <<
"]" << std::endl ;
int Int_t
Signed integer 4 bytes (int).
#define ClassDefOverride(name, id)
Common abstract base class for objects that represent a value and a "shape" in RooFit.
RooAbsArg * _owner
Pointer to owning RooAbsArg.
RooAbsCache(RooAbsArg *owner=nullptr)
Constructor. Takes owner as argument and register cache with owner.
Abstract container object that can hold multiple RooAbsArg objects.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
RooCacheManager(Int_t maxSize=2)
Constructor for simple caches without RooAbsArg payload.
Int_t cacheSize() const
Return size of cache.
void printCompactTreeHook(std::ostream &, const char *) override
Interface function to cache add contents to output in tree printing mode.
virtual void insertObjectHook(T &)
Interface function to perform post-insert operations on cached object.
virtual void sterilize()
Clear the cache payload but retain slot mapping w.r.t to normalization and integration sets.
std::vector< T * > _object
! Payload
std::vector< RooNormSetCache > _nsetCache
! Normalization/Integration set manager
~RooCacheManager() override
Destructor.
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 i...
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
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 i...
bool redirectServersHook(const RooAbsCollection &, bool, bool, bool) override
Interface function to intercept server redirects.
void reset()
Clear the cache.
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.
Int_t _maxSize
! Maximum size
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
void wireCache() override
T * getObj(const RooArgSet *nset, const RooArgSet *iset, Int_t *sterileIdx, const char *isetRangeName)
Int_t _lastIndex
! Last slot accessed
bool _wired
! In wired mode, there is a single payload which is returned always
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
The TNamed class is the base class for all named ROOT classes.
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.