109 const RooArgSet& projDeps,
const char* rangeName,
const char* addCoefRangeName,
111 RooAbsTestStatistic(
name,title,real,indata,projDeps,rangeName, addCoefRangeName, nCPU, interleave,
verbose, splitCutRange),
134 initSlave(real,indata,projDeps,rangeName,addCoefRangeName) ;
169 const char* addCoefRangeName)
198 delete projDataDeps ;
229 if (realDepRLV && realDepRLV->isDerived()) {
231 realDepRLV->leafNodeServerList(&tmp2, 0,
kTRUE);
248 if (!realReal) continue ;
250 if (!datReal) continue ;
255 coutE(
InputArguments) <<
"RooAbsOptTestStatistic: ERROR minimum of FUNC observable " << arg->GetName()
256 <<
"(" << realReal->
getMin() <<
") is smaller than that of "
257 << arg->GetName() <<
" in the dataset (" << datReal->
getMin() <<
")" << endl ;
263 coutE(
InputArguments) <<
"RooAbsOptTestStatistic: ERROR maximum of FUNC observable " << arg->GetName()
264 <<
" is larger than that of " << arg->GetName() <<
" in the dataset" << endl ;
272 if (rangeName && strlen(rangeName)) {
287 if (rangeName && strlen(rangeName)) {
288 cxcoutI(
Fitting) <<
"RooAbsOptTestStatistic::ctor(" <<
GetName() <<
") constructing test statistic for sub-range named " << rangeName << endl ;
290 bool observablesKnowRange =
false;
297 observablesKnowRange |= realObs->
hasRange(rangeName);
300 if (!(addCoefRangeName && strlen(addCoefRangeName))) {
313 const std::string fitRangeName = std::string(
"fit_") +
GetName();
315 std::string newAttr = origAttrib ? origAttrib :
"";
317 if (newAttr.find(fitRangeName) == std::string::npos) {
318 newAttr += (newAttr.empty() ?
"" :
",") + fitRangeName;
323 origObs->
setRange(fitRangeName.c_str(), realObs->
getMin(rangeName), realObs->
getMax(rangeName));
329 if (!observablesKnowRange)
330 coutW(
Fitting) <<
"None of the fit observables seem to know the range '" << rangeName <<
"'. This means that the full range will be used." << std::endl;
342 if (rangeName && strlen(rangeName)) {
347 if (addCoefRangeName && strlen(addCoefRangeName)) {
349 <<
") fixing interpretation of coefficients of any RooAddPdf component to range " << addCoefRangeName << endl ;
353 <<
") fixing interpretation of coefficients of any RooAddPdf to full domain of observables " << endl ;
381 delete projDataDeps ;
385 coutI(
Optimization) <<
"RooAbsOptTestStatistic::ctor(" <<
GetName() <<
") optimizing internal clone of p.d.f for likelihood evaluation."
386 <<
"Lazy evaluation and associated change tracking will disabled for all nodes that depend on observables" << endl ;
443 for (
Int_t i = 0; i <
n; ++i) {
448 carry = (t -
sum) -
y;
478 indent2 +=
"opt >>" ;
503 <<
") dataset cache is owned by another object, no constant term optimization can be applied" << endl ;
511 <<
") function caching prohibited by test statistic, no constant term optimization is applied" << endl ;
523 <<
") optimizing evaluation of test statistic by finding all nodes in p.d.f that depend exclusively"
524 <<
" on observables and constant parameters and precalculating their values" << endl ;
530 <<
") deactivating optimization of constant terms in test statistic" << endl ;
536 <<
") one ore more parameter were changed from constant to floating or vice versa, "
537 <<
"re-evaluating constant term optimization" << endl ;
544 <<
") the value of one ore more constant parameter were changed re-evaluating constant term optimization" << endl ;
616 if (applyTrackingOpt) {
619 <<
") WARNING Cache-and-track optimization (Optimize level 2) is only available for datasets"
620 <<
" implement in terms of RooVectorDataStore - ignoring this option for current dataset" << endl ;
621 applyTrackingOpt =
kFALSE ;
625 if (applyTrackingOpt) {
628 for (
auto arg : branches) {
629 arg->setCacheAndTrackHints(trackNodes);
633 trackNodes.
remove(*constNodes) ;
671 actualTrackNodes.
remove(*constNodes) ;
673 if (constNodes->
getSize()<20) {
674 coutI(
Minimization) <<
" The following expressions have been identified as constant and will be precalculated and cached: " << *constNodes << endl ;
676 coutI(
Minimization) <<
" A total of " << constNodes->
getSize() <<
" expressions have been identified as constant and will be precalculated and cached." << endl ;
684 if (actualTrackNodes.
getSize()>0) {
685 if (actualTrackNodes.
getSize()<20) {
686 coutI(
Minimization) <<
" The following expressions will be evaluated in cache-and-track mode: " << actualTrackNodes << endl ;
688 coutI(
Minimization) <<
" A total of " << constNodes->
getSize() <<
" expressions will be evaluated in cache-and-track-mode." << endl ;
745 coutW(
InputArguments) <<
"RooAbsOptTestStatistic::setData(" <<
GetName() <<
") WARNING: test statistic was constructed with range selection on data, "
746 <<
"ignoring request to _not_ clone the input dataset" << endl ;
797 <<
") WARNING: object sealed by creator - access to data is not permitted: "
798 << (notice?
sealNotice():
"<no user notice>") << endl ;
813 <<
") WARNING: object sealed by creator - access to data is not permitted: "
814 << (notice?
sealNotice():
"<no user notice>") << endl ;
static RooMathCoreReg dummy
static void indent(ostringstream &buf, int indent_level)
char * Form(const char *fmt,...)
virtual RooAbsArg * cloneTree(const char *newname=0) const
Clone tree expression of objects.
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Return the observables of this pdf given a set of observables.
void printCompactTree(const char *indent="", const char *fileName=0, const char *namePat=0, RooAbsArg *client=0)
Print tree structure of expression tree on stdout, or to file if filename is specified.
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
Bool_t 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 ...
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
virtual void optimizeCacheMode(const RooArgSet &observables)
Activate cache mode optimization with given definition of observables.
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
void branchNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=0, Bool_t recurseNonDerived=kFALSE) const
Fill supplied list with all branch nodes of the arg tree starting with ourself as top node.
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
virtual RooAbsReal * highBoundFunc() const
virtual RooAbsReal * lowBoundFunc() const
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
Storage_t::size_type size() const
RooAbsArg * first() const
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.
RooAbsArg * find(const char *name) const
Find object with given name in list.
virtual const RooAbsArg * cacheOwner()=0
virtual void forceCacheUpdate()
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'.
RooAbsData * reduce(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg())
Create a reduced copy of this dataset.
virtual Int_t numEntries() const
virtual void resetCache()
Internal method – Remove cached function values.
Bool_t hasFilledCache() const
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.
void attachBuffers(const RooArgSet &extObs)
virtual void setArgStatus(const RooArgSet &set, Bool_t active)
void setDirtyProp(Bool_t flag)
Control propagation of dirty flags from observables in dataset.
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
virtual ~RooAbsOptTestStatistic()
Destructor.
RooAbsReal * _origFunc
List of nodes that are cached as constant expressions.
void optimizeCaching()
This method changes the value caching logic for all nodes that depends on any of the observables as d...
const char * sealNotice() const
void optimizeConstantTerms(Bool_t, Bool_t=kTRUE)
Driver function to activate global constant term optimization.
virtual Bool_t allowFunctionCache()
virtual Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
Catch server redirect calls and forward to internal clone of function.
virtual void printCompactTreeHook(std::ostream &os, const char *indent="")
Catch print hook function and forward to function clone.
void initSlave(RooAbsReal &real, RooAbsData &indata, const RooArgSet &projDeps, const char *rangeName, const char *addCoefRangeName)
virtual Double_t combinedValue(RooAbsReal **gofArray, Int_t nVal) const
Method to combined test statistic results calculated into partitions into the global result.
RooArgSet * _funcCloneSet
virtual RooArgSet requiredExtraObservables() const
RooAbsOptTestStatistic()
Default Constructor.
Bool_t setDataSlave(RooAbsData &data, Bool_t cloneData=kTRUE, Bool_t ownNewDataAnyway=kFALSE)
Change dataset that is used to given one.
void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Driver function to propagate constant term optimizations in test statistic.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
virtual Bool_t hasRange(const char *name) const
Check if variable has a binning with given name.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual void fixAddCoefRange(const char *rangeName=0, Bool_t force=kTRUE)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
virtual Double_t getValV(const RooArgSet *normalisationSet=nullptr) const
Return value of object.
virtual void fixAddCoefNormalization(const RooArgSet &addNormSet=RooArgSet(), Bool_t force=kTRUE)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
RooAbsTestStatistic is the abstract base class for all test statistics.
std::string _addCoefRangeName
GOFOpMode operMode() const
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Forward constant term optimization management calls to component test statistics.
virtual Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
Forward server redirect calls to component test statistics.
void setEventCount(Int_t nEvents)
virtual Double_t getCarry() const
Double_t _evalCarry
avoids loss of precision
virtual void printCompactTreeHook(std::ostream &os, const char *indent="")
Add extra information on component test statistics when printing itself as part of a tree structure.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
The RooDataHist is a container class to hold N-dimensional binned data.
void cacheValidEntries()
Cache the datahist entries with bin centers that are inside/outside the current observable definitio.
RooDataSet is a container class to hold unbinned data.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
RooArgSet * getConnectedParameters(const RooArgSet &observables) const
Return all parameter constraint p.d.f.s on parameters listed in constrainedParams.
RooRealVar represents a variable that can be changed from the outside.
void setRange(const char *name, Double_t min, Double_t max)
Set a fit or plotting range.
const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const
Return binning definition with name.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Overloaded RooArgSet::add() method inserts 'var' into set and registers 'var' as server to owner with...
virtual void removeAll()
Remove all argument inset using remove(const RooAbsArg&).
RooVectorDataStore is the abstract base class for data collection that use a TTree as internal storag...
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * GetName() const
Returns name of object.
const char * Data() const
RooCmdArg SelectVars(const RooArgSet &vars)
RooCmdArg CutRange(const char *rangeName)
static long int sum(long int i)