ATLAS Offline Software
TransformToLine.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DCMATH_TRANSFORMTOLINE_H
6 #define DCMATH_TRANSFORMTOLINE_H
7 
8 #include <cmath>
9 
12 
13 namespace TrkDriftCircleMath {
14 
16  public:
17  TransformToLine() = default;
18  TransformToLine(const Line& line) : m_toLineRot(line.phi()), m_toLocalRot(-line.phi()), m_shift(line.x0(), line.y0()) {}
19 
20  LocVec2D toLine(const LocVec2D& pos) const { return m_toLineRot * pos - m_shift; }
21 
23  double toLineX(const LocVec2D& pos) const { return m_toLineRot.xval(pos) - m_shift.x(); }
24  double toLineY(const LocVec2D& pos) const { return m_toLineRot.yval(pos) - m_shift.y(); }
25 
26  LocVec2D toLocal(const LocVec2D& pos) const { return m_toLocalRot * (pos + m_shift); }
27 
28  void set(const Line& line) {
29  m_toLineRot.set(line.phi());
30  m_toLocalRot.set(-line.phi());
31  m_shift.setX(line.x0());
32  m_shift.setY(line.y0());
33  }
34 
35  DriftCircle toLine(const DriftCircle& dc) const {
36  return DriftCircle(toLine(dc.position()), dc.r(), dc.dr(), dc.driftState(), dc.id(), dc.rot(), dc.index());
37  }
38  DriftCircle toLocal(const DriftCircle& dc) const {
39  return DriftCircle(toLocal(dc.position()), dc.r(), dc.dr(), dc.driftState(), dc.id(), dc.rot(), dc.index());
40  }
41 
43  const RotPhi& toLineRotation() const { return m_toLineRot; }
44 
46  const RotPhi& toLocalRotation() const { return m_toLocalRot; }
47 
48  private:
51  LocVec2D m_shift{0., 0.};
52  };
53 
54 } // namespace TrkDriftCircleMath
55 
56 #endif
TrkDriftCircleMath::LocVec2D::setY
void setY(double y)
Set only y.
Definition: LocVec2D.h:44
checkFileSG.line
line
Definition: checkFileSG.py:75
TrkDriftCircleMath::DriftCircle::index
unsigned int index() const
Definition: DriftCircle.h:99
TrkDriftCircleMath::TransformToLine::toLocal
DriftCircle toLocal(const DriftCircle &dc) const
Definition: TransformToLine.h:38
TrkDriftCircleMath::TransformToLine::m_toLineRot
RotPhi m_toLineRot
Definition: TransformToLine.h:49
TrkDriftCircleMath::TransformToLine::m_shift
LocVec2D m_shift
Definition: TransformToLine.h:51
TrkDriftCircleMath::DriftCircle::position
const LocVec2D & position() const
access to local position
Definition: DriftCircle.h:74
TrkDriftCircleMath::RotPhi
Definition: RotPhi.h:14
TrkDriftCircleMath::TransformToLine::toLineX
double toLineX(const LocVec2D &pos) const
only get one coordinate -> faster
Definition: TransformToLine.h:23
TrkDriftCircleMath
Function object to check whether two Segments are sub/super sets or different.
Definition: IMdtSegmentFinder.h:13
TrkDriftCircleMath::DriftCircle::dr
double dr() const
access to error drift radius
Definition: DriftCircle.h:89
DriftCircle.h
TrkDriftCircleMath::LocVec2D::x
double x() const
Returns the x coordinate of the vector.
Definition: LocVec2D.h:27
TrkDriftCircleMath::RotPhi::xval
double xval(const LocVec2D &lv) const
Definition: RotPhi.h:28
TrkDriftCircleMath::DriftCircle
This class represents a drift time measurement.
Definition: DriftCircle.h:22
TrkDriftCircleMath::DriftCircle::rot
const Muon::MdtDriftCircleOnTrack * rot() const
access to the ROT
Definition: DriftCircle.h:97
TrkDriftCircleMath::DriftCircle::r
double r() const
access to drift radius
Definition: DriftCircle.h:86
TrkDriftCircleMath::TransformToLine::set
void set(const Line &line)
Definition: TransformToLine.h:28
TrkDriftCircleMath::TransformToLine
Definition: TransformToLine.h:15
TrkDriftCircleMath::TransformToLine::m_toLocalRot
RotPhi m_toLocalRot
Definition: TransformToLine.h:50
TrkDriftCircleMath::TransformToLine::TransformToLine
TransformToLine()=default
TrkDriftCircleMath::LocVec2D
Implementation of 2 dimensional vector class.
Definition: LocVec2D.h:16
TrkDriftCircleMath::LocVec2D::setX
void setX(double x)
Set only x.
Definition: LocVec2D.h:42
TrkDriftCircleMath::Line
Definition: Line.h:17
TrkDriftCircleMath::TransformToLine::toLineRotation
const RotPhi & toLineRotation() const
rotate local position into line frame
Definition: TransformToLine.h:43
Line.h
TrkDriftCircleMath::DriftCircle::driftState
const DriftState & driftState() const
access to drift state
Definition: DriftCircle.h:95
TrkDriftCircleMath::LocVec2D::y
double y() const
Returns the y coordinate of the vector.
Definition: LocVec2D.h:29
TrkDriftCircleMath::RotPhi::set
void set(double phi)
Definition: RotPhi.h:34
TrkDriftCircleMath::TransformToLine::TransformToLine
TransformToLine(const Line &line)
Definition: TransformToLine.h:18
TrkDriftCircleMath::TransformToLine::toLocal
LocVec2D toLocal(const LocVec2D &pos) const
Definition: TransformToLine.h:26
TrkDriftCircleMath::TransformToLine::toLine
LocVec2D toLine(const LocVec2D &pos) const
Definition: TransformToLine.h:20
TrkDriftCircleMath::RotPhi::yval
double yval(const LocVec2D &lv) const
Definition: RotPhi.h:29
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TrkDriftCircleMath::TransformToLine::toLineY
double toLineY(const LocVec2D &pos) const
Definition: TransformToLine.h:24
TrkDriftCircleMath::DriftCircle::id
const MdtId & id() const
access to identifier
Definition: DriftCircle.h:77
TrkDriftCircleMath::TransformToLine::toLine
DriftCircle toLine(const DriftCircle &dc) const
Definition: TransformToLine.h:35
TrkDriftCircleMath::TransformToLine::toLocalRotation
const RotPhi & toLocalRotation() const
rotate position in line frame into local frame
Definition: TransformToLine.h:46