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