CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
StraightLinePropagator Class Referencefinal

#include <StraightLinePropagator.h>

Inheritance diagram for StraightLinePropagator:
Propagator

Public Member Functions

StraightLinePropagatorclone () const override
 
const MagneticFieldmagneticField () const override
 
virtual FreeTrajectoryState propagate (const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
 
virtual FreeTrajectoryState propagate (const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest1, const GlobalPoint &pDest2) const final
 
virtual FreeTrajectoryState propagate (const FreeTrajectoryState &ftsStart, const reco::BeamSpot &beamSpot) const final
 
template<typename STA , typename SUR >
TrajectoryStateOnSurface propagate (STA const &state, SUR const &surface) const
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const TrajectoryStateOnSurface &tsos, const Surface &sur) const final
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const FreeTrajectoryState &, const Cylinder &) const=0
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const TrajectoryStateOnSurface &tsos, const Cylinder &sur) const
 
virtual std::pair< FreeTrajectoryState, double > propagateWithPath (const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const
 
virtual std::pair< FreeTrajectoryState, double > propagateWithPath (const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest1, const GlobalPoint &pDest2) const
 Propagate to PCA to a line (given by 2 points) given a starting point. More...
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const FreeTrajectoryState &, const Surface &) const final
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const TrajectoryStateOnSurface &tsos, const Plane &sur) const
 
virtual std::pair< FreeTrajectoryState, double > propagateWithPath (const FreeTrajectoryState &ftsStart, const reco::BeamSpot &beamSpot) const
 Propagate to PCA to a line (given by beamSpot position and slope) given a starting point. More...
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const FreeTrajectoryState &, const Plane &) const=0
 
std::pair< TSOS, double > propagateWithPath (const FreeTrajectoryState &fts, const Plane &surface) const override
 
std::pair< TSOS, double > propagateWithPath (const FreeTrajectoryState &fts, const Cylinder &surface) const override
 
 StraightLinePropagator (const MagneticField *field, PropagationDirection aDir=alongMomentum)
 
 ~StraightLinePropagator () override
 
- Public Member Functions inherited from Propagator
template<typename STA , typename SUR >
TrajectoryStateOnSurface propagate (STA const &state, SUR const &surface) const
 
virtual FreeTrajectoryState propagate (const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
 
virtual FreeTrajectoryState propagate (const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest1, const GlobalPoint &pDest2) const final
 
virtual FreeTrajectoryState propagate (const FreeTrajectoryState &ftsStart, const reco::BeamSpot &beamSpot) const final
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const FreeTrajectoryState &, const Surface &) const final
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const TrajectoryStateOnSurface &tsos, const Surface &sur) const final
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const TrajectoryStateOnSurface &tsos, const Plane &sur) const
 
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath (const TrajectoryStateOnSurface &tsos, const Cylinder &sur) const
 
