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

#include <TrkFilteringNodes.h>

Inheritance diagram for Trk::TrkPixelNode:
Collaboration diagram for Trk::TrkPixelNode:

Public Member Functions

 TrkPixelNode (TrkPlanarSurface *, double, const PrepRawData *)
 TrkPixelNode (TrkPlanarSurface *, double, const double[2], const double[4])
virtual ~TrkPixelNode ()
virtual void validateMeasurement (TrkTrackState *)
virtual void updateTrackState (TrkTrackState *)
virtual double getChi2Distance (TrkTrackState *)
virtual void serialize (char fileName[])
virtual void report ()
virtual void updateWithRIO (const RIO_OnTrack *)
virtual int getKalmanGain (double[5][2])
virtual int getResiduals (double[2])
virtual int getInverseResidualVariance (double[2][2])
virtual int getMeasurementMatrix (double[2][5])
virtual void runKalmanFilter (TrkTrackState *)
virtual double calculateChi2 ()
virtual bool isValidated ()
virtual void setNodeState (int)
virtual int getNodeState ()
virtual void setNodeType (char)
virtual char getNodeType ()
virtual void updateInternal ()
TrkTrackStategetTrackState ()
virtual TrkPlanarSurfacegetSurface ()
virtual const PrepRawDatagetPrepRawData ()
double getChi2 () const
int getNdof () const

Protected Attributes

double m_B [5][2]
double m_D [2][2]
double m_H [2][5]
double m_K [5][2]
double m_resid [2]
double m_m [2]
double m_V [2][2]
int m_nodeState
double m_chi2Cut
char m_nodeType
TrkPlanarSurfacem_pSurface
const PrepRawDatam_pPRD
double m_dChi2
int m_ndof
TrkTrackStatem_pTrackState

Detailed Description

Constructor & Destructor Documentation

◆ TrkPixelNode() [1/2]

TrkPixelNode::TrkPixelNode ( TrkPlanarSurface * pS,
double chi2Cut,
const PrepRawData * pPRD )

◆ TrkPixelNode() [2/2]

TrkPixelNode::TrkPixelNode ( TrkPlanarSurface * pS,
double chi2Cut,
const double pos[2],
const double cov[4] )

Definition at line 314 of file TrkFilteringNodes.cxx.

314 {
315 m_pSurface = pS;
316 m_chi2Cut = chi2Cut;
317 m_m[0] = pos[0];
318 m_m[1] = pos[1];
319 m_V[0][0] = cov[0];
320 m_V[0][1] = cov[1];
321 m_V[1][0] = cov[2];
322 m_V[1][1] = cov[3];
323 m_pPRD = nullptr;
324 m_nodeType = 1;
325 m_ndof = 2;
326 }

◆ ~TrkPixelNode()

virtual Trk::TrkPixelNode::~TrkPixelNode ( )
inlinevirtual

Member Function Documentation

◆ calculateChi2()

double TrkFilteringNode2D::calculateChi2 ( )
virtualinherited

◆ getChi2()

double TrkBaseNode::getChi2 ( ) const
inherited

◆ getChi2Distance()

double TrkPixelNode::getChi2Distance ( TrkTrackState * pTS)
virtual

Implements Trk::TrkBaseNode.

Definition at line 349 of file TrkFilteringNodes.cxx.

349 {
350 double det;
351
352 m_H[0][0] = 1.0;
353 m_H[1][1] = 1.0;
354 m_H[0][1] = 0.0;
355 m_H[0][2] = 0.0;
356 m_H[0][3] = 0.0;
357 m_H[0][4] = 0.0;
358 m_H[1][0] = 0.0;
359 m_H[1][2] = 0.0;
360 m_H[1][3] = 0.0;
361 m_H[1][4] = 0.0;
362
363 m_B[0][0] = pTS->getTrackCovariance(0, 0);
364 m_B[0][1] = pTS->getTrackCovariance(0, 1);
365 m_B[1][0] = pTS->getTrackCovariance(0, 1);
366 m_B[1][1] = pTS->getTrackCovariance(1, 1);
367 m_B[2][0] = pTS->getTrackCovariance(0, 2);
368 m_B[2][1] = pTS->getTrackCovariance(1, 2);
369 m_B[3][0] = pTS->getTrackCovariance(0, 3);
370 m_B[3][1] = pTS->getTrackCovariance(1, 3);
371 m_B[4][0] = pTS->getTrackCovariance(0, 4);
372 m_B[4][1] = pTS->getTrackCovariance(1, 4);
373
374 m_resid[0] = m_m[0] - pTS->getTrackState(0);
375 m_resid[1] = m_m[1] - pTS->getTrackState(1);
376
377 double W[2][2];
378
379 W[0][0] = pTS->getTrackCovariance(0, 0) + m_V[0][0];
380 W[1][0] = W[0][1] = pTS->getTrackCovariance(0, 1) + m_V[0][1];
381 W[1][1] = pTS->getTrackCovariance(1, 1) + m_V[1][1];
382 det = W[0][0] * W[1][1] - W[0][1] * W[0][1];
383 if (det == 0.0) return 1e8;
384 det = 1.0 / det;
385 m_D[0][0] = W[1][1] * det;
386 m_D[0][1] = -W[0][1] * det;
387 m_D[1][0] = m_D[0][1];
388 m_D[1][1] = W[0][0] * det;
389
390 return calculateChi2();
391 }

