ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
MuonCalib::CurvedLine Class Reference

#include <CurvedLine.h>

Collaboration diagram for MuonCalib::CurvedLine:

Public Types

using MdtHitVec = MuonCalibSegment::MdtHitVec
 
using MdtHitPtr = MuonCalibSegment::MdtHitPtr
 

Public Member Functions

 CurvedLine ()
 Default constructor: a straight line through (0,0,0) pointing in in the local x direction of the chambers is created. More...
 
 CurvedLine (std::vector< Amg::Vector3D > &points)
 Constructor. More...
 
 CurvedLine (std::vector< Amg::Vector3D > &points, std::vector< Amg::Vector3D > &x_and_y_errors)
 Constructor. More...
 
Amg::Vector3D getPointOnLine (const double &loc_z) const
 get the point on the line a the local z coordinate "loc_z" More...
 
MTStraightLine getTangent (const double &loc_z) const
 get the tangent to the line a the local z coordinate "loc_z" More...
 
void setChi2 (double chi2)
 Cache the chi2. More...
 
double chi2 () const
 
void setNumberOfTrackHits (unsigned int n_hits)
 cache the number of track hits More...
 
unsigned int numberOfTrackHits () const
 
double chi2PerDegreesOfFreedom () const
 Return chi2 / number of TrackHits - 3. More...
 
void setUsedHits (const MdtHitVec &hits)
 
const MdtHitVectrackHits () const
 

Private Member Functions

void init (std::vector< Amg::Vector3D > &points, std::vector< Amg::Vector3D > &x_and_y_errors)
 

Private Attributes

const Legendre_polynomialm_Legendre = nullptr
 
Amg::VectorX m_coeff_xz
 
Amg::VectorX m_coeff_yz
 
double m_chi2 {-1}
 
unsigned int m_numTrkHits {0}
 
MdtHitVec m_used_hits
 

Detailed Description

Definition at line 31 of file CurvedLine.h.

Member Typedef Documentation

◆ MdtHitPtr

Definition at line 34 of file CurvedLine.h.

◆ MdtHitVec

Definition at line 33 of file CurvedLine.h.

Constructor & Destructor Documentation

◆ CurvedLine() [1/3]

CurvedLine::CurvedLine ( )

Default constructor: a straight line through (0,0,0) pointing in in the local x direction of the chambers is created.

Definition at line 20 of file CurvedLine.cxx.

20  {
22  // VARIABLES //
24 
25  std::vector<Amg::Vector3D> points(3);
26  std::vector<Amg::Vector3D> errors(3);
27 
29  // FILL VARIABLES //
31 
32  points[0] = Amg::Vector3D(0.0, 0.0, 0.0);
33  errors[0] = Amg::Vector3D(1.0, 1.0, 0.0);
34  points[1] = Amg::Vector3D(0.0, 0.0, 1.0);
35  errors[1] = Amg::Vector3D(1.0, 1.0, 0.0);
36  points[2] = Amg::Vector3D(0.0, 0.0, 2.0);
37  errors[2] = Amg::Vector3D(1.0, 1.0, 0.0);
38 
40  // INITIALIZATION //
42 
43  init(points, errors);
44 }

◆ CurvedLine() [2/3]

CurvedLine::CurvedLine ( std::vector< Amg::Vector3D > &  points)

Constructor.

Parameters
pointsA straight line in the xz and a parabolic line in the yz plane is fitter through the given points. All points get equal weight.

Definition at line 52 of file CurvedLine.cxx.

52  {
54  // VARIABLES //
56 
57  std::vector<Amg::Vector3D> errors(points.size());
58 
60  // FILL VARIABLES //
62 
63  for (auto & error : errors) { error = Amg::Vector3D(1.0, 1.0, 0.0); }
64 
66  // INITIALIZATION //
68 
69  init(points, errors);
70 }

◆ CurvedLine() [3/3]

CurvedLine::CurvedLine ( std::vector< Amg::Vector3D > &  points,
std::vector< Amg::Vector3D > &  x_and_y_errors 
)

Constructor.

Parameters
pointsA straight line in the xz and a parabolic line in the yz plane is fitter through the given points.
x_and_y_errorsErrors of the x and y coordinates of the given points

