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