Logo ROOT   6.16/01
Reference Guide
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
RooMCStudy Class Reference

RooMCStudy is a help class to facilitate Monte Carlo studies such as 'goodness-of-fit' studies, that involve fitting a PDF to multiple toy Monte Carlo sets generated from the same PDF or another PDF.

Given a fit PDF and a generator PDF, RooMCStudy can produce large numbers of toyMC samples and/or fit these samples and accumulate the final parameters of each fit in a dataset. Additional plotting routines simplify the task of plotting the distribution of the minimized likelihood, the fitted parameter values, fitted error and pull distribution. RooMCStudy provides the option to insert add-in modules that modify the generate and fit cycle and allow to perform extra steps in the cycle. Output of these modules can be stored alongside the fit results in the aggregate results dataset. These study modules should derive from class RooAbsMCStudyModel

Definition at line 32 of file RooMCStudy.h.

Public Member Functions

 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 (const RooAbsPdf &model, const RooArgSet &observables, 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())
 Construct Monte Carlo Study Manager. More...
 
virtual ~RooMCStudy ()
 
Bool_t addFitResult (const RooFitResult &fr)
 Utility function to add fit result from external fit to this RooMCStudy and process its results through the standard RooMCStudy statistics gathering tools. More...
 
void addModule (RooAbsMCStudyModule &module)
 Insert given RooMCStudy add-on module to the processing chain of this MCStudy object. More...
 
Bool_t fit (Int_t nSamples, const char *asciiFilePat)
 Fit 'nSamples' datasets, which are read from ASCII files. More...
 
Bool_t fit (Int_t nSamples, TList &dataSetList)
 Fit 'nSamples' datasets, as supplied in 'dataSetList'. More...
 
const RooArgSetfitParams (Int_t sampleNum) const
 Return an argset with the fit parameters for the given sample number. More...
 
const RooDataSetfitParDataSet ()
 Return a RooDataSet the resulting fit parameters of each toy cycle. More...
 
const RooFitResultfitResult (Int_t sampleNum) const
 Return the RooFitResult object of the fit to given sample. More...
 
RooAbsDatagenData (Int_t sampleNum) const
 Return the given generated dataset. More...
 
Bool_t generate (Int_t nSamples, Int_t nEvtPerSample=0, Bool_t keepGenData=kFALSE, const char *asciiFilePat=0)
 Generate 'nSamples' samples of 'nEvtPerSample' events. More...
 
Bool_t generateAndFit (Int_t nSamples, Int_t nEvtPerSample=0, Bool_t keepGenData=kFALSE, const char *asciiFilePat=0)
 Generate and fit 'nSamples' samples of 'nEvtPerSample' events. More...
 
const RooDataSetgenParDataSet () const
 
RooPlotplotError (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())
 Plot the distribution of the fit errors for the specified parameter on a newly created frame. More...
 
RooPlotplotError (const RooRealVar &param, Double_t lo, Double_t hi, Int_t nbins=100)
 Create a RooPlot of the distribution of the fitted errors of the given parameter. More...
 
RooPlotplotNLL (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())
 Plot the distribution of the -log(L) values on a newly created frame. More...
 
RooPlotplotNLL (Double_t lo, Double_t hi, Int_t nBins=100)
 Create a RooPlot of the -log(L) distribution in the range lo-hi with 'nBins' bins. More...
 
RooPlotplotParam (const char *paramName, 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())
 Plot the distribution of the fitted value of the given parameter on a newly created frame. More...
 
RooPlotplotParam (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())
 Plot the distribution of the fitted value of the given parameter on a newly created frame. More...
 
RooPlotplotParamOn (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())
 Plot the distribution of fitted values of a parameter. More...
 
RooPlotplotPull (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())
 Plot the distribution of pull values for the specified parameter on a newly created frame. More...
 
RooPlotplotPull (const RooRealVar &param, Double_t lo=-3.0, Double_t hi=3.0, Int_t nbins=25, Bool_t fitGauss=kFALSE)
 Create a RooPlot of the pull distribution for the given parameter. More...
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 TNamed copy ctor. More...
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 TNamed destructor. More...
 
virtual void Clear (Option_t *option="")
 Set name and title to empty strings (""). More...
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare two TNamed objects. More...
 
virtual void Copy (TObject &named) const
 Copy this to obj. More...
 
virtual void FillBuffer (char *&buffer)
 Encode TNamed into output buffer. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
virtual Bool_t IsSortable () const
 
virtual void ls (Option_t *option="") const
 List TNamed name and title. More...
 
TNamedoperator= (const TNamed &rhs)
 TNamed assignment operator. More...
 
