Warning, file /include/root/RooMCStudy.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_MC_STUDY
0017 #define ROO_MC_STUDY
0018
0019 #include "TList.h"
0020 #include "TNamed.h"
0021 #include "RooArgSet.h"
0022 #include <list>
0023 class RooAbsPdf;
0024 class RooDataSet ;
0025 class RooAbsData ;
0026 class RooAbsGenContext ;
0027 class RooFitResult ;
0028 class RooPlot ;
0029 class RooRealVar ;
0030 class RooAbsMCStudyModule ;
0031
0032 class RooMCStudy : public TNamed {
0033 public:
0034
0035 RooMCStudy(const RooAbsPdf& model, const RooArgSet& observables,
0036 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
0037 const RooCmdArg& arg3={}, const RooCmdArg& arg4={}, const RooCmdArg& arg5={},
0038 const RooCmdArg& arg6={}, const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
0039
0040 ~RooMCStudy() override ;
0041
0042
0043 void addModule(RooAbsMCStudyModule& module) ;
0044
0045
0046
0047 bool generateAndFit(Int_t nSamples, Int_t nEvtPerSample=0, bool keepGenData=false, const char* asciiFilePat=nullptr) ;
0048 bool generate(Int_t nSamples, Int_t nEvtPerSample=0, bool keepGenData=false, const char* asciiFilePat=nullptr) ;
0049 bool fit(Int_t nSamples, const char* asciiFilePat) ;
0050 bool fit(Int_t nSamples, TList& dataSetList) ;
0051 bool addFitResult(const RooFitResult& fr) ;
0052
0053
0054 const RooArgSet* fitParams(Int_t sampleNum) const ;
0055 const RooFitResult* fitResult(Int_t sampleNum) const ;
0056 RooAbsData* genData(Int_t sampleNum) const ;
0057 const RooDataSet& fitParDataSet() ;
0058
0059
0060 const RooDataSet* genParDataSet() const {
0061 return _genParData.get();
0062 }
0063
0064
0065 RooPlot* plotParamOn(RooPlot* frame, const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
0066 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
0067 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
0068 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
0069 RooPlot* plotParam(const RooRealVar& param, const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
0070 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
0071 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
0072 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
0073 RooPlot* plotParam(const char* paramName, const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
0074 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
0075 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
0076 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
0077 RooPlot* plotNLL(const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
0078 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
0079 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
0080 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
0081 RooPlot* plotError(const RooRealVar& param, const RooCmdArg& arg1={}, const RooCmdArg& arg2={},
0082 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
0083 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
0084 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
0085 RooPlot* plotPull(const RooRealVar& param, const RooCmdArg& arg1, const RooCmdArg& arg2={},
0086 const RooCmdArg& arg3={}, const RooCmdArg& arg4={},
0087 const RooCmdArg& arg5={}, const RooCmdArg& arg6={},
0088 const RooCmdArg& arg7={}, const RooCmdArg& arg8={}) ;
0089
0090
0091 RooPlot* plotNLL(double lo, double hi, Int_t nBins=100) ;
0092 RooPlot* plotError(const RooRealVar& param, double lo, double hi, Int_t nbins=100) ;
0093 RooPlot* plotPull(const RooRealVar& param, double lo=-3.0, double hi=3.0, Int_t nbins=25, bool fitGauss=false) ;
0094
0095 protected:
0096
0097 friend class RooAbsMCStudyModule ;
0098
0099 RooPlot* makeFrameAndPlotCmd(const RooRealVar& param, RooLinkedList& cmdList, bool symRange=false) const ;
0100
0101 bool run(bool generate, bool fit, Int_t nSamples, Int_t nEvtPerSample, bool keepGenData, const char* asciiFilePat) ;
0102 bool fitSample(RooAbsData* genSample) ;
0103 RooFit::OwningPtr<RooFitResult> doFit(RooAbsData* genSample) ;
0104
0105 void calcPulls() ;
0106
0107 RooAbsData* _genSample = nullptr;
0108 RooAbsPdf* _genModel = nullptr;
0109 std::unique_ptr<RooAbsGenContext> _genContext;
0110 RooArgSet _genInitParams;
0111 RooArgSet _genParams;
0112 const RooDataSet* _genProtoData ;
0113 RooArgSet _projDeps ;
0114
0115 std::unique_ptr<RooAbsPdf> _constrPdf;
0116 std::unique_ptr<RooAbsGenContext> _constrGenContext;
0117
0118 RooArgSet _dependents ;
0119 RooArgSet _allDependents ;
0120 RooAbsPdf* _fitModel ;
0121 RooArgSet _fitInitParams;
0122 RooArgSet _fitParams;
0123 std::unique_ptr<RooRealVar> _nllVar;
0124 std::unique_ptr<RooRealVar> _ngenVar;
0125
0126 TList _genDataList ;
0127 TList _fitResList ;
0128 std::unique_ptr<RooDataSet> _genParData;
0129 std::unique_ptr<RooDataSet> _fitParData;
0130 RooLinkedList _fitOptList ;
0131 bool _extendedGen ;
0132 bool _binGenData ;
0133 double _nExpGen ;
0134 bool _randProto ;
0135
0136 bool _canAddFitResults ;
0137 bool _verboseGen ;
0138 bool _perExptGenParams = false;
0139 bool _silence ;
0140
0141 std::list<RooAbsMCStudyModule*> _modList ;
0142
0143
0144 RooFit::OwningPtr<RooFitResult> refit(RooAbsData* genSample=nullptr) ;
0145 void resetFitParams() ;
0146 void RecursiveRemove(TObject *obj) override;
0147
0148 private:
0149
0150 RooMCStudy(const RooMCStudy&) ;
0151
0152 ClassDefOverride(RooMCStudy,0)
0153 } ;
0154
0155
0156 #endif
0157