00001 /***************************************************************************** 00002 * Project: RooFit * 00003 * * 00004 * Copyright (c) 2000-2005, Regents of the University of California * 00005 * and Stanford University. All rights reserved. * 00006 * * 00007 * Redistribution and use in source and binary forms, * 00008 * with or without modification, are permitted according to the terms * 00009 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) * 00010 *****************************************************************************/ 00011 00012 #ifndef ROOCACHEDREAL 00013 #define ROOCACHEDREAL 00014 00015 #include "RooAbsCachedReal.h" 00016 #include "RooRealProxy.h" 00017 #include "RooAbsReal.h" 00018 00019 00020 class RooCachedReal : public RooAbsCachedReal { 00021 public: 00022 RooCachedReal() { 00023 // coverity[UNINIT_CTOR] 00024 } 00025 RooCachedReal(const char *name, const char *title, RooAbsReal& _func, const RooArgSet& cacheObs); 00026 RooCachedReal(const char *name, const char *title, RooAbsReal& _func); 00027 RooCachedReal(const RooCachedReal& other, const char* name=0) ; 00028 virtual TObject* clone(const char* newname) const { return new RooCachedReal(*this,newname); } 00029 virtual ~RooCachedReal() ; 00030 00031 void setCdfBoundaries(Bool_t flag) { 00032 // If flag is true the RooHistFunc that represent the cache histogram 00033 // will use special boundary conditions for use with cumulative distribution 00034 // functions: at the lower bound the function is forced to converge at zero and the upper 00035 // bound is the function is forced to converge at 1.0 00036 _useCdfBoundaries = flag ; 00037 } 00038 Bool_t getCdfBoundaries() const { 00039 // If true the c.d.f boundary mode is active 00040 return _useCdfBoundaries ; 00041 } 00042 00043 protected: 00044 00045 virtual const char* inputBaseName() const { 00046 // Return base name for caches, i.e. the name of the cached function 00047 return func.arg().GetName() ; 00048 } ; 00049 virtual RooArgSet* actualObservables(const RooArgSet& nset) const ; 00050 virtual RooArgSet* actualParameters(const RooArgSet& nset) const ; 00051 virtual void fillCacheObject(FuncCacheElem& cacheFunc) const ; 00052 virtual Double_t evaluate() const { 00053 // Dummy evaluate, it is never called 00054 return 0 ; 00055 } 00056 00057 virtual const char* payloadUniqueSuffix() const { return func.arg().aggregateCacheUniqueSuffix() ; } 00058 00059 RooRealProxy func ; // Proxy to function being cached 00060 RooSetProxy _cacheObs ; // Variables to be cached 00061 Bool_t _useCdfBoundaries ; // Are c.d.f boundary conditions used by the RooHistFuncs? 00062 00063 private: 00064 00065 ClassDef(RooCachedReal,1) // P.d.f class that wraps another p.d.f and caches its output 00066 00067 }; 00068 00069 #endif