Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
21public:
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=nullptr) ;
28 TObject* clone(const char* newname) const override { return new RooCachedReal(*this,newname); }
29
30 /// If flag is true the RooHistFunc that represent the cache histogram
31 /// will use special boundary conditions for use with cumulative distribution
32 /// functions: at the lower bound the function is forced to converge at zero and the upper
33 /// bound is the function is forced to converge at 1.0
34 void setCdfBoundaries(bool flag) {
35 _useCdfBoundaries = flag ;
36 }
37 /// If true the c.d.f boundary mode is active
38 bool getCdfBoundaries() const {
39 return _useCdfBoundaries ;
40 }
41
42 bool cacheSource() const { return _cacheSource ; }
43 void setCacheSource(bool flag) { _cacheSource = flag ; }
44
45protected:
46
47 /// Return base name for caches, i.e. the name of the cached function
48 const char* inputBaseName() const override {
49 return func.arg().GetName() ;
50 } ;
51 RooFit::OwningPtr<RooArgSet> actualObservables(const RooArgSet& nset) const override ;
53 void fillCacheObject(FuncCacheElem& cacheFunc) const override ;
54 /// Dummy evaluate, it is never called
55 double evaluate() const override {
56 return func ;
57 }
58
59 void operModeHook() override ;
60
61 FuncCacheElem* createCache(const RooArgSet* nset) const override ;
62
63 const char* payloadUniqueSuffix() const override { return func.arg().aggregateCacheUniqueSuffix() ; }
64
65 RooRealProxy func ; ///< Proxy to function being cached
66 RooSetProxy _cacheObs ; ///< Variables to be cached
67 bool _useCdfBoundaries ; ///< Are c.d.f boundary conditions used by the RooHistFuncs?
68 bool _cacheSource ; ///< Keep an attached clone of the source in the cache for fast operation
69
70private:
71
72 ClassDefOverride(RooCachedReal,2) // P.d.f class that wraps another p.d.f and caches its output
73
74};
75
76#endif
RooAbsReal * _func
Pointer to original input function.
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
const char * aggregateCacheUniqueSuffix() const
Abstract base class for functions that need or want to cache their evaluate() output in a RooHistFunc...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Implementation of RooAbsCachedReal that can cache any external RooAbsReal input function provided in ...
bool _useCdfBoundaries
Are c.d.f boundary conditions used by the RooHistFuncs?
TObject * clone(const char *newname) const override
const char * payloadUniqueSuffix() const override
void fillCacheObject(FuncCacheElem &cacheFunc) const override
Update contents of cache histogram by resampling the input function.
RooFit::OwningPtr< RooArgSet > actualObservables(const RooArgSet &nset) const override
If this pdf is operated with a fixed set of observables, return the subset of the fixed observables t...
double evaluate() const override
Dummy evaluate, it is never called.
void operModeHook() override
bool _cacheSource
Keep an attached clone of the source in the cache for fast operation.
bool getCdfBoundaries() const
If true the c.d.f boundary mode is active.
RooRealProxy func
Proxy to function being cached.
void setCdfBoundaries(bool flag)
If flag is true the RooHistFunc that represent the cache histogram will use special boundary conditio...
bool cacheSource() const
void setCacheSource(bool flag)
FuncCacheElem * createCache(const RooArgSet *nset) const override
Interface function to create an internal cache object that represent each cached function configurati...
RooSetProxy _cacheObs
Variables to be cached.
RooFit::OwningPtr< RooArgSet > actualParameters(const RooArgSet &nset) const override
If this p.d.f is operated with a fixed set of observables, return all variables of the external input...
const char * inputBaseName() const override
Return base name for caches, i.e. the name of the cached function.
const T & arg() const
Return reference to object held in proxy.
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
Mother of all ROOT objects.
Definition TObject.h:41
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:35