Definition at line 78 of file CurvedLine.cxx.

78 { init(points, x_and_y_errors); }

Member Function Documentation

◆ chi2()

double CurvedLine::chi2 ( ) const

Definition at line 191 of file CurvedLine.cxx.

191 { return m_chi2; }

◆ chi2PerDegreesOfFreedom()

double CurvedLine::chi2PerDegreesOfFreedom ( ) const

Return chi2 / number of TrackHits - 3.

Definition at line 195 of file CurvedLine.cxx.

195 { return m_chi2 / (m_numTrkHits > 2 ? m_numTrkHits - 3 : 0.01); }

◆ getPointOnLine()

Amg::Vector3D CurvedLine::getPointOnLine ( const double &  loc_z) const

get the point on the line a the local z coordinate "loc_z"

Definition at line 86 of file CurvedLine.cxx.

86  {
88  // VARIABLES //
90 
91  double loc_x(0.0), loc_y(0.0);
92 
94  // CALCULATE THE COORDINATES //
96 
97  for (int k = 0; k < m_coeff_xz.rows(); k++) { loc_x = loc_x + m_coeff_xz[k] * m_Legendre->value(k, loc_z); }
98 
99  for (int k = 0; k < m_coeff_yz.rows(); k++) { loc_y = loc_y + m_coeff_yz[k] * m_Legendre->value(k, loc_z); }
100 
102  // RETURN THE REQUESTED POINT //
104 
105  return Amg::Vector3D(loc_x, loc_y, loc_z);
106 }

◆ getTangent()

MTStraightLine CurvedLine::getTangent ( const double &  loc_z) const

get the tangent to the line a the local z coordinate "loc_z"

Definition at line 114 of file CurvedLine.cxx.

114  {
116  // VARIABLES //
118 
119  Amg::Vector3D null_vec(0.0, 0.0, 0.0); // auxiliary 0 vector
120  Amg::Vector3D point_1(getPointOnLine(loc_z)); // first point on the curved
121  // line
122  Amg::Vector3D point_2(getPointOnLine(loc_z + 1.0)); // second point on the
123  // curved line
124 
126  // RETURN THE TANGENT //
128 
129  return MTStraightLine(point_1, point_2 - point_1, null_vec, null_vec);
130 }

◆ init()

void CurvedLine::init ( std::vector< Amg::Vector3D > &  points,
std::vector< Amg::Vector3D > &  x_and_y_errors 
)
private

Definition at line 138 of file CurvedLine.cxx.

138  {
140  // CHECK THE NUMBER OF POINTS //
142 
143  if (points.size() < 3) {
144  MsgStream log(Athena::getMessageSvc(), "CurvedLine");
145  log << MSG::ERROR << "Class CurvedLine, method init: Not enough points given, must be at least 3 points!" << endmsg;
146  }
147 
149  // VARIABLES //
151 
153  LegendrePolynomial legendre; // Legendre polynomial needed by the base
154  // function fitter
155  std::vector<SamplePoint> sample_points(points.size()); // sample points needed
156  // by the base function
157  // fitter
159  // FILL THE VARIABLES AND PERFORM THE FITS //
161 
162  // xz plane //
163  for (unsigned int k = 0; k < points.size(); k++) {
164  sample_points[k].set_x1(points[k].z());
165  sample_points[k].set_x2(points[k].x());
166  sample_points[k].set_error(x_and_y_errors[k].x());
167  }
168  fitter.set_number_of_coefficients(2);
169  fitter.fit_parameters(sample_points, 1, sample_points.size(), &legendre);
170  m_coeff_xz = fitter.coefficients();
171 
172  // yz plane //
173  for (unsigned int k = 0; k < points.size(); k++) {
174  sample_points[k].set_x1(points[k].z());
175  sample_points[k].set_x2(points[k].y());
176  sample_points[k].set_error(x_and_y_errors[k].y());
177  }
178  fitter.set_number_of_coefficients(3);
179  fitter.fit_parameters(sample_points, 1, sample_points.size(), &legendre);
180  m_coeff_yz = fitter.coefficients();
181 
183  // GET A POINTER TO THE LEGENDRE POLYNOMIAL //
185 
187 
188  return;
189 }