virtual std::pair< FreeTrajectoryState, double > propagateWithPath (const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const
 
virtual std::pair< FreeTrajectoryState, double > propagateWithPath (const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest1, const GlobalPoint &pDest2) const
 Propagate to PCA to a line (given by 2 points) given a starting point. More...
 
virtual std::pair< FreeTrajectoryState, double > propagateWithPath (const FreeTrajectoryState &ftsStart, const reco::BeamSpot &beamSpot) const
 Propagate to PCA to a line (given by beamSpot position and slope) given a starting point. More...
 
virtual PropagationDirection propagationDirection () const final
 
 Propagator (PropagationDirection dir=alongMomentum)
 
virtual bool setMaxDirectionChange (float phiMax)
 
virtual void setPropagationDirection (PropagationDirection dir)
 
virtual ~Propagator ()
 

Private Types

typedef FreeTrajectoryState FTS
 
typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

AlgebraicMatrix55 jacobian (double &s) const
 
TrajectoryStateOnSurface propagatedState (const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix55 &jacobian, const GlobalPoint &x, const GlobalVector &p) const
 
TrajectoryStateOnSurface propagatedState (const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix55 &jacobian, const LocalPoint &x, const LocalVector &p) const
 
bool propagateParametersOnCylinder (const FreeTrajectoryState &fts, const Cylinder &cylinder, GlobalPoint &x, GlobalVector &p, double &s) const
 
bool propagateParametersOnPlane (const FreeTrajectoryState &fts, const Plane &plane, LocalPoint &x, LocalVector &p, double &s) const
 

Private Attributes

const MagneticFieldtheField
 

Detailed Description

As the name indicates, propagates track parameters according to a straight line model. Intended for test beams without magnetic field and similar cases.

Warning
The errors are NOT propagated.

Definition at line 16 of file StraightLinePropagator.h.

Member Typedef Documentation

◆ FTS

Definition at line 18 of file StraightLinePropagator.h.

◆ TSOS

Definition at line 19 of file StraightLinePropagator.h.

Constructor & Destructor Documentation

◆ StraightLinePropagator()

StraightLinePropagator::StraightLinePropagator ( const MagneticField field,
PropagationDirection  aDir = alongMomentum 
)
inline

Definition at line 22 of file StraightLinePropagator.h.

Referenced by clone().

23  : Propagator(aDir), theField(field) {}
Propagator(PropagationDirection dir=alongMomentum)
Definition: Propagator.h:46
const MagneticField * theField

◆ ~StraightLinePropagator()

StraightLinePropagator::~StraightLinePropagator ( )
inlineoverride

Definition at line 25 of file StraightLinePropagator.h.

25 {}

Member Function Documentation

◆ clone()

StraightLinePropagator* StraightLinePropagator::clone ( void  ) const
inlineoverridevirtual

Implements Propagator.

Definition at line 34 of file StraightLinePropagator.h.

References StraightLinePropagator().

34 { return new StraightLinePropagator(*this); }
StraightLinePropagator(const MagneticField *field, PropagationDirection aDir=alongMomentum)

◆ jacobian()

AlgebraicMatrix55 StraightLinePropagator::jacobian ( double &  s) const
private

Definition at line 86 of file StraightLinePropagator.cc.

References alongMomentum, DeadROC_duringRun::dir, dqmiolumiharvest::j, Propagator::propagationDirection(), and alignCSCRings::s.

Referenced by propagatedState(), and propagateWithPath().

86  {
87  //Jacobian for 5*5 local error matrix
88  AlgebraicMatrix55 j = AlgebraicMatrixID(); //Jacobian
89 
90  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
91  if (s * dir < 0.)
92  return j;
93 
94  j(3, 1) = s;
95  j(4, 2) = s;
96 
97  return j;
98 }
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139

◆ magneticField()

const MagneticField* StraightLinePropagator::magneticField ( ) const
inlineoverridevirtual

Implements Propagator.

Definition at line 36 of file StraightLinePropagator.h.

References theField.

36 { return theField; }
const MagneticField * theField

◆ propagate() [1/4]

template<typename STA , typename SUR >
TrajectoryStateOnSurface Propagator::propagate ( typename STA  ,
typename SUR   
)
inline

Definition at line 50 of file Propagator.h.

50  {
51  return propagateWithPath(state, surface).first;
52  }
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override

◆ propagate() [2/4]

virtual FreeTrajectoryState Propagator::propagate
inlinefinal

Definition at line 109 of file Propagator.h.

109  {
110  return propagateWithPath(ftsStart, pDest).first;
111  }
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override

◆ propagate() [3/4]

virtual FreeTrajectoryState Propagator::propagate
inlinefinal

Definition at line 112 of file Propagator.h.

114  {
115  return propagateWithPath(ftsStart, pDest1, pDest2).first;
116  }
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override

◆ propagate() [4/4]

virtual FreeTrajectoryState Propagator::propagate
inlinefinal

Definition at line 117 of file Propagator.h.

118  {
119  return propagateWithPath(ftsStart, beamSpot).first;
120  }
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override

◆ propagatedState() [1/2]

TrajectoryStateOnSurface StraightLinePropagator::propagatedState ( const FreeTrajectoryState fts,
const Surface surface,
const AlgebraicMatrix55 jacobian,
const GlobalPoint x,
const GlobalVector p 
) const
private

Definition at line 65 of file StraightLinePropagator.cc.

References FreeTrajectoryState::charge(), FreeTrajectoryState::hasError(), jacobian(), AlCaHLTBitMon_ParallelJobs::p, theField, createJobs::tmp, and x.

Referenced by propagateWithPath().

69  {
70  if (fts.hasError()) {
71  // propagate error
72  TSOS tmp(fts, surface);
73  const AlgebraicSymMatrix55& eLocal = tmp.localError().matrix();
74  AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian, eLocal);
75  LocalTrajectoryError eloc(lte);
76 
77  TSOS tmp2(tmp.localParameters(), eloc, surface, theField);
79  return TSOS(gtp, tmp2.cartesianError(), surface);
80  } else {
81  // return state without errors
82  return TSOS(GlobalTrajectoryParameters(x, p, fts.charge(), theField), surface);
83  }
84 }
TrackCharge charge() const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
tmp
align.sh
Definition: createJobs.py:716

