/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Analysis/VertexFit/VertexFit-00-02-78/VertexFit/KalmanVertexFit.h

Go to the documentation of this file.
00001 #ifndef Kalman_Vertex_Fit_H
00002 #define Kalman_Vertex_Fit_H
00003 
00004 #include <vector>
00005 #include "VertexFit/HTrackParameter.h"
00006 #include "VertexFit/VertexParameter.h"
00007 #include "VertexFit/WTrackParameter.h"
00008 
00009 using namespace std;
00010 //
00011 // Kalman vertex fit interface 
00012 //
00013 // Apr. 13, 2007, K.L. He created
00014 //
00015 
00016 class KalmanVertexFit {
00017 
00018  public:
00019   
00020   static KalmanVertexFit *instance();
00021   ~KalmanVertexFit();
00022   
00023   //
00024   //  initialization
00025   void init();
00026   //
00027   // initial vertex parameter
00028   //
00029   void initVertex(const VertexParameter vtx);
00030   //
00031   //  track interface
00032   //
00033   void addTrack(const HTrackParameter);
00034   //
00035   //  an interface for magnetic field
00036   //
00037 
00038   /* will in added in the future */
00039      
00040   //
00041   //  the method of filter
00042   //
00043   int filter(const int k);  // iteration for track k;
00044   void filter();
00045   //
00046   //  the method of inverse filter
00047   //
00048   void inverse(const int k);  // inverse kalman filter
00049   //
00050   //  the method of smooth
00051   //
00052   void smooth(const int k);
00053   void smooth();
00054   //
00055   // remove track k
00056   //
00057   void remove(const int k);  // remove track k from vertex, done by user
00058 
00059   // xum
00060   HepVector pull(const int k);
00061   double pullmomentum(const int k);
00062   //
00063   //  output of Kalman vertex fit
00064   //
00065 
00066   // updated vertex information
00067   VertexParameter vtx() const; 
00068   HepVector x() const {return m_x;}
00069   HepSymMatrix Ex() const;
00070 
00071   //
00072   // number of track, chi-square, etc
00073   //
00074   int numTrack() const;
00075   int ndof() const {return m_ndof;}
00076   double chisq() {return m_chisq;}
00077   int trackID(const int k) const {return m_hTrkOrigin[k].trackID();}
00078   std::vector<int> trackIDList() const; // ID of tracks constribute to vertex fitting 
00079 
00080   //
00081   // chi-square of filter and smooth 
00082   //
00083   double chiF(const int k) const {return m_chiF[k];}  // chi-square of filter for track k
00084   double chiS(const int k) const;  // chi-square of smooth for track k
00085   
00086   //
00087   // updated helix parameter after fit
00088   //
00089   HTrackParameter hTrack(const int k) const;  // at cloest point approach to origin
00090   WTrackParameter wTrack(const int k, const double mass) const;  // at the vertex position
00091 
00092   //
00093   //  set the number of iteration, chi-square cut for tracks
00094   //
00095   void setVertexIteration(const int num) {m_maxVertexIteration = num;}
00096   void setTrackIteration(const int num) {m_maxTrackIteration = num;}
00097   void setChisqCut(const double chicut) {m_chisqCutforTrack = chicut;}
00098   void setTrackIterationCut(const double chicut) {m_chisqCutforTrackIteration = chicut;} //xum
00099   //
00100   //  set input vector<HTrackParameter>, wait for some days
00101   //
00102   
00103  private:
00104   void updateMatrices(const int k);  // update derivative matrices during filter  
00105   void updateMatrices(const int k, const HepVector p, const HepVector x);  // update derivative matrices during filter  
00106   KalmanVertexFit(); // constructor
00107   static KalmanVertexFit *m_pointer;  // pointer 
00108 
00109  private:
00110   HepVector m_x;    // vertex position
00111   HepSymMatrix m_C0;   // Initial inverse covariance matrix of vertex
00112   HepSymMatrix m_C;    // current inverse covariance matrix of vertex
00113   int m_ndof;       // number of degree of freedom = 2 * nTrk -3
00114   double m_chisq;   // total chisq of vertex fit
00115  private:
00116   std::vector<int> m_flag;   // remove flag for track k;
00117   std::vector<HepVector> m_p; // 3-momentum at vertex position for track k
00118   std::vector<HTrackParameter> m_hTrkOrigin;  // measured helix parameter for track k
00119   std::vector<HTrackParameter> m_hTrkInfit;  // xum add
00120  private:
00121   std::vector<HepSymMatrix> m_G;             // 5x5 matrix G=V^{-1}, inversion of error matrix for track k, do not change during fitting
00122   std::vector<HepMatrix> m_A;                // 5x3 derivative matrix da/dx for track k
00123   std::vector<HepMatrix> m_B;                // 5x3 derivative matrix da/dp for track k
00124   std::vector<HepVector> m_c;                // c0 vector for track k
00125   std::vector<HepSymMatrix> m_W;             // 3x3 matrix (BT * G * B)^{-1}
00126   std::vector<HepSymMatrix> m_GB;            // 5x5 matrix 
00127   std::vector<double> m_chiF;                // chisq of filter
00128  
00129  private: //xum
00130   double calculationP(const double kappa, const double lamb); 
00131   double calculationSigmaP(const double kappa, const double lamb, const double Vkappa,
00132                    const double Vlamb, const double Vkappa_lamb); 
00133 
00134  private:
00135   double m_chisqCutforTrack;  // chisq cut
00136   int m_maxVertexIteration;  // number of iteration, 3 times are enough
00137   int m_maxTrackIteration;
00138   double m_chisqCutforTrackIteration;
00139 };
00140 #endif

Generated on Tue Nov 29 22:57:40 2016 for BOSS_7.0.2 by  doxygen 1.4.7