◆ getInverseResidualVariance()

int TrkFilteringNode2D::getInverseResidualVariance ( double V[2][2])
virtualinherited

Implements Trk::TrkBaseNode.

Definition at line 113 of file TrkFilteringNodes.cxx.

113 {
114 int i, j;
115
116 for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) V[i][j] = m_D[i][j];
117 return 2;
118 }

◆ getKalmanGain()

int TrkFilteringNode2D::getKalmanGain ( double K[5][2])
virtualinherited

Implements Trk::TrkBaseNode.

Definition at line 100 of file TrkFilteringNodes.cxx.

100 {
101 int i, j;
102
103 for (i = 0; i < 5; i++) for (j = 0; j < 2; j++) K[i][j] = m_K[i][j];
104 return 2;
105 }

◆ getMeasurementMatrix()

int TrkFilteringNode2D::getMeasurementMatrix ( double H[2][5])
virtualinherited

Implements Trk::TrkBaseNode.

Definition at line 120 of file TrkFilteringNodes.cxx.

120 {
121 int i, j;
122
123 for (j = 0; j < 2; j++) for (i = 0; i < 5; i++) H[j][i] = m_H[j][i];
124 return 2;
125 }
#define H(x, y, z)
Definition MD5.cxx:114

◆ getNdof()

int TrkBaseNode::getNdof ( ) const
inherited

Definition at line 65 of file TrkBaseNode.cxx.

65 {
66 return m_ndof;
67 }

◆ getNodeState()

int TrkBaseNode::getNodeState ( )
virtualinherited

◆ getNodeType()

char TrkBaseNode::getNodeType ( )
virtualinherited

Definition at line 61 of file TrkBaseNode.cxx.

61 {
62 return m_nodeType;
63 }

◆ getPrepRawData()

const PrepRawData * TrkBaseNode::getPrepRawData ( )
virtualinherited

Definition at line 39 of file TrkBaseNode.cxx.

39 {
40 return m_pPRD;
41 }

◆ getResiduals()

int TrkFilteringNode2D::getResiduals ( double r[2])
virtualinherited

Implements Trk::TrkBaseNode.

Definition at line 107 of file TrkFilteringNodes.cxx.

107 {
108 r[0] = m_resid[0];
109 r[1] = m_resid[1];
110 return 2;
111 }
int r
Definition globals.cxx:22

◆ getSurface()

TrkPlanarSurface * TrkBaseNode::getSurface ( )
virtualinherited

Definition at line 35 of file TrkBaseNode.cxx.

35 {
36 return m_pSurface;
37 }

◆ getTrackState()

TrkTrackState * TrkBaseNode::getTrackState ( )
inherited

◆ isValidated()

bool TrkBaseNode::isValidated ( )
virtualinherited

Definition at line 31 of file TrkBaseNode.cxx.

31 {
32 return (m_nodeState != 0);
33 }

◆ report()

void TrkPixelNode::report ( )
virtual

Implements Trk::TrkBaseNode.

Definition at line 337 of file TrkFilteringNodes.cxx.

337 {
338 /*
339 printf("PIXEL NODE x=%f y=%f\n",m_m[0],m_m[1]);
340 */
341 m_pSurface->report();
342 }

◆ runKalmanFilter()

void TrkFilteringNode2D::runKalmanFilter ( TrkTrackState * pTS)
virtualinherited

Definition at line 83 of file TrkFilteringNodes.cxx.

83 {
84 int i, j, idx = 0;
85 double updState[5], updCov[15];
86
87 for (i = 0; i < 5; i++)
88 for (j = 0; j < 2; j++)
89 m_K[i][j] = m_B[i][0] * m_D[0][j] + m_B[i][1] * m_D[1][j];
90 for (i = 0; i < 5; i++)
91 updState[i] = m_K[i][0] * m_resid[0] + m_K[i][1] * m_resid[1];
92 pTS->updateTrackState(updState);
93 for (i = 0; i < 5; i++) for (j = i; j < 5; j++) {
94 updCov[idx] = -m_K[i][0] * m_B[j][0] - m_K[i][1] * m_B[j][1];
95 idx++;
96 }
97 pTS->updateTrackCovariance(updCov);
98 }
void updateTrackState(double *)
void updateTrackCovariance(double *)

