58 _cacheMgr(other._cacheMgr,this),
59 _ipOrder(other._ipOrder),
60 _disableCache(other._disableCache)
79 double value = cachedPdf->getVal(nset) ;
80 _norm = cachedPdf->_norm;
92 return cache ? cache->
pdf() :
nullptr;
102 return cache ? cache->
hist() :
nullptr;
125 int sterileIdx = -1 ;
130 if (cache->paramTracker()->hasChanged(
true) && (recalculate || !cache->pdf()->haveUnitNorm()) ) {
131 cxcoutD(
Eval) <<
"RooAbsCachedPdf::getCache(" <<
GetName() <<
") cache " << cache <<
" pdf "
132 << cache->pdf()->GetName() <<
" requires recalculation as parameters changed" << std::endl ;
134 cache->pdf()->setValueDirty() ;
147 cache->hist()->
reset() ;
148 cache->hist()->add(*htmp) ;
155 eoclone->removeSelfFromDir() ;
164 coutI(
Caching) <<
"RooAbsCachedPdf::getCache(" <<
GetName() <<
") creating new cache " << cache <<
" with pdf "
165 << cache->pdf()->GetName() <<
" for nset " << (nset?*nset:
RooArgSet()) <<
" with code " << code ;
195 _hist = std::make_unique<RooDataHist>(hname,hname,orderedObs,self.
binningName()) ;
196 _hist->removeSelfFromDir() ;
204 for(
auto const& harg : orderedObs) {
208 pdfFinalObs.
add(po) ;
217 if (nsetIn && !nsetIn->
empty()) {
219 for (
auto *arg : *nsetIn)
220 pdfname += std::string(
"_") + arg->GetName();
230 params->
remove(pdfFinalObs,
true,
true) ;
232 auto name = std::string(
_pdf->GetName()) +
"_CACHEPARAMS";
238 _pdf->addServerList(*params) ;
241 _pdf->setValueDirty() ;
252 std::string
name =
"_Obs[";
255 for(
auto const& arg : nset) {
261 name += arg->GetName();
284 cache->pdf()->setInterpolationOrder(order) ;
297 ret.
add(*_paramTracker) ;
309 os <<
indent <<
"--- RooAbsCachedPdf begin cache ---" << std::endl ;
312 os <<
"[" << curElem <<
"]" <<
" Configuration for observables " << _nset << std::endl;
313 auto indent2 = std::string(
indent) +
"[" + std::to_string(curElem) +
"]";
314 _pdf->printCompactTree(os,indent2.c_str()) ;
316 os <<
"[" << curElem <<
"] Norm ";
320 if (curElem==maxElem) {
321 os <<
indent <<
"--- RooAbsCachedPdf end cache --- " << std::endl ;
345 if (allVars.
empty()) {
364 std::vector<int> codeList(2);
367 int masterCode =
_anaReg.
store(codeList,all,ana,nrm)+1 ;
372 analVars.
add(allVars,
true) ;
391 RooArgSet *allVars(0),*anaVars(0),*normSet2(0),*dummy(0) ;
392 const std::vector<int> codeList =
_anaReg.
retrieve(code-1,allVars,anaVars,normSet2,dummy) ;
399 factObs.
remove(*anaVars,
true,
true) ;
400 for(
auto * arg : dynamic_range_cast<RooAbsLValue*>(factObs)) {
401 ret *= arg->volume(rangeName) ;
412 cachePdf->computeBatch(stream,
output, nEvents, dataMap);
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
const std::vector< Int_t > & retrieve(Int_t masterCode) const
Retrieve the array of integer codes associated with the given master code.
Int_t store(const std::vector< Int_t > &codeList, RooArgSet *set1=0, RooArgSet *set2=0, RooArgSet *set3=0, RooArgSet *set4=0)
Store given arrays of integer codes, and up to four RooArgSets in the registry (each setX pointer may...
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
RooExpensiveObjectCache & expensiveObjectCache() const
RooArgSet * getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
virtual bool isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
RooArgList containedArgs(Action) override
Returns all RooAbsArg objects contained in the cache element.
std::unique_ptr< RooChangeTracker > _paramTracker
PdfCacheElem(const RooAbsCachedPdf &self, const RooArgSet *nset)
Constructor of cache object which owns RooDataHist cache histogram, RooHistPdf pdf that represents is...
void printCompactTreeHook(std::ostream &, const char *, Int_t, Int_t) override
Print contents of cache when printing self as part of object tree.
std::unique_ptr< RooHistPdf > _pdf
std::unique_ptr< RooDataHist > _hist
RooAbsCachedPdf is the abstract base class for p.d.f.s that need or want to cache their evaluate() ou...
Int_t getInterpolationOrder() const
virtual RooAbsArg & pdfObservable(RooAbsArg &histObservable) const
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Advertises internal (analytical) integration capabilities.
double getValV(const RooArgSet *set=nullptr) const override
Implementation of getVal() overriding default implementation of RooAbsPdf.
virtual PdfCacheElem * createCache(const RooArgSet *nset) const
PdfCacheElem * getCache(const RooArgSet *nset, bool recalculate=true) const
Retrieve cache object associated with given choice of observables.
virtual RooArgSet * actualParameters(const RooArgSet &nset) const =0
RooAICRegistry _anaReg
! Registry for analytical integration codes
virtual TString histNameSuffix() const
virtual const char * binningName() const
bool forceAnalyticalInt(const RooAbsArg &dep) const override
Force RooRealIntegral to offer all our actual observable for internal integration.
virtual const char * inputBaseName() const =0
void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const override
Base function for computing multiple values of a RooAbsReal.
RooAbsPdf * getCachePdf(const RooArgSet &nset) const
RooDataHist * getCacheHist(const RooArgSet &nset) const
bool _disableCache
Flag to run object in passthrough (= non-caching mode)
virtual void fillCacheObject(PdfCacheElem &cache) const =0
void clearCacheObject(PdfCacheElem &cache) const
Mark all bins of given cache as unitialized (value -1)
RooObjCacheManager _cacheMgr
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Implements internal (analytical) integration capabilities.
Int_t _ipOrder
The cache manager.
virtual const char * payloadUniqueSuffix() const
virtual RooArgSet * actualObservables(const RooArgSet &nset) const =0
std::string cacheNameSuffix(const RooArgSet &nset) const
Construct string with unique suffix for cache objects based on observable names that define cache con...
void setInterpolationOrder(int order)
Change the interpolation order that is used in RooHistPdf cache representation smoothing the RooDataH...
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
double getValV(const RooArgSet *set=nullptr) const override
Return current value, normalized by integrating over the observables in nset.
RooArgSet const * _normSet
Normalization integral (owned by _normMgr)
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Analytical integral with normalization (see RooAbsReal::analyticalIntegralWN() for further informatio...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
virtual Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const
Variant of getAnalyticalIntegral that is also passed the normalization set that should be applied to ...
double _value
Cache for current value of object.
virtual void preferredObservableScanOrder(const RooArgSet &obs, RooArgSet &orderedObs) const
Interface method for function objects to indicate their preferred order of observables for scanning t...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
Int_t cacheSize() const
Return size of cache.
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
The RooDataHist is a container class to hold N-dimensional binned data.
void setAllWeights(double value)
Set all the event weight of all bins to the specified value.
void reset() override
Reset all bin weights to zero.
bool registerObject(const char *ownerName, const char *objectName, TObject &cacheObject, const RooArgSet ¶ms)
Register object associated with given name and given associated parameters with given values in cache...
const TObject * retrieveObject(const char *name, TClass *tclass, const RooArgSet ¶ms)
Retrieve object from cache that was registered under given name with given parameters,...
bool haveUnitNorm() const
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
const char * GetName() const override
Returns name of object.
const char * Data() const