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