ATLAS Offline Software
MTStraightLine.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MTStraightLineH
6 #define MTStraightLineH
9 
13 
14 namespace MuonCalib {
15 
17  public:
20 
21  // Constructors //
25 
26  MTStraightLine(const Amg::Vector3D& r_position, const Amg::Vector3D& r_direction, const Amg::Vector3D& r_position_error,
27  const Amg::Vector3D& r_direction_error) {
28  init(r_position, r_direction, r_position_error, r_direction_error);
29  }
35 
36  MTStraightLine(const double& r_a_x1, const double& r_b_x1, const double& r_a_x2, const double& r_b_x2, const double& r_a_x1_err,
37  const double& r_b_x1_err, const double& r_a_x2_err, const double& r_b_x2_err) {
38  init(r_a_x1, r_b_x1, r_a_x2, r_b_x2, r_a_x1_err, r_b_x1_err, r_a_x2_err, r_b_x2_err);
39  }
48 
49  // Methods //
50  // get-methods //
63  double a_x1() const;
66  double a_x1_error() const;
69  double b_x1() const;
72  double b_x1_error() const;
76  double a_x2() const;
79  double a_x2_error() const;
82  double b_x2() const;
85  double b_x2_error() const;
89  Amg::Vector3D pointOnLine(const double& lambda) const;
93  double signDistFrom(const MTStraightLine& h) const;
97  double distFromLine(const Amg::Vector3D& point) const;
100 
102  void setChi2(double chi2);
103  double chi2() const;
104 
106  void setNumberOfTrackHits(unsigned int n_hits);
107  unsigned int numberOfTrackHits() const;
109  double chi2PerDegreesOfFreedom() const;
110 
111  void setUsedHits(const MdtHitVec& hits);
112  const MdtHitVec& trackHits() const;
113 
114  private:
115  // internal representation of the straight line //
116  Amg::Vector3D m_position{0., 0., 0.}; // position vector of the straight line
117  Amg::Vector3D m_direction{0., 0., 0.}; // direction vector of the straight line
118 
119  // errors on the position and direction vector //
120  Amg::Vector3D m_position_error{0., 0., 0.}; // error on the position vector
121  Amg::Vector3D m_direction_error{0., 0., 0.}; // error on the direction vector
122 
123  double m_chi2{-1};
124  unsigned int m_numTrkHits{0};
126 
127  // initializtion methods //
128  void init(); // default initialization method
129 
130  void init(const Amg::Vector3D& r_position, const Amg::Vector3D& r_direction, const Amg::Vector3D& r_position_error,
131  const Amg::Vector3D& r_direction_error);
132  // r_position: position vector of the straight line;
133  // r_direction: direction vector of the straight line;
134  // r_position_error: error on the position vector;
135  // r_direction_error: error on the direction vector
136 
137  void init(const double& r_a_x1, const double& r_b_x1, const double& r_a_x2, const double& r_b_x2, const double& r_a_x1_err,
138  const double& r_b_x1_err, const double& r_a_x2_err, const double& r_b_x2_err);
139  // Coordinates: x1, x2, x3.
140  // Parametrization of the straight line: x1 = r_a_x1*x3 + r_b_x1;
141  // x2 = r_a_x2*x3 + r_b_x2;
142  // x3 arbitrary.
143  // r_a_x1_err: error on r_a_x1.
144  // r_b_x1_err: error on r_b_x1.
145  // r_a_x2_err: error on r_a_x2.
146  // r_b_x2_err: error on r_b_x2.
147  };
148 
149 } // namespace MuonCalib
150 
151 #endif
MuonCalib::MTStraightLine::MdtHitVec
MuonCalibSegment::MdtHitVec MdtHitVec
Definition: MTStraightLine.h:18
MuonCalib::MTStraightLine::a_x1
double a_x1() const
get the slope of the straight line in the x1-x3 plane
Definition: MTStraightLine.cxx:46
MuonCalib::MTStraightLine::MTStraightLine
MTStraightLine(const Amg::Vector3D &r_position, const Amg::Vector3D &r_direction, const Amg::Vector3D &r_position_error, const Amg::Vector3D &r_direction_error)
Constructor: r_position: position vector of the straight line; r_direction: direction vector of the s...
Definition: MTStraightLine.h:26
MuonCalibSegment.h
MuonCalib::MTStraightLine::setChi2
void setChi2(double chi2)
Cache the chi2.
Definition: MTStraightLine.cxx:134
MuonCalib::MTStraightLine::m_numTrkHits
unsigned int m_numTrkHits
Definition: MTStraightLine.h:124
MuonCalib::MTStraightLine::m_direction
Amg::Vector3D m_direction
Definition: MTStraightLine.h:117
MuonCalib::MTStraightLine::MTStraightLine
MTStraightLine(const double &r_a_x1, const double &r_b_x1, const double &r_a_x2, const double &r_b_x2, const double &r_a_x1_err, const double &r_b_x1_err, const double &r_a_x2_err, const double &r_b_x2_err)
Coordinates: x1, x2, x3.
Definition: MTStraightLine.h:36
MuonCalib::MTStraightLine::positionError
Amg::Vector3D positionError() const
get the error on the position vector of the straight line
Definition: MTStraightLine.cxx:44
MuonCalib::MuonCalibSegment::MdtHitVec
std::vector< MdtHitPtr > MdtHitVec
Definition: MuonCalibSegment.h:45
MuonCalib::MTStraightLine::a_x2
double a_x2() const
get the slope of the straight line in the x2-x3 plane
Definition: MTStraightLine.cxx:65
MuonCalib::MTStraightLine::directionVector
Amg::Vector3D directionVector() const
get the direction vector of the straight line
Definition: MTStraightLine.cxx:43
MuonCalib::MTStraightLine::b_x1_error
double b_x1_error() const
get the error on the intercept of the straight line in the x1-x3 plane
Definition: MTStraightLine.cxx:62
MuonCalib::MTStraightLine::pointOnLine
Amg::Vector3D pointOnLine(const double &lambda) const
get the point on the line for the given scale factor lambda, point=position_vector+lambda*direction_v...
Definition: MTStraightLine.cxx:87
MuonCalib::MTStraightLine::b_x1
double b_x1() const
get the intercept of the straight line in the x1-x3 plane
Definition: MTStraightLine.cxx:53
MuonCalib::MTStraightLine::m_direction_error
Amg::Vector3D m_direction_error
Definition: MTStraightLine.h:121
MuonCalib::MTStraightLine::init
void init()
Definition: MTStraightLine.cxx:14
MuonCalib::MTStraightLine::a_x2_error
double a_x2_error() const
get the error on the slope of the straight line in the x2-x3 plane
Definition: MTStraightLine.cxx:66
MuonCalib::MTStraightLine::chi2PerDegreesOfFreedom
double chi2PerDegreesOfFreedom() const
Return chi2 / number of TrackHits - 2.
Definition: MTStraightLine.cxx:139
MuonCalib::MTStraightLine::a_x1_error
double a_x1_error() const
get the error on the slope of the straight line in the x1-x3 plane
Definition: MTStraightLine.cxx:48
GeoPrimitives.h
MuonCalib::MTStraightLine::numberOfTrackHits
unsigned int numberOfTrackHits() const
Definition: MTStraightLine.cxx:137
MuonCalib::MTStraightLine::directionError
Amg::Vector3D directionError() const
get the error on the direction vector of the straight line
Definition: MTStraightLine.cxx:45
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
MuonCalib::MTStraightLine::m_chi2
double m_chi2
Definition: MTStraightLine.h:123
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::MTStraightLine::m_position
Amg::Vector3D m_position
Definition: MTStraightLine.h:116
MuonCalib::MTStraightLine::MTStraightLine
MTStraightLine()
Default constructor: all internal parameters of the straight line are set to 0.
Definition: MTStraightLine.h:22
MuonCalib::MTStraightLine::MdtHitPtr
MuonCalibSegment::MdtHitPtr MdtHitPtr
Definition: MTStraightLine.h:19
MuonCalib::MTStraightLine::b_x2
double b_x2() const
get the intercept of the straight line in the x2-x3 plane
Definition: MTStraightLine.cxx:74
MuonCalib::MTStraightLine::chi2
double chi2() const
Definition: MTStraightLine.cxx:135
MuonCalib::MTStraightLine::m_position_error
Amg::Vector3D m_position_error
Definition: MTStraightLine.h:120
MuonCalib::MTStraightLine::signDistFrom
double signDistFrom(const MTStraightLine &h) const
get the signed distance of two lines (if both are parallel, dist>0)
Definition: MTStraightLine.cxx:89
MuonCalib::MTStraightLine::setUsedHits
void setUsedHits(const MdtHitVec &hits)
Definition: MTStraightLine.cxx:141
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonCalib::MTStraightLine::distFromLine
double distFromLine(const Amg::Vector3D &point) const
get the distance of point point from straight line
Definition: MTStraightLine.cxx:120
h
MuonCalib::MTStraightLine::m_used_hits
MdtHitVec m_used_hits
Definition: MTStraightLine.h:125
MuonCalib::MTStraightLine::b_x2_error
double b_x2_error() const
get the slope of the intercept of the straight line in the x2-x3 plane
Definition: MTStraightLine.cxx:83
MuonCalib::MTStraightLine
Definition: MTStraightLine.h:16
MuonCalib::MTStraightLine::trackHits
const MdtHitVec & trackHits() const
Definition: MTStraightLine.cxx:142
MuonCalib::MTStraightLine::positionVector
Amg::Vector3D positionVector() const
get the position vector of the straight line
Definition: MTStraightLine.cxx:42
MuonCalib::MTStraightLine::setNumberOfTrackHits
void setNumberOfTrackHits(unsigned int n_hits)
cache the number of track hits
Definition: MTStraightLine.cxx:136
MuonCalib::MuonCalibSegment::MdtHitPtr
std::shared_ptr< MdtCalibHitBase > MdtHitPtr
typedef for a collection of MdtCalibHitBase s
Definition: MuonCalibSegment.h:44