ATLAS Offline Software
FPGATrackSimKeyLayerTool.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 #ifndef FPGATrackSimKeyLayerTool_H
4 #define FPGATrackSimKeyLayerTool_H
5 
28 #include <cmath>
29 
30 //-------------------------------------------------------------------------------------------------------
31 //
32 // Tool for doing Key Layer Math
33 // -- that is converting be the track parameters set by the standard (pT,eta,phi,d0,z0) and
34 // the "KeyLayer" parametes set by the phi and z at to radii (R1,R2) and a deviation from
35 // straight line between the two points (xm)
36 // -- All the math for the r-phi plane is based finding the rotated coordinate system where
37 // the points (R1,phiR1) and (R2,phiR2) both lie on the x=0 axis. Then the x of a track halfway
38 // between the points (called xm) is the sagitta.
39 //
40 //-------------------------------------------------------------------------------------------------------
42 {
43 public:
44  FPGATrackSimKeyLayerTool(double r1, double r2) : m_R1(r1), m_R2(r2) {}
45  FPGATrackSimKeyLayerTool() {} // NOTE r1 and r2 must be set before using class
46 
47  struct KeyLyrPars {
48  KeyLyrPars() = default;
50  : z1(parset[0]), z2(parset[1]), phi1(parset[2]), phi2(parset[3]), xm(parset[4]) {}
51  double z1{};
52  double z2{};
53  double phi1{};
54  double phi2{};
55  double xm{};
56  };
57 
58  // convert (r,phi) to (x,y)
59  std::pair<double, double> getXY(double r, double phi) const;
60 
61  // Get rotation angles need to rotate the two given points to be only seperated in the y direction (both have same x)
62  // results is the sin and cos of rotation
63  std::pair<double, double> getRotationAngles(const std::pair<double, double>& xy1, const std::pair<double, double>& xy2) const;
64 
65  // Apply a rotation angles (sin and cos) to a point xy
66  std::pair<double, double> rotateXY(const std::pair<double, double>& xy, const std::pair<double, double>& ang) const;
67 
68  // Simple struct and function to get the rotation angle and full rotated information in one call
70  {
71  std::pair<double, double> xy1p{}; // point 1 after rotation
72  std::pair<double, double> xy2p{}; // point 2 after rotation
73  std::pair<double, double> rotang{}; // rotation angle
74  double y{}; // y seperation after rotation
75  };
76  rotatedConfig getRotatedConfig(const KeyLyrPars &keypars) const;
77 
78  // get the x,y coordinates of a hit in the rotated coordinate system specified by rotang
79  std::pair<double, double> getRotatedHit(const std::pair<double, double>& rotang, double rHit, double phiHit) const;
80 
81  // Convert back and forth to standard track parameters
82  KeyLyrPars trackParsToKeyPars(const FPGATrackSimTrackPars &pars) const;
83  FPGATrackSimTrackPars keyParsToTrackPars(const KeyLyrPars &keypars) const;
84 
85  // find expected z hit position given a radius
86  double zExpected(const KeyLyrPars& keypars, double r) const;
87 
88  // find expected x position of a hit at given a radius in the rotated coordinate system
89  double xExpected(const KeyLyrPars& keypars, double rHit, double phiHit) const;
90 
91  // takes hit position and calculated what xm would be for track going through that hit
92  double xmForHit(const KeyLyrPars& keypars, double rHit, double phiHit) const;
93 
94  // Find shift from nominal track to hit in the "x" direction
95  double deltaX(const KeyLyrPars& keypars, double rHit, double phiHit) const;
96 
97  // accessors
98  double R1() const {return m_R1;}
99  double R2() const {return m_R2;}
100  void setR1(const double r1) {m_R1=r1;}
101  void setR2(const double r2) {m_R2=r2;}
102 
103  private:
104  double m_R1{};
105  double m_R2{};
106 };
107 
108 
109 
110 #endif // FPGATrackSimKeyLayerTool_H
FPGATrackSimKeyLayerTool::xmForHit
double xmForHit(const KeyLyrPars &keypars, double rHit, double phiHit) const
Definition: FPGATrackSimKeyLayerTool.cxx:133
FPGATrackSimKeyLayerTool::rotatedConfig::xy1p
std::pair< double, double > xy1p
Definition: FPGATrackSimKeyLayerTool.h:71
FPGATrackSimKeyLayerTool::setR1
void setR1(const double r1)
Definition: FPGATrackSimKeyLayerTool.h:100
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
beamspotman.r
def r
Definition: beamspotman.py:672
FPGATrackSimKeyLayerTool::getRotatedHit
std::pair< double, double > getRotatedHit(const std::pair< double, double > &rotang, double rHit, double phiHit) const
Definition: FPGATrackSimKeyLayerTool.cxx:47
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
FPGATrackSimTrackPars
Definition: FPGATrackSimTrackPars.h:22
FPGATrackSimKeyLayerTool::R2
double R2() const
Definition: FPGATrackSimKeyLayerTool.h:99
FPGATrackSimKeyLayerTool::rotatedConfig
Definition: FPGATrackSimKeyLayerTool.h:70
FPGATrackSimKeyLayerTool::rotateXY
std::pair< double, double > rotateXY(const std::pair< double, double > &xy, const std::pair< double, double > &ang) const
Definition: FPGATrackSimKeyLayerTool.cxx:26
FPGATrackSimKeyLayerTool::KeyLyrPars::xm
double xm
Definition: FPGATrackSimKeyLayerTool.h:55
FPGATrackSimKeyLayerTool::rotatedConfig::xy2p
std::pair< double, double > xy2p
Definition: FPGATrackSimKeyLayerTool.h:72
FPGATrackSimKeyLayerTool::KeyLyrPars::phi2
double phi2
Definition: FPGATrackSimKeyLayerTool.h:54
FPGATrackSimKeyLayerTool::m_R2
double m_R2
Definition: FPGATrackSimKeyLayerTool.h:105
FPGATrackSimKeyLayerTool
Definition: FPGATrackSimKeyLayerTool.h:42
FPGATrackSimKeyLayerTool::FPGATrackSimKeyLayerTool
FPGATrackSimKeyLayerTool()
Definition: FPGATrackSimKeyLayerTool.h:45
FPGATrackSimBinUtil.h
Binning Utilities for GenScanTool.
FPGATrackSimKeyLayerTool::KeyLyrPars::KeyLyrPars
KeyLyrPars()=default
FPGATrackSimBinUtil::ParSet
Definition: FPGATrackSimBinUtil.h:45
FPGATrackSimKeyLayerTool::KeyLyrPars::z2
double z2
Definition: FPGATrackSimKeyLayerTool.h:52
FPGATrackSimKeyLayerTool::KeyLyrPars::phi1
double phi1
Definition: FPGATrackSimKeyLayerTool.h:53
FPGATrackSimKeyLayerTool::setR2
void setR2(const double r2)
Definition: FPGATrackSimKeyLayerTool.h:101
FPGATrackSimKeyLayerTool::trackParsToKeyPars
KeyLyrPars trackParsToKeyPars(const FPGATrackSimTrackPars &pars) const
Definition: FPGATrackSimKeyLayerTool.cxx:53
FPGATrackSimKeyLayerTool::getRotatedConfig
rotatedConfig getRotatedConfig(const KeyLyrPars &keypars) const
Definition: FPGATrackSimKeyLayerTool.cxx:32
FPGATrackSimKeyLayerTool::KeyLyrPars::KeyLyrPars
KeyLyrPars(const FPGATrackSimBinUtil::ParSet &parset)
Definition: FPGATrackSimKeyLayerTool.h:49
FPGATrackSimKeyLayerTool::R1
double R1() const
Definition: FPGATrackSimKeyLayerTool.h:98
FPGATrackSimKeyLayerTool::KeyLyrPars::z1
double z1
Definition: FPGATrackSimKeyLayerTool.h:51
FPGATrackSimKeyLayerTool::rotatedConfig::rotang
std::pair< double, double > rotang
Definition: FPGATrackSimKeyLayerTool.h:73
FPGATrackSimKeyLayerTool::deltaX
double deltaX(const KeyLyrPars &keypars, double rHit, double phiHit) const
Definition: FPGATrackSimKeyLayerTool.cxx:157
FPGATrackSimKeyLayerTool::rotatedConfig::y
double y
Definition: FPGATrackSimKeyLayerTool.h:74
FPGATrackSimKeyLayerTool::zExpected
double zExpected(const KeyLyrPars &keypars, double r) const
Definition: FPGATrackSimKeyLayerTool.cxx:127
FPGATrackSimKeyLayerTool::xExpected
double xExpected(const KeyLyrPars &keypars, double rHit, double phiHit) const
Definition: FPGATrackSimKeyLayerTool.cxx:171
FPGATrackSimKeyLayerTool::getRotationAngles
std::pair< double, double > getRotationAngles(const std::pair< double, double > &xy1, const std::pair< double, double > &xy2) const
Definition: FPGATrackSimKeyLayerTool.cxx:16
FPGATrackSimKeyLayerTool::getXY
std::pair< double, double > getXY(double r, double phi) const
Definition: FPGATrackSimKeyLayerTool.cxx:11
FPGATrackSimTrackPars.h
Structs that store the 5 track parameters.
FPGATrackSimKeyLayerTool::keyParsToTrackPars
FPGATrackSimTrackPars keyParsToTrackPars(const KeyLyrPars &keypars) const
Definition: FPGATrackSimKeyLayerTool.cxx:79
FPGATrackSimKeyLayerTool::FPGATrackSimKeyLayerTool
FPGATrackSimKeyLayerTool(double r1, double r2)
Definition: FPGATrackSimKeyLayerTool.h:44
FPGATrackSimKeyLayerTool::KeyLyrPars
Definition: FPGATrackSimKeyLayerTool.h:47
FPGATrackSimKeyLayerTool::m_R1
double m_R1
Definition: FPGATrackSimKeyLayerTool.h:104