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

Definition at line 98 of file Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h.

Constructor & Destructor Documentation

◆ TrkPixelNode() [1/2]

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

Definition at line 296 of file TrkFilteringNodes.cxx.

296  {
297  int i, j;
298 
299  m_pSurface = pS;
300  m_chi2Cut = chi2Cut;
301  for (i = 0; i < 2; i++) {
302  m_m[i] = pPRD->localPosition()[i];
303  for (j = 0; j < 2; j++) m_V[i][j] = pPRD->localCovariance()(i, j);
304  }
305  m_pPRD = pPRD;
306  m_nodeType = 1;
307  m_ndof = 2;
308  }

◆ TrkPixelNode() [2/2]

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

Definition at line 310 of file TrkFilteringNodes.cxx.

310  {
311  m_pSurface = pS;
312  m_chi2Cut = chi2Cut;
313  m_m[0] = pos[0];
314  m_m[1] = pos[1];
315  m_V[0][0] = cov[0];
316  m_V[0][1] = cov[1];
317  m_V[1][0] = cov[2];
318  m_V[1][1] = cov[3];
319  m_pPRD = nullptr;
320  m_nodeType = 1;
321  m_ndof = 2;
322  }

◆ ~TrkPixelNode()

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

Member Function Documentation

◆ calculateChi2()

double TrkFilteringNode2D::calculateChi2 ( )
virtualinherited

Definition at line 75 of file TrkFilteringNodes.cxx.

75  {
76  double dchi2;
77 
78  dchi2 = m_resid[0] * m_resid[0] * m_D[0][0] + 2 * m_resid[0] * m_resid[1] * m_D[0][1] +
79  m_resid[1] * m_resid[1] * m_D[1][1];
80  return dchi2;
81  }

◆ getChi2()

double TrkBaseNode::getChi2 ( ) const
inherited

Definition at line 69 of file TrkBaseNode.cxx.

69  {
70  return m_dChi2;
71  }

◆ getChi2Distance()

double TrkPixelNode::getChi2Distance ( TrkTrackState pTS)
virtual

Implements Trk::TrkBaseNode.

Definition at line 343 of file TrkFilteringNodes.cxx.

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

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

◆ 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

Definition at line 53 of file TrkBaseNode.cxx.

53  {
54  return m_nodeState;
55  }

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

◆ getSurface()

TrkPlanarSurface * TrkBaseNode::getSurface ( )
virtualinherited

Definition at line 35 of file TrkBaseNode.cxx.

35  {
36  return m_pSurface;
37  }

◆ getTrackState()

TrkTrackState * TrkBaseNode::getTrackState ( )
inherited

Definition at line 43 of file TrkBaseNode.cxx.

43  {
44  return m_pTrackState;
45  }

◆ 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 331 of file TrkFilteringNodes.cxx.

331  {
332  /*
333  printf("PIXEL NODE x=%f y=%f\n",m_m[0],m_m[1]);
334  */
335  m_pSurface->report();
336  }

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

◆ serialize()

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

Implements Trk::TrkBaseNode.

Definition at line 324 of file TrkFilteringNodes.cxx.

324  {
325  FILE* pFile;
326 
327  pFile = fopen(fileName, "a");
328  fclose(pFile);
329  }

◆ 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 387 of file TrkFilteringNodes.cxx.

387  {
388  if (isValidated()) runKalmanFilter(pTS);
389  m_pTrackState = pTS;
390  }

◆ updateWithRIO()

void TrkPixelNode::updateWithRIO ( const RIO_OnTrack pRIO)
virtual

Implements Trk::TrkBaseNode.

Definition at line 392 of file TrkFilteringNodes.cxx.

