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) {
72 function->branchNodeServerList(&branches);
73 for (
const auto arg : branches) {
74 arg->setCacheAndTrackHints(trackNodes);
78 trackNodes.
remove(*constNodes);
87 function->findConstantNodes(*dataset->get(), cached_nodes);
93 dataset->cacheArgs(
nullptr, cached_nodes, norm_set, !
function->getAttribute(
"BinnedLikelihood"));
96 for (
const auto cacheArg : cached_nodes) {
100 std::unique_ptr<RooArgSet> constNodes{
102 RooArgSet actualTrackNodes(cached_nodes);
103 actualTrackNodes.
remove(*constNodes);
104 if (!constNodes->empty()) {
105 if (constNodes->size() < 20) {
107 <<
" The following expressions have been identified as constant and will be precalculated and cached: "
108 << *constNodes << std::endl;
111 <<
" A total of " << constNodes->size()
112 <<
" expressions have been identified as constant and will be precalculated and cached." << std::endl;
115 if (!actualTrackNodes.
empty()) {
116 if (actualTrackNodes.
size() < 20) {
117 oocoutI(
nullptr,
Minimization) <<
" The following expressions will be evaluated in cache-and-track mode: "
118 << actualTrackNodes << std::endl;
121 <<
" expressions will be evaluated in cache-and-track-mode." << std::endl;
133 dataset->resetCache();
136 dataset->setArgStatus(*dataset->get(),
true);
142 dataset->setDirtyProp(
false);
157 std::unique_ptr<RooArgSet> ownedObservables;
158 if (observables ==
nullptr) {
159 ownedObservables = std::unique_ptr<RooArgSet>{
function->getObservables(dataset)};
160 observables = ownedObservables.get();
162 function->optimizeCacheMode(*observables);
165 dataset->setDirtyProp(
false);
RooAbsCollection * selectByAttrib(const char *name, bool value) const
Create a subset of the current collection, consisting only of those elements with the specified attri...
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.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Uses std::vector to store data columns.
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)