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 ~RooAbsMCStudyModule() override {} ;
36
37 /// Initializer method called upon attachement to given RooMCStudy object
38 bool doInitializeInstance(RooMCStudy& /*study*/) ;
39
40 /// Initializer called immediately after attachment to RooMCStudy object and initialization of module base class
41 virtual bool initializeInstance() {
42 return true ;
43 }
44
45 /// Method called at the beginning of each RooMCStudy run
46 virtual bool initializeRun(Int_t /*numSamples*/) {
47 return true ;
48 }
49
50 /// Method called at the end of each RooMCStudy run. If a RooDataSet is returned, it must have a length equal to
51 /// the number of toy experiments performed and will merged with the fitpar dataset of RooMCStudy.
53 return nullptr ;
54 }
55
56 /// Method called after resetting of generator parameters to initial values and before call to generator context
57 /// Any modifications to generator parameters will affect next generation operation (only)
58 virtual bool processBeforeGen(Int_t /*sampleNum*/) {
59 return true ;
60 }
61
62 /// Method called after generation of toy data sample and resetting of fit parameters to initial values and before
63 /// actual fit is performed. Any modifications to fit parameters will apply to next fit operation. Note that setConstant
64 /// flag of fit parameters are not explicitly reset by RooMCStudy, so any changes made to these flags here will persist
65 virtual bool processBetweenGenAndFit(Int_t /*sampleNum*/) {
66 return true ;
67 }
68
69 /// Method called after fit has been performed.
70 virtual bool processAfterFit(Int_t /*sampleNum*/) {
71 return true ;
72 }
73
74protected:
75
76 // Interface methods to RooMCStudy objects,
77 // which are only functional after module has been attached to a RooMCStudy object
78
79 /// Refit model using original or specified data sample
81
82 /// Return generate sample
84 return _mcs ? _mcs->_genSample : nullptr ;
85 }
86
87 /// Return generator pdf
89 return _mcs ? _mcs->_genModel : nullptr ;
90 }
91
92 // Accessor for generator context, generator parameters, prototype data and projected dependents.
94 return _mcs ? _mcs->_genContext.get() : nullptr ;
95 }
96
97 /// Return initial value of generator model parameters
99 return _mcs ? &_mcs->_genInitParams : nullptr ;
100 }
101
102 /// Return current value of generator model parameters
104 return _mcs ? &_mcs->_genParams : nullptr ;
105 }
106
107 /// Return generator prototype data provided by user
109 return _mcs ? _mcs->_genProtoData : nullptr ;
110 }
111
112 /// Return projected observables
114 return _mcs ? &_mcs->_projDeps : nullptr ;
115 }
116
117 // Accessors for fit observables, fit model, current and initial fit parameters and NLL value
118
119 /// Return fit model observables
121 return _mcs ? &_mcs->_dependents : nullptr ;
122 }
123
124 /// Return all observables
126 return _mcs ? &_mcs->_allDependents : nullptr ;
127 }
128
129 /// Return fit model
131 return _mcs ? _mcs->_fitModel : nullptr ;
132 }
133
134 /// Return initial value of parameters of fit model
136 return _mcs ? &_mcs->_fitInitParams : nullptr ;
137 }
138
139 /// Return current value of parameters of fit model
141 return _mcs ? &_mcs-> _fitParams : nullptr ;
142 }
143
144 /// Return pointer to RooRealVar holding minimized -log(L) value
146 return _mcs ? _mcs->_nllVar.get() : nullptr ;
147 }
148
149 // Accessors for fit options, generator and MCstudy configuration flags
150
151 /// Return list of fit options provided by user
153 return _mcs ? &_mcs->_fitOptList : nullptr ;
154 }
155
156 /// If true extended mode generation is requested
157 bool extendedGen() {
158 return _mcs ? _mcs->_extendedGen : false ;
159 }
160
161 /// If true binning of data between generating and fitting is requested
162 bool binGenData() {
163 return _mcs ? _mcs->_binGenData : false ;
164 }
165
166 /// Return expected number of events from generator model
167 double numExpGen() {
168 return _mcs ? _mcs->_nExpGen : 0 ;
169 }
170
171 /// If true randomization of prototype data order is requested
172 bool randProto() {
173 return _mcs ? _mcs->_randProto : false ;
174 }
175
176 /// If true verbose message in the generation step is requested
177 bool verboseGen() {
178 return _mcs ? _mcs->_verboseGen : false ;
179 }
180
181private:
182
183 RooMCStudy* _mcs ; ///< Pointer to RooMCStudy object module is attached to
184
185 ClassDefOverride(RooAbsMCStudyModule,0) // Monte Carlo study manager add-on module
186} ;
187
188
189#endif
190
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:59
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...
RooArgSet * allDependents()
Return all observables.
RooRealVar * nllVar()
Return pointer to RooRealVar holding minimized -log(L) value.
RooMCStudy * _mcs
Pointer to RooMCStudy object module is attached to.
virtual RooDataSet * finalizeRun()
Method called at the end of each RooMCStudy run.
bool extendedGen()
If true extended mode generation is requested.
virtual bool initializeInstance()
Initializer called immediately after attachment to RooMCStudy object and initialization of module bas...
RooAbsData * genSample()
Return generate sample.
virtual bool initializeRun(Int_t)
Method called at the beginning of each RooMCStudy run.
RooAbsGenContext * genContext()
bool randProto()
If true randomization of prototype data order is requested.
RooLinkedList * fitOptList()
Return list of fit options provided by user.
virtual bool processBetweenGenAndFit(Int_t)
Method called after generation of toy data sample and resetting of fit parameters to initial values a...
double numExpGen()
Return expected number of events from generator model.
const RooDataSet * genProtoData()
Return generator prototype data provided by user.
RooFit::OwningPtr< RooFitResult > refit(RooAbsData *inGenSample=nullptr)
Refit model using original or specified data sample.
RooArgSet * genInitParams()
Return initial value of generator model parameters.
virtual bool processAfterFit(Int_t)
Method called after fit has been performed.
RooAbsPdf * fitModel()
Return fit model.
RooArgSet * fitParams()
Return current value of parameters of fit model.
bool binGenData()
If true binning of data between generating and fitting is requested.
RooArgSet * genParams()
Return current value of generator model parameters.
RooArgSet * projDeps()
Return projected observables.
RooAbsPdf * genModel()
Return generator pdf.
bool verboseGen()
If true verbose message in the generation step is requested.
virtual bool processBeforeGen(Int_t)
Method called after resetting of generator parameters to initial values and before call to generator ...
RooArgSet * fitInitParams()
Return initial value of parameters of fit model.
RooArgSet * dependents()
Return fit model observables.
bool doInitializeInstance(RooMCStudy &)
Initializer method called upon attachement to given RooMCStudy object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
RooDataSet is a container class to hold unbinned data.
Definition RooDataSet.h:57
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
Currently generated sample.
Definition RooMCStudy.h:107
RooArgSet _projDeps
List of projected dependents in fit.
Definition RooMCStudy.h:113
RooArgSet _genParams
List of actual generator parameters.
Definition RooMCStudy.h:111
RooArgSet _dependents
List of dependents.
Definition RooMCStudy.h:118
bool _verboseGen
Verbose generation?
Definition RooMCStudy.h:137
RooArgSet _genInitParams
List of original generator parameters.
Definition RooMCStudy.h:110
double _nExpGen
Definition RooMCStudy.h:133
bool _extendedGen
Definition RooMCStudy.h:131
const RooDataSet * _genProtoData
Generator prototype data set.
Definition RooMCStudy.h:112
bool _binGenData
Definition RooMCStudy.h:132
std::unique_ptr< RooAbsGenContext > _genContext
Generator context.
Definition RooMCStudy.h:109
RooAbsPdf * _genModel
Generator model.
Definition RooMCStudy.h:108
std::unique_ptr< RooRealVar > _nllVar
Definition RooMCStudy.h:123
RooLinkedList _fitOptList
Definition RooMCStudy.h:130
RooArgSet _allDependents
List of generate + prototype dependents.
Definition RooMCStudy.h:119
RooAbsPdf * _fitModel
Fit model.
Definition RooMCStudy.h:120
bool _randProto
Definition RooMCStudy.h:134
RooArgSet _fitInitParams
List of initial values of fit parameters.
Definition RooMCStudy.h:121
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:40
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:43