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