/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/TrkReco/TrkReco-00-08-59-patch4-slc6tag/TrkReco/TRunge.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // $Id: TRunge.h,v 1.28 2012/05/28 05:16:29 maoh Exp $
00003 //-----------------------------------------------------------------------------
00004 // Filename : TRunge.h
00005 // Section  : Tracking
00006 // Owner    : Kenji Inami
00007 // Email    : inami@bmail.kek.jp
00008 //-----------------------------------------------------------------------------
00009 // Description : A class to represent a track using Runge Kutta method
00010 //               See http://bsunsrv1.kek.jp/~yiwasaki/tracking/
00011 //-----------------------------------------------------------------------------
00012 
00013 //#ifdef TRKRECO_DEBUG_DETAIL
00014 //#define TRKRECO_DEBUG
00015 //#endif
00016 #ifndef TRUNGE_FLAG_
00017 #define TRUNGE_FLAG_
00018 
00019 #define Runge   64
00020 // This must be writen in TTrackBase.h
00021 
00022 #define HEP_SHORT_NAMES
00023 #ifndef CLHEP_POINT3D_H
00024 #include "CLHEP/Geometry/Point3D.h"
00025 #endif
00026 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00027     typedef HepGeom::Point3D<double> HepPoint3D;
00028 #endif
00029 
00030 #ifndef CLHEP_VECTOR3D_H
00031 #include "CLHEP/Geometry/Vector3D.h"
00032 #endif
00033 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00034     typedef HepGeom::Vector3D<double> HepVector3D;
00035 #endif
00036 typedef HepGeom::Transform3D  HepTransform3D;
00037 //#include "helix/Helix.h"
00038 //#include "coil/Bfield.h"
00039 //#include "TrkReco/Helix.h"
00040 #include "TrackUtil/Helix.h"
00041 #include "TrkReco/Bfield.h"
00042 #include "TrkReco/TTrackBase.h"
00043 #include "TrkReco/TRunge.h"    
00044 
00045 #include "GaudiKernel/IInterface.h"
00046 #include "GaudiKernel/Kernel.h"
00047 #include "GaudiKernel/Service.h"
00048 #include "MagneticField/IMagneticFieldSvc.h"
00049 #include "MagneticField/MagneticFieldSvc.h"
00050 
00051 #include "CLHEP/Matrix/Vector.h"
00052 #include "CLHEP/Matrix/SymMatrix.h"
00053 #include "CLHEP/Vector/ThreeVector.h"
00054 #include "CLHEP/Vector/LorentzVector.h"
00055 #include "CLHEP/Geometry/Point3D.h"
00056 #include "MdcRecEvent/RecMdcTrack.h"
00057 #include "TrkReco/RkFitMaterial.h"
00058 #include "CLHEP/Geometry/Transform3D.h"
00059 class TRungeFitter;
00060 class TTrack;
00061 class TMLink;
00062 
00063 #define TRunge_MAXstep 10000
00065 class TRunge : public TTrackBase {
00066 
00067 public:
00069   TRunge();
00070   TRunge(const TTrack&);
00071   TRunge(const Helix&);
00072   TRunge(const TRunge&);
00073   TRunge(const RecMdcTrack&);
00075   ~TRunge();
00076 
00077 public:// General information
00079   unsigned objectType(void) const;
00080 
00081 public:// Extractors
00083   double dr(void) const;
00084   double phi0(void) const;
00085   double kappa(void) const;
00086   double dz(void) const;
00087   double tanl(void) const;
00088 
00090   const HepPoint3D& pivot(void) const;
00091 
00093   const Vector& a(void) const;
00094 
00096   const SymMatrix& Ea(void) const;
00097 
00099   Helix helix(void) const;
00100 
00101 
00103   unsigned ndf(void) const;
00104 
00106   double chi2(void) const;
00107 
00109   double reducedchi2(void) const;
00110 
00112   int BfieldID(void) const;
00113 
00115   double StepSize(void) const;
00116 
00118   const double* Yscal(void) const;
00119   double Eps(void) const;
00120   double StepSizeMax(void) const;
00121   double StepSizeMin(void) const;
00122 
00123   
00125   float Mass(void) const;
00126 
00128   double MaxFlightLength(void) const;
00129 
00130 public:// Executors
00131 
00132 public:// Utilities
00135   int approach(TMLink &, const RkFitMaterial ,bool sagCorrection = true ) ;
00136   int approach(TMLink &, float& tof, HepVector3D& p,
00137                const RkFitMaterial ,bool sagCorrection = true ) ;
00138 
00140   int approach_line(TMLink &,const HepPoint3D&,const HepVector3D&,
00141                     HepPoint3D& onLine,HepPoint3D& onTrack,const RkFitMaterial  material) ;
00142   int approach_line(TMLink &,const HepPoint3D&,const HepVector3D&,
00143                     HepPoint3D& onLine,HepPoint3D& onTrack,
00144                     float& tof, HepVector3D& p,const RkFitMaterial  material) ;
00145   int approach_line(TMLink &,const HepPoint3D&,const HepVector3D&,
00146                     HepPoint3D& onLine,HepPoint3D& onTrack,
00147                     float& tof, HepVector3D& p, const RkFitMaterial  material,unsigned& stepNum) ;
00148 
00150   int approach_point(TMLink &,const HepPoint3D&,HepPoint3D& onTrack,const RkFitMaterial  material) const;
00151 
00152 public:// Modifiers
00154   const HepPoint3D& pivot(const HepPoint3D&);
00155 
00157   const Vector& a(const Vector&);
00158 
00160   const SymMatrix& Ea(const SymMatrix&);
00161 
00163   int BfieldID(int);
00164 
00166   double StepSize(double);
00167 
00169   const double* Yscal(const double*);
00170   double Eps(double);
00171   double StepSizeMax(double);
00172   double StepSizeMin(double);
00173 
00175   float Mass(float);
00176 
00177   // set max flight length
00178   double MaxFlightLength(double);
00179 
00180   double DisToWire(TMLink& ,double,HepPoint3D ,HepPoint3D&);
00181   double dEpath(double , double , double)const;
00182   void eloss(double path, const RkFitMaterial * material,double mass,double y[6],int index)const;
00183 
00184 public:// utilities for local use
00186   unsigned Fly(const RkFitMaterial  material) const;
00187   unsigned Fly_SC(void) const; //fly with stepsize control
00188   double intersect_cylinder(double r) const;
00189   double intersect_yz_plane(const HepTransform3D& plane, double x) const;
00190   double intersect_zx_plane(const HepTransform3D& plane, double y) const;
00191   double intersect_xy_plane(double z) const;
00193   void Propagate(double y[6],const double& step,const RkFitMaterial  material) const;
00194   void Function(const double y[6],double f[6]) const;
00195   // for propagate with quality check
00196   void Propagate1(const double y[6], const double dydx[6],
00197                   const double& step, double yout[6]) const;
00198   void Propagate_QC(double y[6],double dydx[6],const double& steptry,
00199                     const double& eps, const double yscal[6],
00200                     double& stepdid, double& stepnext) const;
00201   
00203   void SetFirst(double y[6]) const;
00205   unsigned Nstep(void) const;
00206   int GetXP(unsigned stepNum,double y[6]) const;
00207   // y[6] = (x,y,z,px,py,pz)  output: error=-1
00208   int GetStep(unsigned stepNum,double& step) const;
00209 
00211   double SetFlightLength(void);
00212 
00213 private:
00214   // track parameters   updated when fitted
00215   HepPoint3D _pivot;
00216   Vector _a;            //dr,phi0,kappa,dz,tanl
00217   SymMatrix _Ea;
00218 
00219   double _chi2;
00220   unsigned _ndf;
00221 
00222   static const TRungeFitter _fitter;
00223 
00224   friend class TRungeFitter;
00225 
00226   Bfield* _bfield;
00227   int _bfieldID;
00228 
00229   double _maxflightlength;
00230   
00231   double _stepSize;     // default step size  
00232                         //if 0, step size will be made automatically
00233   double _yscal[6];
00234   double _eps;          //used for step size control
00235   double _stepSizeMax;
00236   double _stepSizeMin;
00237 
00238   float _mass;
00239   const  RkFitMaterial FitMdcMaterial;
00240 
00241 
00242 private:
00243   // caches
00244   float _mass2; //=_mass*_mass;
00245   int _charge;
00246 
00247   mutable double _y[TRunge_MAXstep][6]; //(x,y,z,px,py,pz)
00248   mutable double _h[TRunge_MAXstep];    //step size in each step
00249   mutable unsigned _Nstep;              //0:not cached the trajectory
00250 private:
00251     IMagneticFieldSvc* m_pmgnIMF;
00252 
00253 
00254 };
00255 
00256 inline unsigned TRunge::objectType(void) const{
00257   return Runge;
00258 }
00259 #endif /* TRUNGE_FLAG_ */

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