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
18
19#include "RooAbsTestStatistic.h"
20#include "RooSetProxy.h"
21#include "RooCategoryProxy.h"
22#include "TString.h"
23
24class RooArgSet ;
25class RooAbsData ;
26class RooAbsReal ;
27
29public:
30
31 // Constructors, assignment etc
32 RooAbsOptTestStatistic(const char *name, const char *title, RooAbsReal& real, RooAbsData& data,
33 const RooArgSet& projDeps,
35 RooAbsOptTestStatistic(const RooAbsOptTestStatistic& other, const char* name=nullptr);
36 ~RooAbsOptTestStatistic() override;
37
38 double combinedValue(RooAbsReal** gofArray, Int_t nVal) const override ;
39
41 const RooAbsReal& function() const { return *_funcClone ; }
42
43 RooAbsData& data() ;
44 const RooAbsData& data() const ;
45
46
47 const char* cacheUniqueSuffix() const override;
48
49 // Override this to be always true to force calculation of likelihood without parameters
50 bool isDerived() const override { return true ; }
51
52 void seal(const char* notice="") { _sealed = true ; _sealNotice = notice ; }
53 bool isSealed() const { return _sealed ; }
54 const char* sealNotice() const { return _sealNotice.Data() ; }
55
56private:
57 void setUpBinSampling();
58
59protected:
60
61 bool setDataSlave(RooAbsData& data, bool cloneData=true, bool ownNewDataAnyway=false) override ;
62 void initSlave(RooAbsReal& real, RooAbsData& indata, const RooArgSet& projDeps, const char* rangeName,
63 const char* addCoefRangeName) ;
64
65 friend class RooAbsReal ;
66 friend class RooAbsTestStatistic ;
67
68 virtual bool allowFunctionCache() { return true ; }
69 void constOptimizeTestStatistic(ConstOpCode opcode, bool doAlsoTrackingOpt=true) override ;
70
71 bool redirectServersHook(const RooAbsCollection& newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override ;
72 void printCompactTreeHook(std::ostream& os, const char* indent="") override ;
73 virtual RooArgSet requiredExtraObservables() const { return RooArgSet() ; }
74 void optimizeCaching() ;
75 void optimizeConstantTerms(bool,bool=true) ;
76 void runRecalculateCache(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override;
77
78 RooArgSet* _normSet = nullptr; ///< Pointer to set with observables used for normalization
79 RooArgSet* _funcCloneSet = nullptr; ///< Set owning all components of internal clone of input function
80 RooAbsData* _dataClone = nullptr; ///< Pointer to internal clone if input data
81 RooAbsReal* _funcClone = nullptr; ///< Pointer to internal clone of input function
82 RooArgSet* _projDeps = nullptr; ///< Set of projected observable
83 bool _ownData = false; ///< Do we own the dataset
84 bool _sealed = false; ///< Is test statistic sealed -- i.e. no access to data
85 TString _sealNotice ; ///< User-defined notice shown when reading a sealed likelihood
86 RooArgSet* _funcObsSet = nullptr; ///< List of observables in the pdf expression
87 RooArgSet _cachedNodes ; ///<! List of nodes that are cached as constant expressions
88 bool _skipZeroWeights = false; ///<! Whether to skip entries with weight zero in the evaluation
89
90 RooAbsReal* _origFunc = nullptr; ///< Original function
91 RooAbsData* _origData = nullptr; ///< Original data
92 bool _optimized = false; ///<!
93 double _integrateBinsPrecision{-1.}; // Precision for finer sampling of bins.
94
95 ClassDefOverride(RooAbsOptTestStatistic,0) // Abstract base class for optimized test statistics
96};
97
98#endif
#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
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
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:380