Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
28 class RooAbsOptTestStatistic : public RooAbsTestStatistic {
29 public:
30 
31  // Constructors, assignment etc
32  RooAbsOptTestStatistic() ;
33  RooAbsOptTestStatistic(const char *name, const char *title, RooAbsReal& real, RooAbsData& data,
34  const RooArgSet& projDeps, const char* rangeName=0, const char* addCoefRangeName=0,
35  Int_t nCPU=1, RooFit::MPSplit interleave=RooFit::BulkPartition, Bool_t verbose=kTRUE, Bool_t splitCutRange=kFALSE,
36  Bool_t cloneInputData=kTRUE) ;
37  RooAbsOptTestStatistic(const RooAbsOptTestStatistic& other, const char* name=0);
38  virtual ~RooAbsOptTestStatistic();
39 
40  virtual Double_t combinedValue(RooAbsReal** gofArray, Int_t nVal) const ;
41 
42  RooAbsReal& function() { return *_funcClone ; }
43  const RooAbsReal& function() const { return *_funcClone ; }
44 
45  RooAbsData& data() ;
46  const RooAbsData& data() const ;
47 
48 
49  virtual const char* cacheUniqueSuffix() const { return Form("_%lx", (ULong_t)_dataClone) ; }
50 
51  // Override this to be always true to force calculation of likelihood without parameters
52  virtual Bool_t isDerived() const { return kTRUE ; }
53 
54  void seal(const char* notice="") { _sealed = kTRUE ; _sealNotice = notice ; }
55  Bool_t isSealed() const { return _sealed ; }
56  const char* sealNotice() const { return _sealNotice.Data() ; }
57 
58 
59 protected:
60 
61  Bool_t setDataSlave(RooAbsData& data, Bool_t cloneData=kTRUE, Bool_t ownNewDataAnyway=kFALSE) ;
62  void initSlave(RooAbsReal& real, RooAbsData& indata, const RooArgSet& projDeps, const char* rangeName,
63  const char* addCoefRangeName) ;
64 
65  friend class RooAbsReal ;
66 
67  virtual Bool_t allowFunctionCache() { return kTRUE ; }
68  void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE) ;
69 
70  virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
71  virtual void printCompactTreeHook(std::ostream& os, const char* indent="") ;
72  virtual RooArgSet requiredExtraObservables() const { return RooArgSet() ; }
73  void optimizeCaching() ;
74  void optimizeConstantTerms(Bool_t,Bool_t=kTRUE) ;
75 
76  RooArgSet* _normSet ; // Pointer to set with observables used for normalization
77  RooArgSet* _funcCloneSet ; // Set owning all components of internal clone of input function
78  RooAbsData* _dataClone ; // Pointer to internal clone if input data
79  RooAbsReal* _funcClone ; // Pointer to internal clone of input function
80  RooArgSet* _projDeps ; // Set of projected observable
81  Bool_t _ownData ; // Do we own the dataset
82  Bool_t _sealed ; // Is test statistic sealed -- i.e. no access to data
83  TString _sealNotice ; // User-defined notice shown when reading a sealed likelihood
84  RooArgSet* _funcObsSet ; // List of observables in the pdf expression
85  RooArgSet _cachedNodes ; //! List of nodes that are cached as constant expressions
86 
87  RooAbsReal* _origFunc ; // Original function
88  RooAbsData* _origData ; // Original data
89  Bool_t _optimized ; //!
90 
91  ClassDef(RooAbsOptTestStatistic,4) // Abstract base class for optimized test statistics
92 };
93 
94 #endif