Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooAbsOptTestStatistic.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooAbsOptGoodnessOfFit.h,v 1.15 2007/05/11 09:11:30 verkerke Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_ABS_OPT_TEST_STATISTIC
17#define ROO_ABS_OPT_TEST_STATISTIC
19// We can't print deprecation warnings when including headers in cling, because
20// this will be done automatically anyway.
21#ifdef __CLING__
22#ifndef ROOFIT_BUILDS_ITSELF
23// These warnings should only be suppressed when building ROOT itself!
24#warning "Including RooAbsOptTestStatistic.h is deprecated, and this header will be removed in ROOT v6.34: it is an implementation detail that should not be part of the public user interface"
25#else
26// If we are builting RooFit itself, this will serve as a reminder to actually
27// remove this deprecate public header. Here is now this needs to be done:
28// 1. Move this header file from inc/ to src/
29// 2. Remove the LinkDef entry, ClassDefOverride, and ClassImpl macros for
30// this class
31// 3. If there are are tests using this class in the test/ directory, change
32// the include to use a relative path the moved header file in the src/
33// directory, e.g. #include <RemovedInterface.h> becomes #include
34// "../src/RemovedInterface.h"
35// 4. Remove this ifndef-else-endif block from the header
36// 5. Remove the deprecation warning at the end of the class declaration
37#include <RVersion.h>
38#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 34, 00)
39#error "Please remove this deprecated public interface."
40#endif
41#endif
42#endif
45#include "RooSetProxy.h"
47#include "TString.h"
48
49class RooArgSet ;
54public:
56 // Constructors, assignment etc
57 RooAbsOptTestStatistic(const char *name, const char *title, RooAbsReal& real, RooAbsData& data,
58 const RooArgSet& projDeps,
60 RooAbsOptTestStatistic(const RooAbsOptTestStatistic& other, const char* name=nullptr);
63 double combinedValue(RooAbsReal** gofArray, Int_t nVal) const override ;
66 const RooAbsReal& function() const { return *_funcClone ; }
67
68 RooAbsData& data() ;
69 const RooAbsData& data() const ;
70
71
72 const char* cacheUniqueSuffix() const override;
73
74 // Override this to be always true to force calculation of likelihood without parameters
75 bool isDerived() const override { return true ; }
76
77 void seal(const char* notice="") { _sealed = true ; _sealNotice = notice ; }
78 bool isSealed() const { return _sealed ; }
79 const char* sealNotice() const { return _sealNotice.Data() ; }
80
81private:
82 void setUpBinSampling();
83
84protected:
85
86 bool setDataSlave(RooAbsData& data, bool cloneData=true, bool ownNewDataAnyway=false) override ;
87 void initSlave(RooAbsReal& real, RooAbsData& indata, const RooArgSet& projDeps, const char* rangeName,
88 const char* addCoefRangeName) ;
89
90 friend class RooAbsReal ;
91 friend class RooAbsTestStatistic ;
92
93 virtual bool allowFunctionCache() { return true ; }
94 void constOptimizeTestStatistic(ConstOpCode opcode, bool doAlsoTrackingOpt=true) override ;
95
96 bool redirectServersHook(const RooAbsCollection& newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override ;
97 void printCompactTreeHook(std::ostream& os, const char* indent="") override ;
98 virtual RooArgSet requiredExtraObservables() const { return RooArgSet() ; }
99 void optimizeCaching() ;
100 void optimizeConstantTerms(bool,bool=true) ;
101 void runRecalculateCache(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override;
102
103 RooArgSet* _normSet = nullptr; ///< Pointer to set with observables used for normalization
104 RooArgSet* _funcCloneSet = nullptr; ///< Set owning all components of internal clone of input function
105 RooAbsData* _dataClone = nullptr; ///< Pointer to internal clone if input data
106 RooAbsReal* _funcClone = nullptr; ///< Pointer to internal clone of input function
107 RooArgSet* _projDeps = nullptr; ///< Set of projected observable
108 bool _ownData = false; ///< Do we own the dataset
109 bool _sealed = false; ///< Is test statistic sealed -- i.e. no access to data
110 TString _sealNotice ; ///< User-defined notice shown when reading a sealed likelihood
111 RooArgSet* _funcObsSet = nullptr; ///< List of observables in the pdf expression
112 RooArgSet _cachedNodes ; ///<! List of nodes that are cached as constant expressions
113 bool _skipZeroWeights = false; ///<! Whether to skip entries with weight zero in the evaluation
114
115 RooAbsReal* _origFunc = nullptr; ///< Original function
116 RooAbsData* _origData = nullptr; ///< Original data
117 bool _optimized = false; ///<!
118 double _integrateBinsPrecision{-1.}; // Precision for finer sampling of bins.
119
120 ClassDefOverride(RooAbsOptTestStatistic,0) // Abstract base class for optimized test statistics
121#ifndef ROOFIT_BUILDS_ITSELF
122} R__DEPRECATED(6,34, "RooAbsOptTestStatistic is a RooFit implementation detail that should not be instantiated in user code.");
123#else
124};
125#endif
126
127#endif
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition RConfig.hxx:504
int Int_t
Definition RtypesCore.h:45
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition TGX11.cxx:110
Abstract container object that can hold multiple RooAbsArg objects.
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract base class for test statistics objects that evaluate a function or PDF at each point of a gi...
bool setDataSlave(RooAbsData &data, bool cloneData=true, bool ownNewDataAnyway=false) override
Change dataset that is used to given one.
~RooAbsOptTestStatistic() override
Destructor.
RooAbsReal * _funcClone
Pointer to internal clone of input function.
bool _sealed
Is test statistic sealed – i.e. no access to data.
void optimizeConstantTerms(bool, bool=true)
Driver function to activate global constant term optimization.
double combinedValue(RooAbsReal **gofArray, Int_t nVal) const override
Method to combined test statistic results calculated into partitions into the global result.
void seal(const char *notice="")
void runRecalculateCache(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override
const RooAbsReal & function() const
RooAbsReal * _origFunc
Original function.
bool _ownData
Do we own the dataset.
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
bool isDerived() const override
Does value or shape of this arg depend on any other arg?
RooAbsData * _origData
Original data.
bool _skipZeroWeights
! Whether to skip entries with weight zero in the evaluation
RooArgSet * _funcObsSet
List of observables in the pdf expression.
void constOptimizeTestStatistic(ConstOpCode opcode, bool doAlsoTrackingOpt=true) override
Driver function to propagate constant term optimizations in test statistic.
void setUpBinSampling()
Inspect PDF to find out if we are doing a binned fit to a 1-dimensional unbinned PDF.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override
Catch server redirect calls and forward to internal clone of function.
RooArgSet _cachedNodes
! List of nodes that are cached as constant expressions
void initSlave(RooAbsReal &real, RooAbsData &indata, const RooArgSet &projDeps, const char *rangeName, const char *addCoefRangeName)
TString _sealNotice
User-defined notice shown when reading a sealed likelihood.
void printCompactTreeHook(std::ostream &os, const char *indent="") override
Catch print hook function and forward to function clone.
RooArgSet * _normSet
Pointer to set with observables used for normalization.
const char * cacheUniqueSuffix() const override
Returns a suffix string that is unique for RooAbsOptTestStatistic instances that don't share the same...
RooArgSet * _funcCloneSet
Set owning all components of internal clone of input function.
RooAbsData * _dataClone
Pointer to internal clone if input data.
virtual RooArgSet requiredExtraObservables() const
RooArgSet * _projDeps
Set of projected observable.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
Abstract base class for all test statistics.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376