70 TNamed(
name,title), _constPars(0), _initPars(0), _finalPars(0), _globalCorr(0), _randomPars(0), _Lt(0),
71 _CM(0), _VM(0), _GC(0)
84 _status(other._status),
85 _covQual(other._covQual),
86 _numBadNLL(other._numBadNLL),
87 _minNLL(other._minNLL),
95 _statusHistory(other._statusHistory)
200 coutE(InputArguments) <<
"RooFitResult::statusCodeHistory(" <<
GetName()
201 <<
" ERROR request for status history slot "
202 << icycle <<
" exceeds history count of " <<
_statusHistory.size() << endl ;
214 coutE(InputArguments) <<
"RooFitResult::statusLabelHistory(" <<
GetName()
215 <<
" ERROR request for status history slot "
216 << icycle <<
" exceeds history count of " <<
_statusHistory.size() << endl ;
249 const char *options)
const
254 coutE(InputArguments) <<
"RooFitResult::correlationPlot: parameter not floated in fit: " << parName1 << endl;
259 coutE(InputArguments) <<
"RooFitResult::correlationPlot: parameter not floated in fit: " << parName2 << endl;
298 box->SetFillStyle(0);
356 for(
Int_t iPar= 0; iPar < nPar; iPar++) {
359 for(
Int_t k= 0; k < iPar; k++) {
361 L(iPar,iPar)-= tmp*tmp;
363 L(iPar,iPar)= sqrt(L(iPar,iPar));
365 for(
Int_t jPar= iPar+1; jPar < nPar; jPar++) {
367 for(
Int_t k= 0; k < iPar; k++) {
368 L(iPar,jPar)-= L(k,iPar)*L(k,jPar);
370 L(iPar,jPar)/= L(iPar,iPar);
407 coutE(InputArguments) <<
"RooFitResult::correlation(" <<
GetName() <<
") parameter " << parname1 <<
" is not a floating fit parameter" << endl ;
411 coutE(InputArguments) <<
"RooFitResult::correlation(" <<
GetName() <<
") parameter " << parname2 <<
" is not a floating fit parameter" << endl ;
431 coutE(InputArguments) <<
"RooFitResult::correlation: variable " << parname <<
" not a floating parameter in fit" << endl ;
450 coutE(InputArguments) <<
"RooFitResult::globalCorr: variable " << parname <<
" not a floating parameter in fit" << endl ;
482 return (*
_CM)(row,col) ;
491 return (*
_VM)(row,col) ;
505 <<
indent <<
" RooFitResult: minimized FCN value: " <<
_minNLL <<
", estimated distance to minimum: " <<
_edm << endl
506 <<
indent <<
" covariance matrix quality: " ;
508 case -1 : os <<
"Unknown, matrix was externally provided" ; break ;
509 case 0 : os <<
"Not calculated at all" ; break ;
510 case 1 : os <<
"Approximation only, not accurate" ; break ;
511 case 2 : os <<
"Full matrix, but forced positive-definite" ; break ;
512 case 3 : os <<
"Full, accurate covariance matrix" ; break ;
515 os <<
indent <<
" Status : " ;
517 os << iter->first <<
"=" << iter->second <<
" " ;
519 os << endl << endl ;;
524 os <<
indent <<
" Constant Parameter Value " << endl
525 <<
indent <<
" -------------------- ------------" << endl ;
546 os <<
indent <<
" Floating Parameter InitialValue FinalValue (+HiError,-LoError) GblCorr." << endl
547 <<
indent <<
" -------------------- ------------ ---------------------------------- --------" << endl ;
549 os <<
indent <<
" Floating Parameter InitialValue FinalValue +/- Error GblCorr." << endl
550 <<
indent <<
" -------------------- ------------ -------------------------- --------" << endl ;
563 os << (doAsymErr?
" ":
"") <<
" +/- " << setw(9) <<
Form(
"%9.2e",err) ;
576 os <<
indent <<
" Floating Parameter FinalValue +/- Error " << endl
577 <<
indent <<
" -------------------- --------------------------" << endl ;
583 <<
" +/- " << setw(9) <<
Form(
"%9.2e",err)
600 coutI(Minimization) <<
"RooFitResult::fillCorrMatrix: number of floating parameters is zero, correlation matrix not filled" << endl ;
605 coutE(Minimization) <<
"RooFitResult::fillCorrMatrix: ERROR: list of initial parameters must be filled first" << endl ;
619 (*_GC)[i] = globalCC[i] ;
651 gcTitle.
Append(
" Global Correlation") ;
669 TString cTitle(
"Correlation between ") ;
683 for (
unsigned int i = 0; i < (
unsigned int)
_CM->
GetNcols() ; ++i) {
691 for (
unsigned int it = 0; it < (
unsigned int)
_CM->
GetNcols() ; ++it) {
693 double value = (*_CM)(i,it) ;
695 (*_CM)(i,it) = value;
718 coutI(Minimization) <<
"RooFitResult::fillCorrMatrix: number of floating parameters is zero, correlation matrix not filled" << endl ;
723 coutE(Minimization) <<
"RooFitResult::fillCorrMatrix: ERROR: list of initial parameters must be filled first" << endl ;
748 ndex =
m*(
m-1) / 2 +
n;
796void isIdenticalErrMsg(std::string
const& msgHead,
const RooAbsReal* tv,
const RooAbsReal* ov,
bool verbose) {
798 std::cout <<
"RooFitResult::isIdentical: " << msgHead <<
" " << tv->
GetName() <<
" differs in value:\t"
815 auto deviation = [tol](
const double left,
const double right){
817 return fabs((left - right)/right) >= tol;
819 return fabs(left) >= tol;
823 if(verbose) cout <<
"RooFitResult::isIdentical: minimized value of -log(L) is different " <<
_minNLL <<
" vs. " << other.
_minNLL << endl ;
831 if(verbose) cout <<
"RooFitResult::isIdentical: cannot find constant parameter " <<
_constPars->
at(i)->
GetName() <<
" in reference" << endl ;
835 isIdenticalErrMsg(
"constant parameter", tv, ov, verbose);
844 if(verbose) cout <<
"RooFitResult::isIdentical: cannot find initial parameter " <<
_initPars->
at(i)->
GetName() <<
" in reference" << endl ;
848 isIdenticalErrMsg(
"initial parameter", tv, ov, verbose);
857 if(verbose) cout <<
"RooFitResult::isIdentical: cannot find final parameter " << tv->
GetName() <<
" in reference" << endl ;
861 isIdenticalErrMsg(
"final parameter", tv, ov, verbose);
881 auto deviationCorr = [tolCorr](
const double left,
const double right){
882 return fabs(left - right) >= tolCorr;
895 if(verbose) cout <<
"RooFitResult::isIdentical: cannot find global correlation coefficient " << tv->
GetName() <<
" in reference" << endl ;
899 isIdenticalErrMsg(
"global correlation coefficient", tv, ov, verbose);
911 if(verbose) cout <<
"RooFitResult::isIdentical: cannot find correlation coefficient " << tv->
GetName() <<
" in reference" << endl ;
915 isIdenticalErrMsg(
"correlation coefficient", tv, ov, verbose);
935 oocoutE((
TObject*)0,InputArguments) <<
"RooFitResult::lastMinuitFit: ERROR: supplied variable list must be either empty " << endl
936 <<
" or match the number of variables of the last fit (" <<
gMinuit->
fNu <<
")" << endl ;
945 oocoutE((
TObject*)0,InputArguments) <<
"RooFitResult::lastMinuitFit: ERROR: variable '" << arg->
GetName() <<
"' is not of type RooRealVar" << endl ;
972 if ((xlo<xhi) && !isConst) {
973 var =
new RooRealVar(varName,varName,xval,xlo,xhi) ;
987 oocoutI((
TObject*)0,Eval) <<
"RooFitResult::lastMinuitFit: fit parameter '" << varName
988 <<
"' stored in variable '" << var->
GetName() <<
"'" << endl ;
1001 Int_t icode,npari,nparx ;
1006 r->setInitParList(floatPars) ;
1007 r->setFinalParList(floatPars) ;
1008 r->setMinNLL(fmin) ;
1010 r->setCovQual(icode) ;
1012 r->fillCorrMatrix() ;
1030 oocoutE((
TObject *)0, InputArguments) <<
"RooFitResult::lastMinuitFit: ERROR: variable '" << arg->
GetName()
1031 <<
"' is not of type RooRealVar" << endl;
1053 r->setInitParList(floatPars);
1054 r->setFinalParList(floatPars);
1059 r->fillPrefitCorrMatrix();
1085 (*_CM)(i,j) = (*
_CM)(i,j) / sqrt((*
_CM)(i,i)*(*
_CM)(j,j)) ;
1107 for (
Int_t i = 0 ; i<
n ; i++) {
1108 for (
Int_t j = 0 ; j<
n; j++) {
1109 hh->
Fill(i+0.5,
n-j-0.5,(*
_CM)(i,j)) ;
1152 coutW(InputArguments) <<
"RooFitResult::reducedCovarianceMatrix(" <<
GetName() <<
") WARNING input variable "
1153 << arg->
GetName() <<
" was not a floating parameters in fit result and is ignored" << endl ;
1160 vector<int> indexMap(params2.
getSize());
1161 for (
int i=0 ; i<params2.
getSize() ; i++) {
1163 assert(indexMap[i] < V.
GetNrows());
1167 for (
int i = 0; i < Vred.
GetNrows(); ++i) {
1168 for (
int j = 0; j < Vred.
GetNcols(); ++j) {
1169 Vred(i,j) = V( indexMap[i], indexMap[j]);
1200 coutE(Eval) <<
"RooFitResult::conditionalCovarianceMatrix(" <<
GetName() <<
") ERROR: covariance matrix is not positive definite (|V|="
1201 << det <<
") cannot reduce it" << endl ;
1202 throw string(
"RooFitResult::conditionalCovarianceMatrix() ERROR, input covariance matrix is not positive definite") ;
1213 coutW(InputArguments) <<
"RooFitResult::conditionalCovarianceMatrix(" <<
GetName() <<
") WARNING input variable "
1214 << arg->
GetName() <<
" was not a floating parameters in fit result and is ignored" << endl ;
1230 vector<int> map1, map2 ;
1250 TMatrixD S22bar = S11 - S12 * (S22Inv * S21) ;
1254 for (
int i=0 ; i<Vred.GetNcols() ; i++) {
1255 for (
int j=i ; j<Vred.GetNcols() ; j++) {
1256 Vred(i,j) = (S22bar(i,j) + S22bar(j,i))/2 ;
1257 Vred(j,i) = Vred(i,j) ;
1286 coutE(Eval) <<
"RooFitResult::createHessePdf(" <<
GetName() <<
") ERROR: covariance matrix is not positive definite (|V|="
1287 << det <<
") cannot construct p.d.f" << endl ;
1299 coutW(InputArguments) <<
"RooFitResult::createHessePdf(" <<
GetName() <<
") WARNING input variable "
1300 << arg->
GetName() <<
" was not a floating parameters in fit result and is ignored" << endl ;
1339 vector<int> map1, map2 ;
1356 for (
UInt_t i=0 ; i<map1.size() ; i++) {
1359 mu1.
add(*parclone) ;
1367 TMatrixD S22bar = S11 - S12 * (S22Inv * S21) ;
1371 for (
int i=0 ; i<Vred.GetNcols() ; i++) {
1372 for (
int j=i ; j<Vred.GetNcols() ; j++) {
1373 Vred(i,j) = (S22bar(i,j) + S22bar(j,i))/2 ;
1374 Vred(j,i) = Vred(i,j) ;
1433 os << IsA()->GetName() ;
1470 if (!opt || strlen(opt)==0) {
1480void RooFitResult::Streamer(
TBuffer &R__b)
1491 TNamed::Streamer(R__b);
1492 RooPrintable::Streamer(R__b);
1493 RooDirItem::Streamer(R__b);
1515 for (
unsigned int i = 0; i < (
unsigned int)
_CM->
GetNcols() ; ++i) {
1519 (*_GC)(i) = gcVal->
getVal() ;
1523 for (
unsigned int it = 0; it < (
unsigned int)
_CM->
GetNcols() ; ++it) {
1525 double value = cVal->
getVal() ;
1526 (*_CM)(it,i) = value ;
1527 (*_CM)(i,it) = value;
1529 (*_VM)(i,it) = (*
_VM)(it,i) ;
static const double x2[5]
static const double x1[5]
static void indent(ostringstream &buf, int indent_level)
TMatrixTSym< Double_t > TMatrixDSym
TMatrixT< Float_t > TMatrix
R__EXTERN TMinuit * gMinuit
char * Form(const char *fmt,...)
TVectorT< Double_t > TVectorD
TVectorT< Float_t > TVector
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
static void ioStreamerPass2Finalize()
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
Bool_t isConstant() const
Check if the "Constant" attribute is set.
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents.
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add an argument and transfer the ownership to the collection.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
RooAbsArg * find(const char *name) const
Find object with given name in list.
void setConstant(Bool_t value=kTRUE)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooDirItem is a utility base class for RooFit objects that are to be attached to ROOT directories.
void appendToDir(TObject *obj, Bool_t forceMemoryResident=kFALSE)
Append object to directory.
void removeFromDir(TObject *obj)
Remove object from directory it was added to.
A RooEllipse is a two-dimensional ellipse that can be used to represent an error contour.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
TMatrixDSym conditionalCovarianceMatrix(const RooArgList ¶ms) const
Return a reduced covariance matrix, which is calculated as.
void fillCorrMatrix()
Internal utility method to extract the correlation matrix and the global correlation coefficients fro...
TList _corrMatrix
List of global correlation coefficients.
std::vector< std::pair< std::string, int > > _statusHistory
const TMatrixDSym & covarianceMatrix() const
Return covariance matrix.
RooFitResult(const char *name=0, const char *title=0)
Constructor with name and title.
TMatrixDSym * _CM
triangular matrix used for generate random perturbations
bool isIdentical(const RooFitResult &other, double tol=1e-6, double tolCorr=1e-4, bool verbose=true) const
Return true if this fit result is identical to other within tolerances.
void setConstParList(const RooArgList &list)
Fill the list of constant parameters.
Int_t statusCodeHistory(UInt_t icycle) const
virtual ~RooFitResult()
Destructor.
virtual Int_t defaultPrintContents(Option_t *opt) const
Configure default contents to be printed.
virtual void printTitle(std::ostream &os) const
Print title of fit result.
Double_t correlation(const RooAbsArg &par1, const RooAbsArg &par2) const
Return correlation between par1 and par2.
TMatrixDSym reducedCovarianceMatrix(const RooArgList ¶ms) const
Return a reduced covariance matrix (Note that Vred is a simple sub-matrix of V, row/columns are order...
void fillPrefitCorrMatrix()
void SetNameTitle(const char *name, const char *title)
Change name and title of RooFitResult object.
Double_t edm() const
Return estimated distance to minimum.
const RooArgList & randomizePars() const
Generate random perturbations of the final parameters using the covariance matrix.
const RooArgList * globalCorr()
Return the list of all global correlations.
static RooFitResult * prefitResult(const RooArgList ¶mList)
Import the results of the last fit performed by gMinuit, interpreting the fit parameters as the given...
void setCovarianceMatrix(TMatrixDSym &V)
Store externally provided correlation matrix in this RooFitResult ;.
virtual StyleOption defaultPrintStyle(Option_t *opt) const
Configure mapping of Print() arguments to RooPrintable print styles.
const RooArgList & constPars() const
Return list of constant parameters.
void SetName(const char *name)
Change name of RooFitResult object.
Double_t covariance(Int_t row, Int_t col) const
Return the covariance matrix element addressed with numeric indices.
virtual void printClassName(std::ostream &os) const
Print class name of fit result.
bool isIdenticalNoCov(const RooFitResult &other, double tol=1e-6, bool verbose=true) const
Return true if this fit result is identical to other within tolerances, ignoring the correlation matr...
const char * statusLabelHistory(UInt_t icycle) const
void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Print fit result to stream 'os'.
virtual void printArgs(std::ostream &os) const
Print arguments of fit result, i.e. the parameters of the fit.
TH2 * correlationHist(const char *name="correlation_matrix") const
Return TH2D of correlation matrix.
void fillLegacyCorrMatrix() const
Sanity check.
void setInitParList(const RooArgList &list)
Fill the list of initial values of the floating parameters.
RooPlot * plotOn(RooPlot *frame, const RooAbsArg &par1, const RooAbsArg &par2, const char *options="ME") const
Add objects to a 2D plot.
TMatrixF * _Lt
List of floating parameters with most recent random perturbation applied.
virtual void printName(std::ostream &os) const
Print name of fit result.
const RooArgList & floatParsFinal() const
Return list of floarting parameters after fit.
RooArgList * _randomPars
Correlation matrix (list of RooArgLists)
static RooFitResult * lastMinuitFit(const RooArgList &varList=RooArgList())
Import the results of the last fit performed by gMinuit, interpreting the fit parameters as the given...
virtual void printValue(std::ostream &os) const
Print the value of the fit result, i.e.g the status, minimized FCN, edm and covariance quality code.
RooAbsPdf * createHessePdf(const RooArgSet ¶ms) const
Return a p.d.f that represents the fit result as a multi-variate probability densisty function on the...
void setFinalParList(const RooArgList &list)
Fill the list of final values of the floating parameters.
const TMatrixDSym & correlationMatrix() const
Return correlation matrix ;.
Multivariate Gaussian p.d.f.
static void blockDecompose(const TMatrixD &input, const std::vector< int > &map1, const std::vector< int > &map2, TMatrixDSym &S11, TMatrixD &S12, TMatrixD &S21, TMatrixDSym &S22)
Block decomposition of covI according to given maps of observables.
A RooPlot is a plot frame and a container for graphics objects within that frame.
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
void addPlotable(RooPlotable *plotable, Option_t *drawOptions="", Bool_t invisible=kFALSE, Bool_t refreshNorm=kFALSE)
Add the specified plotable object to our plot.
RooPlotable is a 'mix-in' base class that define the standard RooFit plotting and printing methods.
virtual StyleOption defaultPrintStyle(Option_t *opt) const
static Double_t gaussian(TRandom *generator=randomGenerator())
Return a Gaussian random variable with mean 0 and variance 1.
RooRealVar represents a variable that can be changed from the outside.
void setError(Double_t value)
void setRange(const char *name, Double_t min, Double_t max)
Set a fit or plotting range.
void deleteSharedProperties()
Stop sharing properties.
Double_t getError() const
virtual void setVal(Double_t value)
Set value of variable to 'value'.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void RemoveAll(TCollection *col)
Remove all objects in collection col from this collection.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual TList * GetList() const
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
2-D histogram with a double per channel (see TH1 documentation)}
Service class for 2-D histogram classes.
Int_t Fill(Double_t)
Invalid Fill method.
Iterator abstract base class.
virtual TObject * Next()=0
Use the TLine constructor to create a simple line.
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Int_t GetNoElements() const
virtual Double_t Determinant() const
TString * fCpnam
Character to be plotted at the X,Y contour positions.
virtual void mnstat(Double_t &fmin, Double_t &fedm, Double_t &errdef, Int_t &npari, Int_t &nparx, Int_t &istat)
Returns concerning the current status of the minimization.
The TNamed class is the base class for all named ROOT classes.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
virtual void SetNameTitle(const char *name, const char *title)
Set all the TNamed parameters (name and title).
Mother of all ROOT objects.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const char * Data() const
void ToUpper()
Change string to upper case.
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Short_t Max(Short_t a, Short_t b)
Double_t Sqrt(Double_t x)
Short_t Min(Short_t a, Short_t b)