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