ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::TrkTrackState Class Reference

#include <TrkTrackState.h>

Collaboration diagram for Trk::TrkTrackState:

Public Member Functions

 TrkTrackState ()
 TrkTrackState (const double[5])
 TrkTrackState (const TrkTrackState *)
 ~TrkTrackState ()
void report ()
void resetCovariance ()
void serialize (char fileName[])
TrkPlanarSurfacegetSurface ()
void attachToSurface (TrkPlanarSurface *)
void setScatteringMode (int)
int getScatteringMode () const
void applyMaterialEffects ()
void updateTrackState (const double *)
void updateTrackCovariance (const double *)
void setTrackCovariance (double A[5][5])
void setTrackState (const double A[5])
void setSmootherGain (double A[5][5])
void setPreviousState (TrkTrackState *)
void runSmoother ()
void applyMultipleScattering ()
void applyEnergyLoss (int)
double getTrackState (int i)
double getTrackCovariance (int i, int j)
int getStateSize ()

Protected Attributes

double m_Rk [5] {}
double m_Re [5] {}
double m_Gk [5][5] {}
double m_Ge [5][5] {}
int m_scattMode
bool m_isScattered
TrkPlanarSurfacem_pSurface
TrkTrackStatem_pPrevState
double m_A [5][5] {}

Detailed Description

Constructor & Destructor Documentation

◆ TrkTrackState() [1/3]

◆ TrkTrackState() [2/3]

TrkTrackState::TrkTrackState ( const double Rk[5])

Definition at line 37 of file TrkTrackState.cxx.

37 {
38 int i;
39
40 for (i = 0; i < 5; i++) m_Rk[i] = Rk[i];
41 if (m_Rk[2] > M_PI) m_Rk[2] -= 2 * M_PI;
42 if (m_Rk[2] < -M_PI) m_Rk[2] += 2 * M_PI;
43 if (m_Rk[3] < 0.0) m_Rk[3] += M_PI;
44 if (m_Rk[3] > M_PI) m_Rk[3] -= M_PI;
45 m_pSurface = nullptr;
46 m_scattMode = 0;
47 m_isScattered = false;
48 m_pPrevState = nullptr;
50 }
#define M_PI

◆ TrkTrackState() [3/3]

TrkTrackState::TrkTrackState ( const TrkTrackState * pTS)

Definition at line 61 of file TrkTrackState.cxx.

61 {
62 for (int i = 0; i < 5; i++) {
63 m_Rk[i] = pTS->m_Rk[i];
64 }
65 for (int i = 0; i < 5; i++)
66 for (int j = 0; j < 5; j++) m_Gk[i][j] = pTS->m_Gk[i][j];
68 m_pSurface = nullptr;
69 m_isScattered = false;
70 m_pPrevState = nullptr;
71 }

◆ ~TrkTrackState()

Trk::TrkTrackState::~TrkTrackState ( )
inline

Member Function Documentation

◆ applyEnergyLoss()

void TrkTrackState::applyEnergyLoss ( int dir)

Definition at line 186 of file TrkTrackState.cxx.

186 {
187 double lenCorr, effLength, lV[3], gV[3];
188 TrkPlanarSurface* pS = m_pSurface;
189
190 if (pS == nullptr) return;
191
192 gV[0] = sin(m_Re[3]) * cos(m_Re[2]);
193 gV[1] = sin(m_Re[3]) * sin(m_Re[2]);
194 gV[2] = cos(m_Re[3]);
195 pS->rotateVectorToLocal(gV, lV);
196 lenCorr = 1.0 / fabs(lV[2]);
197 effLength = m_pSurface->getRadLength() * lenCorr;
198
199 if (abs(dir) == 1) {
200 m_Re[4] += dir * (m_Re[4] * effLength * (1.0 - 0.5 * effLength));
201 m_Ge[4][4] += m_Re[4] * m_Re[4] * effLength * (0.415 - 0.744 * effLength);
202 m_Rk[4] = m_Re[4];
203 m_Gk[4][4] = m_Ge[4][4];
204 } else if (abs(dir) == 2) {
205 m_Ge[4][4] += 1e-5;
206 m_Rk[4] = m_Re[4];
207 m_Gk[4][4] = m_Ge[4][4];
208 }
209 }
void rotateVectorToLocal(double *, double *)

◆ applyMaterialEffects()

void TrkTrackState::applyMaterialEffects ( )

Definition at line 211 of file TrkTrackState.cxx.

211 {
213 if (m_scattMode == -2) applyEnergyLoss(-1);
214 else if (m_scattMode == 2) applyEnergyLoss(1);
215 if (m_pSurface != nullptr) {
216 if (m_pSurface->isBreakPoint()) applyEnergyLoss(2);
217 }
218 }

◆ applyMultipleScattering()

