File indexing completed on 2025-09-15 09:12:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_FIT_RESULT
0017 #define ROO_FIT_RESULT
0018
0019 #include "RooAbsArg.h"
0020 #include "RooPrintable.h"
0021 #include "RooDirItem.h"
0022 #include "RooArgList.h"
0023
0024 #include "RVersion.h"
0025 #include "TMatrixFfwd.h"
0026 #include "TMatrixDSym.h"
0027 #include "TList.h"
0028
0029 #include <vector>
0030 #include <string>
0031 #include <utility>
0032
0033 class RooArgSet ;
0034 class RooAbsPdf ;
0035 class RooPlot;
0036 class TObject ;
0037 class TH2 ;
0038 typedef RooArgSet* pRooArgSet ;
0039
0040 class RooFitResult : public TNamed, public RooPrintable, public RooDirItem {
0041 public:
0042
0043
0044 RooFitResult(const char* name=nullptr, const char* title=nullptr) ;
0045 RooFitResult(const RooFitResult& other) ;
0046 TObject* Clone(const char* newname = nullptr) const override {
0047 RooFitResult* r = new RooFitResult(*this) ;
0048 if (newname && *newname) r->SetName(newname) ;
0049 return r ;
0050 }
0051 virtual TObject* clone() const { return new RooFitResult(*this); }
0052 ~RooFitResult() override ;
0053
0054 static RooFitResult *prefitResult(const RooArgList ¶mList);
0055
0056
0057 void printValue(std::ostream& os) const override ;
0058 void printName(std::ostream& os) const override ;
0059 void printTitle(std::ostream& os) const override ;
0060 void printClassName(std::ostream& os) const override ;
0061 void printArgs(std::ostream& os) const override ;
0062 void printMultiline(std::ostream& os, Int_t contents, bool verbose=false, TString indent="") const override ;
0063
0064 inline void Print(Option_t *options= nullptr) const override {
0065
0066 printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
0067 }
0068
0069 Int_t defaultPrintContents(Option_t* opt) const override ;
0070 StyleOption defaultPrintStyle(Option_t* opt) const override ;
0071
0072 RooAbsPdf* createHessePdf(const RooArgSet& params) const ;
0073
0074
0075
0076 inline Int_t status() const {
0077 return _status ;
0078 }
0079
0080 inline UInt_t numStatusHistory() const { return _statusHistory.size() ; }
0081 Int_t statusCodeHistory(UInt_t icycle) const ;
0082 const char* statusLabelHistory(UInt_t icycle) const ;
0083
0084
0085 inline Int_t covQual() const {
0086 return _covQual ;
0087 }
0088
0089 inline Int_t numInvalidNLL() const {
0090 return _numBadNLL ;
0091 }
0092
0093 inline double edm() const {
0094 return _edm ;
0095 }
0096
0097 inline double minNll() const {
0098 return _minNLL ;
0099 }
0100
0101 inline const RooArgList& constPars() const {
0102 return *_constPars ;
0103 }
0104
0105 inline const RooArgList& floatParsInit() const {
0106 return *_initPars ;
0107 }
0108
0109 inline const RooArgList& floatParsFinal() const {
0110 return *_finalPars ;
0111 }
0112
0113 TH2* correlationHist(const char* name = "correlation_matrix") const ;
0114
0115
0116 double correlation(const RooAbsArg& par1, const RooAbsArg& par2) const {
0117 return correlation(par1.GetName(),par2.GetName()) ;
0118 }
0119
0120 const RooArgList* correlation(const RooAbsArg& par) const {
0121 return correlation(par.GetName()) ;
0122 }
0123
0124 double correlation(const char* parname1, const char* parname2) const ;
0125 const RooArgList* correlation(const char* parname) const ;
0126
0127
0128 const TMatrixDSym& covarianceMatrix() const ;
0129 const TMatrixDSym& correlationMatrix() const ;
0130 TMatrixDSym reducedCovarianceMatrix(const RooArgList& params) const ;
0131 TMatrixDSym conditionalCovarianceMatrix(const RooArgList& params) const ;
0132
0133
0134
0135 double globalCorr(const RooAbsArg& par) { return globalCorr(par.GetName()) ; }
0136 double globalCorr(const char* parname) ;
0137 const RooArgList* globalCorr() ;
0138
0139
0140
0141
0142 inline RooPlot *plotOn(RooPlot *frame, const RooAbsArg &par1, const RooAbsArg &par2,
0143 const char *options= "ME") const {
0144 return plotOn(frame,par1.GetName(),par2.GetName(),options);
0145 }
0146 RooPlot *plotOn(RooPlot *plot, const char *parName1, const char *parName2,
0147 const char *options= "ME") const;
0148
0149
0150 const RooArgList& randomizePars() const;
0151
0152 bool isIdenticalNoCov(const RooFitResult& other, double tol=1e-6, double tolErr=1e-3, bool verbose=true) const ;
0153 bool isIdentical(const RooFitResult& other, double tol=1e-6, double tolCorr=1e-4, bool verbose=true) const ;
0154
0155 void SetName(const char *name) override ;
0156 void SetNameTitle(const char *name, const char* title) override ;
0157
0158
0159
0160 void setCovarianceMatrix(TMatrixDSym& V) ;
0161 void setConstParList(const RooArgList& list) ;
0162 void setInitParList(const RooArgList& list) ;
0163 void setFinalParList(const RooArgList& list) ;
0164 inline void setMinNLL(double val) { _minNLL = val ; }
0165 inline void setEDM(double val) { _edm = val ; }
0166 inline void setStatus(Int_t val) { _status = val ; }
0167 inline void setCovQual(Int_t val) { _covQual = val ; }
0168 inline void setNumInvalidNLL(Int_t val) { _numBadNLL=val ; }
0169 void setStatusHistory(std::vector<std::pair<std::string,int> >& hist) { _statusHistory = hist ; }
0170 void fillCorrMatrix(const std::vector<double>& globalCC, const TMatrixDSym& corrs, const TMatrixDSym& covs) ;
0171
0172 protected:
0173
0174 void fillLegacyCorrMatrix() const ;
0175 void fillPrefitCorrMatrix();
0176 double correlation(Int_t row, Int_t col) const;
0177 double covariance(Int_t row, Int_t col) const;
0178
0179 Int_t _status ;
0180 Int_t _covQual ;
0181 Int_t _numBadNLL ;
0182 double _minNLL ;
0183 double _edm ;
0184 RooArgList* _constPars = nullptr;
0185 RooArgList* _initPars = nullptr;
0186 RooArgList* _finalPars = nullptr;
0187
0188 mutable RooArgList* _globalCorr = nullptr;
0189 mutable TList _corrMatrix ;
0190
0191 mutable RooArgList *_randomPars = nullptr;
0192 mutable TMatrixF* _Lt = nullptr;
0193
0194 TMatrixDSym* _CM = nullptr;
0195 TMatrixDSym* _VM = nullptr;
0196 TVectorD* _GC = nullptr;
0197
0198 std::vector<std::pair<std::string,int> > _statusHistory ;
0199
0200 ClassDefOverride(RooFitResult,5)
0201 };
0202
0203 #endif