Logo ROOT   6.14/05
Reference Guide
RooAbsMCStudyModule.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooAbsMCStudyModule.h,v 1.2 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 
17 #ifndef ROO_ABS_MC_STUDY_MODULE
18 #define ROO_ABS_MC_STUDY_MODULE
19 
20 #include "TList.h"
21 #include "RooArgSet.h"
22 #include "RooMCStudy.h"
23 class RooAbsPdf;
24 class RooDataSet ;
25 class RooAbsData ;
26 class RooAbsGenContext ;
27 class RooFitResult ;
28 class RooPlot ;
29 class RooRealVar ;
30 
31 class RooAbsMCStudyModule : public TNamed {
32 public:
33 
34  RooAbsMCStudyModule(const char* name, const char* title) ;
36  virtual ~RooAbsMCStudyModule() {} ;
37 
38  // Initializer method called upon attachement to given RooMCStudy object
40 
42  // Initializer called immediately after attachment to RooMCStudy object and initialization of module base class
43  return kTRUE ;
44  }
45 
46  virtual Bool_t initializeRun(Int_t /*numSamples*/) {
47  // Method called at the beginning of each RooMCStudy run
48  return kTRUE ;
49  }
50 
51  virtual RooDataSet* finalizeRun() {
52  // Method called at the end of each RooMCStudy run. If a RooDataSet is returned, it must have a length equal to
53  // the number of toy experiments performed and will merged with the fitpar dataset of RooMCStudy.
54  return 0 ;
55  }
56 
57  virtual Bool_t processBeforeGen(Int_t /*sampleNum*/) {
58  // Method called after resetting of generator parameters to initial values and before call to generator context
59  // Any modifications to generator parameters will affect next generation operation (only)
60  return kTRUE ;
61  }
62 
63 
64  virtual Bool_t processBetweenGenAndFit(Int_t /*sampleNum*/) {
65  // Method called after generation of toy data sample and resetting of fit parameters to initial values and before
66  // actual fit is performed. Any modifications to fit parameters will apply to next fit operation. Note that setConstant
67  // flag of fit parameters are not explicitly reset by RooMCStudy, so any changes made to these flags here will persist
68  return kTRUE ;
69  }
70 
71  virtual Bool_t processAfterFit(Int_t /*sampleNum*/) {
72  // Method called after fit has been performed.
73  return kTRUE ;
74  }
75 
76 protected:
77 
78  // Interface methods to RooMCStudy objects,
79  // which are only functional after module has been attached to a RooMCStudy object
80 
81  RooFitResult* refit(RooAbsData* inGenSample=0) {
82  // Refit model using orignal or specified data sample
83  if (_mcs) return _mcs->refit(inGenSample) ; else return 0 ;
84  }
85 
87  // Return generate sample
88  return _mcs ? _mcs->_genSample : 0 ;
89  }
91  // Return generator pdf
92  return _mcs ? _mcs->_genModel : 0 ;
93  }
94 
95  // Accessor for generator context, generator parameters, prototype data and projected dependents
97  // Return generator context
98  return _mcs ? _mcs->_genContext : 0 ;
99  }
101  // Return initial value of generator model parameters
102  return _mcs ? _mcs->_genInitParams : 0 ;
103  }
105  // Return current value of generator model parameters
106  return _mcs ? _mcs->_genParams : 0 ;
107  }
109  // Return generator prototype data provided by user
110  return _mcs ? _mcs->_genProtoData : 0 ;
111  }
113  // Return projected observables
114  return _mcs ? &_mcs->_projDeps : 0 ;
115  }
116 
117  // Accessors for fit observables, fit model, current and initial fit parameters and NLL value
119  // Return fit model observables
120  return _mcs ? &_mcs->_dependents : 0 ;
121  }
123  // Returna all observables
124  return _mcs ? &_mcs->_allDependents : 0 ;
125  }
127  // Return fit model
128  return _mcs ? _mcs->_fitModel : 0 ;
129  }
131  // Return initial value of parameters of fit model
132  return _mcs ? _mcs->_fitInitParams : 0 ;
133  }
135  // Return current value of parameters of fit model
136  return _mcs ? _mcs-> _fitParams : 0 ;
137  }
139  // Return pointer to RooRealVar holding minimized -log(L) value
140  return _mcs ? _mcs->_nllVar : 0 ;
141  }
142 
143  // Accessors for fit options, generator annd MCstudy configuration flags
144  const char* fitOptions() {
145  // Return fit option string provided user
146  return _mcs ? _mcs->_fitOptions.Data() : 0 ;
147  }
149  // Return list of fit options provided by user
150  return _mcs ? &_mcs->_fitOptList : 0 ;
151  }
153  // If true extended mode generation is requested
154  return _mcs ? _mcs->_extendedGen : 0 ;
155  }
157  // If true binning of data between generating and fitting is requested
158  return _mcs ? _mcs->_binGenData : 0 ;
159  }
161  // Return expected number of events from generator model
162  return _mcs ? _mcs->_nExpGen : 0 ;
163  }
165  // If true randomization of prototype data order is requested
166  return _mcs ? _mcs->_randProto : 0 ;
167  }
169  // If true verbose message in the generation step is requested
170  return _mcs ? _mcs->_verboseGen : 0 ;
171  }
172 
173 private:
174 
175  RooMCStudy* _mcs ; // Pointer to RooMCStudy object module is attached to
176 
177  ClassDef(RooAbsMCStudyModule,0) // Monte Carlo study manager add-on module
178 } ;
179 
180 
181 #endif
182 
Bool_t doInitializeInstance(RooMCStudy &)
Store reference to RooMCStudy object that this module relates to and call internal module initializat...
virtual Bool_t initializeInstance()
RooFitResult * refit(RooAbsData *genSample=0)
Redo fit on 'current' toy sample, or if genSample is not NULL do fit on given sample instead...
Definition: RooMCStudy.cxx:792
RooMCStudy is a help class to facilitate Monte Carlo studies such as 'goodness-of-fit' studies...
Definition: RooMCStudy.h:32
RooRealVar * _nllVar
Definition: RooMCStudy.h:127
RooAbsData * genSample()
RooAbsMCStudyModule is a base class for add-on modules to RooMCStudy that can perform additional calc...
Bool_t _verboseGen
Definition: RooMCStudy.h:142
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
RooArgSet _projDeps
Definition: RooMCStudy.h:117
#define ClassDef(name, id)
Definition: Rtypes.h:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
RooArgSet * _genParams
Definition: RooMCStudy.h:115
RooAbsPdf * _genModel
Definition: RooMCStudy.h:112
Bool_t _binGenData
Definition: RooMCStudy.h:137
const RooDataSet * _genProtoData
Definition: RooMCStudy.h:116
virtual Bool_t initializeRun(Int_t)
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
RooAbsGenContext * genContext()
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
RooAbsPdf * _fitModel
Definition: RooMCStudy.h:124
TString _fitOptions
Definition: RooMCStudy.h:134
RooAbsMCStudyModule(const char *name, const char *title)
Constructor.
RooAbsData * _genSample
Definition: RooMCStudy.h:111
virtual Bool_t processAfterFit(Int_t)
RooLinkedList * fitOptList()
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:29
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
Definition: RooPlot.h:41
const RooDataSet * genProtoData()
virtual RooDataSet * finalizeRun()
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
virtual Bool_t processBeforeGen(Int_t)
RooArgSet _dependents
Definition: RooMCStudy.h:122
double Double_t
Definition: RtypesCore.h:55
virtual Bool_t processBetweenGenAndFit(Int_t)
RooLinkedList _fitOptList
Definition: RooMCStudy.h:135
Double_t _nExpGen
Definition: RooMCStudy.h:138
Bool_t _extendedGen
Definition: RooMCStudy.h:136
RooAbsGenContext * _genContext
Definition: RooMCStudy.h:113
RooArgSet * _fitInitParams
Definition: RooMCStudy.h:125
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
Bool_t _randProto
Definition: RooMCStudy.h:139
RooArgSet _allDependents
Definition: RooMCStudy.h:123
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
RooFitResult * refit(RooAbsData *inGenSample=0)
RooArgSet * _genInitParams
Definition: RooMCStudy.h:114
const char * Data() const
Definition: TString.h:364