void TrkTrackState::applyMultipleScattering ( )

Definition at line 160 of file TrkTrackState.cxx.

160 {
161 double lenCorr, sigmaMS, s2, a2, radLength, lV[3], gV[3], a;
162 TrkPlanarSurface* pS = m_pSurface;
163
164 if (pS == nullptr) return;
165
166 gV[0] = sin(m_Re[3]) * cos(m_Re[2]);
167 gV[1] = sin(m_Re[3]) * sin(m_Re[2]);
168 gV[2] = cos(m_Re[3]);
169 pS->rotateVectorToLocal(gV, lV);
170 lenCorr = 1.0 / fabs(lV[2]);
171 radLength = m_pSurface->getRadLength() * lenCorr;
172 sigmaMS = 13.6 * fabs(m_Re[4]) * sqrt(radLength) * (1.0 + 0.038 * log(radLength));
173 s2 = sigmaMS * sigmaMS;
174 a = 1.0 / sin(m_Rk[3]);
175 a2 = a * a;
176 m_Ge[2][2] += s2 * a2;
177 m_Ge[3][3] += s2;
178 m_Ge[2][3] += s2 * a;
179 m_Ge[3][2] = m_Ge[2][3];
180 m_Gk[2][2] = m_Ge[2][2];
181 m_Gk[2][3] = m_Ge[2][3];
182 m_Gk[3][2] = m_Ge[3][2];
183 m_Gk[3][3] = m_Ge[3][3];
184 }
static Double_t a

◆ attachToSurface()

void TrkTrackState::attachToSurface ( TrkPlanarSurface * pS)

Definition at line 103 of file TrkTrackState.cxx.

103 {
104 m_pSurface = pS;
105 m_isScattered = false;
106 }

◆ getScatteringMode()

int TrkTrackState::getScatteringMode ( ) const

Definition at line 136 of file TrkTrackState.cxx.

136 {
137 return m_scattMode;
138 }

◆ getStateSize()

int Trk::TrkTrackState::getStateSize ( )
inline

◆ getSurface()

TrkPlanarSurface * TrkTrackState::getSurface ( )

Definition at line 108 of file TrkTrackState.cxx.

108 {
109 return m_pSurface;
110 }

◆ getTrackCovariance()

double Trk::TrkTrackState::getTrackCovariance ( int i,
int j )
inline

◆ getTrackState()

double Trk::TrkTrackState::getTrackState ( int i)
inline

◆ report()

void TrkTrackState::report ( )

Definition at line 91 of file TrkTrackState.cxx.

91 {
92 printf("STATE x0=%f y0=%f phi=%f theta=%f qOverP=%f pT=%f\n",
93 m_Rk[0], m_Rk[1], m_Rk[2], m_Rk[3], m_Rk[4], sin(m_Rk[3]) / m_Rk[4]);
94 printf("COVARIANCE \n");
95 for (auto & i : m_Gk) {
96 for (double j : i) {
97 printf("%E ", j);
98 }
99 printf("\n");
100 }
101 }

◆ resetCovariance()

void TrkTrackState::resetCovariance ( )

Definition at line 52 of file TrkTrackState.cxx.

52 {
53 memset(m_Gk, 0, sizeof(m_Gk));
54 m_Gk[0][0] = 100.0;
55 m_Gk[1][1] = 100.0;
56 m_Gk[2][2] = 0.01;
57 m_Gk[3][3] = 0.01;
58 m_Gk[4][4] = 1e-5;
59 }

◆ runSmoother()

void TrkTrackState::runSmoother ( )

Definition at line 220 of file TrkTrackState.cxx.

220 {
221 double dR[5], dG[5][5], B[5][5];
222 int i, j, m;
223
224 if (m_pPrevState == nullptr) return;
225
226 for (i = 0; i < 5; i++) {
227 dR[i] = m_Rk[i] - m_Re[i];
228 for (j = 0; j < 5; j++) dG[i][j] = m_Gk[i][j] - m_Ge[i][j];
229 }
230
231 if (dR[2] > M_PI) dR[2] -= 2 * M_PI;
232 if (dR[2] < -M_PI) dR[2] += 2 * M_PI;
233 for (i = 0; i < 5; i++) {
234 for (j = 0; j < 5; j++) m_pPrevState->m_Rk[i] += m_A[i][j] * dR[j];
235 }
236
237 if (m_pPrevState->m_Rk[2] > M_PI) m_pPrevState->m_Rk[2] -= 2 * M_PI;
238 if (m_pPrevState->m_Rk[2] < -M_PI) m_pPrevState->m_Rk[2] += 2 * M_PI;
239 if (m_pPrevState->m_Rk[3] < 0.0) m_pPrevState->m_Rk[3] += M_PI;
240 if (m_pPrevState->m_Rk[3] > M_PI) m_pPrevState->m_Rk[3] -= M_PI;
241 for (i = 0; i < 5; i++)
242 for (j = 0; j < 5; j++) {
243 B[i][j] = 0.0;
244 for (m = 0; m < 5; m++) B[i][j] += m_A[i][m] * dG[m][j];
245 }
246 for (i = 0; i < 5; i++)
247 for (j = 0; j < 5; j++) {
248 for (m = 0; m < 5; m++)
249 m_pPrevState->m_Gk[i][j] += B[i][m] * m_A[j][m];
250 }
251 }

