Logo ROOT  
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 "RooArgSet.h"
21 #include "RooMCStudy.h"
22 class RooAbsPdf;
23 class RooDataSet ;
24 class RooAbsData ;
25 class RooAbsGenContext ;
26 class RooFitResult ;
27 class RooPlot ;
28 class RooRealVar ;
29 
30 class RooAbsMCStudyModule : public TNamed {
31 public:
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 
75 protected:
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 
172 private:
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 
RooAbsMCStudyModule::fitInitParams
RooArgSet * fitInitParams()
Definition: RooAbsMCStudyModule.h:129
RooAbsMCStudyModule::projDeps
RooArgSet * projDeps()
Definition: RooAbsMCStudyModule.h:111
RooAbsMCStudyModule::nllVar
RooRealVar * nllVar()
Definition: RooAbsMCStudyModule.h:137
RooAbsMCStudyModule::binGenData
Bool_t binGenData()
Definition: RooAbsMCStudyModule.h:155
RooMCStudy::_binGenData
Bool_t _binGenData
Definition: RooMCStudy.h:138
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooAbsData
Definition: RooAbsData.h:46
RooMCStudy.h
RooArgSet.h
RooMCStudy::_fitModel
RooAbsPdf * _fitModel
Definition: RooMCStudy.h:125
TString::Data
const char * Data() const
Definition: TString.h:369
RooMCStudy
Definition: RooMCStudy.h:32
RooMCStudy::_allDependents
RooArgSet _allDependents
Definition: RooMCStudy.h:124
RooMCStudy::_extendedGen
Bool_t _extendedGen
Definition: RooMCStudy.h:137
RooMCStudy::_nExpGen
Double_t _nExpGen
Definition: RooMCStudy.h:139
RooMCStudy::_dependents
RooArgSet _dependents
Definition: RooMCStudy.h:123
RooAbsMCStudyModule::fitModel
RooAbsPdf * fitModel()
Definition: RooAbsMCStudyModule.h:125
RooMCStudy::_fitOptList
RooLinkedList _fitOptList
Definition: RooMCStudy.h:136
RooAbsMCStudyModule::dependents
RooArgSet * dependents()
Definition: RooAbsMCStudyModule.h:117
RooAbsMCStudyModule::allDependents
RooArgSet * allDependents()
Definition: RooAbsMCStudyModule.h:121
RooAbsMCStudyModule::genSample
RooAbsData * genSample()
Definition: RooAbsMCStudyModule.h:85
RooAbsMCStudyModule::genModel
RooAbsPdf * genModel()
Definition: RooAbsMCStudyModule.h:89
bool
RooFitResult
Definition: RooFitResult.h:40
RooMCStudy::_nllVar
RooRealVar * _nllVar
Definition: RooMCStudy.h:128
RooAbsMCStudyModule::initializeRun
virtual Bool_t initializeRun(Int_t)
Definition: RooAbsMCStudyModule.h:45
RooAbsMCStudyModule
Definition: RooAbsMCStudyModule.h:30
RooMCStudy::_genContext
RooAbsGenContext * _genContext
Definition: RooMCStudy.h:114
RooAbsMCStudyModule::randProto
Bool_t randProto()
Definition: RooAbsMCStudyModule.h:163
RooAbsMCStudyModule::processBetweenGenAndFit
virtual Bool_t processBetweenGenAndFit(Int_t)
Definition: RooAbsMCStudyModule.h:63
RooMCStudy::_fitInitParams
RooArgSet * _fitInitParams
Definition: RooMCStudy.h:126
RooMCStudy::refit
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:799
RooMCStudy::_randProto
Bool_t _randProto
Definition: RooMCStudy.h:140
RooAbsMCStudyModule::doInitializeInstance
Bool_t doInitializeInstance(RooMCStudy &)
Store reference to RooMCStudy object that this module relates to and call internal module initializat...
Definition: RooAbsMCStudyModule.cxx:63
TNamed
Definition: TNamed.h:29
RooAbsMCStudyModule::extendedGen
Bool_t extendedGen()
Definition: RooAbsMCStudyModule.h:151
RooAbsMCStudyModule::~RooAbsMCStudyModule
virtual ~RooAbsMCStudyModule()
Definition: RooAbsMCStudyModule.h:35
RooAbsMCStudyModule::RooAbsMCStudyModule
RooAbsMCStudyModule(const char *name, const char *title)
Constructor.
Definition: RooAbsMCStudyModule.cxx:46
RooLinkedList
Definition: RooLinkedList.h:35
RooPlot
Definition: RooPlot.h:44
RooAbsGenContext
Definition: RooAbsGenContext.h:26
RooAbsMCStudyModule::genProtoData
const RooDataSet * genProtoData()
Definition: RooAbsMCStudyModule.h:107
RooAbsMCStudyModule::processAfterFit
virtual Bool_t processAfterFit(Int_t)
Definition: RooAbsMCStudyModule.h:70
RooMCStudy::_genInitParams
RooArgSet * _genInitParams
Definition: RooMCStudy.h:115
RooAbsMCStudyModule::genContext
RooAbsGenContext * genContext()
Definition: RooAbsMCStudyModule.h:95
RooMCStudy::_verboseGen
Bool_t _verboseGen
Definition: RooMCStudy.h:143
RooAbsMCStudyModule::numExpGen
Double_t numExpGen()
Definition: RooAbsMCStudyModule.h:159
Double_t
double Double_t
Definition: RtypesCore.h:59
RooMCStudy::_genModel
RooAbsPdf * _genModel
Definition: RooMCStudy.h:113
RooMCStudy::_genParams
RooArgSet * _genParams
Definition: RooMCStudy.h:116
RooAbsMCStudyModule::_mcs
RooMCStudy * _mcs
Definition: RooAbsMCStudyModule.h:174
RooMCStudy::_projDeps
RooArgSet _projDeps
Definition: RooMCStudy.h:118
RooAbsMCStudyModule::initializeInstance
virtual Bool_t initializeInstance()
Definition: RooAbsMCStudyModule.h:40
RooAbsMCStudyModule::verboseGen
Bool_t verboseGen()
Definition: RooAbsMCStudyModule.h:167
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
RooAbsMCStudyModule::fitParams
RooArgSet * fitParams()
Definition: RooAbsMCStudyModule.h:133
RooDataSet
Definition: RooDataSet.h:33
RooAbsMCStudyModule::fitOptList
RooLinkedList * fitOptList()
Definition: RooAbsMCStudyModule.h:147
RooAbsPdf
Definition: RooAbsPdf.h:40
RooRealVar
Definition: RooRealVar.h:35
RooMCStudy::_genSample
RooAbsData * _genSample
Definition: RooMCStudy.h:112
RooMCStudy::_fitOptions
TString _fitOptions
Definition: RooMCStudy.h:135
RooAbsMCStudyModule::genInitParams
RooArgSet * genInitParams()
Definition: RooAbsMCStudyModule.h:99
RooAbsMCStudyModule::fitOptions
const char * fitOptions()
Definition: RooAbsMCStudyModule.h:143
RooAbsMCStudyModule::genParams
RooArgSet * genParams()
Definition: RooAbsMCStudyModule.h:103
RooAbsMCStudyModule::finalizeRun
virtual RooDataSet * finalizeRun()
Definition: RooAbsMCStudyModule.h:50
RooMCStudy::_genProtoData
const RooDataSet * _genProtoData
Definition: RooMCStudy.h:117
RooAbsMCStudyModule::processBeforeGen
virtual Bool_t processBeforeGen(Int_t)
Definition: RooAbsMCStudyModule.h:56
RooArgSet
Definition: RooArgSet.h:28
RooAbsMCStudyModule::refit
RooFitResult * refit(RooAbsData *inGenSample=0)
Definition: RooAbsMCStudyModule.h:80
int