CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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); }
WorkSpace int float eps
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
Propagator * clone() const override
T y() const
Definition: PV3DBase.h:60
RKPropagatorInZ(const MagVolume &vol, PropagationDirection dir=alongMomentum)
TrackCharge charge() const
Definition: Plane.h:16
T mag() const
Definition: PV3DBase.h:64
const MagVolume * theVolume
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:61
GlobalVector momentum() const
GlobalPoint position() const
std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Plane &) const override
T x() const
Definition: PV3DBase.h:59
TrajectoryStateOnSurface myPropagate(const FreeTrajectoryState &, const Plane &) const