392  {
393  int i, j;
394 
395  /*
396  printf("RIO update, Pixel: old m %f %f new m %f %f\n",
397  m_m[0],m_m[1],pRIO->localParameters()[Trk::locX],pRIO->localParameters()[Trk::locY]);
398  */
399  m_m[0] = pRIO->localParameters()[Trk::locX];
400  m_m[1] = pRIO->localParameters()[Trk::locY];
401 
402  // printf("old errors: %f %f %f\n",sqrt(m_V[0][0]),m_V[0][1],sqrt(m_V[1][1]));
403 
404  for (i = 0; i < 2; i++) {
405  for (j = 0; j < 2; j++) m_V[i][j] = pRIO->localCovariance()(i, j);
406  }
407  // printf("new errors: %f %f %f\n",sqrt(m_V[0][0]),m_V[0][1],sqrt(m_V[1][1]));
408  }

◆ validateMeasurement()

void TrkPixelNode::validateMeasurement ( TrkTrackState pTS)
virtual

Implements Trk::TrkBaseNode.

Definition at line 338 of file TrkFilteringNodes.cxx.

338  {
339  m_dChi2 = getChi2Distance(pTS);
340  m_nodeState = (m_dChi2 < m_chi2Cut) ? 1 : 0;
341  }

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:
Trk::TrkBaseNode::m_pSurface
TrkPlanarSurface * m_pSurface
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkBaseNode.h:54
beamspotman.r
def r
Definition: beamspotman.py:676
TrkTrackState::getTrackState
double getTrackState(int i)
Definition: Trigger/TrigAccel/TrigCudaFitter/src/TrkTrackState.h:40
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Trk::locX
@ locX
Definition: ParamDefs.h:37
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
TrkTrackState::updateTrackState
void updateTrackState(double *)
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
Trk::TrkFilteringNode2D::calculateChi2
virtual double calculateChi2()
Definition: TrkFilteringNodes.cxx:75
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
Trk::TrkFilteringNode2D::m_D
double m_D[2][2]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:61
Trk::TrkBaseNode::m_chi2Cut
double m_chi2Cut
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkBaseNode.h:52
Trk::TrkBaseNode::m_pTrackState
TrkTrackState * m_pTrackState
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkBaseNode.h:58
Trk::TrkFilteringNode2D::runKalmanFilter
virtual void runKalmanFilter(TrkTrackState *)
Definition: TrkFilteringNodes.cxx:83
Trk::TrkFilteringNode2D::m_m
double m_m[2]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:63
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
Trk::TrkPixelNode::getChi2Distance
virtual double getChi2Distance(TrkTrackState *)
Definition: TrkFilteringNodes.cxx:343
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::TrkBaseNode::m_dChi2
double m_dChi2
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkBaseNode.h:56
Trk::TrkBaseNode::m_nodeType
char m_nodeType
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkBaseNode.h:53
Trk::TrkFilteringNode2D::m_V
double m_V[2][2]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:64
Trk::TrkBaseNode::isValidated
virtual bool isValidated()
Definition: TrkBaseNode.cxx:31
Trk::TrkBaseNode::m_ndof
int m_ndof
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkBaseNode.h:57
Trk::TrkFilteringNode2D::m_B
double m_B[5][2]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:61
Trk::TrkFilteringNode2D::m_resid
double m_resid[2]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:62
Trk::TrkPlanarSurface::report
void report()
Definition: TrkPlanarSurface.cxx:147
Trk::TrkBaseNode::m_nodeState
int m_nodeState
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkBaseNode.h:51
Trk::TrkBaseNode::m_pPRD
const PrepRawData * m_pPRD
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkBaseNode.h:55
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::TrkFilteringNode2D::m_H
double m_H[2][5]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:61
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Trk::TrkFilteringNode2D::m_K
double m_K[5][2]
Definition: Tracking/TrkFitter/TrkDistributedKalmanFilter/TrkDistributedKalmanFilter/TrkFilteringNodes.h:61
TrkTrackState::updateTrackCovariance
void updateTrackCovariance(double *)
TrkTrackState::getTrackCovariance
double getTrackCovariance(int i, int j)
Definition: Trigger/TrigAccel/TrigCudaFitter/src/TrkTrackState.h:44