Logo ROOT   6.16/01
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"
23class RooAbsPdf;
24class RooDataSet ;
25class RooAbsData ;
26class RooAbsGenContext ;
27class RooFitResult ;
28class RooPlot ;
29class RooRealVar ;
30
32public:
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
76protected:
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
173private:
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
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassDef(name, id)
Definition: Rtypes.h:324
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
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)
RooAbsData * genSample()
RooAbsGenContext * genContext()
RooLinkedList * fitOptList()
virtual Bool_t initializeInstance()
const RooDataSet * genProtoData()
RooAbsMCStudyModule(const char *name, const char *title)
Constructor.
virtual Bool_t processBetweenGenAndFit(Int_t)
virtual Bool_t processAfterFit(Int_t)
RooFitResult * refit(RooAbsData *inGenSample=0)
virtual Bool_t processBeforeGen(Int_t)
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:31
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
RooMCStudy is a help class to facilitate Monte Carlo studies such as 'goodness-of-fit' studies,...
Definition: RooMCStudy.h:32
RooAbsData * _genSample
Definition: RooMCStudy.h:111
RooArgSet _projDeps
Definition: RooMCStudy.h:117
Bool_t _extendedGen
Definition: RooMCStudy.h:136
RooArgSet _dependents
Definition: RooMCStudy.h:122
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:785
const RooDataSet * _genProtoData
Definition: RooMCStudy.h:116
RooAbsGenContext * _genContext
Definition: RooMCStudy.h:113
Bool_t _randProto
Definition: RooMCStudy.h:139
RooArgSet * _fitInitParams
Definition: RooMCStudy.h:125
RooArgSet * _genInitParams
Definition: RooMCStudy.h:114
Bool_t _binGenData
Definition: RooMCStudy.h:137
RooAbsPdf * _genModel
Definition: RooMCStudy.h:112
Double_t _nExpGen
Definition: RooMCStudy.h:138
RooLinkedList _fitOptList
Definition: RooMCStudy.h:135
RooArgSet _allDependents
Definition: RooMCStudy.h:123
RooArgSet * _genParams
Definition: RooMCStudy.h:115
Bool_t _verboseGen
Definition: RooMCStudy.h:142
RooAbsPdf * _fitModel
Definition: RooMCStudy.h:124
RooRealVar * _nllVar
Definition: RooMCStudy.h:127
TString _fitOptions
Definition: RooMCStudy.h:134
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:41
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
const char * Data() const
Definition: TString.h:364