library: libRooFit #include "RooMCStudy.h"

# RooMCStudy

class description - source file - inheritance tree (.pdf)

## class RooMCStudy

| Inheritance Chart:
`RooMCStudy` |

        private:

                     RooMCStudy(const RooMCStudy&)

        protected:

              void calcPulls()
            Bool_t fitSample(RooAbsData* genSample)
          RooPlot* makeFrameAndPlotCmd(const RooRealVar& param, RooLinkedList& cmdList, Bool_t symRange = kFALSE) const
            Bool_t run(Bool_t generate, Bool_t fit, Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char* asciiFilePat)

        public:

                              RooMCStudy(const RooAbsPdf& model, const RooArgSet& observables, RooCmdArg arg1 = RooCmdArg::none, RooCmdArg arg2 = RooCmdArg::none, RooCmdArg arg3 = RooCmdArg::none, RooCmdArg arg4 = RooCmdArg::none, RooCmdArg arg5 = RooCmdArg::none, RooCmdArg arg6 = RooCmdArg::none, RooCmdArg arg7 = RooCmdArg::none, RooCmdArg arg8 = RooCmdArg::none)
                              RooMCStudy(const RooAbsPdf& genModel, const RooAbsPdf& fitModel, const RooArgSet& dependents, const char* genOptions = "", const char* fitOptions = "", const RooDataSet* genProtoData = 0, const RooArgSet& projDeps = RooArgSet())
                      virtual ~RooMCStudy()
                       Bool_t addFitResult(const RooFitResult& fr)
               static TClass* Class()
                       Bool_t fit(Int_t nSamples, const char* asciiFilePat)
                       Bool_t fit(Int_t nSamples, TList& dataSetList)
             const RooArgSet* fitParams(Int_t sampleNum) const
            const RooDataSet& fitParDataSet() const
          const RooFitResult* fitResult(Int_t sampleNum) const
            const RooDataSet* genData(Int_t sampleNum) const
                       Bool_t generate(Int_t nSamples, Int_t nEvtPerSample = 0, Bool_t keepGenData = kFALSE, const char* asciiFilePat = "0")
                       Bool_t generateAndFit(Int_t nSamples, Int_t nEvtPerSample = 0, Bool_t keepGenData = kFALSE, const char* asciiFilePat = "0")
              virtual TClass* IsA() const
                     RooPlot* plotError(const RooRealVar& param, const RooCmdArg& arg1 = RooCmdArg::none, const RooCmdArg& arg2 = RooCmdArg::none, const RooCmdArg& arg3 = RooCmdArg::none, const RooCmdArg& arg4 = RooCmdArg::none, const RooCmdArg& arg5 = RooCmdArg::none, const RooCmdArg& arg6 = RooCmdArg::none, const RooCmdArg& arg7 = RooCmdArg::none, const RooCmdArg& arg8 = RooCmdArg::none)
                     RooPlot* plotError(const RooRealVar& param, Double_t lo, Double_t hi, Int_t nbins = 100)
                     RooPlot* plotNLL(const RooCmdArg& arg1 = RooCmdArg::none, const RooCmdArg& arg2 = RooCmdArg::none, const RooCmdArg& arg3 = RooCmdArg::none, const RooCmdArg& arg4 = RooCmdArg::none, const RooCmdArg& arg5 = RooCmdArg::none, const RooCmdArg& arg6 = RooCmdArg::none, const RooCmdArg& arg7 = RooCmdArg::none, const RooCmdArg& arg8 = RooCmdArg::none)
                     RooPlot* plotNLL(Double_t lo, Double_t hi, Int_t nBins = 100)
                     RooPlot* plotParam(const RooRealVar& param, const RooCmdArg& arg1 = RooCmdArg::none, const RooCmdArg& arg2 = RooCmdArg::none, const RooCmdArg& arg3 = RooCmdArg::none, const RooCmdArg& arg4 = RooCmdArg::none, const RooCmdArg& arg5 = RooCmdArg::none, const RooCmdArg& arg6 = RooCmdArg::none, const RooCmdArg& arg7 = RooCmdArg::none, const RooCmdArg& arg8 = RooCmdArg::none)
                     RooPlot* plotParamOn(RooPlot* frame, const RooCmdArg& arg1 = RooCmdArg::none, const RooCmdArg& arg2 = RooCmdArg::none, const RooCmdArg& arg3 = RooCmdArg::none, const RooCmdArg& arg4 = RooCmdArg::none, const RooCmdArg& arg5 = RooCmdArg::none, const RooCmdArg& arg6 = RooCmdArg::none, const RooCmdArg& arg7 = RooCmdArg::none, const RooCmdArg& arg8 = RooCmdArg::none)
                     RooPlot* plotPull(const RooRealVar& param, const RooCmdArg& arg1, const RooCmdArg& arg2 = RooCmdArg::none, const RooCmdArg& arg3 = RooCmdArg::none, const RooCmdArg& arg4 = RooCmdArg::none, const RooCmdArg& arg5 = RooCmdArg::none, const RooCmdArg& arg6 = RooCmdArg::none, const RooCmdArg& arg7 = RooCmdArg::none, const RooCmdArg& arg8 = RooCmdArg::none)
                     RooPlot* plotPull(const RooRealVar& param, Double_t lo = -3.0, Double_t hi = 3.0, Int_t nbins = 25, Bool_t fitGauss = kFALSE)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

                 RooAbsPdf* _genModel          Generator model
          RooAbsGenContext* _genContext        Generator context
                 RooArgSet* _genParams         List of fit parameters
          const RooDataSet* _genProtoData      Generator prototype data set
                  RooArgSet _projDeps          List of projected dependents in fit
                  RooArgSet _dependents        List of dependents
                  RooArgSet _allDependents     List of generate + prototype dependents
                 RooAbsPdf* _fitModel          Fit model
                 RooArgSet* _fitInitParams     List of initial values of fit parameters
                 RooArgSet* _fitParams         List of fit parameters
                RooRealVar* _nllVar
                      TList _genDataList       List of generated data sample
                      TList _fitResList        List of RooFitResult fit output objects
                RooDataSet* _fitParData        Data set of fit parameters of each sample
                    TString _fitOptions        Fit options string
              RooLinkedList _fitOptList        Fit option command list
                     Bool_t _extendedGen       Add poisson term to number of events to generate?
                     Bool_t _binGenData        Bin data between generating and fitting
                   Double_t _nExpGen           Number of expected events to generate in extended mode
                     Bool_t _randProto         Randomize order of prototype data access
                     Bool_t _canAddFitResults  Allow adding of external fit results?
                     Bool_t _verboseGen        Verbose generation?

