Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Public Member Functions | Private Attributes | List of all members
FPGATrackSimKeyLayerTool Class Reference

#include <FPGATrackSimKeyLayerTool.h>

Collaboration diagram for FPGATrackSimKeyLayerTool:

Classes

struct  KeyLyrPars
 
struct  rotatedConfig
 

Public Member Functions

 FPGATrackSimKeyLayerTool (double r1, double r2)
 
 FPGATrackSimKeyLayerTool ()
 
std::pair< double, double > getXY (double r, double phi) const
 
std::pair< double, double > getRotationAngles (const std::pair< double, double > &xy1, const std::pair< double, double > &xy2) const
 
std::pair< double, double > rotateXY (const std::pair< double, double > &xy, const std::pair< double, double > &ang) const
 
rotatedConfig getRotatedConfig (const KeyLyrPars &keypars) const
 
std::pair< double, double > getRotatedHit (const std::pair< double, double > &rotang, const FPGATrackSimHit *hit) const
 
KeyLyrPars trackParsToKeyPars (const FPGATrackSimTrackPars &pars) const
 
FPGATrackSimTrackPars keyParsToTrackPars (const KeyLyrPars &keypars) const
 
double zExpected (const KeyLyrPars &keypars, double r) const
 
double xExpected (const KeyLyrPars &keypars, const FPGATrackSimHit *hit) const
 
double xmForHit (const KeyLyrPars &keypars, const FPGATrackSimHit *hit) const
 
double deltaX (const KeyLyrPars &keypars, const FPGATrackSimHit *hit) const
 
double R1 () const
 
double R2 () const
 
void setR1 (const double r1)
 
void setR2 (const double r2)
 

Private Attributes

double m_R1 {}
 
double m_R2 {}
 

Detailed Description

Definition at line 46 of file FPGATrackSimKeyLayerTool.h.

Constructor & Destructor Documentation

◆ FPGATrackSimKeyLayerTool() [1/2]

FPGATrackSimKeyLayerTool::FPGATrackSimKeyLayerTool ( double  r1,
double  r2 
)
inline

Definition at line 49 of file FPGATrackSimKeyLayerTool.h.

49 : m_R1(r1), m_R2(r2) {}

◆ FPGATrackSimKeyLayerTool() [2/2]

FPGATrackSimKeyLayerTool::FPGATrackSimKeyLayerTool ( )
inline

Definition at line 50 of file FPGATrackSimKeyLayerTool.h.

50 {} // NOTE r1 and r2 must be set before using class

Member Function Documentation

◆ deltaX()

double FPGATrackSimKeyLayerTool::deltaX ( const KeyLyrPars keypars,
const FPGATrackSimHit hit 
) const

Definition at line 156 of file FPGATrackSimKeyLayerTool.cxx.

157 {
158  auto rotated_coords = getRotatedConfig(keypars);
159 
160  auto rotang = rotated_coords.rotang;
161 
162  auto xyhp = getRotatedHit(rotang, hit);
163 
164  double xh = xyhp.first-rotated_coords.xy1p.first;
165 
166  return xh - xExpected(keypars,hit);
167 }

◆ getRotatedConfig()

FPGATrackSimKeyLayerTool::rotatedConfig FPGATrackSimKeyLayerTool::getRotatedConfig ( const KeyLyrPars keypars) const

Definition at line 32 of file FPGATrackSimKeyLayerTool.cxx.

33 {
34  rotatedConfig result;
35 
36  auto xy1 = getXY(m_R1, keypars.phi1);
37  auto xy2 = getXY(m_R2, keypars.phi2);
38 
39  result.rotang = getRotationAngles(xy1, xy2);
40  result.xy1p = rotateXY(xy1, result.rotang);
41  result.xy2p = rotateXY(xy2, result.rotang);
42  result.y = result.xy2p.second - result.xy1p.second;
43 
44  return result;
45 }

◆ getRotatedHit()

std::pair< double, double > FPGATrackSimKeyLayerTool::getRotatedHit ( const std::pair< double, double > &  rotang,
const FPGATrackSimHit hit 
) const

Definition at line 47 of file FPGATrackSimKeyLayerTool.cxx.

48 {
49  auto xyh = getXY(hit->getR(), hit->getGPhi());
50  return rotateXY(xyh, rotang);
51 }

◆ getRotationAngles()

std::pair< double, double > FPGATrackSimKeyLayerTool::getRotationAngles ( const std::pair< double, double > &  xy1,
const std::pair< double, double > &  xy2 
) const

Definition at line 16 of file FPGATrackSimKeyLayerTool.cxx.

17 {
18  double dr12x = xy2.first - xy1.first;
19  double dr12y = xy2.second - xy1.second;
20  double dr12mag = std::hypot(dr12x, dr12y);
21  double cos_rot = dr12y / dr12mag;
22  double sin_rot = -dr12x / dr12mag;
23  return std::pair<double, double>(cos_rot, sin_rot);
24 }

◆ getXY()

std::pair< double, double > FPGATrackSimKeyLayerTool::getXY ( double  r,
double  phi 
) const

Definition at line 11 of file FPGATrackSimKeyLayerTool.cxx.

