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) {
173 for (i=0 ; i<other.
_size ; i++) {
191 for (i=0 ; i<_size ; i++) {
204 for (i=0 ; i<_maxSize ; i++) {
207 _nsetCache[i].clear() ;
222 for (i=0 ; i<_maxSize ; i++) {
236 Int_t sterileIdx(-1) ;
237 if (getObj(nset,iset,&sterileIdx,isetRangeName)) {
245 if (sterileIdx>=_maxSize) {
247 _maxSize = sterileIdx+4;
248 _object.resize(_maxSize,0) ;
249 _nsetCache.resize(_maxSize) ;
253 _object[sterileIdx] = obj ;
256 insertObjectHook(*obj) ;
261 if (_size>=_maxSize-1) {
264 _object.resize(_maxSize,0) ;
265 _nsetCache.resize(_maxSize) ;
269 _nsetCache[_size].autoCache(_owner,nset,iset,isetRangeName,
kTRUE) ;
270 if (_object[_size]) {
271 delete _object[_size] ;
274 _object[_size] = obj ;
278 insertObjectHook(*obj) ;
297 if(_object[0]==0 && sterileIdx) *sterileIdx=0 ;
302 for (i=0 ; i<_size ; i++) {
303 if (_nsetCache[i].contains(nset,iset,isetRangeName)==
kTRUE) {
305 if(_object[i]==0 && sterileIdx) *sterileIdx=i ;
310 for (i=0 ; i<_size ; i++) {
311 if (_nsetCache[i].autoCache(_owner,nset,iset,isetRangeName,
kFALSE)==
kFALSE) {
313 if(_object[i]==0 && sterileIdx) *sterileIdx=i ;
328 if (index<0||index>=_size) {
330 << index <<
") out of range [0," << _size-1 <<
"]" << std::endl ;
333 return _object[index] ;
341 if (index<0||index>=_size) {
343 << index <<
") out of range [0," << _size-1 <<
"]" << std::endl ;
346 return &_nsetCache[index].nameSet1() ;
354 if (index<0||index>=_size) {
356 << index <<
") out of range [0," << _size-1 <<
"]" << std::endl ;
359 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)
RooCacheManager(Int_t maxSize=2)
virtual void insertObjectHook(T &)
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)
const RooNameSet * nameSet2ByIndex(Int_t index) const
T * getObjByIndex(Int_t index) const
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
T * getObj(const RooArgSet *nset, const RooArgSet *iset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
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()
RooCacheManager(RooAbsArg *owner, Int_t maxSize=2)
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.