ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::Fit2D::LinStats Struct Reference

A structure to hold linear fit statistics. More...

#include <Fit2D.h>

Collaboration diagram for Muon::Fit2D::LinStats:

Public Member Functions

 LinStats ()
 Constructor.
void clear ()
 Clear the statistics before a new fit.
void eval (double fX, double &fY, double &fYerr) const
 Evaluate a point along the fitted line.
std::string toString () const
 Get a string representation of the fit parameters.

Public Attributes

int n
 Number of points.
double fIntercept
 Intercept of the fit line.
double fSlope
 Slope of the fit line.
double fCov [2][2]
 The parameter covariance matrix.
double fChi2
 Chi-squared of the fit.

Detailed Description

A structure to hold linear fit statistics.

Definition at line 76 of file Fit2D.h.

Constructor & Destructor Documentation

◆ LinStats()

Muon::Fit2D::LinStats::LinStats ( )
inline

Constructor.

Definition at line 163 of file Fit2D.h.

163 :
164 n(0),
165 fIntercept(0.0),
166 fSlope(0.0),
167 fChi2(0.0)
168 {
169 memset(fCov, 0, sizeof(fCov));
170 }
double fCov[2][2]
The parameter covariance matrix.
Definition Fit2D.h:81
int n
Number of points.
Definition Fit2D.h:78
double fIntercept
Intercept of the fit line.
Definition Fit2D.h:79
double fChi2
Chi-squared of the fit.
Definition Fit2D.h:82
double fSlope
Slope of the fit line.
Definition Fit2D.h:80

Member Function Documentation

◆ clear()

void Muon::Fit2D::LinStats::clear ( )
inline

Clear the statistics before a new fit.

Definition at line 172 of file Fit2D.h.

173 {
174 n = 0;
175 fIntercept = fSlope = fChi2 = 0.0;
176 memset(fCov, 0, sizeof(fCov));
177 }

◆ eval()

void Muon::Fit2D::LinStats::eval ( double fX,
double & fY,
double & fYerr ) const

Evaluate a point along the fitted line.

Parameters
fXThe X value of the point to project
fY[output] The projected Y value
fYerr[output] The error of the projected Y value

Definition at line 26 of file Fit2D.cxx.

27{
28 gsl_fit_linear_est(fX, fIntercept, fSlope, fCov[0][0], fCov[0][1], fCov[1][1], &fY, &fYerr);
29}

◆ toString()

std::string Muon::Fit2D::LinStats::toString ( ) const

Get a string representation of the fit parameters.

Definition at line 31 of file Fit2D.cxx.

32{
33 std::ostringstream oss;
34 oss << "Y=" << fIntercept << "+X*" << fSlope
35 << ", N=" << n
36 << ", Cov=[[" << fCov[0][0] << "," << fCov[0][1] << "],["
37 << fCov[1][0] << "," << fCov[1][1] << "]]"
38 << ", Chi2=" << fChi2;
39
40 return oss.str();
41}

Member Data Documentation

◆ fChi2

double Muon::Fit2D::LinStats::fChi2

Chi-squared of the fit.

Definition at line 82 of file Fit2D.h.

◆ fCov

double Muon::Fit2D::LinStats::fCov[2][2]

The parameter covariance matrix.

Definition at line 81 of file Fit2D.h.

◆ fIntercept

double Muon::Fit2D::LinStats::fIntercept

Intercept of the fit line.

Definition at line 79 of file Fit2D.h.

◆ fSlope

double Muon::Fit2D::LinStats::fSlope

Slope of the fit line.

Definition at line 80 of file Fit2D.h.

◆ n

int Muon::Fit2D::LinStats::n

Number of points.

Definition at line 78 of file Fit2D.h.


The documentation for this struct was generated from the following files: