EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FwdKalmanFilter.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FwdKalmanFilter.cxx
1 //
2 // AYK (ayk@bnl.gov)
3 //
4 // STAR-related forward tracker Kalman filter;
5 //
6 
7 #include <assert.h>
8 
9 #include <FwdKalmanFilter.h>
10 
11 #if _OFF_
12 // ---------------------------------------------------------------------------------------
13 
14 int FwdKalmanFilter::CalculateHMatrix(KalmanNode *node)
15 {
16  assert(0);
17 
18 
19  //return 0;
20 } // FwdKalmanFilter::CalculateHMatrix()
21 
22 // ---------------------------------------------------------------------------------------
23 
24 int FwdKalmanFilter::Transport(KalmanNode *from, KalmanFilter::Direction fb, unsigned mode)
25 {
26  // For now (magnet off case) is not needed;
27  assert(0);
28  //return 0;
29 } // FwdKalmanFilter::Transport()
30 
31 // ---------------------------------------------------------------------------------------
32 
33 #if 0
34 #define _FLYSUB_TYPICAL_XY_COORD_ERROR_ ( 0.010)
35 #define _FLYSUB_TYPICAL_SLOPE_ERROR_ ( 0.0001)
36 //#define _FLYSUB_TYPICAL_XY_COORD_ERROR_ ( 10.000)
37 //#define _FLYSUB_TYPICAL_SLOPE_ERROR_ ( 1.)
38 #define _FLYSUB_TYPICAL_MOMENTUM_ERROR_ ( 1.000)
39 #define _FLYSUB_COVARIANCE_BLOWUP_CFF_ (30)
40 #endif
41 
42 void FwdKalmanFilter::ResetNode(KalmanNode *node, double S[], int assignmentMode)
43 {
44  assert(0);
45 
46 #if _NOW_
47  unsigned sdim = mFieldMode == NoField ? 4 : 5;
48 
49  if (S)
50  for(int ip=_X_; ip<sdim; ip++)
51  node->x0->KFV(ip) = S[ip];
52 
53  // Initialization depends on whether it's a 0-th iteration or not;
54  if (assignmentMode != _USE_00_) {
55  // Otherwise a normal Kalman filter iterative update;
56  KfVector *add = assignmentMode == _USE_XF_ ? node->xf : node->xs;
57 
58  for(int ip=_X_; ip<=_SY_; ip++)
59  node->x0->KFV(ip) += add->KFV(ip);
60 
61  // Momentum expansion point;
62  // NB: head->x0[_QP_] will remain 0. in all cases!;
63  if (sdim == 5) node->mInversedMomentum += add->KFV(_QP_);
64  } //if
65 
66  // Yes, predicted state vector at start of chain is set to 0.0;
67  for(int ip=_X_; ip<sdim; ip++)
68  node->xp->KFV(ip) = 0.;
69 
70  // Cook dummy (diagonal) covariance matrix;
71  node->CP->Reset();
72  // Just [0..3] components;
73  for(int ip=_X_; ip<=_SY_; ip++) {
74  double diag;
75 
76  switch (ip) {
77  case _X_:;
78  case _Y_:
80  break;
81  case _SX_:;
82  case _SY_:
84  break;
85  default:
86  assert(0);
87  } //switch
88 
89  node->CP->KFM(ip,ip) = SQR(diag*_FLYSUB_COVARIANCE_BLOWUP_CFF_);
90  } //for ip
91 
92  if (sdim == 5)
93  node->CP->KFM(_QP_,_QP_) =
94  SQR(_FLYSUB_TYPICAL_MOMENTUM_ERROR_*(node->mInversedMomentum)*
96 #endif
97 } // FwdKalmanFilter::ResetNode()
98 #endif
99 // ---------------------------------------------------------------------------------------