Logo ROOT  
Reference Guide
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 
24 class RooArgSet ;
25 class RooAbsData ;
26 class RooAbsReal ;
27 
29 public:
30 
31  // Constructors, assignment etc
33  RooAbsOptTestStatistic(const char *name, const char *title, RooAbsReal& real, RooAbsData& data,
34  const RooArgSet& projDeps,
36  RooAbsOptTestStatistic(const RooAbsOptTestStatistic& other, const char* name=0);
37  virtual ~RooAbsOptTestStatistic();
38 
39  virtual Double_t combinedValue(RooAbsReal** gofArray, Int_t nVal) const ;
40 
41  RooAbsReal& function() { return *_funcClone ; }
42  const RooAbsReal& function() const { return *_funcClone ; }
43 
44  RooAbsData& data() ;
45  const RooAbsData& data() const ;
46 
47 
48  virtual const char* cacheUniqueSuffix() const { return Form("_%lx", (ULong_t)_dataClone) ; }
49 
50  // Override this to be always true to force calculation of likelihood without parameters
51  virtual Bool_t isDerived() const { return kTRUE ; }
52 
53  void seal(const char* notice="") { _sealed = kTRUE ; _sealNotice = notice ; }
54  Bool_t isSealed() const { return _sealed ; }
55  const char* sealNotice() const { return _sealNotice.Data() ; }
56 
57 private:
58  void setUpBinSampling();
59 
60 protected:
61 
62  Bool_t setDataSlave(RooAbsData& data, Bool_t cloneData=kTRUE, Bool_t ownNewDataAnyway=kFALSE) ;
63  void initSlave(RooAbsReal& real, RooAbsData& indata, const RooArgSet& projDeps, const char* rangeName,
64  const char* addCoefRangeName) ;
65 
66  friend class RooAbsReal ;
67  friend class RooAbsTestStatistic ;
68 
69  virtual Bool_t allowFunctionCache() { return kTRUE ; }
70  void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE) ;
71 
72  virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
73  virtual void printCompactTreeHook(std::ostream& os, const char* indent="") ;
74  virtual RooArgSet requiredExtraObservables() const { return RooArgSet() ; }
75  void optimizeCaching() ;
77 
78  RooArgSet* _normSet ; // Pointer to set with observables used for normalization
79  RooArgSet* _funcCloneSet ; // Set owning all components of internal clone of input function
80  RooAbsData* _dataClone{nullptr}; // Pointer to internal clone if input data
81  RooAbsReal* _funcClone ; // Pointer to internal clone of input function
82  RooArgSet* _projDeps ; // Set of projected observable
83  Bool_t _ownData ; // Do we own the dataset
84  Bool_t _sealed ; // 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 ; // List of observables in the pdf expression
87  RooArgSet _cachedNodes ; //! List of nodes that are cached as constant expressions
88 
89  RooAbsReal* _origFunc ; // Original function
90  RooAbsData* _origData ; // Original data
92  double _integrateBinsPrecision{-1.}; // Precision for finer sampling of bins.
93 
94  ClassDef(RooAbsOptTestStatistic,5) // Abstract base class for optimized test statistics
95 };
96 
97 #endif
RooAbsOptTestStatistic::_funcObsSet
RooArgSet * _funcObsSet
Definition: RooAbsOptTestStatistic.h:86
RooAbsOptTestStatistic::setUpBinSampling
void setUpBinSampling()
Inspect PDF to find out if we are doing a binned fit to a 1-dimensional unbinned PDF.
Definition: RooAbsOptTestStatistic.cxx:810
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
RooAbsOptTestStatistic::combinedValue
virtual Double_t combinedValue(RooAbsReal **gofArray, Int_t nVal) const
Method to combined test statistic results calculated into partitions into the global result.
Definition: RooAbsOptTestStatistic.cxx:441
RooAbsOptTestStatistic::isSealed
Bool_t isSealed() const
Definition: RooAbsOptTestStatistic.h:54
RooAbsOptTestStatistic::redirectServersHook
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.
Definition: RooAbsOptTestStatistic.cxx:462
RooAbsOptTestStatistic::_funcCloneSet
RooArgSet * _funcCloneSet
Definition: RooAbsOptTestStatistic.h:79
RooAbsData
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:49
TString::Data
const char * Data() const
Definition: TString.h:369
Form
char * Form(const char *fmt,...)
RooAbsOptTestStatistic::_funcClone
RooAbsReal * _funcClone
Definition: RooAbsOptTestStatistic.h:81
RooAbsOptTestStatistic::RooAbsOptTestStatistic
RooAbsOptTestStatistic()
Default Constructor.
Definition: RooAbsOptTestStatistic.cxx:74
RooAbsTestStatistic.h
RooAbsOptTestStatistic::allowFunctionCache
virtual Bool_t allowFunctionCache()
Definition: RooAbsOptTestStatistic.h:69
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooAbsOptTestStatistic::_dataClone
RooAbsData * _dataClone
Definition: RooAbsOptTestStatistic.h:80
RooSetProxy.h
TString
Basic string class.
Definition: TString.h:136
RooAbsOptTestStatistic::data
RooAbsData & data()
Definition: RooAbsOptTestStatistic.cxx:773
RooAbsOptTestStatistic::constOptimizeTestStatistic
void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Driver function to propagate constant term optimizations in test statistic.
Definition: RooAbsOptTestStatistic.cxx:494
TString.h
RooAbsOptTestStatistic::seal
void seal(const char *notice="")
Definition: RooAbsOptTestStatistic.h:53
bool
RooAbsOptTestStatistic::_sealNotice
TString _sealNotice
Definition: RooAbsOptTestStatistic.h:85
RooAbsOptTestStatistic::optimizeConstantTerms
void optimizeConstantTerms(Bool_t, Bool_t=kTRUE)
Driver function to activate global constant term optimization.
Definition: RooAbsOptTestStatistic.cxx:597
RooAbsOptTestStatistic::optimizeCaching
void optimizeCaching()
This method changes the value caching logic for all nodes that depends on any of the observables as d...
Definition: RooAbsOptTestStatistic.cxx:568
RooAbsOptTestStatistic::initSlave
void initSlave(RooAbsReal &real, RooAbsData &indata, const RooArgSet &projDeps, const char *rangeName, const char *addCoefRangeName)
Definition: RooAbsOptTestStatistic.cxx:179
RooAbsTestStatistic
RooAbsTestStatistic is the abstract base class for all test statistics.
Definition: RooAbsTestStatistic.h:39
RooAbsOptTestStatistic::setDataSlave
Bool_t setDataSlave(RooAbsData &data, Bool_t cloneData=kTRUE, Bool_t ownNewDataAnyway=kFALSE)
Change dataset that is used to given one.
Definition: RooAbsOptTestStatistic.cxx:707
RooAbsOptTestStatistic::_integrateBinsPrecision
double _integrateBinsPrecision
Definition: RooAbsOptTestStatistic.h:92
RooAbsOptTestStatistic::printCompactTreeHook
virtual void printCompactTreeHook(std::ostream &os, const char *indent="")
Catch print hook function and forward to function clone.
Definition: RooAbsOptTestStatistic.cxx:475
RooAbsOptTestStatistic::_projDeps
RooArgSet * _projDeps
Definition: RooAbsOptTestStatistic.h:82
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
RooAbsOptTestStatistic::_ownData
Bool_t _ownData
Definition: RooAbsOptTestStatistic.h:83
RooAbsCollection
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Definition: RooAbsCollection.h:33
RooAbsArg::RooArgSet
friend class RooArgSet
Definition: RooAbsArg.h:599
RooAbsTestStatistic::Configuration
Definition: RooAbsTestStatistic.h:43
RooAbsOptTestStatistic::_optimized
Bool_t _optimized
Definition: RooAbsOptTestStatistic.h:91
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
RooAbsOptTestStatistic::isDerived
virtual Bool_t isDerived() const
Does value or shape of this arg depend on any other arg?
Definition: RooAbsOptTestStatistic.h:51
RooAbsOptTestStatistic::sealNotice
const char * sealNotice() const
Definition: RooAbsOptTestStatistic.h:55
RooAbsOptTestStatistic::_cachedNodes
RooArgSet _cachedNodes
Definition: RooAbsOptTestStatistic.h:87
RooCategoryProxy.h
RooAbsOptTestStatistic::requiredExtraObservables
virtual RooArgSet requiredExtraObservables() const
Definition: RooAbsOptTestStatistic.h:74
RooAbsOptTestStatistic::cacheUniqueSuffix
virtual const char * cacheUniqueSuffix() const
Definition: RooAbsOptTestStatistic.h:48
Double_t
double Double_t
Definition: RtypesCore.h:59
RooAbsOptTestStatistic::_sealed
Bool_t _sealed
Definition: RooAbsOptTestStatistic.h:84
RooAbsOptTestStatistic
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
Definition: RooAbsOptTestStatistic.h:28
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
RooAbsOptTestStatistic::_normSet
RooArgSet * _normSet
Definition: RooAbsOptTestStatistic.h:78
RooAbsArg::ConstOpCode
ConstOpCode
Definition: RooAbsArg.h:388
RooAbsOptTestStatistic::_origData
RooAbsData * _origData
Definition: RooAbsOptTestStatistic.h:90
RooAbsOptTestStatistic::~RooAbsOptTestStatistic
virtual ~RooAbsOptTestStatistic()
Destructor.
Definition: RooAbsOptTestStatistic.cxx:419
RooAbsOptTestStatistic::_origFunc
RooAbsReal * _origFunc
List of nodes that are cached as constant expressions.
Definition: RooAbsOptTestStatistic.h:89
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:33
int