ATLAS Offline Software
Loading...
Searching...
No Matches
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.
 CurvedLine (std::vector< Amg::Vector3D > &points)
 Constructor.
 CurvedLine (std::vector< Amg::Vector3D > &points, std::vector< Amg::Vector3D > &x_and_y_errors)
 Constructor.
Amg::Vector3D getPointOnLine (const double loc_z) const
 get the point on the line a the local z coordinate "loc_z"
MTStraightLine getTangent (const double loc_z) const
 get the tangent to the line a the local z coordinate "loc_z"
void setChi2 (double chi2)
 Cache the chi2.
double chi2 () const
void setNumberOfTrackHits (unsigned int n_hits)
 cache the number of track hits
unsigned int numberOfTrackHits () const
double chi2PerDegreesOfFreedom () const
 Return chi2 / number of TrackHits - 3.
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

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 30 of file CurvedLine.h.

Member Typedef Documentation

◆ MdtHitPtr

◆ MdtHitVec

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}
void init(std::vector< Amg::Vector3D > &points, std::vector< Amg::Vector3D > &x_and_y_errors)
Eigen::Matrix< double, 3, 1 > Vector3D

◆ 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(), Amg::Vector3D(1.0, 1.0, 0.0));
58
60 // INITIALIZATION //
62
63 init(points, errors);
64}

◆ 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 72 of file CurvedLine.cxx.

72{ init(points, x_and_y_errors); }

Member Function Documentation

◆ chi2()

double CurvedLine::chi2 ( ) const

Definition at line 182 of file CurvedLine.cxx.

182{ return m_chi2; }

◆ chi2PerDegreesOfFreedom()

double CurvedLine::chi2PerDegreesOfFreedom ( ) const

Return chi2 / number of TrackHits - 3.

Definition at line 186 of file CurvedLine.cxx.

186{ return m_chi2 / (m_numTrkHits > 2 ? m_numTrkHits - 3 : 0.01); }
unsigned int m_numTrkHits
Definition CurvedLine.h:83

◆ 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 80 of file CurvedLine.cxx.

80 {
82 // VARIABLES //
84
85 double loc_x{0.0}, loc_y{0.0};
86
88 // CALCULATE THE COORDINATES //
90
91 for (int k = 0; k < m_coeff_xz.rows(); k++) {
92 loc_x += m_coeff_xz[k] * std::legendre(k, loc_z);
93 }
94
95 for (int k = 0; k < m_coeff_yz.rows(); k++) {
96 loc_y += m_coeff_yz[k] * std::legendre(k, loc_z);
97 }
98
100 // RETURN THE REQUESTED POINT //
102
103 return Amg::Vector3D(loc_x, loc_y, loc_z);
104}
Amg::VectorX m_coeff_yz
Definition CurvedLine.h:79
Amg::VectorX m_coeff_xz
Definition CurvedLine.h:77

◆ 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 112 of file CurvedLine.cxx.

112 {
114 // VARIABLES //
116
117 Amg::Vector3D null_vec(0.0, 0.0, 0.0); // auxiliary 0 vector
118 Amg::Vector3D point_1(getPointOnLine(loc_z)); // first point on the curved
119 // line
120 Amg::Vector3D point_2(getPointOnLine(loc_z + 1.0)); // second point on the
121 // curved line
122
124 // RETURN THE TANGENT //
126
127 return MTStraightLine(point_1, point_2 - point_1, null_vec, null_vec);
128}
Amg::Vector3D getPointOnLine(const double loc_z) const
get the point on the line a the local z coordinate "loc_z"

◆ init()

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

Definition at line 136 of file CurvedLine.cxx.

136 {
138 // CHECK THE NUMBER OF POINTS //
140
141 if (points.size() < 3) {
142 MsgStream log(Athena::getMessageSvc(), "CurvedLine");
143 log << MSG::ERROR << "Class CurvedLine, method init: Not enough points given, must be at least 3 points!" << endmsg;
144 }
145
147 // VARIABLES //
149
150 BaseFunctionFitter fitter;
151 LegendrePolynomial legendre; // Legendre polynomial needed by the base
152 // function fitter
153 std::vector<SamplePoint> sample_points(points.size()); // sample points needed
154 // by the base function
155 // fitter
157 // FILL THE VARIABLES AND PERFORM THE FITS //
159
160 // xz plane //
161 for (unsigned int k = 0; k < points.size(); k++) {
162 sample_points[k].set_x1(points[k].z());
163 sample_points[k].set_x2(points[k].x());
164 sample_points[k].set_error(x_and_y_errors[k].x());
165 }
166 fitter.set_number_of_coefficients(2);
167 fitter.fit_parameters(sample_points, 1, sample_points.size(), legendre);
168 m_coeff_xz = fitter.coefficients();
169
170 // yz plane //
171 for (unsigned int k = 0; k < points.size(); k++) {
172 sample_points[k].set_x1(points[k].z());
173 sample_points[k].set_x2(points[k].y());
174 sample_points[k].set_error(x_and_y_errors[k].y());
175 }
176 fitter.set_number_of_coefficients(3);
177 fitter.fit_parameters(sample_points, 1, sample_points.size(), legendre);
178 m_coeff_yz = fitter.coefficients();
179
180}
#define endmsg
#define y
#define x
#define z
IMessageSvc * getMessageSvc(bool quiet=false)
const ShapeFitter * fitter

◆ numberOfTrackHits()

unsigned int CurvedLine::numberOfTrackHits ( ) const

Definition at line 184 of file CurvedLine.cxx.

184{ return m_numTrkHits; }

◆ setChi2()

void CurvedLine::setChi2 ( double chi2)

Cache the chi2.

Definition at line 181 of file CurvedLine.cxx.

181{ m_chi2 = std::isnan(chi2) ? -1 : chi2; }
double chi2() const

◆ setNumberOfTrackHits()

void CurvedLine::setNumberOfTrackHits ( unsigned int n_hits)

cache the number of track hits

Definition at line 183 of file CurvedLine.cxx.

183{ m_numTrkHits = n_hits; }

◆ setUsedHits()

void CurvedLine::setUsedHits ( const MdtHitVec & hits)

Definition at line 188 of file CurvedLine.cxx.

◆ trackHits()

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

Definition at line 189 of file CurvedLine.cxx.

189{ return m_used_hits; }

Member Data Documentation

◆ m_chi2

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

Definition at line 82 of file CurvedLine.h.

82{-1};

◆ m_coeff_xz

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

Definition at line 77 of file CurvedLine.h.

◆ m_coeff_yz

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

Definition at line 79 of file CurvedLine.h.

◆ m_numTrkHits

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

Definition at line 83 of file CurvedLine.h.

83{0};

◆ m_used_hits

MdtHitVec MuonCalib::CurvedLine::m_used_hits
private

Definition at line 84 of file CurvedLine.h.


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