◆ propagatedState() [2/2]

TrajectoryStateOnSurface StraightLinePropagator::propagatedState ( const FreeTrajectoryState fts,
const Surface surface,
const AlgebraicMatrix55 jacobian,
const LocalPoint x,
const LocalVector p 
) const
private

Definition at line 46 of file StraightLinePropagator.cc.

References FreeTrajectoryState::charge(), FreeTrajectoryState::hasError(), jacobian(), AlCaHLTBitMon_ParallelJobs::p, theField, createJobs::tmp, and x.

50  {
51  if (fts.hasError()) {
52  // propagate error
53  TSOS tmp(fts, surface);
54  const AlgebraicSymMatrix55& eLocal = tmp.localError().matrix();
55  AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian, eLocal);
56  LocalTrajectoryError eloc(lte);
57  LocalTrajectoryParameters ltp(x, p, fts.charge());
58  return TSOS(ltp, eloc, surface, theField);
59  } else {
60  // return state without errors
61  return TSOS(LocalTrajectoryParameters(x, p, fts.charge()), surface, theField);
62  }
63 }
TrackCharge charge() const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
tmp
align.sh
Definition: createJobs.py:716

◆ propagateParametersOnCylinder()

bool StraightLinePropagator::propagateParametersOnCylinder ( const FreeTrajectoryState fts,
const Cylinder cylinder,
GlobalPoint x,
GlobalVector p,
double &  s 
) const
private

Definition at line 100 of file StraightLinePropagator.cc.

References alongMomentum, DeadROC_duringRun::dir, dt, FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), Propagator::propagationDirection(), Cylinder::radius(), alignCSCRings::s, Surface::toGlobal(), x, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by propagateWithPath().

101  {
102  GlobalPoint sp = cylinder.toGlobal(LocalPoint(0., 0.));
103  if (sp.x() != 0. || sp.y() != 0.) {
104  throw PropagationException("Cannot propagate to an arbitrary cylinder");
105  }
106 
107  x = fts.position();
108  p = fts.momentum();
109  s = cylinder.radius() - x.perp();
110 
111  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
112  if (s * dir < 0.)
113  return false;
114 
115  double dt = s / p.perp();
116  x = GlobalPoint(x.x() + p.x() * dt, x.y() + p.y() * dt, x.z() + p.z() * dt);
117 
118  return true;
119 }
float dt
Definition: AMPTWrapper.h:136
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalVector momentum() const
Common base class.
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:64

◆ propagateParametersOnPlane()

bool StraightLinePropagator::propagateParametersOnPlane ( const FreeTrajectoryState fts,
const Plane plane,
LocalPoint x,
LocalVector p,
double &  s 
) const
private

Definition at line 121 of file StraightLinePropagator.cc.

References FreeTrajectoryState::momentum(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), alignCSCRings::s, GloballyPositioned< T >::toLocal(), and x.

Referenced by propagateWithPath().

