/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/KalFitAlg/KalFitAlg-00-07-55-p03/KalFitAlg/KalFitTrack.h

Go to the documentation of this file.
00001 #ifndef _DEFINE_KALFITTRACK_H_
00002 #define _DEFINE_KALFITTRACK_H_
00003 #ifndef DBL_MAX 
00004 #define DBL_MAX 9999
00005 #endif
00006 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00007 typedef HepGeom::Transform3D  HepTransform3D;
00008 #endif
00009 
00010 //#include "TrackUtil/Helix.h"
00011 #include "KalFitAlg/helix/Helix.h"
00012 #include "KalFitAlg/coil/Bfield.h"
00013 #include "CLHEP/Geometry/Transform3D.h"
00014 #include "CLHEP/Geometry/Point3D.h"
00015 #include "CLHEP/Matrix/Vector.h"
00016 #include "CLHEP/Matrix/Matrix.h"
00017 #include "KalFitAlg/KalFitHitMdc.h"
00018 #include "KalFitAlg/KalFitHelixSeg.h"
00019 #include "MdcCalibFunSvc/MdcCalibFunSvc.h"
00020 #include "MagneticField/IMagneticFieldSvc.h"
00021 #include "MagneticField/MagneticFieldSvc.h"
00022 #include "MdcRawEvent/MdcDigi.h"
00023 #include "EventModel/Event.h"
00024 
00025 //class HepTransform3D;
00026 class KalFitMaterial;
00027 
00028 
00029 using namespace KalmanFit;
00030 using namespace CLHEP;
00031 
00032 
00034 class KalFitTrack : public Helix                 
00035 {
00036         int type_; // track with  hits in pattern recognition (=1)
00037         double mass_;
00038         int trasan_id_;
00039         int l_mass_;
00040         int insist_;
00041         double chiSq_; 
00042         unsigned int nchits_, nster_, ncath_, ndf_back_;
00043         double chiSq_back_, pathip_, path_rd_, 
00044                path_ab_, tof_, dchi2_max_, r_max_;
00045         double tof_kaon_, tof_proton_;
00046         double p_kaon_, p_proton_;
00047         double r0_;
00048         double PathL_[43];
00049         double pathSM_;
00050         double fiTerm_;
00051         double tof2_;
00052 
00053         CLHEP::Hep3Vector mom_[43];
00054         int pat1_, pat2_;
00055         int layer_prec_;
00056         int nhit_r_, nhit_z_;
00057 
00058         // Information at the last hit included :
00059         HepPoint3D pivot_last_;
00060         CLHEP::HepVector a_last_;
00061         CLHEP::HepSymMatrix Ea_last_;
00062         HepPoint3D point_last_;
00063 
00064 
00065         // Information at the inned hit of Mdc :
00066         HepPoint3D pivot_forMdc_;
00067         CLHEP::HepVector a_forMdc_;
00068         CLHEP::HepSymMatrix Ea_forMdc_;
00069         vector<KalFitHitMdc> HitsMdc_;
00070         //it is used to for record the intermediate info. of fwd-filter and bwd-filter 
00071         vector<KalFitHelixSeg> HelixSegs_;
00072 
00073         enum { NMASS = 5 };
00074         static const double MASS[NMASS];
00075 
00077         static int lead_, back_;
00078         // the used svcs for this track
00079         static const MdcCalibFunSvc* CalibFunSvc_;
00080         static const IMagneticFieldSvc* MFSvc_;
00081         static IMdcGeomSvc* iGeomSvc_;
00082         static double EventT0_;
00083         static HepSymMatrix initMatrix_;
00084         static MdcDigiCol* mdcDigiCol_ ;
00085 public:
00087         KalFitTrack(const HepPoint3D& pivot,
00088                         const CLHEP::HepVector& a,
00089                         const CLHEP::HepSymMatrix& Ea,
00090                         unsigned int m,
00091                         double chiSq,
00092                         unsigned int nhits);
00093 
00095         ~KalFitTrack(void);
00096 
00098         double intersect_cylinder(double r) const;
00099         double intersect_yz_plane(const HepTransform3D& plane,
00100                         double x) const;
00101         double intersect_zx_plane(const HepTransform3D& plane,
00102                         double y) const;
00103         double intersect_xy_plane(double z) const;
00104 
00106         void msgasmdc(double path, int index);
00107         void ms(double path,
00108                         const KalFitMaterial& m, int index);
00109 
00111         void eloss(double path,
00112                         const KalFitMaterial& m, int index);
00113 
00115         double smoother_Mdc(KalFitHelixSeg& seg, CLHEP::Hep3Vector& meas, int& flg, int csmflag);
00116         double smoother_Mdc_csmalign(KalFitHelixSeg& seg, CLHEP::Hep3Vector& meas, int& flg, int csmflag );
00117         double smoother_Mdc(KalFitHitMdc& HitMdc, CLHEP::Hep3Vector& meas, KalFitHelixSeg& seg, double& dchi2, int csmflag);
00118 
00120 
00121         double update_hits(KalFitHitMdc& HitMdc, int inext, CLHEP::Hep3Vector& meas, int way, double& dchi2, double& dtrack, double& dtracknew, double& dtdc, int csmflag);
00122 
00123         double update_hits(KalFitHelixSeg& HelixSeg, int inext, CLHEP::Hep3Vector& meas, int way, double& dchi2, int csmflag);
00124         double update_hits_csmalign(KalFitHelixSeg& HelixSeg, int inext, CLHEP::Hep3Vector& meas, int way, double& dchi2,int csmflag );
00125         double chi2_next(Helix& H, KalFitHitMdc & HitMdc, int csmflag);
00126         double chi2_next(Helix& H, KalFitHitMdc & HitMdc);
00127 
00128 
00129 
00131         //double approach(KalFitHitMdc& hit, bool doSagCorrection) const;
00132 
00133         //double approach(HepPoint3D pfwd, HepPoint3D pbwd,  bool doSagCorrection) const;
00134 
00135 
00137         void update_last(void);
00138         void update_forMdc(void);
00139 
00141         void point_last(const HepPoint3D& point) { point_last_ = point;} 
00142         const HepPoint3D& point_last(void)   { return point_last_;} 
00143 
00144 
00146         const HepPoint3D & pivot_last(void)         const{ return pivot_last_;  }
00147         const CLHEP::HepVector & a_last(void)       const{ return a_last_;      }
00148         const CLHEP::HepSymMatrix & Ea_last(void)   const{ return Ea_last_;     }
00149 
00150         const HepPoint3D & pivot_forMdc(void)       const{ return pivot_forMdc_;}
00151         const CLHEP::HepVector & a_forMdc(void)     const{ return a_forMdc_;    }
00152         const CLHEP::HepSymMatrix & Ea_forMdc(void) const{ return Ea_forMdc_;   }
00153 
00155         void path_add(double path);
00156 
00157         void addPathSM(double path);
00158         double getPathSM(void) { return pathSM_;}
00159 
00160         void addTofSM(double time);
00161         double getTofSM(void) { return tof2_;}
00162 
00163         void fiTerm(double fi);
00164         double getFiTerm(void) { return fiTerm_;}
00165 
00167         void tof(double path);
00169         double filter(double v_m, const CLHEP::HepVector& m_H,
00170                         double v_d, double m_V);
00171 
00173         double cor_tanldep(double* p, double er);
00174 
00175         void update_bit(int i);
00176 
00178         int insist(void) const { return insist_; }
00179         int type(void) const { return type_; }
00180         int trasan_id(void) const { return trasan_id_; }
00181         double r0(void) const { return r0_; }
00182         double mass(void) const { return mass_; }
00183         double chiSq(void) const { return chiSq_; }
00184         double chiSq_back(void) const { return chiSq_back_; }
00185         int ndf_back(void) const { return ndf_back_; }
00186         double pathip(void) const { return pathip_; }
00187         double path_rd(void) const { return path_rd_; }
00188         double path_ab(void) const { return path_ab_; }
00189         double* pathl(void) { return PathL_; }
00190         CLHEP::Hep3Vector* mom(void) { return mom_; }
00191         double tof(void) const { return tof_; }
00192         double tof_kaon(void) const { return tof_kaon_; }
00193         double tof_proton(void) const { return tof_proton_; }
00194         double p_kaon(void) const { return p_kaon_; }
00195         double p_proton(void) const { return p_proton_; }
00196         double dchi2_max(void) const { return dchi2_max_; }
00197         double r_max(void) const { return r_max_; }
00198         unsigned int nchits(void) const { return nchits_; }
00199         unsigned int nster(void) const { return nster_; }
00200         unsigned int ncath(void) const { return ncath_; }
00201         int pat1(void) const { return pat1_;  }
00202         int pat2(void) const { return pat2_;  }
00203         int nhit_r(void) const { return nhit_r_;  }
00204         int nhit_z(void) const { return nhit_z_;  }
00205 
00207         void type(int t){ type_ = t;}
00208         void trasan_id(int t){ trasan_id_ = t;}
00209         void insist(int t){ insist_ = t;}
00210 
00211         void pathip(double pl){ pathip_ = pl;}
00212         void p_kaon(double pl){ p_kaon_ = pl;}
00213         void p_proton(double pl){ p_proton_ = pl;}
00214         void chiSq(double c){ chiSq_ = c; }
00215         void chiSq_back(double c){ chiSq_back_ = c; }
00216         void ndf_back(int n){ ndf_back_ = n; }
00217         void nchits(int n){ nchits_ = n; }
00218         void nster(int n){ nster_ = n; }
00219 
00220         void add_nhit_r(void) { nhit_r_++;}
00221         void add_nhit_z(void) { nhit_z_++;}
00222 
00224         double PathL(int layer);
00225 
00227         void appendHitsMdc(KalFitHitMdc h);
00228         void HitsMdc(vector<KalFitHitMdc>& lh);
00229         vector<KalFitHitMdc>& HitsMdc(void) { return HitsMdc_;}
00230         KalFitHitMdc& HitMdc(int i) { return HitsMdc_[i];}
00231 
00232         void appendHelixSegs(KalFitHelixSeg s);
00233         void HelixSegs(vector<KalFitHelixSeg>& vs);
00234         vector<KalFitHelixSeg>& HelixSegs(void) { return HelixSegs_;}
00235         KalFitHelixSeg& HelixSeg(int i) { return HelixSegs_[i];}
00236 
00239         void order_wirhit(int index);
00240         void order_hits(void);
00241         void number_wirhit(void);
00242 
00244         const HepPoint3D & pivot_numf(const HepPoint3D & newPivot);
00245         const HepPoint3D & pivot_numf(const HepPoint3D & newPivot, double & pathl);
00246 
00248         double radius_numf(void) const;
00249 
00250         //temporily for wire resolution, use service in future
00251         double getSigma(int layerId, double driftDist ) const;
00252 
00253         //  call from calibration service 
00254         double  getSigma(KalFitHitMdc& hitmdc, double tanlam, int lr, double dist) const;
00255         double  getDriftDist(KalFitHitMdc& hitmdc, double drifttime, int lr) const;
00256 
00257         double  getDriftTime(KalFitHitMdc& hitmdc , double toftime) const;
00258 
00259         // event start time
00260         static void  setT0(double t0);
00261         double getT0(void) const;
00262 
00263         static void setInitMatrix(HepSymMatrix m);
00264         HepSymMatrix getInitMatrix(void) const;
00265 
00266         double  getDigi() const;
00267 
00268         //for get service 
00269         static void setMdcCalibFunSvc(const MdcCalibFunSvc* calibsvc);
00270         static void setMagneticFieldSvc(IMagneticFieldSvc*);
00271         static void setIMdcGeomSvc( IMdcGeomSvc* igeomsvc);
00272         static void setMdcDigiCol(MdcDigiCol*  digicol);
00273 
00274         static double  mdcGasRadlen_;
00275 
00277         static int tprop_;
00278 
00280         static int debug_;  
00282         static double chi2_hitf_, chi2_hits_;  
00284         static int numf_;   
00285         static int inner_steps_;
00286         static int outer_steps_;
00287 
00288         static double dchi2cutf_anal[43];
00289 
00290         static double dchi2cuts_anal[43];
00291 
00292         static double dchi2cutf_calib[43];
00293 
00294         static double dchi2cuts_calib[43];
00295 
00297         static int numfcor_;   
00298         // Nominal mag field 
00299         static double Bznom_;
00302         static int steplev_;   
00303 
00305         static int Tof_correc_;  
00306 
00308         static int strag_;
00310         static double factor_strag_;
00312         static int nmdc_hit2_;
00313         static double chi2mdc_hit2_; 
00314         static int tofall_;
00316         static int resolflag_;
00317 
00319         static int LR_;
00321         static int drifttime_choice_;
00322         static int nmass(void);
00323         static double mass(int i);
00324         void chgmass(int i);
00325         static void LR(int x);
00327         static int lead(void);
00328         static void lead(int i);
00329         static int back(void);
00330         static void back(int i);
00331         static int resol(void);
00332         static void resol(int i);
00333         static int numf(void);
00334         static void numf(int i);
00335 
00336         int nLayerUsed() 
00337         {
00338                 int n=0;
00339                 for(int i=0; i<43; i++) n+=myLayerUsed[i];
00340                 return n;
00341         }
00342 
00343         void resetLayerUsed() {
00344                 for(int i=0; i<43; i++) myLayerUsed[i]=0;
00345         }
00346 
00347         void useLayer(int iLay) {
00348                 if(iLay>=0 && iLay<=43) myLayerUsed[iLay]=1;
00349         }
00350 
00351 
00352 private:
00353         int myLayerUsed[43];
00354 
00355 
00356 };
00357 
00358 #endif
00359 

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