virtual void Print (Option_t *option="") const
 Print TNamed name and title. More...
 
virtual void SetName (const char *name)
 Set the name of the TNamed. More...
 
virtual void SetNameTitle (const char *name, const char *title)
 Set all the TNamed parameters (name and title). More...
 
virtual void SetTitle (const char *title="")
 Set the title of the TNamed. More...
 
virtual Int_t Sizeof () const
 Return size of the TNamed part of the TObject. More...
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor. More...
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
ULong_t CheckedHash ()
 Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad). More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
Bool_t HasInconsistentHash () const
 Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More...
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
virtual Bool_t IsSortable () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 

Protected Member Functions

void calcPulls ()
 Calculate the pulls for all fit parameters in the fit results data set, and add them to that dataset. More...
 
RooFitResultdoFit (RooAbsData *genSample)
 Internal function. Performs actual fit according to specifications. More...
 
Bool_t fitSample (RooAbsData *genSample)
 Internal method. More...
 
RooPlotmakeFrameAndPlotCmd (const RooRealVar &param, RooLinkedList &cmdList, Bool_t symRange=kFALSE) const
 Internal function. More...
 
virtual void RecursiveRemove (TObject *obj)
 If one of the TObject we have a referenced to is deleted, remove the reference. More...
 
RooFitResultrefit (RooAbsData *genSample=0)
 Redo fit on 'current' toy sample, or if genSample is not NULL do fit on given sample instead. More...
 
void resetFitParams ()
 Reset all fit parameters to the initial model parameters at the time of the RooMCStudy constructor. More...
 
Bool_t run (Bool_t generate, Bool_t fit, Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char *asciiFilePat)
 Run engine method. More...
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 
void MakeZombie ()
 

Protected Attributes

RooArgSet _allDependents
 
Bool_t _binGenData
 
Bool_t _canAddFitResults
 
RooAbsGenContext_constrGenContext
 
RooAbsPdf_constrPdf
 
RooArgSet _dependents
 
Bool_t _extendedGen
 
RooArgSet_fitInitParams
 
RooAbsPdf_fitModel
 
TString _fitOptions
 
RooLinkedList _fitOptList
 
RooArgSet_fitParams
 
RooDataSet_fitParData
 
TList _fitResList
 
RooAbsGenContext_genContext
 
TList _genDataList
 
RooArgSet_genInitParams
 
RooAbsPdf_genModel
 
RooArgSet_genParams
 
RooDataSet_genParData
 
const RooDataSet_genProtoData
 
RooAbsData_genSample
 
std::list< RooAbsMCStudyModule * > _modList
 
Double_t _nExpGen
 
RooRealVar_ngenVar
 
RooRealVar_nllVar
 
Bool_t _perExptGenParams
 
RooArgSet _projDeps
 
Bool_t _randProto
 
Bool_t _silence
 
Bool_t _verboseGen
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 

Private Member Functions

 RooMCStudy (const RooMCStudy &)
 

Friends

class RooAbsMCStudyModule
 

Additional Inherited Members

- Public Types inherited from TObject
enum  {
  kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 ,
  kBitMask = 0x00ffffff
}
 
enum  { kSingleKey = BIT(0) , kOverwrite = BIT(1) , kWriteDelete = BIT(2) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = BIT(3) }
 
enum  EStatusBits {
  kCanDelete = BIT(0) , kMustCleanup = BIT(3) , kIsReferenced = BIT(4) , kHasUUID = BIT(5) ,
  kCannotPick = BIT(6) , kNoContextMenu = BIT(8) , kInvalidObject = BIT(13)
}
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 

#include <RooMCStudy.h>

Inheritance diagram for RooMCStudy:
[legend]

Constructor & Destructor Documentation

◆ RooMCStudy() [1/3]

RooMCStudy::RooMCStudy ( const RooAbsPdf model,
const RooArgSet observables,
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() 
)

Construct Monte Carlo Study Manager.

This class automates generating data from a given PDF, fitting the PDF to that data and accumulating the fit statistics.