122  {
123  //Do extrapolation in local frame of plane
124  // LocalPoint sp = plane.toLocal(plane.position());
125  x = plane.toLocal(fts.position());
126  p = plane.toLocal(fts.momentum());
127  s = -x.z(); // sp.z() - x.z(); local z of plane always 0
128 
129  //double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
130  //if(s*dir < 0.) return false;
131  if ((p.x() != 0 || p.y() != 0) && p.z() == 0 && s != 0)
132  return false;
133 
134  x = LocalPoint(x.x() + (p.x() / p.z()) * s, x.y() + (p.y() / p.z()) * s, x.z() + s);
135 
136  return true;
137 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
LocalPoint toLocal(const GlobalPoint &gp) const
GlobalPoint position() const
GlobalVector momentum() const

◆ propagateWithPath() [1/11]

std::pair< FreeTrajectoryState, double > Propagator::propagateWithPath

Propagate to PCA to a line (given by beamSpot position and slope) given a starting point.

Definition at line 53 of file Propagator.cc.

54  {
55  throw cms::Exception("Propagator::propagate(FTS,beamSpot) not implemented");
56  return std::pair<FreeTrajectoryState, double>();
57 }

◆ propagateWithPath() [2/11]

std::pair< FreeTrajectoryState, double > Propagator::propagateWithPath

Propagate to PCA to a line (given by 2 points) given a starting point.

Definition at line 47 of file Propagator.cc.

49  {
50  throw cms::Exception("Propagator::propagate(FTS,GlobalPoint,GlobalPoint) not implemented");
51  return std::pair<FreeTrajectoryState, double>();
52 }

◆ propagateWithPath() [3/11]

std::pair< FreeTrajectoryState, double > Propagator::propagateWithPath

implemented by Stepping Helix Propagate to PCA to point given a starting point

Definition at line 42 of file Propagator.cc.

43  {
44  throw cms::Exception("Propagator::propagate(FTS,GlobalPoint) not implemented");
45  return std::pair<FreeTrajectoryState, double>();
46 }

◆ propagateWithPath() [4/11]

std::pair< TrajectoryStateOnSurface, double > Propagator::propagateWithPath
final

The methods propagateWithPath() are identical to the corresponding methods propagate() in what concerns the resulting TrajectoryStateOnSurface, but they provide in addition the exact path length along the trajectory.Only use the generic method if the surface type (plane or cylinder) is not known at the calling point.

Definition at line 10 of file Propagator.cc.

11  {
12  // try plane first, most probable case (disk "is a" plane too)
13  const Plane* bp = dynamic_cast<const Plane*>(&sur);
14  if (bp != nullptr)
15  return propagateWithPath(state, *bp);
16 
17  // if not plane try cylinder
18  const Cylinder* bc = dynamic_cast<const Cylinder*>(&sur);
19  if (bc != nullptr)
20  return propagateWithPath(state, *bc);
21 
22  // unknown surface - can't do it!
23  throw PropagationException("The surface is neither Cylinder nor Plane");
24 }
Definition: Plane.h:16
Common base class.
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override

◆ propagateWithPath() [5/11]

virtual std::pair<TrajectoryStateOnSurface, double> Propagator::propagateWithPath

◆ propagateWithPath() [6/11]

std::pair< TrajectoryStateOnSurface, double > Propagator::propagateWithPath
final

The following three methods are equivalent to the corresponding methods above, but if the starting state is a TrajectoryStateOnSurface, it's better to use it as such rather than use just the FreeTrajectoryState part. It may help some concrete propagators.Only use the generic method if the surface type (plane or cylinder) is not known at the calling point.

Definition at line 26 of file Propagator.cc.

27  {
28  // try plane first, most probable case (disk "is a" plane too)
29  const Plane* bp = dynamic_cast<const Plane*>(&sur);
30  if (bp != nullptr)
31  return propagateWithPath(state, *bp);
32 
33  // if not plane try cylinder
34  const Cylinder* bc = dynamic_cast<const Cylinder*>(&sur);
35  if (bc != nullptr)
36  return propagateWithPath(state, *bc);
37 
38  // unknown surface - can't do it!
39  throw PropagationException("The surface is neither Cylinder nor Plane");
40 }
Definition: Plane.h:16
Common base class.
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override

◆ propagateWithPath() [7/11]

virtual std::pair<TrajectoryStateOnSurface, double> Propagator::propagateWithPath
inline

Definition at line 86 of file Propagator.h.

87  {
88  return propagateWithPath(*tsos.freeState(), sur);
89  }
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override

◆ propagateWithPath() [8/11]

virtual std::pair<TrajectoryStateOnSurface, double> Propagator::propagateWithPath
inline

Definition at line 91 of file Propagator.h.

92  {
93  return propagateWithPath(*tsos.freeState(), sur);
94  }
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Plane &surface) const override