◆ numberOfTrackHits()

unsigned int CurvedLine::numberOfTrackHits ( ) const

Definition at line 193 of file CurvedLine.cxx.

193 { return m_numTrkHits; }

◆ setChi2()

void CurvedLine::setChi2 ( double  chi2)

Cache the chi2.

Definition at line 190 of file CurvedLine.cxx.

190 { m_chi2 = std::isnan(chi2) ? -1 : chi2; }

◆ setNumberOfTrackHits()

void CurvedLine::setNumberOfTrackHits ( unsigned int  n_hits)

cache the number of track hits

Definition at line 192 of file CurvedLine.cxx.

192 { m_numTrkHits = n_hits; }

◆ setUsedHits()

void CurvedLine::setUsedHits ( const MdtHitVec hits)

Definition at line 197 of file CurvedLine.cxx.

197 { m_used_hits = hits; }

◆ trackHits()

const CurvedLine::MdtHitVec & CurvedLine::trackHits ( ) const

Definition at line 198 of file CurvedLine.cxx.

198 { return m_used_hits; }

Member Data Documentation

◆ m_chi2

double MuonCalib::CurvedLine::m_chi2 {-1}
private

Definition at line 86 of file CurvedLine.h.

◆ m_coeff_xz

Amg::VectorX MuonCalib::CurvedLine::m_coeff_xz
private

Definition at line 81 of file CurvedLine.h.

◆ m_coeff_yz

Amg::VectorX MuonCalib::CurvedLine::m_coeff_yz
private

Definition at line 83 of file CurvedLine.h.

◆ m_Legendre

const Legendre_polynomial* MuonCalib::CurvedLine::m_Legendre = nullptr
private

Definition at line 79 of file CurvedLine.h.

◆ m_numTrkHits

unsigned int MuonCalib::CurvedLine::m_numTrkHits {0}
private

Definition at line 87 of file CurvedLine.h.

◆ m_used_hits

MdtHitVec MuonCalib::CurvedLine::m_used_hits
private

Definition at line 88 of file CurvedLine.h.


The documentation for this class was generated from the following files:
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
MuonCalib::CurvedLine::init
void init(std::vector< Amg::Vector3D > &points, std::vector< Amg::Vector3D > &x_and_y_errors)
Definition: CurvedLine.cxx:138
MuonCalib::CurvedLine::m_used_hits
MdtHitVec m_used_hits
Definition: CurvedLine.h:88
MuonCalib::CurvedLine::m_Legendre
const Legendre_polynomial * m_Legendre
Definition: CurvedLine.h:79
MuonCalib::Legendre_polynomial::get_Legendre_polynomial
static const Legendre_polynomial * get_Legendre_polynomial(void)
get a pointer to the Legendre polynomial
Definition: Legendre_polynomial.cxx:31
x
#define x
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
MuonCalib::CurvedLine::getPointOnLine
Amg::Vector3D getPointOnLine(const double &loc_z) const
get the point on the line a the local z coordinate "loc_z"
Definition: CurvedLine.cxx:86
MuonCalib::BaseFunctionFitter
Definition: BaseFunctionFitter.h:47
z
#define z
MuonCalib::CurvedLine::m_coeff_xz
Amg::VectorX m_coeff_xz
Definition: CurvedLine.h:81
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
MuonCalib::Legendre_polynomial::value
double value(const int &order, const double &x) const
get the value of the Legendre polynomial of order m_order at x
MuonCalib::LegendrePolynomial
Definition: LegendrePolynomial.h:39
MuonCalib::CurvedLine::chi2
double chi2() const
Definition: CurvedLine.cxx:191
MuonCalib::CurvedLine::m_numTrkHits
unsigned int m_numTrkHits
Definition: CurvedLine.h:87
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
MuonCalib::CurvedLine::m_chi2
double m_chi2
Definition: CurvedLine.h:86
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
y
#define y
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MuonCalib::MTStraightLine
Definition: MTStraightLine.h:16
error
Definition: IImpactPoint3dEstimator.h:70
MuonCalib::CurvedLine::m_coeff_yz
Amg::VectorX m_coeff_yz
Definition: CurvedLine.h:83
fitman.k
k
Definition: fitman.py:528