Logo ROOT   6.08/07
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 "Riosfwd.h"
20 #include "RooAbsTestStatistic.h"
21 #include "RooSetProxy.h"
22 #include "RooCategoryProxy.h"
23 #include "TString.h"
24 
25 class RooArgSet ;
26 class RooAbsData ;
27 class RooAbsReal ;
28 
30 public:
31 
32  // Constructors, assignment etc
34  RooAbsOptTestStatistic(const char *name, const char *title, RooAbsReal& real, RooAbsData& data,
35  const RooArgSet& projDeps, const char* rangeName=0, const char* addCoefRangeName=0,
36  Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition, Bool_t verbose=kTRUE, Bool_t splitCutRange=kFALSE,
37  Bool_t cloneInputData=kTRUE) ;
38  RooAbsOptTestStatistic(const RooAbsOptTestStatistic& other, const char* name=0);
39  virtual ~RooAbsOptTestStatistic();
40 
41  virtual Double_t combinedValue(RooAbsReal** gofArray, Int_t nVal) const ;
42 
43  RooAbsReal& function() { return *_funcClone ; }
44  const RooAbsReal& function() const { return *_funcClone ; }
45 
46  RooAbsData& data() ;
47  const RooAbsData& data() const ;
48 
49 
50  virtual const char* cacheUniqueSuffix() const { return Form("_%lx", (ULong_t)_dataClone) ; }
51 
52  // Override this to be always true to force calculation of likelihood without parameters
53  virtual Bool_t isDerived() const { return kTRUE ; }
54 
55  void seal(const char* notice="") { _sealed = kTRUE ; _sealNotice = notice ; }
56  Bool_t isSealed() const { return _sealed ; }
57  const char* sealNotice() const { return _sealNotice.Data() ; }
58 
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 
68  virtual Bool_t allowFunctionCache() { return kTRUE ; }
69  void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE) ;
70 
71  virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
72  virtual void printCompactTreeHook(std::ostream& os, const char* indent="") ;
73  virtual RooArgSet requiredExtraObservables() const { return RooArgSet() ; }
74  void optimizeCaching() ;
76 
77  RooArgSet* _normSet ; // Pointer to set with observables used for normalization
78  RooArgSet* _funcCloneSet ; // Set owning all components of internal clone of input function
79  RooAbsData* _dataClone ; // Pointer to internal clone if input data
80  RooAbsReal* _funcClone ; // Pointer to internal clone of input function
81  RooArgSet* _projDeps ; // Set of projected observable
82  Bool_t _ownData ; // Do we own the dataset
83  Bool_t _sealed ; // Is test statistic sealed -- i.e. no access to data
84  TString _sealNotice ; // User-defined notice shown when reading a sealed likelihood
85  RooArgSet* _funcObsSet ; // List of observables in the pdf expression
86  RooArgSet _cachedNodes ; //! List of nodes that are cached as constant expressions
87 
88  RooAbsReal* _origFunc ; // Original function
89  RooAbsData* _origData ; // Original data
91 
92  ClassDef(RooAbsOptTestStatistic,4) // Abstract base class for optimized test statistics
93 };
94 
95 #endif
virtual Bool_t allowFunctionCache()
void seal(const char *notice="")
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 ~RooAbsOptTestStatistic()
Destructor.
Basic string class.
Definition: TString.h:137
RooAbsReal * _origFunc
List of nodes that are cached as constant expressions.
void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Driver function to propagate constant term optimizations in test statistic.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void optimizeConstantTerms(Bool_t, Bool_t=kTRUE)
Driver function to activate global constant term optimization.
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void printCompactTreeHook(std::ostream &os, const char *indent="")
Catch print hook function and forward to function clone.
Bool_t setDataSlave(RooAbsData &data, Bool_t cloneData=kTRUE, Bool_t ownNewDataAnyway=kFALSE)
cout << "RAOTS::setDataSlave(" << this << ") START" << endl ; Change dataset that is used to given on...
virtual Double_t combinedValue(RooAbsReal **gofArray, Int_t nVal) const
Method to combined test statistic results calculated into partitions into the global result...
const char * sealNotice() const
#define ClassDef(name, id)
Definition: Rtypes.h:254
void optimizeCaching()
This method changes the value caching logic for all nodes that depends on any of the observables as d...
friend class RooArgSet
Definition: RooAbsArg.h:469
bool verbose
char * Form(const char *fmt,...)
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
static void indent(ostringstream &buf, int indent_level)
virtual Bool_t isDerived() const
virtual RooArgSet requiredExtraObservables() const
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
virtual const char * cacheUniqueSuffix() const
RooAbsTestStatistic is the abstract base class for all test statistics.
unsigned long ULong_t
Definition: RtypesCore.h:51
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects...
const Bool_t kTRUE
Definition: Rtypes.h:91
RooAbsOptTestStatistic()
Default Constructor.
char name[80]
Definition: TGX11.cxx:109
void initSlave(RooAbsReal &real, RooAbsData &indata, const RooArgSet &projDeps, const char *rangeName, const char *addCoefRangeName)
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
const char * Data() const
Definition: TString.h:349