00001 #ifndef SteppingHelixPropagator_SteppingHelixPropagator_h
00002 #define SteppingHelixPropagator_SteppingHelixPropagator_h
00003
00004
00005
00017
00018
00019
00020
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 Hep3Vector Vector;
00047 typedef 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,
00078 HEL_ALL_F,
00079 POL_1_F,
00080 POL_2_F,
00081 POL_M_F
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 const AlgebraicSymMatrix66& cov, PropagationDirection dir) const;
00216
00219 void getNextState(const SteppingHelixPropagator::StateInfo& svPrevious,
00220 SteppingHelixPropagator::StateInfo& svNext,
00221 double dP,
00222 const SteppingHelixPropagator::Vector& tau, const SteppingHelixPropagator::Vector& drVec,
00223 double dS, double dX0,
00224 const AlgebraicMatrix66& dCov) const;
00225
00227 void setRep(SteppingHelixPropagator::Basis& rep,
00228 const SteppingHelixPropagator::Vector& tau) const;
00229
00231 bool makeAtomStep(SteppingHelixPropagator::StateInfo& svCurrent,
00232 SteppingHelixPropagator::StateInfo& svNext,
00233 double dS, PropagationDirection dir,
00234 SteppingHelixPropagator::Fancy fancy) const;
00235
00237 double getDeDx(const SteppingHelixPropagator::StateInfo& sv,
00238 double& dEdXPrime, double& radX0, MatBounds& rzLims) const;
00239
00241 int cIndex_(int ind) const;
00242
00244 Result refToDest(DestType dest, const SteppingHelixPropagator::StateInfo& sv,
00245 const double pars[6],
00246 double& dist, double& tanDist, PropagationDirection& refDirection,
00247 double fastSkipDist = 1e12) const;
00248
00251 Result refToMagVolume(const SteppingHelixPropagator::StateInfo& sv,
00252 PropagationDirection dir,
00253 double& dist, double& tanDist,
00254 double fastSkipDist = 1e12, bool expectNewMagVolume = false) const;
00255
00256 Result refToMatVolume(const SteppingHelixPropagator::StateInfo& sv,
00257 PropagationDirection dir,
00258 double& dist, double& tanDist,
00259 double fastSkipDist = 1e12) const;
00260
00262 bool isYokeVolume(const MagVolume* vol) const;
00263
00264
00265 private:
00266 typedef std::pair<TrajectoryStateOnSurface, double> TsosPP;
00267 typedef std::pair<FreeTrajectoryState, double> FtsPP;
00268 static const int MAX_STEPS = 10000;
00269 static const int MAX_POINTS = 50;
00270 mutable int nPoints_;
00271 mutable StateInfo svBuf_[MAX_POINTS+1];
00272
00273 StateInfo invalidState_;
00274
00275 mutable AlgebraicMatrix66 covRot_;
00276 mutable AlgebraicMatrix66 dCTransform_;
00277
00278 const MagneticField* field_;
00279 const VolumeBasedMagneticField* vbField_;
00280 const AlgebraicSymMatrix66 unit66_;
00281 bool debug_;
00282 bool noMaterialMode_;
00283 bool noErrorPropagation_;
00284 bool applyRadX0Correction_;
00285 bool useMagVolumes_;
00286 bool useIsYokeFlag_;
00287 bool useMatVolumes_;
00288 bool useInTeslaFromMagField_;
00289 bool returnTangentPlane_;
00290 bool sendLogWarning_;
00291 bool useTuningForL2Speed_;
00292
00293 double defaultStep_;
00294
00295 double ecShiftPos_;
00296 double ecShiftNeg_;
00297 };
00298
00299 #endif