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
36 /// Initializer method called upon attachment to given RooMCStudy object
37 bool doInitializeInstance(RooMCStudy& /*study*/) ;
38
39 /// Initializer called immediately after attachment to RooMCStudy object and initialization of module base class
40 virtual bool initializeInstance() {
41 return true ;
42 }
43
44 /// Method called at the beginning of each RooMCStudy run
45 virtual bool initializeRun(Int_t /*numSamples*/) {
46 return true ;
47 }
48
49 /// Method called at the end of each RooMCStudy run. If a RooDataSet is returned, it must have a length equal to
50 /// the number of toy experiments performed and will merged with the fitpar dataset of RooMCStudy.
52 return nullptr ;
53 }
54
55 /// Method called after resetting of generator parameters to initial values and before call to generator context
56 /// Any modifications to generator parameters will affect next generation operation (only)
57 virtual bool processBeforeGen(Int_t /*sampleNum*/) {
58 return true ;
59 }
60
61 /// Method called after generation of toy data sample and resetting of fit parameters to initial values and before
62 /// actual fit is performed. Any modifications to fit parameters will apply to next fit operation. Note that setConstant
63 /// flag of fit parameters are not explicitly reset by RooMCStudy, so any changes made to these flags here will persist
64 virtual bool processBetweenGenAndFit(Int_t /*sampleNum*/) {
65 return true ;
66 }
67
68 /// Method called after fit has been performed.
69 virtual bool processAfterFit(Int_t /*sampleNum*/) {
70 return true ;
71 }
72
73protected:
74
75 // Interface methods to RooMCStudy objects,
76 // which are only functional after module has been attached to a RooMCStudy object
77
78 /// Refit model using original or specified data sample
80
81 /// Return generate sample
83 return _mcs ? _mcs->_genSample : nullptr ;
84 }
85
86 /// Return generator pdf
88 return _mcs ? _mcs->_genModel : nullptr ;
89 }
90
91 // Accessor for generator context, generator parameters, prototype data and projected dependents.
93 return _mcs ? _mcs->_genContext.get() : nullptr ;
94 }
95
96 /// Return initial value of generator model parameters
98 return _mcs ? &_mcs->_genInitParams : nullptr ;
99 }
100
101 /// Return current value of generator model parameters
103 return _mcs ? &_mcs->_genParams : nullptr ;
104 }
105
106 /// Return generator prototype data provided by user
108 return _mcs ? _mcs->_genProtoData : nullptr ;
109 }
110
111 /// Return projected observables
113 return _mcs ? &_mcs->_projDeps : nullptr ;
114 }
115
116 // Accessors for fit observables, fit model, current and initial fit parameters and NLL value
117
118 /// Return fit model observables
120 return _mcs ? &_mcs->_dependents : nullptr ;
121 }
122
123 /// Return all observables
125 return _mcs ? &_mcs->_allDependents : nullptr ;
126 }
127
128 /// Return fit model
130 return _mcs ? _mcs->_fitModel : nullptr ;
131 }
132
133 /// Return initial value of parameters of fit model
135 return _mcs ? &_mcs->_fitInitParams : nullptr ;
136 }
137
138 /// Return current value of parameters of fit model
140 return _mcs ? &_mcs-> _fitParams : nullptr ;
141 }
142
143 /// Return pointer to RooRealVar holding minimized -log(L) value
145 return _mcs ? _mcs->_nllVar.get() : nullptr ;
146 }
147
148 // Accessors for fit options, generator and MCstudy configuration flags
149
150 /// Return list of fit options provided by user
152 return _mcs ? &_mcs->_fitOptList : nullptr ;
153 }
154
155 /// If true extended mode generation is requested
156 bool extendedGen() {
157 return _mcs ? _mcs->_extendedGen : false ;
158 }
159
160 /// If true binning of data between generating and fitting is requested
161 bool binGenData() {
162 return _mcs ? _mcs->_binGenData : false ;
163 }
164
165 /// Return expected number of events from generator model
166 double numExpGen() {
167 return _mcs ? _mcs->_nExpGen : 0 ;
168 }
169
170 /// If true randomization of prototype data order is requested
171 bool randProto() {
172 return _mcs ? _mcs->_randProto : false ;
173 }
174
175 /// If true verbose message in the generation step is requested
176 bool verboseGen() {
177 return _mcs ? _mcs->_verboseGen : false ;
178 }
179
180private:
181
182 RooMCStudy* _mcs ; ///< Pointer to RooMCStudy object module is attached to
183
184 ClassDefOverride(RooAbsMCStudyModule,0) // Monte Carlo study manager add-on module
185} ;
186
187
188#endif
189
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract base class for generator contexts of RooAbsPdf objects.
Base class for add-on modules to RooMCStudy that can perform additional calculations on each generate...
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 attachment to given RooMCStudy object.
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
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.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
Helper class to facilitate Monte Carlo studies such as 'goodness-of-fit' studies, that involve fittin...
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
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
Variable that can be changed from the outside.
Definition RooRealVar.h:37
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:35