Parameters
[in]modelThe PDF to be studied
[in]observablesThe variables of the PDF to be considered the observables
[in]argXArguments from the table below
Optional arguments
Silence() Suppress all RooFit messages during running below PROGRESS level
FitModel(const RooAbsPdf&) The PDF for fitting, if it is different from the PDF for generating
ConditionalObservables(const RooArgSet& set) The set of observables that the PDF should not be normalized over
Binned(Bool_t flag) Bin the dataset before fitting it. Speeds up fitting of large data samples
FitOptions(const char*) Classic fit options, provided for backward compatibility
FitOptions(....) Options to be used for fitting. All named arguments inside FitOptions() are passed to RooAbsPdf::fitTo()
Verbose(Bool_t flag) Activate informational messages in event generation phase
Extended(Bool_t flag) Determine number of events for each sample anew from a Poisson distribution
Constrain(const RooArgSet& pars) Apply internal constraints on given parameters in fit and sample constrained parameter values from constraint p.d.f for each toy.
ExternalConstraints(const RooArgSet& ) Apply internal constraints on given parameters in fit and sample constrained parameter values from constraint p.d.f for each toy.
ProtoData(const RooDataSet&, Bool_t randOrder) Prototype data for the event generation. If the randOrder flag is set, the order of the dataset will be re-randomized for each generation cycle to protect against systematic biases if the number of generated events does not exactly match the number of events in the prototype dataset at the cost of reduced precision with mu equal to the specified number of events

Definition at line 99 of file RooMCStudy.cxx.

◆ RooMCStudy() [2/3]

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() 
)
Deprecated:
PLEASE USE CONSTRUCTOR WITH NAMED ARGUMENTS. RETAINED FOR BACKWARD COMPATIBILY.

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()

Definition at line 316 of file RooMCStudy.cxx.

◆ ~RooMCStudy()

RooMCStudy::~RooMCStudy ( )
virtual

Definition at line 408 of file RooMCStudy.cxx.

◆ RooMCStudy() [3/3]

RooMCStudy::RooMCStudy ( const RooMCStudy )
private

Member Function Documentation

◆ addFitResult()

Bool_t RooMCStudy::addFitResult ( const RooFitResult fr)

Utility function to add fit result from external fit to this RooMCStudy and process its results through the standard RooMCStudy statistics gathering tools.

This function allows users to run the toy MC generation and/or fitting in a distributed way and to collect and analyze the results in a RooMCStudy as if they were run locally.

This method is only functional if this RooMCStudy object is cleanm, i.e. it was not used to generate and/or fit any samples.

Definition at line 866 of file RooMCStudy.cxx.

◆ addModule()

void RooMCStudy::addModule ( RooAbsMCStudyModule module)

Insert given RooMCStudy add-on module to the processing chain of this MCStudy object.

Definition at line 431 of file RooMCStudy.cxx.

◆ calcPulls()

void RooMCStudy::calcPulls ( )
protected

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

Definition at line 900 of file RooMCStudy.cxx.

◆ doFit()

RooFitResult * RooMCStudy::doFit ( RooAbsData genSample)
protected

Internal function. Performs actual fit according to specifications.

Definition at line 734 of file RooMCStudy.cxx.

◆ fit() [1/2]

Bool_t RooMCStudy::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 snprintf, should look something like "data/toymc_%04d.dat" and should contain one integer field that encodes the sample serial number.

Definition at line 685 of file RooMCStudy.cxx.

◆ fit() [2/2]

Bool_t RooMCStudy::fit ( Int_t  nSamples,
TList dataSetList 
)

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

Definition at line 700 of file RooMCStudy.cxx.

◆ fitParams()

const RooArgSet * RooMCStudy::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()

Definition at line 969 of file RooMCStudy.cxx.

◆ fitParDataSet()

const RooDataSet & RooMCStudy::fitParDataSet ( )

Return a RooDataSet the resulting fit parameters of each toy cycle.

This dataset also contains any additional output that was generated by study modules that were added to this RooMCStudy

Definition at line 949 of file RooMCStudy.cxx.

◆ fitResult()

const RooFitResult * RooMCStudy::fitResult ( Int_t  sampleNum) const

Return the RooFitResult object of the fit to given sample.

Definition at line 985 of file RooMCStudy.cxx.

◆ fitSample()

Bool_t RooMCStudy::fitSample ( RooAbsData genSample)
protected

Internal method.

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().

Definition at line 812 of file RooMCStudy.cxx.

◆ genData()

RooAbsData * RooMCStudy::genData ( Int_t  sampleNum) const

Return the given generated dataset.

This method will only return datasets if during the run cycle it was indicated that generator data should be saved.

Definition at line 1010 of file RooMCStudy.cxx.

◆ generate()

Bool_t RooMCStudy::generate ( Int_t  nSamples,
Int_t  nEvtPerSample = 0,
Bool_t  keepGenData = kFALSE,
const char *  asciiFilePat = 0 
)

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 snprintf, should look something like "data/toymc_%04d.dat" and should contain one integer field that encodes the sample serial number.

Definition at line 668 of file RooMCStudy.cxx.

◆ generateAndFit()

