CMS 3D CMS Logo

RKPropagatorInZ.cc
Go to the documentation of this file.
3 // #include "CommonReco/RKPropagators/interface/RK4PreciseSolver.h"
6 #include "RKLocalFieldProvider.h"
8 #include "RKAdaptiveSolver.h"
9 #include "RKOne4OrderStep.h"
10 #include "RKOneCashKarpStep.h"
11 
13  //typedef RK4PreciseSolver<double,5> Solver;
14  //typedef RKAdaptiveSolver<double,RKOne4OrderStep, 5> Solver;
16  typedef Solver::Vector RKVector;
17 
18  GlobalPoint pos(ts.position());
19  GlobalVector mom(ts.momentum());
20 
21  // cout << "RKPropagatorInZ: starting from FTS " << ts << endl;
22 
23  LocalPoint startpos = plane.toLocal(pos);
24  LocalVector startmom = plane.toLocal(mom);
25  double pzSign = startmom.z() > 0 ? 1.0 : -1.0;
26 
27  // cout << "In local plane coordinates: " << startpos << ", momentum " << startmom << endl;
28 
29  RKVector start;
30  start(0) = startpos.x();
31  start(1) = startpos.y();
32  start(2) = startmom.x() / startmom.z();
33  start(3) = startmom.y() / startmom.z();
34  start(4) = pzSign * ts.charge() / startmom.mag();
35 
36  // cout << "RKPropagatorInZ: Solving with par " << startpos.z() << " and state " << start << endl;
37 
38  RKLocalFieldProvider localField(*theVolume, plane);
39 
40  CurvilinearLorentzForce<double, 5> deriv(localField);
42  double eps = 1.e-5;
43  Solver solver;
44  try {
45  RKVector rkresult = solver(startpos.z(), start, -startpos.z(), deriv, dist, eps);
46 
48  LocalTrajectoryParameters(rkresult(4), rkresult(2), rkresult(3), rkresult(0), rkresult(1), pzSign),
49  plane,
50  theVolume);
51  } catch (CurvilinearLorentzForceException& e) {
52  // the propagation failed due to momentum almost parallel to the plane.
53  // This does not mean the propagation is impossible, but it should be done
54  // in a different parametrization (e.g. s)
55  return TrajectoryStateOnSurface();
56  }
57 }
58 
60  return TrajectoryStateOnSurface();
61 }
62 
63 std::pair<TrajectoryStateOnSurface, double> RKPropagatorInZ::propagateWithPath(const FreeTrajectoryState&,
64  const Plane&) const {
65  return std::pair<TrajectoryStateOnSurface, double>();
66 }
67 
68 std::pair<TrajectoryStateOnSurface, double> RKPropagatorInZ::propagateWithPath(const FreeTrajectoryState&,
69  const Cylinder&) const {
70  return std::pair<TrajectoryStateOnSurface, double>();
71 }
72 
73 Propagator* RKPropagatorInZ::clone() const { return new RKPropagatorInZ(*this); }
T z() const
Definition: PV3DBase.h:61
Propagator * clone() const override
RKPropagatorInZ(const MagVolume &vol, PropagationDirection dir=alongMomentum)
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: Plane.h:16
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
const MagVolume * theVolume
TrackCharge charge() const
T mag() const
Definition: PV3DBase.h:64
GlobalVector momentum() const
math::XYZVectorF Vector
Definition: Common.h:42
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Plane &) const override
TrajectoryStateOnSurface myPropagate(const FreeTrajectoryState &, const Plane &) const