EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrKalmanFilter.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrKalmanFilter.h
1 //
2 // AYK (ayk@bnl.gov)
3 //
4 // Forward detector tracking application of the Kalman filter stuff;
5 // ported from HERMES/OLYMPUS sources; cleaned up 2014/10/17;
6 //
7 
8 #include <Mgrid.h>
9 
10 class MediaBank;
11 struct t_particle_group;
12 
13 extern "C" t_particle_group *get_particle_group_by_name(const char *name);
14 
15 #include <TrKalmanNode.h>
16 #include <KalmanFilter.h>
17 
18 #ifndef _TR_KALMAN_FILTER_
19 #define _TR_KALMAN_FILTER_
20 
22  public:
23  // The constructor; just call KalmanFilter() constructor;
25  KalmanFilter(fieldMode == WithField ? 5 : 4), mFieldMode(fieldMode),
27 
28  t_particle_group *SetParticleGroup(const char *group) {
30 
31  return mParticleGroup;
32  };
33 
34  MfieldMode GetFieldMode() const { return mFieldMode; };
35 
36  int Configure(MediaBank *media_bank, StringList *config);
37 
38  virtual MgridSlice *InitializeMgridSlice(double z0) = 0;
40  int InitializeMediaSlices(MediaBank *media_bank);
42 
43  int CalculateHMatrix(KalmanNode *node);
44  int Transport(KalmanNode *from, KalmanFilter::Direction fb, unsigned mode);
45  // Multiple scattering and dE/dx accounting;
46  int TransportExtra(KalmanNode *from, KalmanFilter::Direction fb, unsigned mode);
47 
48  // Prepare node to become a starting point of a filter pass (so
49  // basically reset x0[], xp[], CP[][] & mInversedMomentum); FIXME: need to make
50  // cov.matrix parameters configurable as well;
51  void ResetNode(TrKalmanNode *node, double S[], int assignmentMode);
52 
53  void SelectActiveNodes();
54  void SetUpLocations();
55 
57 
58  // Do this better later (bind FF[]- matrix calculation to locations rather
59  // than nodes);
60  void BuildNodeList() {
62 
64  };
65 
66  void AccountEnergyLosses(bool flag) { mAccountEnergyLosses = flag; };
67 
68  protected:
71 
72  private:
74 
75  // It turns out to be very convenient to store particle type
76  // in a separate variable instead of passing application-specific
77  // pointers to tfun()/.../xfun() functions;
79 
81 
82  // Yes, this is the trick: allocate extra space compared to the
83  // KalmanNode base class; whether it is correct or not I do not
84  // care to the moment; from memory allocation model I'd suppose it is;
85  KalmanNode *AllocateNode() { return new TrKalmanNode(); };
86 
87  // Yes, for tracking Kalman filter this call checks field/no-field mode;
88  // FIXME: may want to return back the functionality to check for field-free regions;
89  bool NeedNonLinearTransport(double z) const {
90  return mFieldMode == WithField ? true : false;
91  };
92 
95 
97 };
98 
99 #endif