00001
00002
00003
00004 #ifndef Helix_FLAG_
00005 #define Helix_FLAG_
00006 #include "GaudiKernel/IInterface.h"
00007 #include "GaudiKernel/Kernel.h"
00008 #include "GaudiKernel/Service.h"
00009 #include "MagneticField/IMagneticFieldSvc.h"
00010 #include "MagneticField/MagneticFieldSvc.h"
00011
00012 #include "CLHEP/Matrix/Vector.h"
00013 #include "CLHEP/Matrix/SymMatrix.h"
00014 #ifndef CLHEP_THREEVECTOR_H
00015 #include "CLHEP/Vector/ThreeVector.h"
00016 #endif
00017
00018 #include "CLHEP/Vector/LorentzVector.h"
00019
00020 #ifndef CLHEP_POINT3D_H
00021 #include "CLHEP/Geometry/Point3D.h"
00022 #endif
00023
00024 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00025 typedef HepGeom::Point3D<double> HepPoint3D;
00026 #endif
00027
00028
00029
00030
00031
00033 class Dedx_Helix {
00034
00035 public:
00037 Dedx_Helix(const HepPoint3D & pivot,
00038 const HepVector & a,
00039 const HepSymMatrix & Ea);
00040
00042 Dedx_Helix(const HepPoint3D & pivot,
00043 const HepVector & a);
00044
00046 Dedx_Helix(const HepPoint3D & position,
00047 const Hep3Vector & momentum,
00048 double charge);
00049
00051 virtual ~Dedx_Helix();
00052
00053 public:
00055 const HepPoint3D & center(void) const;
00056
00058 const HepPoint3D & pivot(void) const;
00059
00061 double radius(void) const;
00062
00064 HepPoint3D x(double dPhi = 0.) const;
00065 double * x(double dPhi, double p[3]) const;
00066
00068 HepPoint3D x(double dPhi, HepSymMatrix & Ex) const;
00069
00071 Hep3Vector direction(double dPhi = 0.) const;
00072
00074 Hep3Vector momentum(double dPhi = 0.) const;
00075
00077 Hep3Vector momentum(double dPhi, HepSymMatrix & Em) const;
00078
00080 HepLorentzVector momentum(double dPhi, double mass) const;
00081
00083 HepLorentzVector momentum(double dPhi, double mass, HepSymMatrix & Em) const;
00084
00086 HepLorentzVector momentum(double dPhi, double mass, HepPoint3D & x, HepSymMatrix & Emx) const;
00087
00088 public:
00090 double dr(void) const;
00091 double phi0(void) const;
00092 double kappa(void) const;
00093 double dz(void) const;
00094 double tanl(void) const;
00095 double curv(void) const;
00096 double sinPhi0(void) const;
00097 double cosPhi0(void) const;
00098
00100 const HepVector & a(void) const;
00101
00103 const HepSymMatrix & Ea(void) const;
00104
00105 public:
00107 const HepVector & a(const HepVector & newA);
00108
00110 const HepSymMatrix & Ea(const HepSymMatrix & newdA);
00111
00113 const HepPoint3D & pivot(const HepPoint3D & newPivot);
00114
00116 void set(const HepPoint3D & pivot,
00117 const HepVector & a,
00118 const HepSymMatrix & Ea);
00119
00121 void ignoreErrorMatrix(void);
00122
00124 double bFieldZ(double);
00125 double bFieldZ(void) const;
00126
00127 public:
00129 Dedx_Helix & operator = (const Dedx_Helix &);
00130
00131 public:
00132 HepMatrix delApDelA(const HepVector & ap) const;
00133 HepMatrix delXDelA(double phi) const;
00134 HepMatrix delMDelA(double phi) const;
00135 HepMatrix del4MDelA(double phi, double mass) const;
00136 HepMatrix del4MXDelA(double phi, double mass) const;
00137
00138 private:
00139 IMagneticFieldSvc* m_pmgnIMF;
00140
00141 private:
00142 void updateCache(void);
00143
00144 public:
00146 static const double ConstantAlpha;
00147
00148 private:
00149 double m_bField;
00150 double m_alpha;
00151 HepPoint3D m_pivot;
00152 HepVector m_a;
00153 HepSymMatrix m_Ea;
00154 bool m_matrixValid;
00155
00156 private:
00157 HepPoint3D m_center;
00158 double m_cp;
00159 double m_sp;
00160 double m_pt;
00161 double m_r;
00162 double m_ac[5];
00163 };
00164
00165
00166
00167 #ifdef Helix_NO_INLINE
00168 #define inline
00169 #else
00170 #undef inline
00171 #define Helix_INLINE_DEFINE_HERE
00172 #endif
00173
00174 #ifdef Helix_INLINE_DEFINE_HERE
00175
00176 inline
00177 const HepPoint3D &
00178 Dedx_Helix::center(void) const {
00179 return m_center;
00180 }
00181
00182 inline
00183 const HepPoint3D &
00184 Dedx_Helix::pivot(void) const {
00185 return m_pivot;
00186 }
00187
00188 inline
00189 double
00190 Dedx_Helix::radius(void) const {
00191 return m_r;
00192 }
00193
00194 inline
00195 Hep3Vector
00196 Dedx_Helix::direction(double phi) const {
00197 return momentum(phi).unit();
00198 }
00199
00200 inline
00201 double
00202 Dedx_Helix::dr(void) const {
00203 return m_ac[0];
00204 }
00205
00206 inline
00207 double
00208 Dedx_Helix::phi0(void) const {
00209 return m_ac[1];
00210 }
00211
00212 inline
00213 double
00214 Dedx_Helix::kappa(void) const {
00215 return m_ac[2];
00216 }
00217
00218 inline
00219 double
00220 Dedx_Helix::dz(void) const {
00221 return m_ac[3];
00222 }
00223
00224 inline
00225 double
00226 Dedx_Helix::tanl(void) const {
00227 return m_ac[4];
00228 }
00229
00230 inline
00231 double
00232 Dedx_Helix::curv(void) const {
00233 return m_r;
00234 }
00235
00236 inline
00237 const HepVector &
00238 Dedx_Helix::a(void) const {
00239 return m_a;
00240 }
00241
00242 inline
00243 const HepSymMatrix &
00244 Dedx_Helix::Ea(void) const {
00245 return m_Ea;
00246 }
00247
00248 inline
00249 const HepVector &
00250 Dedx_Helix::a(const HepVector & i) {
00251 m_a = i;
00252 updateCache();
00253 return m_a;
00254 }
00255
00256 inline
00257 const HepSymMatrix &
00258 Dedx_Helix::Ea(const HepSymMatrix & i) {
00259 return m_Ea = i;
00260 }
00261
00262 inline
00263 double
00264 Dedx_Helix::bFieldZ(double a) {
00265 m_bField = a;
00266 m_alpha = 10000. / 2.99792458 / m_bField;
00267 updateCache();
00268 return m_bField;
00269 }
00270
00271 inline
00272 double
00273 Dedx_Helix::bFieldZ(void) const {
00274 return m_bField;
00275 }
00276
00277 inline
00278 double
00279 Dedx_Helix::sinPhi0(void) const {
00280 return m_sp;
00281 }
00282
00283 inline
00284 double
00285 Dedx_Helix::cosPhi0(void) const {
00286 return m_cp;
00287 }
00288
00289 #endif
00290
00291 #undef inline
00292
00293 #endif