Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooCachedReal.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  *                                                                           *
0004  * Copyright (c) 2000-2005, Regents of the University of California          *
0005  *                          and Stanford University. All rights reserved.    *
0006  *                                                                           *
0007  * Redistribution and use in source and binary forms,                        *
0008  * with or without modification, are permitted according to the terms        *
0009  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0010  *****************************************************************************/
0011 
0012 #ifndef ROOCACHEDREAL
0013 #define ROOCACHEDREAL
0014 
0015 #include "RooAbsCachedReal.h"
0016 #include "RooRealProxy.h"
0017 #include "RooAbsReal.h"
0018 
0019 
0020 class RooCachedReal : public RooAbsCachedReal {
0021 public:
0022   RooCachedReal() : _cacheSource(false) {
0023     // coverity[UNINIT_CTOR]
0024   }
0025   RooCachedReal(const char *name, const char *title, RooAbsReal& _func, const RooArgSet& cacheObs);
0026   RooCachedReal(const char *name, const char *title, RooAbsReal& _func);
0027   RooCachedReal(const RooCachedReal& other, const char* name=nullptr) ;
0028   TObject* clone(const char* newname) const override { return new RooCachedReal(*this,newname); }
0029 
0030   /// If flag is true the RooHistFunc that represent the cache histogram
0031   /// will use special boundary conditions for use with cumulative distribution
0032   /// functions: at the lower bound the function is forced to converge at zero and the upper
0033   /// bound is the function is forced to converge at 1.0
0034   void setCdfBoundaries(bool flag) {
0035     _useCdfBoundaries = flag ;
0036   }
0037   /// If true the c.d.f boundary mode is active
0038   bool getCdfBoundaries() const {
0039     return _useCdfBoundaries ;
0040   }
0041 
0042   bool cacheSource() const { return _cacheSource ; }
0043   void setCacheSource(bool flag) { _cacheSource = flag ; }
0044 
0045 protected:
0046 
0047   /// Return base name for caches, i.e. the name of the cached function
0048   const char* inputBaseName() const override {
0049     return func.arg().GetName() ;
0050   } ;
0051   RooFit::OwningPtr<RooArgSet> actualObservables(const RooArgSet& nset) const override ;
0052   RooFit::OwningPtr<RooArgSet> actualParameters(const RooArgSet& nset) const override;
0053   void fillCacheObject(FuncCacheElem& cacheFunc) const override ;
0054   /// Dummy evaluate, it is never called
0055   double evaluate() const override {
0056     return func ;
0057   }
0058 
0059   void operModeHook() override ;
0060 
0061   FuncCacheElem* createCache(const RooArgSet* nset) const override ;
0062 
0063   const char* payloadUniqueSuffix() const override { return func.arg().aggregateCacheUniqueSuffix() ; }
0064 
0065   RooRealProxy func ;           ///< Proxy to function being cached
0066   RooSetProxy  _cacheObs ;      ///< Variables to be cached
0067   bool _useCdfBoundaries ;    ///< Are c.d.f boundary conditions used by the RooHistFuncs?
0068   bool _cacheSource ;         ///< Keep an attached clone of the source in the cache for fast operation
0069 
0070 private:
0071 
0072   ClassDefOverride(RooCachedReal,2) // P.d.f class that wraps another p.d.f and caches its output
0073 
0074 };
0075 
0076 #endif