Skip to content

Commit

Permalink
[RF] Added old function to get covariance matrices
Browse files Browse the repository at this point in the history
In older ROOT versions, RooMinimizer::FitResult used to have a method
called GetCovarianceMatrix. This commit reinstates that old method for
compatibility reasons.
  • Loading branch information
cburgard authored and guitargeek committed Nov 15, 2024
1 parent 896ed3f commit cdb00fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions roofit/roofitcore/inc/RooMinimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class RooMinimizer : public TObject {
double Edm() const { return fEdm; }
bool IsValid() const { return fValid; }
int Status() const { return fStatus; }
void GetCovarianceMatrix(TMatrixDSym &cov) const;

bool isParameterFixed(unsigned int ipar) const;

Expand Down
11 changes: 11 additions & 0 deletions roofit/roofitcore/src/RooMinimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1179,3 +1179,14 @@ bool RooMinimizer::FitResult::isParameterFixed(unsigned int ipar) const
{
return fFixedParams.find(ipar) != fFixedParams.end();
}

void RooMinimizer::FitResult::GetCovarianceMatrix(TMatrixDSym &covs) const
{
const size_t nParams = fParams.size();
covs.ResizeTo(nParams, nParams);
for (std::size_t ic = 0; ic < nParams; ic++) {
for (std::size_t ii = 0; ii < nParams; ii++) {
covs(ic, ii) = covMatrix(fCovMatrix, ic, ii);
}
}
}

0 comments on commit cdb00fd

Please sign in to comment.