59 _cacheMgr(other._cacheMgr,this),
60 _ipOrder(other._ipOrder),
61 _disableCache(other._disableCache)
80 double value = cachedPdf->getVal(nset) ;
81 _norm = cachedPdf->_norm;
93 return cache ? cache->
pdf() :
nullptr;
103 return cache ? cache->
hist() :
nullptr;
116 int sterileIdx = -1 ;
121 if (cache->paramTracker()->hasChanged(
true) && (recalculate || !cache->pdf()->haveUnitNorm()) ) {
122 cxcoutD(Eval) <<
"RooAbsCachedPdf::getCache(" <<
GetName() <<
") cache " << cache <<
" pdf "
123 << cache->
pdf()->
GetName() <<
" requires recalculation as parameters changed" << std::endl ;
125 cache->pdf()->setValueDirty() ;
138 cache->hist()->
reset() ;
139 cache->hist()->add(*histTmp) ;
146 eoclone->removeSelfFromDir() ;
155 coutI(Caching) <<
"RooAbsCachedPdf::getCache(" <<
GetName() <<
") creating new cache " << cache <<
" with pdf "
156 << cache->pdf()->GetName() <<
" for nset " << (nset?*nset:
RooArgSet()) <<
" with code " << code ;
158 ccoutI(Caching) <<
" from preexisting content." ;
160 ccoutI(Caching) << std::endl ;
186 _hist = std::make_unique<RooDataHist>(hname,hname,orderedObs,self.
binningName()) ;
187 _hist->removeSelfFromDir() ;
195 for(
auto const& harg : orderedObs) {
199 pdfFinalObs.
add(po) ;
208 if (nsetIn && !nsetIn->
empty()) {
210 for (
auto *arg : *nsetIn)
211 pdfname += std::string(
"_") + arg->GetName();
221 params->remove(pdfFinalObs,
true,
true) ;
223 auto name = std::string(
_pdf->GetName()) +
"_CACHEPARAMS";
229 _pdf->addServerList(*params) ;
232 _pdf->setValueDirty() ;
243 std::string
name =
"_Obs[";
246 for(
auto const& arg : nset) {
252 name += arg->GetName();
275 cache->pdf()->setInterpolationOrder(order) ;
288 ret.
add(*_paramTracker) ;
300 os <<
indent <<
"--- RooAbsCachedPdf begin cache ---" << std::endl ;
303 os <<
"[" << curElem <<
"]" <<
" Configuration for observables " << _nset << std::endl;
304 auto indent2 = std::string(
indent) +
"[" + std::to_string(curElem) +
"]";
305 _pdf->printCompactTree(os,indent2.c_str()) ;
307 os <<
"[" << curElem <<
"] Norm ";
311 if (curElem==maxElem) {
312 os <<
indent <<
"--- RooAbsCachedPdf end cache --- " << std::endl ;
336 if (allVars.
empty()) {
355 std::vector<int> codeList(2);
358 int masterCode =
_anaReg.
store(codeList,all,ana,nrm)+1 ;
363 analVars.
add(allVars,
true) ;
386 const std::vector<int> codeList =
_anaReg.
retrieve(code-1,allVars,anaVars,normSet2,dummy) ;
393 factObs.
remove(*anaVars,
true,
true) ;
394 for(
auto * arg : dynamic_range_cast<RooAbsLValue*>(factObs)) {
395 ret *= arg->volume(rangeName) ;
409std::unique_ptr<RooAbsArg>
412 if (normSet.
empty()) {
415 std::unique_ptr<RooAbsPdf> pdfClone(
static_cast<RooAbsPdf *
>(this->
Clone()));
418 auto newArg = std::make_unique<RooFit::Detail::RooNormalizedPdf>(*pdfClone, normSet);
422 for (
RooAbsArg *server : newArg->servers()) {
426 newArg->addOwnedComponents(std::move(pdfClone));
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=nullptr, RooArgSet *set2=nullptr, RooArgSet *set3=nullptr, RooArgSet *set4=nullptr)
Store given arrays of integer codes, and up to four RooArgSets in the registry (each setX pointer may...
Common abstract base class for objects that represent a value and a "shape" in RooFit.
RooExpensiveObjectCache & expensiveObjectCache() const
RooFit::OwningPtr< RooArgSet > getVariables(bool stripDisconnected=true) const
Return RooArgSet with all variables (tree leaf nodes of expression tree)
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
virtual bool isFundamental() const
Is this object a fundamental type that can be added to a dataset? Fundamental-type subclasses overrid...
Abstract base class for objects to be stored in RooAbsCache cache manager objects.
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
Abstract base class for p.d.f.s that need or want to cache their evaluate() output in a RooHistPdf de...
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 RooFit::OwningPtr< RooArgSet > actualObservables(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
RooAbsPdf * getCachePdf(const RooArgSet &nset) const
RooDataHist * getCacheHist(const RooArgSet &nset) const
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
bool _disableCache
Flag to run object in passthrough (= non-caching mode)
virtual void fillCacheObject(PdfCacheElem &cache) const =0
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
std::string cacheNameSuffix(const RooArgSet &nset) const
Construct string with unique suffix for cache objects based on observable names that define cache con...
void doEval(RooFit::EvalContext &) const override
Base function for computing multiple values of a RooAbsReal.
void setInterpolationOrder(int order)
Change the interpolation order that is used in RooHistPdf cache representation smoothing the RooDataH...
virtual RooFit::OwningPtr< RooArgSet > actualParameters(const RooArgSet &nset) const =0
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.
Abstract interface for all probability density functions.
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
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...
virtual void doEval(RooFit::EvalContext &) const
Base function for computing multiple values of a RooAbsReal.
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.
Container class to hold N-dimensional binned data.
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,...
void markAsCompiled(RooAbsArg &arg) const
void compileServers(RooAbsArg &arg, RooArgSet const &normSet)
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