◆ serialize()

void TrkTrackState::serialize ( char fileName[])

Definition at line 73 of file TrkTrackState.cxx.

73 {
74 FILE* pFile = fopen(fileName, "a");
75 if (!pFile) {
76 std::cerr << "Cannot open file " << fileName << " for write.\n";
77 std::abort();
78 }
79 fprintf(pFile, "%f %f %f %f %f\n",
80 m_Rk[0], m_Rk[1], m_Rk[2], m_Rk[3], m_Rk[4]);
81 for (int i = 0; i < 5; i++) {
82 for (int j = 0; j < 5; j++) {
83 if (j < i) fprintf(pFile, " ");
84 else fprintf(pFile, "%f ", getTrackCovariance(i, j));
85 }
86 fprintf(pFile, "\n");
87 }
88 fclose(pFile);
89 }

◆ setPreviousState()

void TrkTrackState::setPreviousState ( TrkTrackState * pTS)

Definition at line 150 of file TrkTrackState.cxx.

150 {
151 m_pPrevState = pTS;
152 }

◆ setScatteringMode()

void TrkTrackState::setScatteringMode ( int mode)

Definition at line 132 of file TrkTrackState.cxx.

132 {
134 }

◆ setSmootherGain()

void TrkTrackState::setSmootherGain ( double A[5][5])

Definition at line 154 of file TrkTrackState.cxx.

154 {
155 for (int i = 0; i < 5; i++)
156 for (int j = 0; j < 5; j++)
157 m_A[i][j] = A[i][j];
158 }

◆ setTrackCovariance()

void TrkTrackState::setTrackCovariance ( double A[5][5])

Definition at line 144 of file TrkTrackState.cxx.

144 {
145 for (int i = 0; i < 5; i++)
146 for (int j = 0; j < 5; j++)
147 m_Ge[i][j] = m_Gk[i][j] = G[i][j];
148 }
#define G(x, y, z)
Definition MD5.cxx:113

◆ setTrackState()

void TrkTrackState::setTrackState ( const double A[5])

Definition at line 140 of file TrkTrackState.cxx.

140 {
141 for (int i = 0; i < 5; i++) m_Re[i] = m_Rk[i] = R[i];
142 }

◆ updateTrackCovariance()

void TrkTrackState::updateTrackCovariance ( const double * pUpd)

Definition at line 120 of file TrkTrackState.cxx.

120 {
121 int idx = 0;
122
123 for (int i = 0; i < 5; i++) {
124 for (int j = i; j < 5; j++) {
125 m_Gk[i][j] += pUpd[idx];
126 idx++;
127 m_Gk[j][i] = m_Gk[i][j];
128 }
129 }
130 }

◆ updateTrackState()

void TrkTrackState::updateTrackState ( const double * pUpd)

Definition at line 112 of file TrkTrackState.cxx.

112 {
113 for (int i = 0; i < 5; i++) m_Rk[i] += pUpd[i];
114 if (m_Rk[2] > M_PI) m_Rk[2] -= 2 * M_PI;
115 if (m_Rk[2] < -M_PI) m_Rk[2] += 2 * M_PI;
116 if (m_Rk[3] < 0.0) m_Rk[3] += M_PI;
117 if (m_Rk[3] > M_PI) m_Rk[3] -= M_PI;
118 }

Member Data Documentation

◆ m_A

double Trk::TrkTrackState::m_A[5][5] {}
protected

◆ m_Ge

double Trk::TrkTrackState::m_Ge[5][5] {}
protected

◆ m_Gk

double Trk::TrkTrackState::m_Gk[5][5] {}
protected

◆ m_isScattered

bool Trk::TrkTrackState::m_isScattered
protected

◆ m_pPrevState

TrkTrackState* Trk::TrkTrackState::m_pPrevState
protected

◆ m_pSurface

TrkPlanarSurface* Trk::TrkTrackState::m_pSurface
protected

◆ m_Re

double Trk::TrkTrackState::m_Re[5] {}
protected

◆ m_Rk

double Trk::TrkTrackState::m_Rk[5] {}
protected

◆ m_scattMode

int Trk::TrkTrackState::m_scattMode
protected

The documentation for this class was generated from the following files: