00001 #ifndef VertexFit_SecondVertexFit_H 00002 #define VertexFit_SecondVertexFit_H 00003 #include "VertexFit/TrackPool.h" 00004 #include "VertexFit/VertexFit.h" 00005 00006 //-------------------------------------------------------------------------------- 00007 // 00008 // Fitting Parameters Format: (px, py, pz, E, xd, yd, zd, xp, yp, zp) 00009 // 00010 // Author Date Comments 00011 // K.L He 11/21/2005 original version 00012 // Xu Min 11/30/2006 Add interface of production vertex and decay vertex 00013 // Martin 09/02/2010 Add some kindly comments 00014 // 00015 //-------------------------------------------------------------------------------- 00016 00017 // You can find the corresponding tutorial on the following web page: 00018 // http://docbes3.ihep.ac.cn/~offlinesoftware/index.php/Vertex_Fit 00019 00020 class SecondVertexFit : public TrackPool 00021 { 00022 public: 00023 00024 // constructor & deconstructor 00025 static SecondVertexFit *instance(); 00026 ~SecondVertexFit(); 00027 00028 // initializtion must be called before SecondVertexFit each time 00029 void init(); 00030 00031 // set iteration number and chisq cut 00032 void setIterNumber(const int niter = 10) {m_niter = niter;} 00033 void setChisqCut(const double chicut = 500, const double chiter = 1.0e-2) {m_chicut = chicut;m_chiter=chiter;} 00034 // set decay point 00035 void setVpar(const VertexParameter vpar) {m_vpar_secondary = vpar;} 00036 // set production point 00037 void setPrimaryVertex(const VertexParameter vpar) {m_vpar_primary.setVx(vpar.Vx());m_vpar_primary.setEvx(vpar.Evx());} 00038 // set magnet correction factor 00039 void setMagCorrFactor(const double factor = 1.000) {m_factor = factor;} 00040 00041 // fit function 00042 bool Fit(); 00043 00044 // fit results 00045 double chisq() const {return m_chisq;} 00046 double decayLength() const {return m_lxyz;} 00047 double decayLengthError() const {return m_lxyz_error;} 00048 double ctau() const {return m_ctau;} 00049 double ctauError() const {return m_ctau_error;} 00050 double factor() const {return m_factor;} 00051 00052 HepLorentzVector p4par() const {return m_p4par;} 00053 WTrackParameter wpar() const {return m_wtrk;} 00054 VertexParameter vpar() const {return m_vpar_secondary;} 00055 inline HepPoint3D crossPoint() const; 00056 inline Hep3Vector crossVector() const; 00057 00058 private: 00059 00060 int m_niter; // number of iteration for second vertex fitting 00061 double m_chisq; // fitting chisquare 00062 double m_chicut; // chisquare upper limit 00063 double m_chiter; // precision of iteration 00064 double m_lxyz; // decay length 00065 double m_lxyz_error; // error of decay length 00066 double m_ctau; // c times tau 00067 double m_ctau_error; // error of ctau 00068 double m_factor; // B Field correction factor 00069 00070 HepVector m_crxyz; // decay vertex in HepVector format 00071 HepLorentzVector m_p4par; // HepLorentzVector of particle at decay vertex 00072 WTrackParameter m_wtrk; // WTrackParameter of particle at decay vertex 00073 VertexParameter m_vpar_primary; // production vertex 00074 VertexParameter m_vpar_secondary; // decay vertex 00075 00076 // Singleton Design 00077 SecondVertexFit(); 00078 static SecondVertexFit * m_pointer; 00079 }; 00080 00081 inline HepPoint3D SecondVertexFit::crossPoint() const 00082 { 00083 return HepPoint3D(m_crxyz[0], m_crxyz[1], m_crxyz[2]); 00084 } 00085 00086 inline Hep3Vector SecondVertexFit::crossVector() const 00087 { 00088 return Hep3Vector(m_crxyz[0] - m_vpar_primary.Vx()[0], 00089 m_crxyz[1] - m_vpar_primary.Vx()[1], 00090 m_crxyz[2] - m_vpar_primary.Vx()[2]); 00091 } 00092 00093 #endif // VertexFit_SecondVertexFit_H 00094