|
ROOT
Reference Guide |
|
Go to the documentation of this file.
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() ;
void reset()
Clear the cache.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
virtual ~RooCacheManager()
Destructor.
virtual void sterilize()
Clear the cache payload but retain slot mapping w.r.t to normalization and integration sets.
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
std::vector< RooNormSetCache > _nsetCache
Last slot accessed.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
virtual void insertObjectHook(T &)
const RooNameSet * nameSet2ByIndex(Int_t index) const
Retrieve RooNameSet associated with slot at given index.
Int_t _lastIndex
Actual use.
virtual void operModeHook()
Interface for operation mode changes.
RooCacheManager(const RooCacheManager &other, RooAbsArg *owner=0)
Copy constructor.
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
The TNamed class is the base class for all named ROOT classes.
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
const RooNameSet * nameSet1ByIndex(Int_t index) const
Retrieve RooNameSet associated with slot at given index.
std::vector< T * > _object
Normalization/Integration set manager.
RooNameSet is a utility class that stores the names the objects in a RooArget.
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(RooAbsArg *owner, Int_t maxSize=2)
Constructor for simple caches with RooAbsArg derived payload.
RooAbsCache is the abstract base class for data members of RooAbsArgs that cache other (composite) Ro...
#define ClassDef(name, id)
virtual void printCompactTreeHook(std::ostream &, const char *)
Interface for printing of cache guts in tree mode printing.
T * getObj(const RooArgSet *nset, const RooArgSet *iset, Int_t *sterileIdx, const char *isetRangeName)
Template class RooCacheManager manages the storage of any type of data indexed on the choice of norma...
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
virtual const char * GetName() const
Returns name of object.
RooCacheManager(Int_t maxSize=2)
Constructor for simple caches without RooAbsArg payload.
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,...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t redirectServersHook(const RooAbsCollection &, Bool_t, Bool_t, Bool_t)
Interface for server redirect calls.