Logo ROOT  
Reference Guide
RooCachedReal.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * *
4  * Copyright (c) 2000-2005, Regents of the University of California *
5  * and Stanford University. All rights reserved. *
6  * *
7  * Redistribution and use in source and binary forms, *
8  * with or without modification, are permitted according to the terms *
9  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
10  *****************************************************************************/
11 
12 #ifndef ROOCACHEDREAL
13 #define ROOCACHEDREAL
14 
15 #include "RooAbsCachedReal.h"
16 #include "RooRealProxy.h"
17 #include "RooAbsReal.h"
18 
19 
21 public:
23  // coverity[UNINIT_CTOR]
24  }
25  RooCachedReal(const char *name, const char *title, RooAbsReal& _func, const RooArgSet& cacheObs);
26  RooCachedReal(const char *name, const char *title, RooAbsReal& _func);
27  RooCachedReal(const RooCachedReal& other, const char* name=0) ;
28  virtual TObject* clone(const char* newname) const { return new RooCachedReal(*this,newname); }
29  virtual ~RooCachedReal() ;
30 
31  void setCdfBoundaries(Bool_t flag) {
32  // If flag is true the RooHistFunc that represent the cache histogram
33  // will use special boundary conditions for use with cumulative distribution
34  // functions: at the lower bound the function is forced to converge at zero and the upper
35  // bound is the function is forced to converge at 1.0
36  _useCdfBoundaries = flag ;
37  }
38  Bool_t getCdfBoundaries() const {
39  // If true the c.d.f boundary mode is active
41  }
42 
43  Bool_t cacheSource() const { return _cacheSource ; }
44  void setCacheSource(Bool_t flag) { _cacheSource = flag ; }
45 
46 protected:
47 
48  virtual const char* inputBaseName() const {
49  // Return base name for caches, i.e. the name of the cached function
50  return func.arg().GetName() ;
51  } ;
52  virtual RooArgSet* actualObservables(const RooArgSet& nset) const ;
53  virtual RooArgSet* actualParameters(const RooArgSet& nset) const ;
54  virtual void fillCacheObject(FuncCacheElem& cacheFunc) const ;
55  virtual Double_t evaluate() const {
56  // Dummy evaluate, it is never called
57  return func ;
58  }
59 
60  void operModeHook() ;
61 
62  virtual FuncCacheElem* createCache(const RooArgSet* nset) const ;
63 
64  virtual const char* payloadUniqueSuffix() const { return func.arg().aggregateCacheUniqueSuffix() ; }
65 
66  RooRealProxy func ; // Proxy to function being cached
67  RooSetProxy _cacheObs ; // Variables to be cached
68  Bool_t _useCdfBoundaries ; // Are c.d.f boundary conditions used by the RooHistFuncs?
69  Bool_t _cacheSource ; // Keep an attached clone of the source in the cache for fast operation
70 
71 private:
72 
73  ClassDef(RooCachedReal,2) // P.d.f class that wraps another p.d.f and caches its output
74 
75 };
76 
77 #endif
RooAbsReal.h
RooCachedReal::fillCacheObject
virtual void fillCacheObject(FuncCacheElem &cacheFunc) const
Update contents of cache histogram by resampling the input function.
Definition: RooCachedReal.cxx:128
RooTemplateProxy::arg
const T & arg() const
Return reference to object held in proxy.
Definition: RooTemplateProxy.h:271
RooSetProxy
Definition: RooSetProxy.h:23
RooCachedReal::operModeHook
void operModeHook()
Definition: RooCachedReal.cxx:202
RooCachedReal::setCacheSource
void setCacheSource(Bool_t flag)
Definition: RooCachedReal.h:53
RooCachedReal::RooCachedReal
RooCachedReal()
Definition: RooCachedReal.h:31
RooCachedReal::actualParameters
virtual RooArgSet * actualParameters(const RooArgSet &nset) const
If this p.d.f is operated with a fixed set of observables, return all variables of the external input...
Definition: RooCachedReal.cxx:193
RooAbsReal
Definition: RooAbsReal.h:61
RooCachedReal::func
RooRealProxy func
Definition: RooCachedReal.h:75
RooCachedReal::getCdfBoundaries
Bool_t getCdfBoundaries() const
Definition: RooCachedReal.h:47
RooCachedReal::cacheSource
Bool_t cacheSource() const
Definition: RooCachedReal.h:52
bool
RooCachedReal::_cacheSource
Bool_t _cacheSource
Definition: RooCachedReal.h:78
RooAbsCachedReal::FuncCacheElem
friend class FuncCacheElem
Definition: RooAbsCachedReal.h:92
RooCachedReal::actualObservables
virtual RooArgSet * actualObservables(const RooArgSet &nset) const
If this pdf is operated with a fixed set of observables, return the subset of the fixed observables t...
Definition: RooCachedReal.cxx:176
RooCachedReal::evaluate
virtual Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Definition: RooCachedReal.h:64
RooCachedReal::inputBaseName
virtual const char * inputBaseName() const
Definition: RooCachedReal.h:57
RooCachedReal
Definition: RooCachedReal.h:20
RooCachedReal::payloadUniqueSuffix
virtual const char * payloadUniqueSuffix() const
Definition: RooCachedReal.h:73
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooRealProxy.h
RooCachedReal::clone
virtual TObject * clone(const char *newname) const
Definition: RooCachedReal.h:37
RooCachedReal::_cacheObs
RooSetProxy _cacheObs
Definition: RooCachedReal.h:76
RooCachedReal::~RooCachedReal
virtual ~RooCachedReal()
Destructor.
Definition: RooCachedReal.cxx:102
RooCachedReal::_useCdfBoundaries
Bool_t _useCdfBoundaries
Definition: RooCachedReal.h:77
RooAbsArg::aggregateCacheUniqueSuffix
const char * aggregateCacheUniqueSuffix() const
Definition: RooAbsArg.cxx:2182
RooTemplateProxy< RooAbsReal >
Double_t
double Double_t
Definition: RtypesCore.h:59
RooAbsCachedReal.h
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooCachedReal::setCdfBoundaries
void setCdfBoundaries(Bool_t flag)
Definition: RooCachedReal.h:40
RooCachedReal::createCache
virtual FuncCacheElem * createCache(const RooArgSet *nset) const
Interface function to create an internal cache object that represent each cached function configurati...
Definition: RooCachedReal.cxx:114
name
char name[80]
Definition: TGX11.cxx:110
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:53
RooAbsCachedReal::FuncCacheElem
Definition: RooAbsCachedReal.h:59
RooAbsCachedReal
Definition: RooAbsCachedReal.h:24
RooArgSet
Definition: RooArgSet.h:28