## Class Description

RooMCStudy(const RooAbsPdf& genModel, const RooAbsPdf& fitModel, const RooArgSet& dependents, const char* genOptions, const char* fitOptions, const RooDataSet* genProtoData, const RooArgSet& projDeps) : _genModel((RooAbsPdf*)&genModel), _genProtoData(genProtoData), _projDeps(projDeps), _dependents(dependents), _allDependents(dependents), _fitModel((RooAbsPdf*)&fitModel), _fitOptions(fitOptions), _canAddFitResults(kTRUE)

     Constructor with a generator and fit model. Both models may point
     to the same object. The 'dependents' set of variables is generated
     in the generator phase. The optional prototype dataset is passed to
     the generator

     Available generator options
      v  - Verbose
      e  - Extended: use Poisson distribution for Nevts generated

     Available fit options
      See RooAbsPdf::fitTo()

~RooMCStudy()

     Destructor

Bool_t run(Bool_t generate, Bool_t fit, Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char* asciiFilePat)

     Run engine. Generate and/or fit, according to flags, 'nSamples' samples of 'nEvtPerSample' events.
     If keepGenData is set, all generated data sets will be kept in memory and can be accessed
     later via genData().

     When generating, data sets will be written out in ascii form if the pattern string is supplied
     The pattern, which is a template for sprintf, should look something like "data/toymc_%04d.dat"
     and should contain one integer field that encodes the sample serial number.

     When fitting only, data sets may optionally be read from ascii files, using the same file
     pattern.

Bool_t generateAndFit(Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char* asciiFilePat)

     Generate and fit 'nSamples' samples of 'nEvtPerSample' events.
     If keepGenData is set, all generated data sets will be kept in memory and can be accessed
     later via genData().

     Data sets will be written out is ascii form if the pattern string is supplied.
     The pattern, which is a template for sprintf, should look something like "data/toymc_%04d.dat"
     and should contain one integer field that encodes the sample serial number.

Bool_t generate(Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char* asciiFilePat)

     Generate 'nSamples' samples of 'nEvtPerSample' events.
     If keepGenData is set, all generated data sets will be kept in memory
     and can be accessed later via genData().

     Data sets will be written out in ascii form if the pattern string is supplied.
     The pattern, which is a template for sprintf, should look something like "data/toymc_%04d.dat"
     and should contain one integer field that encodes the sample serial number.

Bool_t fit(Int_t nSamples, const char* asciiFilePat)

     Fit 'nSamples' datasets, which are read from ASCII files.

     The ascii file pattern, which is a template for sprintf, should look something like "data/toymc_%04d.dat"
     and should contain one integer field that encodes the sample serial number.

Bool_t fit(Int_t nSamples, TList& dataSetList)

     Fit 'nSamples' datasets, as supplied in 'dataSetList'

Bool_t fitSample(RooAbsData* genSample)

     Fit given dataset with fit model. If fit
     converges (TMinuit status code zero)
     The fit results are appended to the fit results
     dataset

     If the fit option "r" is supplied, the RooFitResult
     objects will always be saved, regardless of the
     fit status. RooFitResults objects can be retrieved
     later via fitResult().