12 {
13  return std::pair<double, double>(r * cos(phi), r * sin(phi));
14 }

◆ keyParsToTrackPars()

FPGATrackSimTrackPars FPGATrackSimKeyLayerTool::keyParsToTrackPars ( const KeyLyrPars keypars) const

Definition at line 79 of file FPGATrackSimKeyLayerTool.cxx.

80 {
81 
83  pars[FPGATrackSimTrackPars::IZ0] = (keypars.z1 * m_R2 - keypars.z2 * m_R1) / (m_R2 - m_R1);
85 
86  // This is the exact math which is a bit messy
87  // if you want the math contact lipeles@sas.upenn.edu
88 
89  double xm = keypars.xm;
90 
91  auto rotated_coords = getRotatedConfig(keypars);
92  auto xy1p = rotated_coords.xy1p;
93  auto rotang = rotated_coords.rotang;
94  auto y = rotated_coords.y;
95 
96  // reverse rotation
97  auto revang = rotang;
98  revang.second = -rotang.second;
99 
100  if (xm != 0)
101  {
102  double Rinv = 2 * xm / (xm * xm + (y / 2) * (y / 2));
103  double d = (y * y / 4.0 - xm * xm) / (2.0 * xm);
104  double sign = (xm > 0) - (xm < 0);
105 
107 
108  std::pair<double, double> xycp(-d + xy1p.first, y / 2.0 + xy1p.second);
109 
110  pars[FPGATrackSimTrackPars::ID0] = -1 * sign * (std::abs(1 / Rinv) - std::hypot(xycp.first, xycp.second));
111 
112  auto xyc = rotateXY(xycp, revang);
113 
114  pars[FPGATrackSimTrackPars::IPHI] = std::atan2(sign * -xyc.first, sign * xyc.second);
115  }
116  else
117  {
119  pars[FPGATrackSimTrackPars::ID0] = -1 * xy1p.first;
120  pars[FPGATrackSimTrackPars::IPHI] = std::atan2(rotang.first, -rotang.second);
121  }
122 
123  return pars;
124 }

◆ R1()

double FPGATrackSimKeyLayerTool::R1 ( ) const
inline

Definition at line 103 of file FPGATrackSimKeyLayerTool.h.

103 {return m_R1;}

◆ R2()

double FPGATrackSimKeyLayerTool::R2 ( ) const
inline

Definition at line 104 of file FPGATrackSimKeyLayerTool.h.

104 {return m_R2;}

◆ rotateXY()

std::pair< double, double > FPGATrackSimKeyLayerTool::rotateXY ( const std::pair< double, double > &  xy,
const std::pair< double, double > &  ang 
) const

Definition at line 26 of file FPGATrackSimKeyLayerTool.cxx.

27 {
28  return std::pair<double, double>(xy.first * ang.first + xy.second * ang.second,
29  -xy.first * ang.second + xy.second * ang.first);
30 }

◆ setR1()

void FPGATrackSimKeyLayerTool::setR1 ( const double  r1)
inline

Definition at line 105 of file FPGATrackSimKeyLayerTool.h.

105 {m_R1=r1;}

◆ setR2()

void FPGATrackSimKeyLayerTool::setR2 ( const double  r2)
inline

Definition at line 106 of file FPGATrackSimKeyLayerTool.h.

106 {m_R2=r2;}

◆ trackParsToKeyPars()

FPGATrackSimKeyLayerTool::KeyLyrPars FPGATrackSimKeyLayerTool::trackParsToKeyPars ( const FPGATrackSimTrackPars pars) const

Definition at line 53 of file FPGATrackSimKeyLayerTool.cxx.

54 {
55  KeyLyrPars retv;
60 
62  if (Rinv != 0)
63  {
64  double R = 1 / Rinv;
65  auto xy1 = getXY(m_R1, retv.phi1);
66  auto xy2 = getXY(m_R2, retv.phi2);
67  double ysqr = (xy2.first - xy1.first) * (xy2.first - xy1.first) + (xy2.second - xy1.second) * (xy2.second - xy1.second);
68  double sign = (R > 0) - (R < 0);
69  retv.xm = -1 * sign * (std::abs(R) - sqrt(R * R - ysqr / 4.0));
70  }
71  else
72  {
73  retv.xm = 0;
74  }
75 
76  return retv;
77 }

◆ xExpected()

double FPGATrackSimKeyLayerTool::xExpected ( const KeyLyrPars keypars,
const FPGATrackSimHit hit 
) const

Definition at line 170 of file FPGATrackSimKeyLayerTool.cxx.

171 {
172  auto rotated_coords = getRotatedConfig(keypars);
173 
174  auto rotang = rotated_coords.rotang;
175  auto y = rotated_coords.y;
176 
177  auto xyhp = getRotatedHit(rotang, hit);
178 
179  double yh = xyhp.second-rotated_coords.xy1p.second;
180 
181  return keypars.xm * (keypars.xm * keypars.xm + yh * (y - yh)) / (keypars.xm * keypars.xm + (y / 2) * (y / 2));
182 }

◆ xmForHit()