Bool_t RooMCStudy::generateAndFit ( Int_t  nSamples,
Int_t  nEvtPerSample = 0,
Bool_t  keepGenData = kFALSE,
const char *  asciiFilePat = 0 
)

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 in ascii form if the pattern string is supplied. The pattern, which is a template for snprintf, should look something like "data/toymc_%04d.dat" and should contain one integer field that encodes the sample serial number.

Definition at line 646 of file RooMCStudy.cxx.

◆ genParDataSet()

const RooDataSet * RooMCStudy::genParDataSet ( ) const
inline

Definition at line 62 of file RooMCStudy.h.

◆ makeFrameAndPlotCmd()

RooPlot * RooMCStudy::makeFrameAndPlotCmd ( const RooRealVar param,
RooLinkedList cmdList,
Bool_t  symRange = kFALSE 
) const
protected

Internal function.

Construct RooPlot from given parameter and modify the list of named arguments 'cmdList' to only contain the plot arguments that should be forwarded to RooAbsData::plotOn()

Definition at line 1230 of file RooMCStudy.cxx.

◆ plotError() [1/2]

RooPlot * RooMCStudy::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() 
)

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

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 there 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

Definition at line 1140 of file RooMCStudy.cxx.

◆ plotError() [2/2]

RooPlot * RooMCStudy::plotError ( const RooRealVar param,
Double_t  lo,
Double_t  hi,
Int_t  nbins = 100 
)

Create a RooPlot of the distribution of the fitted errors of the given parameter.

The frame is created with a range [lo,hi] and plotted data will be binned in 'nbins' bins

Definition at line 1300 of file RooMCStudy.cxx.

◆ plotNLL() [1/2]

RooPlot * RooMCStudy::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() 
)

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

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 there 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

Definition at line 1116 of file RooMCStudy.cxx.

◆ plotNLL() [2/2]

RooPlot * RooMCStudy::plotNLL ( Double_t  lo,
Double_t  hi,
Int_t  nBins = 100 
)

Create a RooPlot of the -log(L) distribution in the range lo-hi with 'nBins' bins.

Definition at line 1286 of file RooMCStudy.cxx.

◆ plotParam() [1/2]

RooPlot * RooMCStudy::plotParam ( const char *  paramName,
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() 
)

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

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 there 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

Definition at line 1060 of file RooMCStudy.cxx.

◆ plotParam() [2/2]

RooPlot * RooMCStudy::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() 
)

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

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 there 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

Definition at line 1082 of file RooMCStudy.cxx.

◆ plotParamOn()

RooPlot * RooMCStudy::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() 
)

Plot the distribution of fitted values of a parameter.

The parameter shown is the one from which the RooPlot was created, e.g.

RooPlot* frame = param.frame(100,-10,10) ; mcstudy.paramOn(frame,LineStyle(kDashed)) ;

Any named arguments passed to plotParamOn() are forwarded to the underlying plotOn() call

Definition at line 1038 of file RooMCStudy.cxx.

◆ plotPull() [1/2]

RooPlot * RooMCStudy::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() 
)

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

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 there 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

Definition at line 1176 of file RooMCStudy.cxx.

◆ plotPull() [2/2]

RooPlot * RooMCStudy::plotPull ( const RooRealVar param,
Double_t  lo = -3.0,
Double_t  hi = 3.0,
Int_t  nbins = 25,
Bool_t  fitGauss = kFALSE 
)

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 ML fit of the distribution to a Gaussian p.d.f is performed. The fit result is overlaid on the returned RooPlot and a box with the fitted mean and sigma is added.

Definition at line 1324 of file RooMCStudy.cxx.

◆ RecursiveRemove()

void RooMCStudy::RecursiveRemove ( TObject obj)
protectedvirtual

If one of the TObject we have a referenced to is deleted, remove the reference.

Reimplemented from TObject.

Definition at line 1359 of file RooMCStudy.cxx.

◆ refit()

RooFitResult * RooMCStudy::refit ( RooAbsData genSample = 0)
protected

Redo fit on 'current' toy sample, or if genSample is not NULL do fit on given sample instead.

Definition at line 785 of file RooMCStudy.cxx.

◆ resetFitParams()

void RooMCStudy::resetFitParams ( )
protected

Reset all fit parameters to the initial model parameters at the time of the RooMCStudy constructor.

Definition at line 724 of file RooMCStudy.cxx.

◆ run()

Bool_t RooMCStudy::run ( Bool_t  doGenerate,
Bool_t  DoFit,
Int_t  nSamples,
Int_t  nEvtPerSample,
Bool_t  keepGenData,
const char *  asciiFilePat 
)
protected