Bool_t addFitResult(const RooFitResult& fr)

void calcPulls()

     Calculate the pulls for all fit parameters in
     the fit results data set, and add them to that dataset

const RooDataSet& fitParDataSet()

     Return the fit parameter dataset

const RooArgSet* fitParams(Int_t sampleNum) const

     Return an argset with the fit parameters for the given sample number
     NB: The fit parameters are only stored for successfull fits,
         thus the maximum sampleNum can be less that the number
         of generated samples and if so, the indeces will
         be out of synch with genData() and fitResult()

const RooFitResult* fitResult(Int_t sampleNum) const

     Return the fit result object of the fit to given sample

const RooDataSet* genData(Int_t sampleNum) const

     Return the given generated dataset

RooPlot* plotParamOn(RooPlot* frame, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4, const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)

     Plot the distribution of the fitted value of the given parameter on the specified frame
     Any specified named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options

RooPlot* plotParam(const RooRealVar& param, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4, const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)

     Plot the distribution of the fitted value of the given parameter on a newly created frame.

     This function accepts the following optional arguments
     FrameRange(double lo, double hi) -- Set range of frame to given specification
     FrameBins(int bins)              -- Set default number of bins of frame to given number
     Frame(...)                       -- Pass supplied named arguments to RooAbsRealLValue::frame() function. See frame() function
                                         for list of allowed arguments

     If no frame specifications are given, the AutoRange() feature will be used to set the range
     Any other named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options

RooPlot* plotNLL(const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4, const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)

     Plot the distribution of the -log(l) values on a newly created frame.

     This function accepts the following optional arguments
     FrameRange(double lo, double hi) -- Set range of frame to given specification
     FrameBins(int bins)              -- Set default number of bins of frame to given number
     Frame(...)                       -- Pass supplied named arguments to RooAbsRealLValue::frame() function. See frame() function
                                         for list of allowed arguments

     If no frame specifications are given, the AutoRange() feature will be used to set the range
     Any other named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options

RooPlot* plotError(const RooRealVar& param, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4, const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)

     Plot the distribution of the fit errors for the specified parameter on a newly created frame.

     This function accepts the following optional arguments
     FrameRange(double lo, double hi) -- Set range of frame to given specification
     FrameBins(int bins)              -- Set default number of bins of frame to given number
     Frame(...)                       -- Pass supplied named arguments to RooAbsRealLValue::frame() function. See frame() function
                                         for list of allowed arguments

     If no frame specifications are given, the AutoRange() feature will be used to set the range
     Any other named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options

RooPlot* plotPull(const RooRealVar& param, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4, const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)

     Plot the distribution of pull values for the specified parameter on a newly created frame. If asymmetric
     errors are calculated in the fit (by MINOS) those will be used in the pull calculation

     This function accepts the following optional arguments
     FrameRange(double lo, double hi) -- Set range of frame to given specification
     FrameBins(int bins)              -- Set default number of bins of frame to given number
     Frame(...)                       -- Pass supplied named arguments to RooAbsRealLValue::frame() function. See frame() function
                                         for list of allowed arguments
     FitGauss(Bool_t flag)            -- Add a gaussian fit to the frame

     If no frame specifications are given, the AutoSymRange() feature will be used to set the range
     Any other named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options

RooPlot* makeFrameAndPlotCmd(const RooRealVar& param, RooLinkedList& cmdList, Bool_t symRange) const

RooPlot* plotNLL(Double_t lo, Double_t hi, Int_t nBins)

     Create a RooPlot of the NLL distribution in the range lo-hi
     with 'nBins' bins

RooPlot* plotError(const RooRealVar& param, Double_t lo, Double_t hi, Int_t nbins)

     Create a RooPlot of the distribution of the fitted errors of the given parameter.
     The range lo-hi is plotted in nbins bins

RooPlot* plotPull(const RooRealVar& param, Double_t lo, Double_t hi, Int_t nbins, Bool_t fitGauss)

     Create a RooPlot of the pull distribution for the given parameter.
     The range lo-hi is plotted in nbins.
     If fitGauss is set, an unbinned max. likelihood fit of the distribution to a Gaussian model
     is performed. The fit result is overlaid on the returned RooPlot and a box with the fitted
     mean and sigma is added.

### Inline Functions

             RooMCStudy RooMCStudy(const RooAbsPdf& genModel, const RooAbsPdf& fitModel, const RooArgSet& dependents, const char* genOptions = "", const char* fitOptions = "", const RooDataSet* genProtoData = 0, const RooArgSet& projDeps = RooArgSet())
             RooMCStudy RooMCStudy(const RooMCStudy&)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)

Last update: Tue Jun 28 18:13:39 2005
Copyright (c) 2000-2005, Regents of the University of California *