◆ propagateWithPath() [9/11]

virtual std::pair<TrajectoryStateOnSurface, double> Propagator::propagateWithPath

◆ propagateWithPath() [10/11]

std::pair< TrajectoryStateOnSurface, double > StraightLinePropagator::propagateWithPath ( const FreeTrajectoryState fts,
const Plane surface 
) const
overridevirtual

Implements Propagator.

Definition at line 8 of file StraightLinePropagator.cc.

References FreeTrajectoryState::charge(), FreeTrajectoryState::hasError(), jacobian(), AlCaHLTBitMon_ParallelJobs::p, propagatedState(), propagateParametersOnPlane(), alignCSCRings::s, theField, and x.

9  {
10  // propagate parameters
11  LocalPoint x;
12  LocalVector p;
13  double s = 0;
14  bool parametersOK = propagateParametersOnPlane(fts, plane, x, p, s);
15  if (!parametersOK)
16  return std::make_pair(TrajectoryStateOnSurface(), 0.);
17 
18  // compute propagated state
19  if (fts.hasError()) {
20  return std::make_pair(propagatedState(fts, plane, jacobian(s), x, p), s);
21  } else {
22  // return state without errors
23  return std::make_pair(TSOS(LocalTrajectoryParameters(x, p, fts.charge()), plane, theField), s);
24  }
25 }
TrajectoryStateOnSurface propagatedState(const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix55 &jacobian, const GlobalPoint &x, const GlobalVector &p) const
TrackCharge charge() const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
bool propagateParametersOnPlane(const FreeTrajectoryState &fts, const Plane &plane, LocalPoint &x, LocalVector &p, double &s) const

◆ propagateWithPath() [11/11]

std::pair< TrajectoryStateOnSurface, double > StraightLinePropagator::propagateWithPath ( const FreeTrajectoryState fts,
const Cylinder surface 
) const
overridevirtual

Implements Propagator.

Definition at line 27 of file StraightLinePropagator.cc.

References FreeTrajectoryState::charge(), FreeTrajectoryState::hasError(), jacobian(), AlCaHLTBitMon_ParallelJobs::p, propagatedState(), propagateParametersOnCylinder(), alignCSCRings::s, theField, and x.

28  {
29  // propagate parameters
30  GlobalPoint x;
32  double s = 0;
33  bool parametersOK = propagateParametersOnCylinder(fts, cylinder, x, p, s);
34  if (!parametersOK)
35  return std::make_pair(TrajectoryStateOnSurface(), 0.);
36 
37  // compute propagated state
38  if (fts.hasError()) {
39  return std::make_pair(propagatedState(fts, cylinder, jacobian(s), x, p), s);
40  } else {
41  // return state without errors
42  return std::make_pair(TSOS(GlobalTrajectoryParameters(x, p, fts.charge(), theField), cylinder), s);
43  }
44 }
TrajectoryStateOnSurface propagatedState(const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix55 &jacobian, const GlobalPoint &x, const GlobalVector &p) const
TrackCharge charge() const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
bool propagateParametersOnCylinder(const FreeTrajectoryState &fts, const Cylinder &cylinder, GlobalPoint &x, GlobalVector &p, double &s) const

Member Data Documentation

◆ theField

const MagneticField* StraightLinePropagator::theField
private

Definition at line 39 of file StraightLinePropagator.h.

Referenced by magneticField(), propagatedState(), and propagateWithPath().