38using std::cout, std::endl, std::string;
53 func(
"func",
"func",this,
_func),
55 _binningName(bname?bname:
"cache")
68 func(
"func",this,other.func),
70 _binningName(other._binningName)
104 _xx(static_cast<
RooRealVar *>(hist()->get()->find(self.
x.arg().GetName())))
107 _ax.resize(
hist()->numEntries());
108 _ay.resize(
hist()->numEntries());
127 ret.
add(FuncCacheElem::containedArgs(action)) ;
143 Int_t nbins = hist()->numEntries() ;
145 double xsave = _self->x ;
148 Int_t nInitRange=32 ;
149 for (
int i=1 ; i<=nInitRange ; i++) {
150 Int_t hi = (i*nbins)/nInitRange -1 ;
152 addRange(lo,
hi,nbins) ;
157 for (
int i=1 ; i<nbins ; i++) {
162 double binv = (_self->x.max()-_self->x.min())/nbins ;
163 for (
int i=0 ; i<nbins ; i++) {
166 hist()->set(i, _ay[i]/_ay[nbins-1], 0.);
168 hist()->set(i, _ay[i]*binv, 0.);
173 func()->setCdfBoundaries(
true) ;
210 Int_t ixmid = (ixlo+ixhi)/2 ;
214 double yInt = _ay[ixlo] + (_ay[ixhi]-_ay[ixlo])*(ixmid-ixlo)/(ixhi-ixlo) ;
217 if (std::abs(yInt-_ay[ixmid])*(_ax[nbins-1]-_ax[0])>1
e-6) {
218 addRange(ixlo,ixmid,nbins) ;
219 addRange(ixmid,ixhi,nbins) ;
221 for (
Int_t j=ixlo+1 ; j<ixmid ; j++) {
222 _ay[j] = _ay[ixlo] + (_ay[ixmid]-_ay[ixlo])*(j-ixlo)/(ixmid-ixlo) ;
224 for (
Int_t j=ixmid+1 ; j<ixhi ; j++) {
225 _ay[j] = _ay[ixmid] + (_ay[ixhi]-_ay[ixmid])*(j-ixmid)/(ixhi-ixmid) ;
238 _self->x = _xx->getVal() ;
239 _ay[ix] = _self->func.arg().getVal(*_xx) ;
277 ret->remove(
x.
arg(),
true,
true) ;
296 cout <<
"RooNumRunningInt::evaluate(" <<
GetName() <<
")" << endl ;
RooAbsReal * _func
Pointer to original input function.
RooFit::OwningPtr< RooArgSet > getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Abstract base class for functions that need or want to cache their evaluate() output in a RooHistFunc...
void setInterpolationOrder(Int_t order)
Set interpolation order of RooHistFunct representing cache histogram.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
const RooArgSet * get() const override
Get bin centre of current bin.
std::vector< double > _ay
std::vector< double > _ax
void addRange(Int_t ixlo, Int_t ixhi, Int_t nbins)
Fill all empty histogram bins in the range [ixlo,ixhi] where nbins is the total number of histogram b...
RooArgList containedArgs(Action) override
Return all RooAbsArg components contained in cache element.
void addPoint(Int_t ix)
Sample function at bin ix.
void calculate(bool cdfmode)
Calculate the numeric running integral and store the result in the cache histogram provided by RooAbs...
RICacheElem(const RooNumRunningInt &ri, const RooArgSet *nset)
Construct RunningIntegral CacheElement.
Implementation of RooAbsCachedReal that represents a running integral.
RooNumRunningInt(const char *name, const char *title, RooAbsReal &_func, RooRealVar &_x, const char *binningName="cache")
Construct running integral of function '_func' over x_print from the lower bound on _x to the present...
double evaluate() const override
Dummy function that is never called.
const char * inputBaseName() const override
Return unique name for RooAbsCachedPdf cache components constructed from input function name.
RooFit::OwningPtr< RooArgSet > actualParameters(const RooArgSet &nset) const override
Return the parameters of the cache created by RooAbsCachedPdf.
RooRealProxy func
Proxy to functions whose running integral is calculated.
FuncCacheElem * createCache(const RooArgSet *nset) const override
Create custom cache element for running integral calculations.
RooFit::OwningPtr< RooArgSet > actualObservables(const RooArgSet &nset) const override
Return observable in nset to be cached by RooAbsCachedPdf this is always the x observable that is int...
~RooNumRunningInt() override
Destructor.
RooRealProxy x
Integrated observable.
void fillCacheObject(FuncCacheElem &cacheFunc) const override
Fill the cache object by calling its calculate() method.
Variable that can be changed from the outside.
const T & arg() const
Return reference to object held in proxy.
const char * GetName() const override
Returns name of object.
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...