22namespace TestStatistics {
45 bool applyTrackingOpt)
49 function->getVal(norm_set);
59 if (applyTrackingOpt) {
62 <<
"enableConstantTermsOptimization(function: " << function->GetName()
63 <<
", dataset: " << dataset->
GetName()
64 <<
") WARNING Cache-and-track optimization (Optimize level 2) is only available for datasets"
65 <<
" implemented in terms of RooVectorDataStore - ignoring this option for current dataset" << std::endl;
70 if (applyTrackingOpt) {
72 function->branchNodeServerList(&branches);
73 for (
const auto arg : branches) {
74 arg->setCacheAndTrackHints(trackNodes);
78 trackNodes.
remove(*constNodes);
88 function->findConstantNodes(*dataset->
get(), cached_nodes);
94 dataset->
cacheArgs(
nullptr, cached_nodes, norm_set, !function->getAttribute(
"BinnedLikelihood"));
97 for (
const auto cacheArg : cached_nodes) {
102 RooArgSet actualTrackNodes(cached_nodes);
103 actualTrackNodes.
remove(*constNodes);
104 if (constNodes->getSize() > 0) {
105 if (constNodes->getSize() < 20) {
107 <<
" The following expressions have been identified as constant and will be precalculated and cached: "
108 << *constNodes << std::endl;
111 <<
" expressions have been identified as constant and will be precalculated and cached."
115 if (actualTrackNodes.
getSize() > 0) {
116 if (actualTrackNodes.
getSize() < 20) {
118 << actualTrackNodes << std::endl;
121 <<
" expressions will be evaluated in cache-and-track-mode." << std::endl;
153 function->getVal(norm_set);
156 function->optimizeCacheMode(*observables);
void setAttribAll(const Text_t *name, Bool_t value=kTRUE)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
RooAbsCollection * selectByAttrib(const char *name, Bool_t value) const
Create a subset of the current collection, consisting only of those elements with the specified attri...
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
RooAbsDataStore * store()
virtual void optimizeReadingWithCaching(RooAbsArg &arg, const RooArgSet &cacheList, const RooArgSet &keepObsList)
Prepare dataset for use with cached constant terms listed in 'cacheList' of expression 'arg'.
virtual void resetCache()
Internal method – Remove cached function values.
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=0, Bool_t skipZeroWeights=kFALSE)
Internal method – Cache given set of functions with data.
virtual void setArgStatus(const RooArgSet &set, Bool_t active)
void setDirtyProp(Bool_t flag)
Control propagation of dirty flags from observables in dataset.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooVectorDataStore uses std::vectors to store data columns.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
static RooArgSet requiredExtraObservables()
static void optimizeCaching(RooAbsReal *function, RooArgSet *norm_set, RooArgSet *observables, RooAbsData *dataset)
static void enableConstantTermsOptimization(RooAbsReal *function, RooArgSet *norm_set, RooAbsData *dataset, bool applyTrackingOpt)
static void disableConstantTermsOptimization(RooAbsReal *function, RooArgSet *norm_set, RooArgSet *observables, RooAbsData *dataset)