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

Go to the documentation of this file.
00001 #ifndef HTrack_Parameter_H
00002 #define HTrack_Parameter_H
00003 //
00004 //
00005 // Track Parameters in Helix format (drho, phi0, kappa, dz, lambda)
00006 // The helix parameters are used in track fit
00007 // Author: K.L He   date: 04/12/2007, created for Kalman vertex fit
00008 //
00009 //
00010 
00011 #include "CLHEP/Matrix/Vector.h"
00012 #include "CLHEP/Vector/LorentzVector.h"
00013 #include "CLHEP/Vector/ThreeVector.h"
00014 #include "CLHEP/Matrix/SymMatrix.h"
00015 #include "CLHEP/Matrix/Matrix.h"
00016 using CLHEP::HepVector;
00017 using CLHEP::HepLorentzVector;
00018 using CLHEP::Hep3Vector;
00019 using CLHEP::HepMatrix;
00020 using CLHEP::HepSymMatrix;
00021 #include "CLHEP/Geometry/Point3D.h"
00022 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00023    typedef HepGeom::Point3D<double> HepPoint3D;
00024 #endif
00025 
00026 class WTrackParameter;
00027 
00028 class HTrackParameter {
00029 
00030  public:
00031      HTrackParameter();
00032      ~HTrackParameter() {;}
00033      HTrackParameter(const HTrackParameter &htrk);
00034      HTrackParameter & operator = (const HTrackParameter &htrk);
00035      HTrackParameter(const HepVector helix, const HepSymMatrix eMatrix, const int trackid, const int partid);
00036      HTrackParameter(const HepVector helix, const double error[], const int trackid, const int partid);
00037 
00038      //
00039      // HTrackParameter from WTrackParameter
00040      //
00041      HTrackParameter(const WTrackParameter wtrk);
00042      //
00043      // measurement equation and derivative matrices
00044      //
00045      HTrackParameter(const int charge, const HepVector p, const HepVector x);
00046      HepMatrix dHdx(const HepVector p, const HepVector x);
00047      HepMatrix dHdp(const HepVector p, const HepVector x);
00048 
00049      HepVector hel() const {return m_hel;}
00050      HepVector helix() const {return m_hel;}
00051      HepSymMatrix eHel() const {return m_eHel;}
00052      int trackID() const {return m_trackID;}
00053      int partID() const {return m_partID;}
00054 
00055      // charge
00056      inline int charge() const;
00057      // 3-momentum and 3-position
00058      inline double pxy() const;
00059      inline HepVector p() const;
00060      inline HepVector x() const;
00061      inline Hep3Vector p3() const;
00062      inline HepPoint3D x3() const;
00063      inline HepLorentzVector  p(const double mass) const;
00064      HepPoint3D center() const;
00065      double radius() const;
00066      // helix parameter
00067      double drho() const {return m_hel[0];}
00068      double phi0() const {return m_hel[1];}
00069      double kappa() const {return m_hel[2];}
00070      double dz() const {return m_hel[3];}
00071      double lambda() const {return m_hel[4];}
00072 
00073 
00074      // WTrackParameter
00075      WTrackParameter wTrack() const;
00076      WTrackParameter wTrack(const double mass) const;
00077 
00078      // set partID, trackID
00079      void setTrackID(const int trackID) {m_trackID = trackID;}
00080      void setPartID(const int partID) { m_partID = partID;}
00081      // set helix parameter and covariance matrix
00082      void setHel(const HepVector he) {m_hel = he;}
00083      void setEHel(const HepSymMatrix eH) {m_eHel = eH;}
00084      //
00085      // some utility function  
00086      //
00087      // mass 
00088      double xmass(const int i) const;
00089      //
00090      // int section position with helix, plane, cylinder, cone, etc
00091      //
00092      HepPoint3D positionTwoHelix(const HTrackParameter) const;    // intersection position in x-y plane
00093      HepPoint3D positionPlane(const double) const;
00094      HepPoint3D positionCylinder(const double) const;
00095      HepPoint3D positionCone() const;
00096      //
00097      //  Mininum distance between helix and helix, helix and line
00098      //
00099      double minDistanceTwoHelix(const HTrackParameter G, HepPoint3D &pos);
00100  private:
00101      int m_trackID;      // for vertex reconstruction
00102      int m_partID;       // for Kalman track, 0:e, 1:mu, 2:pi, 3:K, 4:p
00103      HepVector m_hel;   // 5 helix parameter
00104      HepSymMatrix m_eHel; // 5x5 error matrix
00105 };
00106 
00107 inline int HTrackParameter::charge() const {
00108   return (m_hel[2]>0 ? +1 :-1);
00109 }
00110 
00111 inline double HTrackParameter::pxy() const {
00112   return fabs(1/m_hel[2]);
00113 }
00114 
00115 inline HepVector HTrackParameter::p() const {
00116   HepVector p0(3, 0);
00117   double pxy = 1./fabs(m_hel[2]);
00118   p0[0] = 0 - pxy*sin(m_hel[1]);
00119   p0[1] = pxy*cos(m_hel[1]); 
00120   p0[2] = pxy * m_hel[4];
00121   return p0;
00122 }
00123 
00124 
00125 inline HepVector HTrackParameter::x() const {
00126   HepVector v0(3, 0);
00127   v0[0] = m_hel[0]*cos(m_hel[1]); 
00128   v0[1] = m_hel[0]*sin(m_hel[1]); 
00129   v0[2] = m_hel[3];
00130   return v0;
00131 }
00132 
00133 inline HepPoint3D HTrackParameter::x3() const {
00134   return HepPoint3D(m_hel[0]*cos(m_hel[1]), m_hel[0]*sin(m_hel[1]), m_hel[3]);
00135 }
00136 
00137 inline Hep3Vector HTrackParameter::p3() const {
00138   double pxy = 1./fabs(m_hel[2]);
00139   return Hep3Vector(0-pxy*sin(m_hel[1]), pxy*cos(m_hel[1]), pxy*m_hel[4]);
00140 }
00141 
00142 inline HepLorentzVector HTrackParameter::p(const double mass) const{
00143 //   // xum 2007-12-28  
00144 //   //Hep3Vector ptrk = (p3()).rho();
00145 //   Hep3Vector ptrk = (p3()).r();
00146 //   double e = sqrt(ptrk*ptrk+mass*mass);
00147 //   return HepLorentzVector(p3(), e);
00148 
00149   // nefedov 2011-11-17
00150   Hep3Vector p3tmp = p3();
00151   double ptrk = p3tmp.r();
00152   double e = sqrt(ptrk*ptrk+mass*mass);
00153   return HepLorentzVector(p3tmp, e);
00154 }
00155 
00156 #endif

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