File indexing completed on 2024-04-06 12:31:44
0001 #ifndef SteppingHelixPropagator_SteppingHelixPropagator_h
0002 #define SteppingHelixPropagator_SteppingHelixPropagator_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0020 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0021 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0022 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0023 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0024 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0025
0026 #include "CLHEP/Matrix/SymMatrix.h"
0027 #include "CLHEP/Matrix/Matrix.h"
0028 #include "CLHEP/Vector/ThreeVector.h"
0029
0030 #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixStateInfo.h"
0031
0032 class MagneticField;
0033 class VolumeBasedMagneticField;
0034 class MagVolume;
0035
0036 class SteppingHelixPropagator final : public Propagator {
0037 public:
0038 typedef CLHEP::Hep3Vector Vector;
0039 typedef CLHEP::Hep3Vector Point;
0040
0041 typedef SteppingHelixStateInfo StateInfo;
0042 typedef SteppingHelixStateInfo::Result Result;
0043
0044 struct Basis {
0045 Vector lX;
0046 Vector lY;
0047 Vector lZ;
0048 };
0049
0050 enum Pars { RADIUS_P = 0, Z_P = 0, PATHL_P = 0 };
0051
0052 enum DestType {
0053 RADIUS_DT = 0,
0054 Z_DT,
0055 PLANE_DT,
0056 CONE_DT,
0057 CYLINDER_DT,
0058 PATHL_DT,
0059 POINT_PCA_DT,
0060 LINE_PCA_DT,
0061 UNDEFINED_DT
0062 };
0063
0064 enum Fancy {
0065 HEL_AS_F = 0,
0066 HEL_ALL_F,
0067 POL_1_F,
0068 POL_2_F,
0069 POL_M_F
0070 };
0071
0072
0073 SteppingHelixPropagator();
0074 SteppingHelixPropagator(const MagneticField* field, PropagationDirection dir = alongMomentum);
0075
0076 SteppingHelixPropagator* clone() const override { return new SteppingHelixPropagator(*this); }
0077
0078
0079 ~SteppingHelixPropagator() override;
0080
0081 const MagneticField* magneticField() const override { return field_; }
0082
0083 using Propagator::propagate;
0084 using Propagator::propagateWithPath;
0085
0086
0087
0088 std::pair<TrajectoryStateOnSurface, double> propagateWithPath(const FreeTrajectoryState& ftsStart,
0089 const Plane& pDest) const override;
0090
0091
0092 std::pair<TrajectoryStateOnSurface, double> propagateWithPath(const FreeTrajectoryState& ftsStart,
0093 const Cylinder& cDest) const override;
0094
0095 std::pair<FreeTrajectoryState, double> propagateWithPath(const FreeTrajectoryState& ftsStart,
0096 const GlobalPoint& pDest) const override;
0097
0098 std::pair<FreeTrajectoryState, double> propagateWithPath(const FreeTrajectoryState& ftsStart,
0099 const GlobalPoint& pDest1,
0100 const GlobalPoint& pDest2) const override;
0101
0102 std::pair<FreeTrajectoryState, double> propagateWithPath(const FreeTrajectoryState& ftsStart,
0103 const reco::BeamSpot& beamSpot) const override;
0104
0105
0106
0107
0108 void propagate(const SteppingHelixStateInfo& ftsStart, const Surface& sDest, SteppingHelixStateInfo& out) const;
0109 void propagate(const SteppingHelixStateInfo& ftsStart, const Plane& pDest, SteppingHelixStateInfo& out) const;
0110
0111 void propagate(const SteppingHelixStateInfo& ftsStart, const Cylinder& cDest, SteppingHelixStateInfo& out) const;
0112
0113 void propagate(const SteppingHelixStateInfo& ftsStart, const GlobalPoint& pDest, SteppingHelixStateInfo& out) const;
0114
0115 void propagate(const SteppingHelixStateInfo& ftsStart,
0116 const GlobalPoint& pDest1,
0117 const GlobalPoint& pDest2,
0118 SteppingHelixStateInfo& out) const;
0119
0120
0121 void setDebug(bool debug) { debug_ = debug; }
0122
0123
0124 void setMaterialMode(bool noMaterial) { noMaterialMode_ = noMaterial; }
0125
0126
0127 void setNoErrorPropagation(bool noErrorPropagation) { noErrorPropagation_ = noErrorPropagation; }
0128
0129
0130
0131
0132
0133 void applyRadX0Correction(bool applyRadX0Correction) { applyRadX0Correction_ = applyRadX0Correction; }
0134
0135
0136 void setUseMagVolumes(bool val) { useMagVolumes_ = val; }
0137
0138
0139 void setUseMatVolumes(bool val) { useMatVolumes_ = val; }
0140
0141
0142 void setReturnTangentPlane(bool val) { returnTangentPlane_ = val; }
0143
0144
0145 void setSendLogWarning(bool val) { sendLogWarning_ = val; }
0146
0147
0148
0149 void setUseIsYokeFlag(bool val) { useIsYokeFlag_ = val; }
0150
0151
0152
0153 void setUseTuningForL2Speed(bool val) { useTuningForL2Speed_ = val; }
0154
0155
0156
0157
0158 void setVBFPointer(const VolumeBasedMagneticField* val) { vbField_ = val; }
0159
0160
0161 void setUseInTeslaFromMagField(bool val) { useInTeslaFromMagField_ = val; }
0162
0163
0164 void setEndcapShiftsInZPosNeg(double valPos, double valNeg) {
0165 ecShiftPos_ = valPos;
0166 ecShiftNeg_ = valNeg;
0167 }
0168
0169 protected:
0170 typedef SteppingHelixStateInfo::VolumeBounds MatBounds;
0171 static const int MAX_POINTS = 7;
0172 typedef StateInfo StateArray[MAX_POINTS + 1];
0173
0174
0175 void initStateArraySHPSpecific(StateArray& svBuf, bool flagsOnly) const;
0176
0177
0178 void setIState(const SteppingHelixStateInfo& sStart, StateArray& svBuff, int& nPoints) const;
0179
0180
0181
0182
0183 Result propagate(StateArray& svBuff,
0184 int& nPoints,
0185 SteppingHelixPropagator::DestType type,
0186 const double pars[6],
0187 double epsilon = 1e-3) const;
0188
0189
0190
0191 void loadState(SteppingHelixPropagator::StateInfo& svCurrent,
0192 const SteppingHelixPropagator::Vector& p3,
0193 const SteppingHelixPropagator::Point& r3,
0194 int charge,
0195 PropagationDirection dir,
0196 const AlgebraicSymMatrix55& covCurv) const;
0197
0198
0199
0200 void getNextState(const SteppingHelixPropagator::StateInfo& svPrevious,
0201 SteppingHelixPropagator::StateInfo& svNext,
0202 double dP,
0203 const SteppingHelixPropagator::Vector& tau,
0204 const SteppingHelixPropagator::Vector& drVec,
0205 double dS,
0206 double dX0,
0207 const AlgebraicMatrix55& dCovCurv) const;
0208
0209
0210 void setRep(SteppingHelixPropagator::Basis& rep, const SteppingHelixPropagator::Vector& tau) const;
0211
0212
0213 bool makeAtomStep(SteppingHelixPropagator::StateInfo& svCurrent,
0214 SteppingHelixPropagator::StateInfo& svNext,
0215 double dS,
0216 PropagationDirection dir,
0217 SteppingHelixPropagator::Fancy fancy) const;
0218
0219
0220 double getDeDx(const SteppingHelixPropagator::StateInfo& sv,
0221 double& dEdXPrime,
0222 double& radX0,
0223 MatBounds& rzLims) const;
0224
0225
0226 int cIndex_(int ind) const;
0227
0228
0229 Result refToDest(DestType dest,
0230 const SteppingHelixPropagator::StateInfo& sv,
0231 const double pars[6],
0232 double& dist,
0233 double& tanDist,
0234 PropagationDirection& refDirection,
0235 double fastSkipDist = 1e12) const;
0236
0237
0238
0239 Result refToMagVolume(const SteppingHelixPropagator::StateInfo& sv,
0240 PropagationDirection dir,
0241 double& dist,
0242 double& tanDist,
0243 double fastSkipDist = 1e12,
0244 bool expectNewMagVolume = false,
0245 double maxStep = 1e12) const;
0246
0247 Result refToMatVolume(const SteppingHelixPropagator::StateInfo& sv,
0248 PropagationDirection dir,
0249 double& dist,
0250 double& tanDist,
0251 double fastSkipDist = 1e12) const;
0252
0253
0254 bool isYokeVolume(const MagVolume* vol) const;
0255
0256 private:
0257 typedef std::pair<TrajectoryStateOnSurface, double> TsosPP;
0258 typedef std::pair<FreeTrajectoryState, double> FtsPP;
0259 static const int MAX_STEPS = 10000;
0260
0261
0262
0263 StateInfo invalidState_;
0264
0265 const MagneticField* field_;
0266 const VolumeBasedMagneticField* vbField_;
0267 const AlgebraicSymMatrix55 unit55_;
0268 bool debug_;
0269 bool noMaterialMode_;
0270 bool noErrorPropagation_;
0271 bool applyRadX0Correction_;
0272 bool useMagVolumes_;
0273 bool useIsYokeFlag_;
0274 bool useMatVolumes_;
0275 bool useInTeslaFromMagField_;
0276 bool returnTangentPlane_;
0277 bool sendLogWarning_;
0278 bool useTuningForL2Speed_;
0279
0280 double defaultStep_;
0281
0282 double ecShiftPos_;
0283 double ecShiftNeg_;
0284 };
0285
0286 #endif