/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/TrkBase/TrkBase-00-01-12/TrkBase/TrkMomCalculator.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //
00004 // Description:  TrkMomCalculator is the momentum calculation engine
00005 //      for the TrkMomVisitor implementation of the Visitor pattern,
00006 //      for use in calculating momenta for different types of
00007 //      trajectories.  Important note: in calculating momentum, these 
00008 //      functions make assumptions about how trajectories relate to mom.
00009 //      Specifically, they assume: 1) that mom should be calculated using
00010 //      the nominal B field, not B at the point in question -- this is valid 
00011 //      for (today's) KalmanTrack, but is not true in general; 2) that 
00012 //      B is parallel to the z axis.
00013 //
00014 // Environment:
00015 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00016 //
00017 // Author(s): Justin Albert, Steve Schaffner
00018 //
00019 //------------------------------------------------------------------------
00020 
00021 #ifndef TRKMOMCALCULATOR_HH
00022 #define TRKMOMCALCULATOR_HH
00023 #include "CLHEP/Vector/ThreeVector.h"
00024 #include "CLHEP/Matrix/Matrix.h"
00025 #include "CLHEP/Matrix/SymMatrix.h"
00026 
00027 class TrkSimpTraj;
00028 class BField;
00029 
00030 using CLHEP::Hep3Vector;
00031 using CLHEP::HepMatrix;
00032 using CLHEP::HepSymMatrix;
00033 class BesVectorErr;
00034 
00035 // Class interface //
00036 class TrkMomCalculator {
00037 
00038 public:
00039 
00040   TrkMomCalculator();
00041   virtual ~TrkMomCalculator();
00042 
00043   //********************************
00044   // The calculator functions:
00045   //********************************
00046 
00047   static double       ptMom( const TrkSimpTraj&, const BField&, double fltlen);
00048   static Hep3Vector   vecMom(const TrkSimpTraj&, const BField&, double fltlen);
00049   static BesVectorErr errMom(const TrkSimpTraj&, const BField&, double fltlen);
00050   static int          charge(const TrkSimpTraj&, const BField&, double fltlen);
00051 
00052   // Interface to vertexing algorithms (M.Bondioli 7/17/98)
00053   // covariance matrices of the track at fixed flight length 
00054   static HepMatrix    posmomCov(const TrkSimpTraj&,const BField&,
00055                                 double fltlen);
00056   static void         getAllCovs(const TrkSimpTraj&,const BField&,
00057                                  double fltlen,
00058                                  HepSymMatrix& xxCov,
00059                                  HepSymMatrix& ppCov,
00060                                  HepMatrix&    xpCov);
00061   // invert 6x6
00062   static bool weightToCov(const HepSymMatrix& inXX,const HepSymMatrix& inPP,const HepMatrix& inXP,
00063                           HepSymMatrix& outXX,     HepSymMatrix& outPP,     HepMatrix& outXP);
00064 
00065   // accessors to 2nd derivative of chi2 wrt x and p.
00066   // x0 and p0 are filled with the pos and 3mom around which expansion 
00067   // takes place, whilst Weights are filled with the 2nd deriv of chi2.
00068   // so that:
00069   //  dx=x-x0   dp=p-p0
00070   //
00071   //  chi2(x,p)=0.5 dx^t*Wxx*dx + dx^t*Wxp*dp + 0.5 dp^t*Wpp*dp
00072   // where:
00073   //  pos and mom are 3-dim Vectors,
00074   //  xxWeight ppWeight and xpWeight are 3 by 3 matrices
00075   //
00076   // takes place, whilst Weights are filled with the 2nd deriv of chi2.
00077   // so that:
00078   //  dx=x-x0   dp=p-p0
00079   //
00080   //  chi2(x,p)=0.5 dx^t*Wxx*dx + dx^t*Wxp*dp + 0.5 dp^t*Wpp*dp
00081   // where:
00082   //  pos and mom are 3-dim Vectors,
00083   //  xxWeight ppWeight and xpWeight are 3 by 3 matrices
00084   //
00085   static void         getAllWeights(const TrkSimpTraj&, const BField&,
00086                                     double fltlen,
00087                                     HepVector& pos,
00088                                     HepVector& mom,
00089                                     HepSymMatrix& xxWeight,
00090                                     HepSymMatrix& ppWeight,
00091                                     HepMatrix&    xpWeight);
00092 
00093 private:
00094 
00095   static double       calcCurvPtMom(const Hep3Vector&,  
00096                                     double curvature, 
00097                                     const BField&);
00098   static Hep3Vector   calcCurvVecMom(const Hep3Vector&, 
00099                                      double curvature, 
00100                                      const BField&);
00101   static BesVectorErr calcCurvErrMom(const TrkSimpTraj&, 
00102                                      const BField&,  
00103                                      double flt); 
00104   static BesVectorErr calcNeutErrMom(const TrkSimpTraj&, const BField&,  
00105                                      double flt);
00106   static int          calcCurvCharge(const Hep3Vector&, 
00107                                      double curvature, 
00108                                      const BField&);        
00109 
00110   static HepMatrix    calcCurvPosmomCov(const TrkSimpTraj&,const BField&,
00111                                         double fltlen);
00112   static HepMatrix    calcNeutPosmomCov(const TrkSimpTraj&,const BField&,
00113                                         double fltlen);
00114 
00115   static void         calcCurvAllCovs(const TrkSimpTraj&,const BField&,
00116                                       double fltlen,
00117                                       HepSymMatrix& xxCov,
00118                                       HepSymMatrix& ppCov,
00119                                       HepMatrix&    xpCov);
00120 
00121   static void         calcCurvAllCovsOLD(const TrkSimpTraj&,const BField&,
00122                                       double fltlen,
00123                                       HepSymMatrix& xxCov,
00124                                       HepSymMatrix& ppCov,
00125                                       HepMatrix&    xpCov);
00126 
00127   static void         calcNeutAllCovs(const TrkSimpTraj&,const BField&,
00128                                       double fltlen,
00129                                       HepSymMatrix& xxCov,
00130                                       HepSymMatrix& ppCov,
00131                                       HepMatrix&    xpCov);
00132 
00133   static void         calcNeutAllCovs(const TrkSimpTraj&,const BField&,
00134                                       double fltlen,
00135                                       HepVector& x0,HepVector& p0,
00136                                       HepSymMatrix& xxCov,
00137                                       HepSymMatrix& ppCov,
00138                                       HepMatrix&    xpCov);
00139 
00140   static void         calcCurvAllWeights(const TrkSimpTraj&,const BField&,
00141                                          double fltlen,
00142                                          HepVector& pos,
00143                                          HepVector& mom,
00144                                          HepSymMatrix& xxWeight,
00145                                          HepSymMatrix& ppWeight,
00146                                          HepMatrix&    xpWeight);
00147 
00148   static void         calcCurvAllWeightsOLD(const TrkSimpTraj&,const BField&,
00149                                          double fltlen,
00150                                          HepVector& pos,
00151                                          HepVector& mom,
00152                                          HepSymMatrix& xxWeight,
00153                                          HepSymMatrix& ppWeight,
00154                                          HepMatrix&    xpWeight);
00155 
00156   static void         calcNeutAllWeights(const TrkSimpTraj&,const BField&,
00157                                          double fltlen,
00158                                          HepVector& pos,
00159                                          HepVector& mom,
00160                                          HepSymMatrix& xxWeight,
00161                                          HepSymMatrix& ppWeight,
00162                                          HepMatrix&    xpWeight);
00163 
00164   static int          nearestInt(double);
00165 
00166 };
00167 
00168 #endif

Generated on Tue Nov 29 23:13:42 2016 for BOSS_7.0.2 by  doxygen 1.4.7