Run engine method.

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 snprintf, 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.

Definition at line 452 of file RooMCStudy.cxx.

Friends And Related Function Documentation

◆ RooAbsMCStudyModule

friend class RooAbsMCStudyModule
friend

Definition at line 101 of file RooMCStudy.h.

Member Data Documentation

◆ _allDependents

RooArgSet RooMCStudy::_allDependents
protected

Definition at line 123 of file RooMCStudy.h.

◆ _binGenData

Bool_t RooMCStudy::_binGenData
protected

Definition at line 137 of file RooMCStudy.h.

◆ _canAddFitResults

Bool_t RooMCStudy::_canAddFitResults
protected

Definition at line 141 of file RooMCStudy.h.

◆ _constrGenContext

RooAbsGenContext* RooMCStudy::_constrGenContext
protected

Definition at line 120 of file RooMCStudy.h.

◆ _constrPdf

RooAbsPdf* RooMCStudy::_constrPdf
protected

Definition at line 119 of file RooMCStudy.h.

◆ _dependents

RooArgSet RooMCStudy::_dependents
protected

Definition at line 122 of file RooMCStudy.h.

◆ _extendedGen

Bool_t RooMCStudy::_extendedGen
protected

Definition at line 136 of file RooMCStudy.h.

◆ _fitInitParams

RooArgSet* RooMCStudy::_fitInitParams
protected

Definition at line 125 of file RooMCStudy.h.

◆ _fitModel

RooAbsPdf* RooMCStudy::_fitModel
protected

Definition at line 124 of file RooMCStudy.h.

◆ _fitOptions

TString RooMCStudy::_fitOptions
protected

Definition at line 134 of file RooMCStudy.h.

◆ _fitOptList

RooLinkedList RooMCStudy::_fitOptList
protected

Definition at line 135 of file RooMCStudy.h.

◆ _fitParams

RooArgSet* RooMCStudy::_fitParams
protected

Definition at line 126 of file RooMCStudy.h.

◆ _fitParData

RooDataSet* RooMCStudy::_fitParData
protected

Definition at line 133 of file RooMCStudy.h.

◆ _fitResList

TList RooMCStudy::_fitResList
protected

Definition at line 131 of file RooMCStudy.h.

◆ _genContext

RooAbsGenContext* RooMCStudy::_genContext
protected

Definition at line 113 of file RooMCStudy.h.

◆ _genDataList

TList RooMCStudy::_genDataList
protected

Definition at line 130 of file RooMCStudy.h.

◆ _genInitParams

RooArgSet* RooMCStudy::_genInitParams
protected

Definition at line 114 of file RooMCStudy.h.

◆ _genModel

RooAbsPdf* RooMCStudy::_genModel
protected

Definition at line 112 of file RooMCStudy.h.

◆ _genParams

RooArgSet* RooMCStudy::_genParams
protected

Definition at line 115 of file RooMCStudy.h.

◆ _genParData

RooDataSet* RooMCStudy::_genParData
protected

Definition at line 132 of file RooMCStudy.h.

◆ _genProtoData

const RooDataSet* RooMCStudy::_genProtoData
protected

Definition at line 116 of file RooMCStudy.h.

◆ _genSample

RooAbsData* RooMCStudy::_genSample
protected

Definition at line 111 of file RooMCStudy.h.

◆ _modList

std::list<RooAbsMCStudyModule*> RooMCStudy::_modList
protected

Definition at line 146 of file RooMCStudy.h.

◆ _nExpGen

Double_t RooMCStudy::_nExpGen
protected

Definition at line 138 of file RooMCStudy.h.

◆ _ngenVar

RooRealVar* RooMCStudy::_ngenVar
protected

Definition at line 128 of file RooMCStudy.h.

◆ _nllVar

RooRealVar* RooMCStudy::_nllVar
protected

Definition at line 127 of file RooMCStudy.h.

◆ _perExptGenParams

Bool_t RooMCStudy::_perExptGenParams
protected

Definition at line 143 of file RooMCStudy.h.

◆ _projDeps

RooArgSet RooMCStudy::_projDeps
protected

Definition at line 117 of file RooMCStudy.h.

◆ _randProto

Bool_t RooMCStudy::_randProto
protected

Definition at line 139 of file RooMCStudy.h.

◆ _silence

Bool_t RooMCStudy::_silence
protected

Definition at line 144 of file RooMCStudy.h.

◆ _verboseGen

Bool_t RooMCStudy::_verboseGen
protected

Definition at line 142 of file RooMCStudy.h.

Libraries for RooMCStudy:
[legend]

The documentation for this class was generated from the following files: