ATLAS Offline Software
Loading...
Searching...
No Matches
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
24
25
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{
43public:
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
Scalar phi() const
phi method
Binning Utilities for GenScanTool.
Structs that store the 5 track parameters.
double deltaX(const KeyLyrPars &keypars, double rHit, double phiHit) const
rotatedConfig getRotatedConfig(const KeyLyrPars &keypars) const
std::pair< double, double > getXY(double r, double phi) const
KeyLyrPars trackParsToKeyPars(const FPGATrackSimTrackPars &pars) const
double xExpected(const KeyLyrPars &keypars, double rHit, double phiHit) const
std::pair< double, double > getRotatedHit(const std::pair< double, double > &rotang, double rHit, double phiHit) const
FPGATrackSimKeyLayerTool(double r1, double r2)
std::pair< double, double > rotateXY(const std::pair< double, double > &xy, const std::pair< double, double > &ang) const
FPGATrackSimTrackPars keyParsToTrackPars(const KeyLyrPars &keypars) const
double zExpected(const KeyLyrPars &keypars, double r) const
std::pair< double, double > getRotationAngles(const std::pair< double, double > &xy1, const std::pair< double, double > &xy2) const
double xmForHit(const KeyLyrPars &keypars, double rHit, double phiHit) const
int r
Definition globals.cxx:22
KeyLyrPars(const FPGATrackSimBinUtil::ParSet &parset)