CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h

Go to the documentation of this file.
00001 #ifndef SteppingHelixPropagator_SteppingHelixPropagator_h
00002 #define SteppingHelixPropagator_SteppingHelixPropagator_h
00003 
00004 
00005 
00017 //
00018 // Original Author:  Vyacheslav Krutelyov
00019 //         Created:  Fri Mar  3 16:01:24 CST 2006
00020 // $Id: SteppingHelixPropagator.h,v 1.30 2010/03/10 22:35:20 slava77 Exp $
00021 //
00022 //
00023 
00024 
00025 
00026 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00027 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00028 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00029 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00030 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
00031 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00032 
00033 #include "CLHEP/Matrix/SymMatrix.h"
00034 #include "CLHEP/Matrix/Matrix.h"
00035 #include "CLHEP/Vector/ThreeVector.h"
00036 
00037 
00038 #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixStateInfo.h"
00039 
00040 class MagneticField;
00041 class VolumeBasedMagneticField;
00042 class MagVolume;
00043 
00044 class SteppingHelixPropagator : public Propagator {
00045  public:
00046   typedef CLHEP::Hep3Vector Vector;
00047   typedef CLHEP::Hep3Vector  Point;
00048 
00049   typedef SteppingHelixStateInfo StateInfo;
00050   typedef SteppingHelixStateInfo::Result Result;
00051 
00052   struct Basis {
00053     Vector lX;
00054     Vector lY;
00055     Vector lZ;
00056   };
00057   
00058   enum Pars {
00059     RADIUS_P=0,
00060     Z_P = 0,
00061     PATHL_P = 0
00062   };
00063 
00064   enum DestType {
00065     RADIUS_DT=0,
00066     Z_DT,
00067     PLANE_DT,
00068     CONE_DT,
00069     CYLINDER_DT,
00070     PATHL_DT,
00071     POINT_PCA_DT,
00072     LINE_PCA_DT,
00073     UNDEFINED_DT
00074   };
00075 
00076   enum Fancy {
00077     HEL_AS_F=0, //simple analytical helix, eloss at end of step
00078     HEL_ALL_F,  //analytical helix with linear eloss
00079     POL_1_F, //1st order approximation, straight line
00080     POL_2_F,//2nd order
00081     POL_M_F //highest available
00082   };
00083 
00085   SteppingHelixPropagator();
00086   SteppingHelixPropagator(const MagneticField* field, PropagationDirection dir = alongMomentum);
00087 
00088   virtual SteppingHelixPropagator* clone() const {return new SteppingHelixPropagator(*this);}
00089 
00091   ~SteppingHelixPropagator() {}
00092   
00093   virtual const MagneticField* magneticField() const { return field_;}
00094   
00096   virtual TrajectoryStateOnSurface 
00097     propagate(const FreeTrajectoryState& ftsStart, const Plane& pDest) const;
00099   virtual TrajectoryStateOnSurface 
00100     propagate(const FreeTrajectoryState& ftsStart, const Cylinder& cDest) const;
00102   virtual FreeTrajectoryState 
00103     propagate(const FreeTrajectoryState& ftsStart, const GlobalPoint& pDest) const;
00105   virtual FreeTrajectoryState 
00106     propagate(const FreeTrajectoryState& ftsStart, 
00107               const GlobalPoint& pDest1, const GlobalPoint& pDest2) const;
00109   virtual FreeTrajectoryState 
00110     propagate(const FreeTrajectoryState& ftsStart, 
00111               const reco::BeamSpot& beamSpot) const;
00112 
00115   virtual std::pair<TrajectoryStateOnSurface, double> 
00116     propagateWithPath(const FreeTrajectoryState& ftsStart, const Plane& pDest) const;
00119   virtual std::pair<TrajectoryStateOnSurface, double> 
00120     propagateWithPath(const FreeTrajectoryState& ftsStart, const Cylinder& cDest) const;
00122   virtual std::pair<FreeTrajectoryState, double> 
00123     propagateWithPath(const FreeTrajectoryState& ftsStart, const GlobalPoint& pDest) const;
00125   virtual std::pair<FreeTrajectoryState, double> 
00126     propagateWithPath(const FreeTrajectoryState& ftsStart, 
00127                       const GlobalPoint& pDest1, const GlobalPoint& pDest2) const;
00129   virtual std::pair<FreeTrajectoryState, double> 
00130     propagateWithPath(const FreeTrajectoryState& ftsStart, 
00131                       const reco::BeamSpot& beamSpot) const;
00132     
00133     
00135   const SteppingHelixStateInfo& 
00136     propagate(const SteppingHelixStateInfo& ftsStart, const Surface& sDest) const;
00137   const SteppingHelixStateInfo& 
00138     propagate(const SteppingHelixStateInfo& ftsStart, const Plane& pDest) const;
00140   const SteppingHelixStateInfo& 
00141     propagate(const SteppingHelixStateInfo& ftsStart, const Cylinder& cDest) const;
00143   const SteppingHelixStateInfo& 
00144     propagate(const SteppingHelixStateInfo& ftsStart, const GlobalPoint& pDest) const;
00146   const SteppingHelixStateInfo& 
00147     propagate(const SteppingHelixStateInfo& ftsStart, 
00148               const GlobalPoint& pDest1, const GlobalPoint& pDest2) const;
00149 
00150   
00152   void setDebug(bool debug){ debug_ = debug;}
00153 
00155   void setMaterialMode(bool noMaterial) { noMaterialMode_ = noMaterial;}
00156 
00158   void setNoErrorPropagation(bool noErrorPropagation) { noErrorPropagation_ = noErrorPropagation;}
00159 
00164   void applyRadX0Correction(bool applyRadX0Correction) { applyRadX0Correction_ = applyRadX0Correction;}
00165 
00167   void setUseMagVolumes(bool val){ useMagVolumes_ = val;}
00168 
00170   void setUseMatVolumes(bool val){ useMatVolumes_ = val;}
00171 
00173   void setReturnTangentPlane(bool val){ returnTangentPlane_ = val;}
00174 
00176   void setSendLogWarning(bool val){ sendLogWarning_ = val;}
00177 
00180   void setUseIsYokeFlag(bool val){ useIsYokeFlag_ = val;}
00181 
00184   void setUseTuningForL2Speed(bool val){ useTuningForL2Speed_ = val;}
00185 
00189   void setVBFPointer(const VolumeBasedMagneticField* val) { vbField_ = val;}
00190 
00192   void setUseInTeslaFromMagField(bool val) { useInTeslaFromMagField_ = val;}
00193 
00195   void setEndcapShiftsInZPosNeg(double valPos, double valNeg){
00196     ecShiftPos_ = valPos; ecShiftNeg_ = valNeg;
00197   }
00198 
00199  protected:
00200   typedef SteppingHelixStateInfo::VolumeBounds MatBounds;
00202   void setIState(const SteppingHelixStateInfo& sStart) const;
00203 
00207   Result propagate(SteppingHelixPropagator::DestType type, 
00208                    const double pars[6], double epsilon = 1e-3) const;
00209 
00212   void loadState(SteppingHelixPropagator::StateInfo& svCurrent, 
00213                  const SteppingHelixPropagator::Vector& p3, 
00214                  const SteppingHelixPropagator::Point& r3, int charge,
00215                  PropagationDirection dir,
00216                  const AlgebraicSymMatrix55& covCurv) const;
00217 
00220   void getNextState(const SteppingHelixPropagator::StateInfo& svPrevious,
00221                     SteppingHelixPropagator::StateInfo& svNext,               
00222                     double dP, 
00223                     const SteppingHelixPropagator::Vector& tau, const SteppingHelixPropagator::Vector& drVec, 
00224                     double dS, double dX0,
00225                     const AlgebraicMatrix55& dCovCurv) const;
00226   
00228   void setRep(SteppingHelixPropagator::Basis& rep,
00229               const SteppingHelixPropagator::Vector& tau) const;
00230 
00232   bool makeAtomStep(SteppingHelixPropagator::StateInfo& svCurrent, 
00233                     SteppingHelixPropagator::StateInfo& svNext, 
00234                     double dS, PropagationDirection dir, 
00235                     SteppingHelixPropagator::Fancy fancy) const;
00236 
00238   double getDeDx(const SteppingHelixPropagator::StateInfo& sv, 
00239                  double& dEdXPrime, double& radX0, MatBounds& rzLims) const;
00240 
00242   int cIndex_(int ind) const;
00243 
00245   Result refToDest(DestType dest, const SteppingHelixPropagator::StateInfo& sv,
00246                    const double pars[6], 
00247                    double& dist, double& tanDist, PropagationDirection& refDirection,
00248                    double fastSkipDist = 1e12) const;
00249 
00252   Result refToMagVolume(const SteppingHelixPropagator::StateInfo& sv,
00253                         PropagationDirection dir,
00254                         double& dist, double& tanDist,
00255                         double fastSkipDist = 1e12, bool expectNewMagVolume = false, double maxStep = 1e12) const;
00256 
00257   Result refToMatVolume(const SteppingHelixPropagator::StateInfo& sv,
00258                         PropagationDirection dir,
00259                         double& dist, double& tanDist,
00260                         double fastSkipDist = 1e12) const;
00261 
00263   bool isYokeVolume(const MagVolume* vol) const;
00264 
00265 
00266  private:
00267   typedef std::pair<TrajectoryStateOnSurface, double> TsosPP;
00268   typedef std::pair<FreeTrajectoryState, double> FtsPP;
00269   static const int MAX_STEPS = 10000;
00270   static const int MAX_POINTS = 7;
00271   mutable int nPoints_;
00272   mutable StateInfo svBuf_[MAX_POINTS+1];
00273 
00274   StateInfo invalidState_;
00275 
00276   mutable AlgebraicMatrix55 covCurvRot_;
00277   mutable AlgebraicMatrix55 dCCurvTransform_;
00278 
00279   const MagneticField* field_;
00280   const VolumeBasedMagneticField* vbField_;
00281   const AlgebraicSymMatrix55 unit55_;
00282   bool debug_;
00283   bool noMaterialMode_;
00284   bool noErrorPropagation_;
00285   bool applyRadX0Correction_;
00286   bool useMagVolumes_;
00287   bool useIsYokeFlag_;
00288   bool useMatVolumes_;
00289   bool useInTeslaFromMagField_;
00290   bool returnTangentPlane_;
00291   bool sendLogWarning_;
00292   bool useTuningForL2Speed_;
00293 
00294   double defaultStep_;
00295 
00296   double ecShiftPos_;
00297   double ecShiftNeg_;
00298 };
00299 
00300 #endif