EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KalmanNode.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file KalmanNode.cxx
1 //
2 // AYK (ayk@bnl.gov)
3 //
4 // Kalman filter node and associated structures; ported from
5 // HERMES/OLYMPUS sources; cleaned up 2014/10/13;
6 //
7 
8 #include <cstdio>
9 #include <cassert>
10 
11 #include <KalmanNode.h>
12 
13 // ---------------------------------------------------------------------------------------
14 
15 //
16 // C++: no sense to check on pointer != NULL, since exception will be thrown anyway, right?;
17 //
18 
19 void KalmanNode::AllocateKfMatrices(unsigned sdim)
20 {
21 
22  // Magnet-off transport matrices are calculated once --> make them global;
23  //printf("allocation %f ...\n", z);
24  for(unsigned fb=0; fb<2; fb++) {
25  FF[fb] = new KfMatrix(sdim, sdim);
26  //if (!node->FF[fb]) return NULL;
27 
28  // Will be unity matrices per default;
29  FF[fb]->Unity();
30  } /*for*/
31 
32  // There are dummy nodes, which can not provide ea measurement -> no need to
33  // allocate these matrices then;
34  if (mDim) {
35  m = new KfVector(mDim);
36 
37  V = new KfMatrix(mDim, mDim);
38 
39  H = new KfMatrix(mDim, sdim);
40 
41  K = new KfMatrix(sdim, mDim);
42 
43  rf = new KfVector(mDim);
44  ep = new KfVector(mDim);
45 
46  RPI = new KfMatrix(mDim, mDim);
47  RF = new KfMatrix(mDim, mDim);
48 
49  rs = new KfVector(mDim);
50  RS = new KfMatrix(mDim, mDim);
51 
52  MMTX = new KfMatrix(mDim, mDim);
53  MVEC = new KfVector(mDim);
54 
55  rm = new KfVector(mDim);
56  RM = new KfMatrix(mDim, mDim);
57  } //if
58 
59  // Will be unity matrix per default;
60  FM = new KfMatrix(sdim, sdim);
61  FM->Unity();
62 
63  Q = new KfMatrix(sdim, sdim);
64 
65  x0 = new KfVector(sdim);
66 
67  xp = new KfVector(sdim);
68 
69  xf = new KfVector(sdim);
70 
71  CP = new KfMatrix(sdim, sdim);
72  CF = new KfMatrix(sdim, sdim);
73 
74  xs = new KfVector(sdim);
75  qq = new KfVector(sdim);
76 
77  CS = new KfMatrix(sdim, sdim);
78 
79  xm = new KfVector(sdim);
80  CM = new KfMatrix(sdim, sdim);
81 
82  LB = new KfMatrix(sdim, sdim);
83  L = new KfMatrix(sdim, sdim);
84  QQ = new KfMatrix(sdim, sdim);
85 } // KalmanNode::AllocateKfMatrices()
86 
87 // ---------------------------------------------------------------------------------------
88 
90 {
91  mFired = true;
92 
93  // And increment all respective group counters;
94  for(int gr=0; gr<mNodeGroupNum; gr++) {
95  NodeGroup *group = mNodeGroups[gr];
96 
97  group->mFiredNodeNum++;
98  //printf(" SetFiredFlag(): now %2d total!\n", group->mFiredNodeNum);
99  } //for gr
100 } // KalmanNode::SetFiredFlag()
101 
102 // ---------------------------------------------------------------------------------------
103 
105 {
106  mFired = false;
107 
108  // And decrement all respective group counters;
109  for(int gr=0; gr<mNodeGroupNum; gr++) {
110  NodeGroup *group = mNodeGroups[gr];
111 
112  group->mFiredNodeNum--;
113  //printf("ResetFiredFlag(): now %2d total!\n", group->mFiredNodeNum);
114 
115  // Remove once debugging finished;
116  assert(group->mFiredNodeNum >= 0);
117  } //for gr
118 } // KalmanNode::ResetFiredFlag()
119 
120 // ---------------------------------------------------------------------------------------
121