ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
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

Definition at line 23 of file Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h.

Constructor & Destructor Documentation

◆ TrkTrackState() [1/3]

TrkTrackState::TrkTrackState ( )

Definition at line 28 of file TrkTrackState.cxx.

29  : m_scattMode(0),
30  m_isScattered(false),
31  m_pSurface(nullptr),
32  m_pPrevState(nullptr) {
33  memset(m_Rk, 0, sizeof(m_Rk));
34  memset(m_Gk, 0, sizeof(m_Gk));
35 }

◆ 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  }

◆ 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];
67  m_scattMode = pTS->m_scattMode;
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 184 of file TrkTrackState.cxx.

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

◆ applyMaterialEffects()

void TrkTrackState::applyMaterialEffects ( )

Definition at line 209 of file TrkTrackState.cxx.

209  {
211  if (m_scattMode == -2) applyEnergyLoss(-1);
212  else if (m_scattMode == 2) applyEnergyLoss(1);
213  if (m_pSurface != nullptr) {
215  }
216  }

◆ applyMultipleScattering()

void TrkTrackState::applyMultipleScattering ( )

Definition at line 158 of file TrkTrackState.cxx.

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

◆ attachToSurface()

void TrkTrackState::attachToSurface ( TrkPlanarSurface pS)

Definition at line 101 of file TrkTrackState.cxx.

101  {
102  m_pSurface = pS;
103  m_isScattered = false;
104  }

◆ getScatteringMode()

int TrkTrackState::getScatteringMode ( ) const

Definition at line 134 of file TrkTrackState.cxx.

134  {
135  return m_scattMode;
136  }

◆ getStateSize()

int Trk::TrkTrackState::getStateSize ( )
inline

Definition at line 55 of file Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h.

56  {
57  return 5;
58  }

◆ getSurface()

TrkPlanarSurface * TrkTrackState::getSurface ( )

Definition at line 106 of file TrkTrackState.cxx.

106  {
107  return m_pSurface;
108  }

◆ getTrackCovariance()

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

Definition at line 51 of file Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h.

52  {
53  return m_Gk[i][j];
54  }

◆ getTrackState()

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

◆ report()

void TrkTrackState::report ( )

Definition at line 89 of file TrkTrackState.cxx.

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

◆ 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 218 of file TrkTrackState.cxx.

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

◆ serialize()

void TrkTrackState::serialize ( char  fileName[])

Definition at line 73 of file TrkTrackState.cxx.

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

◆ setPreviousState()

void TrkTrackState::setPreviousState ( TrkTrackState pTS)

Definition at line 148 of file TrkTrackState.cxx.

148  {
149  m_pPrevState = pTS;
150  }

◆ setScatteringMode()

void TrkTrackState::setScatteringMode ( int  mode)

Definition at line 130 of file TrkTrackState.cxx.

130  {
131  m_scattMode = mode;
132  }

◆ setSmootherGain()

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

Definition at line 152 of file TrkTrackState.cxx.

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

◆ setTrackCovariance()

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

Definition at line 142 of file TrkTrackState.cxx.

142  {
143  for (int i = 0; i < 5; i++)
144  for (int j = 0; j < 5; j++)
145  m_Ge[i][j] = m_Gk[i][j] = G[i][j];
146  }

◆ setTrackState()

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

Definition at line 138 of file TrkTrackState.cxx.

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

◆ updateTrackCovariance()

void TrkTrackState::updateTrackCovariance ( const double *  pUpd)

Definition at line 118 of file TrkTrackState.cxx.

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

◆ updateTrackState()

void TrkTrackState::updateTrackState ( const double *  pUpd)

Definition at line 110 of file TrkTrackState.cxx.

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

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:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Trk::TrkTrackState::applyMultipleScattering
void applyMultipleScattering()
Definition: TrkTrackState.cxx:158
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::TrkTrackState::m_isScattered
bool m_isScattered
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:63
TrkTrackState::m_Rk
double m_Rk[5]
Definition: Trigger/TrigAccel/TrigCudaFitter/src/TrkTrackState.h:54
Trk::TrkTrackState::m_pSurface
TrkPlanarSurface * m_pSurface
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:64
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Trk::TrkTrackState::m_scattMode
int m_scattMode
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:62
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
TrkPlanarSurface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/TrkPlanarSurface.h:15
A
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
lumiFormat.i
int i
Definition: lumiFormat.py:85
G
#define G(x, y, z)
Definition: MD5.cxx:113
Preparation.mode
mode
Definition: Preparation.py:94
Trk::TrkTrackState::applyEnergyLoss
void applyEnergyLoss(int)
Definition: TrkTrackState.cxx:184
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::TrkPlanarSurface::getRadLength
double getRadLength() const
Definition: TrkPlanarSurface.cxx:129
Trk::TrkTrackState::m_Gk
double m_Gk[5][5]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:61
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
a
TList * a
Definition: liststreamerinfos.cxx:10
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
TrkTrackState::m_Gk
double m_Gk[5][5]
Definition: Trigger/TrigAccel/TrigCudaFitter/src/TrkTrackState.h:56
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Trk::TrkTrackState::m_Ge
double m_Ge[5][5]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:61
TrkPlanarSurface::rotateVectorToLocal
void rotateVectorToLocal(double *, double *)
Trk::TrkTrackState::m_pPrevState
TrkTrackState * m_pPrevState
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:65
Trk::TrkTrackState::m_Re
double m_Re[5]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:60
Trk::TrkTrackState::m_Rk
double m_Rk[5]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:60
Trk::TrkPlanarSurface::isBreakPoint
bool isBreakPoint() const
Definition: TrkPlanarSurface.cxx:139
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Trk::TrkTrackState::resetCovariance
void resetCovariance()
Definition: TrkTrackState.cxx:52
Trk::TrkTrackState::m_A
double m_A[5][5]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:66
Trk::TrkTrackState::getTrackCovariance
double getTrackCovariance(int i, int j)
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkTrackState.h:51
TrkTrackState::m_scattMode
int m_scattMode
Definition: Trigger/TrigAccel/TrigCudaFitter/src/TrkTrackState.h:58