16#ifndef ROO_CACHE_MANAGER
17#define ROO_CACHE_MANAGER
46 return getObj(nset,0,sterileIndex,isetRangeName) ;
51 return setObj(nset,0,obj,isetRangeName) ;
97 }
else if (
_size==1) {
100 }
else if (
_size>1) {
170 for (i=0 ; i<other.
_size ; i++) {
184 for (
int i=0 ; i<_size ; i++) {
194 for (
int i=0 ; i<_maxSize ; i++) {
197 _nsetCache[i].clear() ;
210 for (i=0 ; i<_maxSize ; i++) {
222 Int_t sterileIdx(-1) ;
223 if (getObj(nset,iset,&sterileIdx,isetRangeName)) {
231 if (sterileIdx>=_maxSize) {
233 _maxSize = sterileIdx+4;
234 _object.resize(_maxSize,0) ;
235 _nsetCache.resize(_maxSize) ;
239 _object[sterileIdx] = obj ;
242 insertObjectHook(*obj) ;
247 if (_size>=_maxSize-1) {
250 _object.resize(_maxSize,0) ;
251 _nsetCache.resize(_maxSize) ;
255 _nsetCache[_size].autoCache(_owner,nset,iset,isetRangeName,
kTRUE) ;
256 if (_object[_size]) {
257 delete _object[_size] ;
260 _object[_size] = obj ;
264 insertObjectHook(*obj) ;
281 if(_object[0]==0 && sterileIdx) *sterileIdx=0 ;
286 for (i=0 ; i<_size ; i++) {
287 if (_nsetCache[i].contains(nset,iset,isetRangeName)==
kTRUE) {
289 if(_object[i]==0 && sterileIdx) *sterileIdx=i ;
294 for (i=0 ; i<_size ; i++) {
295 if (_nsetCache[i].autoCache(_owner,nset,iset,isetRangeName,
kFALSE)==
kFALSE) {
297 if(_object[i]==0 && sterileIdx) *sterileIdx=i ;
310 if (index<0||index>=_size) {
312 << index <<
") out of range [0," << _size-1 <<
"]" << std::endl ;
315 return _object[index] ;
323 if (index<0||index>=_size) {
325 << index <<
") out of range [0," << _size-1 <<
"]" << std::endl ;
328 return &_nsetCache[index].nameSet1() ;
336 if (index<0||index>=_size) {
338 << index <<
") out of range [0," << _size-1 <<
"]" << std::endl ;
341 return &_nsetCache[index].nameSet2() ;
#define ClassDef(name, id)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooAbsCache is the abstract base class for data members of RooAbsArgs that cache other (composite) Ro...
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Template class RooCacheManager manages the storage of any type of data indexed on the choice of norma...
Int_t setObj(const RooArgSet *nset, const RooArgSet *iset, T *obj, const TNamed *isetRangeName=0)
Insert payload object 'obj' in cache indexed on nset,iset and isetRangeName.
RooCacheManager(Int_t maxSize=2)
Constructor for simple caches without RooAbsArg payload.
virtual void insertObjectHook(T &)
virtual void sterilize()
Clear the cache payload but retain slot mapping w.r.t to normalization and integration sets.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
std::vector< T * > _object
Normalization/Integration set manager.
std::vector< RooNormSetCache > _nsetCache
Last slot accessed.
RooCacheManager(const RooCacheManager &other, RooAbsArg *owner=0)
Copy constructor.
const RooNameSet * nameSet2ByIndex(Int_t index) const
Retrieve RooNameSet associated with slot at given index.
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
void reset()
Clear the cache.
virtual void printCompactTreeHook(std::ostream &, const char *)
Interface for printing of cache guts in tree mode printing.
virtual Bool_t redirectServersHook(const RooAbsCollection &, Bool_t, Bool_t, Bool_t)
Interface for server redirect calls.
const RooNameSet * nameSet1ByIndex(Int_t index) const
Retrieve RooNameSet associated with slot at given index.
T * getObj(const RooArgSet *nset, const RooArgSet *iset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
Retrieve payload object indexed on nset,uset amd isetRangeName If sterileIdx is not null,...
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
T * getObj(const RooArgSet *nset, const RooArgSet *iset, Int_t *sterileIdx, const char *isetRangeName)
virtual ~RooCacheManager()
Destructor.
RooCacheManager(RooAbsArg *owner, Int_t maxSize=2)
Constructor for simple caches with RooAbsArg derived payload.
Int_t _lastIndex
Actual use.
virtual void operModeHook()
Interface for operation mode changes.
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
RooNameSet is a utility class that stores the names the objects in a RooArget.
The TNamed class is the base class for all named ROOT classes.
virtual const char * GetName() const
Returns name of object.