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;
66 applyTrackingOpt =
false;
70 if (applyTrackingOpt) {
73 for (
const auto arg : branches) {
74 arg->setCacheAndTrackHints(trackNodes);
77 std::unique_ptr<RooArgSet> constNodes{trackNodes.
selectByAttrib(
"Constant",
true)};
78 trackNodes.
remove(*constNodes);
96 for (
const auto cacheArg : cached_nodes) {
100 std::unique_ptr<RooArgSet> constNodes{cached_nodes.
selectByAttrib(
"ConstantExpressionCached",
true)};
101 RooArgSet actualTrackNodes(cached_nodes);
102 actualTrackNodes.
remove(*constNodes);
103 if (!constNodes->empty()) {
104 if (constNodes->size() < 20) {
106 <<
" The following expressions have been identified as constant and will be precalculated and cached: "
107 << *constNodes << std::endl;
110 <<
" A total of " << constNodes->size()
111 <<
" expressions have been identified as constant and will be precalculated and cached." << std::endl;
114 if (!actualTrackNodes.
empty()) {
115 if (actualTrackNodes.
size() < 20) {
116 oocoutI(
nullptr,
Minimization) <<
" The following expressions will be evaluated in cache-and-track mode: "
117 << actualTrackNodes << std::endl;
120 <<
" expressions will be evaluated in cache-and-track-mode." << std::endl;
153 function->
getVal(norm_set);
156 std::unique_ptr<RooArgSet> ownedObservables;
157 if (observables ==
nullptr) {
158 ownedObservables = std::unique_ptr<RooArgSet>{function->
getObservables(dataset)};
159 observables = ownedObservables.get();
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
bool findConstantNodes(const RooArgSet &observables, RooArgSet &cacheList)
Find branch nodes with all-constant parameters, and add them to the list of nodes that can be cached ...
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
virtual void optimizeCacheMode(const RooArgSet &observables)
Activate cache mode optimization with given definition of observables.
void branchNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=nullptr, bool recurseNonDerived=false) const
Fill supplied list with all branch nodes of the arg tree starting with ourself as top node.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
void setAttribAll(const Text_t *name, bool value=true)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
Storage_t::size_type size() const
Abstract base class for binned and unbinned datasets.
virtual const RooArgSet * get() const
RooAbsDataStore * store()
void setDirtyProp(bool flag)
Control propagation of dirty flags from observables in dataset.
virtual void setArgStatus(const RooArgSet &set, bool active)
virtual void cacheArgs(const RooAbsArg *owner, RooArgSet &varSet, const RooArgSet *nset=nullptr, bool skipZeroWeights=false)
Internal method – Cache given set of functions with data.
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.
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.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * selectByAttrib(const char *name, bool value) const
Use RooAbsCollection::selectByAttrib(), but return as RooArgSet.
Uses std::vector to store data columns.
const char * GetName() const override
Returns name of object.
Namespace for new RooFit test statistic calculation.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
static void disableConstantTermsOptimization(RooAbsReal *function, RooArgSet *norm_set, RooAbsData *dataset, RooArgSet *observables=nullptr)
static void optimizeCaching(RooAbsReal *function, RooArgSet *norm_set, RooAbsData *dataset, RooArgSet *observables=nullptr)
static RooArgSet requiredExtraObservables()
static void enableConstantTermsOptimization(RooAbsReal *function, RooArgSet *norm_set, RooAbsData *dataset, bool applyTrackingOpt)