◆ serialize()

void TrkPixelNode::serialize ( char fileName[])
virtual

Implements Trk::TrkBaseNode.

Definition at line 328 of file TrkFilteringNodes.cxx.

328 {
329 FILE* pFile = fopen(fileName, "a");
330 if (!pFile) {
331 std::cerr << "Cannot open file " << fileName << " for write.\n";
332 std::abort();
333 }
334 fclose(pFile);
335 }

◆ setNodeState()

void TrkBaseNode::setNodeState ( int s)
virtualinherited

Definition at line 49 of file TrkBaseNode.cxx.

49 {
50 m_nodeState = s;
51 }

◆ setNodeType()

void TrkBaseNode::setNodeType ( char s)
virtualinherited

Definition at line 57 of file TrkBaseNode.cxx.

57 {
58 m_nodeType = s;
59 }

◆ updateInternal()

void TrkBaseNode::updateInternal ( )
virtualinherited

Reimplemented in Trk::TrkTrtNode.

Definition at line 73 of file TrkBaseNode.cxx.

73 {
74 }

◆ updateTrackState()

void TrkPixelNode::updateTrackState ( TrkTrackState * pTS)
virtual

Implements Trk::TrkBaseNode.

Definition at line 393 of file TrkFilteringNodes.cxx.

393 {
394 if (isValidated()) runKalmanFilter(pTS);
395 m_pTrackState = pTS;
396 }
virtual bool isValidated()
virtual void runKalmanFilter(TrkTrackState *)

◆ updateWithRIO()

void TrkPixelNode::updateWithRIO ( const RIO_OnTrack * pRIO)
virtual

Implements Trk::TrkBaseNode.

Definition at line 398 of file TrkFilteringNodes.cxx.

398 {
399 int i, j;
400
401 /*
402 printf("RIO update, Pixel: old m %f %f new m %f %f\n",
403 m_m[0],m_m[1],pRIO->localParameters()[Trk::locX],pRIO->localParameters()[Trk::locY]);
404 */
405 m_m[0] = pRIO->localParameters()[Trk::locX];
406 m_m[1] = pRIO->localParameters()[Trk::locY];
407
408 // printf("old errors: %f %f %f\n",sqrt(m_V[0][0]),m_V[0][1],sqrt(m_V[1][1]));
409
410 for (i = 0; i < 2; i++) {
411 for (j = 0; j < 2; j++) m_V[i][j] = pRIO->localCovariance()(i, j);
412 }
413 // printf("new errors: %f %f %f\n",sqrt(m_V[0][0]),m_V[0][1],sqrt(m_V[1][1]));
414 }
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37

◆ validateMeasurement()

void TrkPixelNode::validateMeasurement ( TrkTrackState * pTS)
virtual

Implements Trk::TrkBaseNode.

Definition at line 344 of file TrkFilteringNodes.cxx.

344 {
346 m_nodeState = (m_dChi2 < m_chi2Cut) ? 1 : 0;
347 }
virtual double getChi2Distance(TrkTrackState *)

Member Data Documentation

◆ m_B

double Trk::TrkFilteringNode2D::m_B[5][2]
protectedinherited

◆ m_chi2Cut

double Trk::TrkBaseNode::m_chi2Cut
protectedinherited

◆ m_D

double Trk::TrkFilteringNode2D::m_D[2][2]
protectedinherited

◆ m_dChi2

double Trk::TrkBaseNode::m_dChi2
protectedinherited

◆ m_H

double Trk::TrkFilteringNode2D::m_H[2][5]
protectedinherited

◆ m_K

double Trk::TrkFilteringNode2D::m_K[5][2]
protectedinherited

◆ m_m

double Trk::TrkFilteringNode2D::m_m[2]
protectedinherited

◆ m_ndof

int Trk::TrkBaseNode::m_ndof
protectedinherited

◆ m_nodeState

int Trk::TrkBaseNode::m_nodeState
protectedinherited

◆ m_nodeType

char Trk::TrkBaseNode::m_nodeType
protectedinherited

◆ m_pPRD

const PrepRawData* Trk::TrkBaseNode::m_pPRD
protectedinherited

◆ m_pSurface

TrkPlanarSurface* Trk::TrkBaseNode::m_pSurface
protectedinherited

◆ m_pTrackState

TrkTrackState* Trk::TrkBaseNode::m_pTrackState
protectedinherited

◆ m_resid

double Trk::TrkFilteringNode2D::m_resid[2]
protectedinherited

◆ m_V

double Trk::TrkFilteringNode2D::m_V[2][2]
protectedinherited

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