double FPGATrackSimKeyLayerTool::xmForHit ( const KeyLyrPars keypars,
const FPGATrackSimHit hit 
) const

Definition at line 132 of file FPGATrackSimKeyLayerTool.cxx.

133 {
134  auto rotated_coords = getRotatedConfig(keypars);
135  auto xy1p = rotated_coords.xy1p;
136  auto rotang = rotated_coords.rotang;
137  auto y = rotated_coords.y;
138 
139  auto xyhp = getRotatedHit(rotang, hit);
140  double xh = xyhp.first - xy1p.first;
141  double yh = xyhp.second - xy1p.second;
142 
143  // use taylor expanded xm calculation
144  double sign = ((yh > 0) && (yh < y)) ? 1 : -1;
145  if ((std::abs(yh) < std::abs(xh)) || (std::abs(y - yh) < std::abs(xh)))
146  {
147  return ((xh > 0) ? 1 : -1) * 100000;
148  }
149 
150  double xm_taylor = sign * y * y / (y * y - 4 * xh * xh - 4 * (yh - y / 2.0) * (yh - y / 2.0)) * xh;
151 
152  return xm_taylor;
153 }

◆ zExpected()

double FPGATrackSimKeyLayerTool::zExpected ( const KeyLyrPars keypars,
double  r 
) const

Definition at line 126 of file FPGATrackSimKeyLayerTool.cxx.

127 {
128  return (keypars.z2 - keypars.z1) / (m_R2 - m_R1) * (r - m_R1) + keypars.z1;
129 }

Member Data Documentation

◆ m_R1

double FPGATrackSimKeyLayerTool::m_R1 {}
private

Definition at line 109 of file FPGATrackSimKeyLayerTool.h.

◆ m_R2

double FPGATrackSimKeyLayerTool::m_R2 {}
private

Definition at line 110 of file FPGATrackSimKeyLayerTool.h.


The documentation for this class was generated from the following files:
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
FPGATrackSimTrackPars::IHIP
@ IHIP
Definition: FPGATrackSimTrackPars.h:49
beamspotman.r
def r
Definition: beamspotman.py:676
FPGATrackSimTrackPars::ID0
@ ID0
Definition: FPGATrackSimTrackPars.h:49
FPGATrackSimKeyLayerTool::getRotatedHit
std::pair< double, double > getRotatedHit(const std::pair< double, double > &rotang, const FPGATrackSimHit *hit) const
Definition: FPGATrackSimKeyLayerTool.cxx:47
get_generator_info.result
result
Definition: get_generator_info.py:21
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
FPGATrackSimBinUtil::GeomHelpers::phiFromPars
static double phiFromPars(double r, const FPGATrackSimTrackPars &pars)
Definition: FPGATrackSimBinUtil.cxx:167
FPGATrackSimTrackPars
Definition: FPGATrackSimTrackPars.h:22
hist_file_dump.d
d
Definition: hist_file_dump.py:143
FPGATrackSimTrackPars::IZ0
@ IZ0
Definition: FPGATrackSimTrackPars.h:49
FPGATrackSimKeyLayerTool::rotateXY
std::pair< double, double > rotateXY(const std::pair< double, double > &xy, const std::pair< double, double > &ang) const
Definition: FPGATrackSimKeyLayerTool.cxx:26
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
MCP::ScaleSmearParam::r2
@ r2
FPGATrackSimKeyLayerTool::m_R2
double m_R2
Definition: FPGATrackSimKeyLayerTool.h:110
FPGATrackSimHit::getGPhi
float getGPhi() const
Definition: FPGATrackSimHit.h:144
FPGATrackSimBinUtil::GeomHelpers::CurvatureConstant
static constexpr double CurvatureConstant
Definition: FPGATrackSimBinUtil.h:111
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
FPGATrackSimKeyLayerTool::getRotatedConfig
rotatedConfig getRotatedConfig(const KeyLyrPars &keypars) const
Definition: FPGATrackSimKeyLayerTool.cxx:32
FPGATrackSimBinUtil::GeomHelpers::EtaFromTheta
static double EtaFromTheta(double theta)
Definition: FPGATrackSimBinUtil.cxx:151
FPGATrackSimTrackPars::IPHI
@ IPHI
Definition: FPGATrackSimTrackPars.h:49
FPGATrackSimHit::getR
float getR() const
Definition: FPGATrackSimHit.h:143
FPGATrackSimKeyLayerTool::xExpected
double xExpected(const KeyLyrPars &keypars, const FPGATrackSimHit *hit) const
Definition: FPGATrackSimKeyLayerTool.cxx:170
y
#define y
FPGATrackSimBinUtil::GeomHelpers::zFromPars
static double zFromPars(double r, const FPGATrackSimTrackPars &pars)
Definition: FPGATrackSimBinUtil.cxx:156
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
MCP::ScaleSmearParam::r1
@ r1
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
FPGATrackSimKeyLayerTool::m_R1
double m_R1
Definition: FPGATrackSimKeyLayerTool.h:109
FPGATrackSimTrackPars::IETA
@ IETA
Definition: FPGATrackSimTrackPars.h:49