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)
201 <<
" ERROR request for status history slot "
202 << icycle <<
" exceeds history count of " <<
_statusHistory.size() << endl ;
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;
803 auto deviation = [tol](
const double left,
const double right){
805 return fabs((left - right)/right) >= tol;
807 return fabs(left) >= tol;
811 cout <<
"RooFitResult::isIdentical: " << msgHead <<
" " << tv->GetName() <<
" differs in value:\t"
812 << tv->getVal() <<
" vs.\t" << ov->getVal()
813 <<
"\t(" << (tv->getVal()-ov->getVal())/ov->getVal() <<
")" << endl;
817 cout <<
"RooFitResult::isIdentical: minimized value of -log(L) is different " <<
_minNLL <<
" vs. " << other.
_minNLL << endl ;
825 cout <<
"RooFitResult::isIdentical: cannot find constant parameter " <<
_constPars->
at(i)->
GetName() <<
" in reference" << endl ;
828 if (ov && deviation(tv->getVal(), ov->getVal())) {
829 errMsg(
"constant parameter", tv, ov);
838 cout <<
"RooFitResult::isIdentical: cannot find initial parameter " <<
_initPars->
at(i)->
GetName() <<
" in reference" << endl ;
841 if (ov && deviation(tv->getVal(), ov->getVal())) {
842 errMsg(
"initial parameter", tv, ov);
851 cout <<
"RooFitResult::isIdentical: cannot find final parameter " << tv->
GetName() <<
" in reference" << endl ;
854 if (ov && deviation(tv->getVal(), ov->getVal())) {
855 errMsg(
"final parameter", tv, ov);
860 auto deviationCorr = [tolCorr](
const double left,
const double right){
861 return fabs(left - right) >= tolCorr;
874 cout <<
"RooFitResult::isIdentical: cannot find global correlation coefficient " << tv->
GetName() <<
" in reference" << endl ;
877 if (ov && deviationCorr(tv->getVal(), ov->getVal())) {
878 errMsg(
"global correlation coefficient", tv, ov);
888 auto ov =
static_cast<const RooAbsReal*
>(orow->
find(tv->GetName())) ;
890 cout <<
"RooFitResult::isIdentical: cannot find correlation coefficient " << tv->
GetName() <<
" in reference" << endl ;
893 if (ov && deviationCorr(tv->getVal(), ov->getVal())) {
894 errMsg(
"correlation coefficient", tv, ov);
915 <<
" or match the number of variables of the last fit (" <<
gMinuit->
fNu <<
")" << endl ;
952 if ((xlo<xhi) && !isConst) {
953 var =
new RooRealVar(varName,varName,xval,xlo,xhi) ;
967 oocoutI((
TObject*)0,
Eval) <<
"RooFitResult::lastMinuitFit: fit parameter '" << varName
968 <<
"' stored in variable '" << var->
GetName() <<
"'" << endl ;
981 Int_t icode,npari,nparx ;
986 r->setInitParList(floatPars) ;
987 r->setFinalParList(floatPars) ;
990 r->setCovQual(icode) ;
992 r->fillCorrMatrix() ;
1011 <<
"' is not of type RooRealVar" << endl;
1034 r->setInitParList(floatPars);
1035 r->setFinalParList(floatPars);
1040 r->fillPrefitCorrMatrix();
1088 for (
Int_t i = 0 ; i<
n ; i++) {
1089 for (
Int_t j = 0 ; j<
n; j++) {
1090 hh->
Fill(i+0.5,
n-j-0.5,(*
_CM)(i,j)) ;
1134 << arg->
GetName() <<
" was not a floating parameters in fit result and is ignored" << endl ;
1141 vector<int> indexMap(params2.
getSize());
1142 for (
int i=0 ; i<params2.
getSize() ; i++) {
1144 assert(indexMap[i] < V.
GetNrows());
1148 for (
int i = 0; i < Vred.
GetNrows(); ++i) {
1149 for (
int j = 0; j < Vred.
GetNcols(); ++j) {
1150 Vred(i,j) = V( indexMap[i], indexMap[j]);
1181 coutE(
Eval) <<
"RooFitResult::conditionalCovarianceMatrix(" <<
GetName() <<
") ERROR: covariance matrix is not positive definite (|V|="
1182 << det <<
") cannot reduce it" << endl ;
1183 throw string(
"RooFitResult::conditionalCovarianceMatrix() ERROR, input covariance matrix is not positive definite") ;
1195 << arg->
GetName() <<
" was not a floating parameters in fit result and is ignored" << endl ;
1211 vector<int> map1, map2 ;
1231 TMatrixD S22bar = S11 - S12 * (S22Inv * S21) ;
1235 for (
int i=0 ; i<Vred.GetNcols() ; i++) {
1236 for (
int j=i ; j<Vred.GetNcols() ; j++) {
1237 Vred(i,j) = (S22bar(i,j) + S22bar(j,i))/2 ;
1238 Vred(j,i) = Vred(i,j) ;
1267 coutE(
Eval) <<
"RooFitResult::createHessePdf(" <<
GetName() <<
") ERROR: covariance matrix is not positive definite (|V|="
1268 << det <<
") cannot construct p.d.f" << endl ;
1281 << arg->
GetName() <<
" was not a floating parameters in fit result and is ignored" << endl ;
1320 vector<int> map1, map2 ;
1337 for (
UInt_t i=0 ; i<map1.size() ; i++) {
1340 mu1.
add(*parclone) ;
1348 TMatrixD S22bar = S11 - S12 * (S22Inv * S21) ;
1352 for (
int i=0 ; i<Vred.GetNcols() ; i++) {
1353 for (
int j=i ; j<Vred.GetNcols() ; j++) {
1354 Vred(i,j) = (S22bar(i,j) + S22bar(j,i))/2 ;
1355 Vred(j,i) = Vred(i,j) ;
1414 os << IsA()->GetName() ;
1451 if (!opt || strlen(opt)==0) {
1461void RooFitResult::Streamer(
TBuffer &R__b)
1472 TNamed::Streamer(R__b);
1473 RooPrintable::Streamer(R__b);
1474 RooDirItem::Streamer(R__b);
1496 for (
unsigned int i = 0; i < (
unsigned int)
_CM->
GetNcols() ; ++i) {
1500 (*_GC)(i) = gcVal->
getVal() ;
1504 for (
unsigned int it = 0; it < (
unsigned int)
_CM->
GetNcols() ; ++it) {
1506 double value = cVal->
getVal() ;
1507 (*_CM)(it,i) = value ;
1508 (*_CM)(i,it) = value;
1510 (*_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
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
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_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Bool_t isConstant() const
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents.
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
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.
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
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
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
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.
const RooArgList & randomizePars() const
Return a list of floating parameter values that are perturbed from the final fit values by random amo...
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
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_t isIdentical(const RooFitResult &other, Double_t tol=1e-6, Double_t tolCorr=1e-4, Bool_t verbose=kTRUE) const
Return true if this fit result is identical to other within tolerances.
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
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
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 range named 'name to [min,max].
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-Dim histogram classes.
Int_t Fill(Double_t)
Invalid Fill method.
Iterator abstract base class.
virtual TObject * Next()=0
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)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
static constexpr double L
Short_t Max(Short_t a, Short_t b)
Double_t Sqrt(Double_t x)
Short_t Min(Short_t a, Short_t b)