CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
StraightLinePropagator Class Reference

#include <StraightLinePropagator.h>

Inheritance diagram for StraightLinePropagator:
Propagator

Public Member Functions

virtual StraightLinePropagatorclone () const
 
virtual const MagneticFieldmagneticField () const
 
virtual TSOS propagate (const FreeTrajectoryState &fts, const Surface &surface) const
 
virtual TSOS propagate (const FreeTrajectoryState &fts, const Plane &plane) const
 
virtual TSOS propagate (const FreeTrajectoryState &fts, const Cylinder &cylinder) const
 
std::pair< TSOS, double > propagateWithPath (const FreeTrajectoryState &fts, const Surface &surface) const
 
std::pair< TSOS, double > propagateWithPath (const FreeTrajectoryState &fts, const Plane &surface) const
 
std::pair< TSOS, double > propagateWithPath (const FreeTrajectoryState &fts, const Cylinder &surface) const
 
 StraightLinePropagator (const MagneticField *field, PropagationDirection aDir=alongMomentum)
 
 ~StraightLinePropagator ()
 
- Public Member Functions inherited from Propagator
virtual TrajectoryStateOnSurface propagate (const TrajectoryStateOnSurface &, const Surface &) const
 
virtual TrajectoryStateOnSurface propagate (const TrajectoryStateOnSurface &, const Plane &) const
 
virtual TrajectoryStateOnSurface propagate (const TrajectoryStateOnSurface &, const Cylinder &) const
 
virtual FreeTrajectoryState propagate (const FreeTrajectoryState &, const reco::BeamSpot &) const
 
virtual std::pair
< TrajectoryStateOnSurface,
double > 
propagateWithPath (const TrajectoryStateOnSurface &, const Surface &) const
 
virtual std::pair
< TrajectoryStateOnSurface,
double > 
propagateWithPath (const TrajectoryStateOnSurface &, const Plane &) const
 
virtual std::pair
< TrajectoryStateOnSurface,
double > 
propagateWithPath (const TrajectoryStateOnSurface &, const Cylinder &) const
 
virtual std::pair
< FreeTrajectoryState, double > 
propagateWithPath (const FreeTrajectoryState &, const GlobalPoint &, const GlobalPoint &) const
 
virtual PropagationDirection propagationDirection () const
 
 Propagator (PropagationDirection dir=alongMomentum)
 
virtual bool setMaxDirectionChange (float phiMax)
 
virtual void setPropagationDirection (PropagationDirection dir) const
 
virtual ~Propagator ()
 

Private Types

typedef FreeTrajectoryState FTS
 
typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

AlgebraicMatrix55 jacobian (double &s) const
 
AlgebraicMatrix jacobian_old (double &s) const
 
TrajectoryStateOnSurface propagatedState (const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix &jacobian, const GlobalPoint &x, const GlobalVector &p) const
 
TrajectoryStateOnSurface propagatedState (const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix &jacobian, const LocalPoint &x, const LocalVector &p) 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 17 of file StraightLinePropagator.h.

Member Typedef Documentation

Definition at line 21 of file StraightLinePropagator.h.

Definition at line 22 of file StraightLinePropagator.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file StraightLinePropagator.h.

Referenced by clone().

27  :
28  Propagator(aDir), theField(field) {}
Propagator(PropagationDirection dir=alongMomentum)
Definition: Propagator.h:41
const MagneticField * theField
StraightLinePropagator::~StraightLinePropagator ( )
inline

Definition at line 30 of file StraightLinePropagator.h.

30 {}

Member Function Documentation

virtual StraightLinePropagator* StraightLinePropagator::clone ( void  ) const
inlinevirtual

Implements Propagator.

Definition at line 58 of file StraightLinePropagator.h.

References StraightLinePropagator().

58  {
59  return new StraightLinePropagator(*this);
60  }
StraightLinePropagator(const MagneticField *field, PropagationDirection aDir=alongMomentum)
AlgebraicMatrix55 StraightLinePropagator::jacobian ( double &  s) const
private

Definition at line 115 of file StraightLinePropagator.cc.

References alongMomentum, dir, j, Propagator::propagationDirection(), and asciidump::s.

Referenced by jacobian_old(), and propagateWithPath().

115  {
116  //Jacobian for 5*5 local error matrix
117  AlgebraicMatrix55 j = AlgebraicMatrixID(); //Jacobian
118 
119  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
120  if (s*dir < 0.) return j;
121 
122  j(3,1) = s;
123  j(4,2) = s;
124 
125  return j;
126 }
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
int j
Definition: DBlmapReader.cc:9
string s
Definition: asciidump.py:422
dbl *** dir
Definition: mlp_gen.cc:35
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
AlgebraicMatrix StraightLinePropagator::jacobian_old ( double &  s) const
private

Definition at line 111 of file StraightLinePropagator.cc.

References asHepMatrix(), and jacobian().

111  {
112  return asHepMatrix(jacobian(s));
113 }
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:49
AlgebraicMatrix55 jacobian(double &s) const
string s
Definition: asciidump.py:422
virtual const MagneticField* StraightLinePropagator::magneticField ( ) const
inlinevirtual

Implements Propagator.

Definition at line 63 of file StraightLinePropagator.h.

References theField.

63 {return theField;}
const MagneticField * theField
virtual TSOS StraightLinePropagator::propagate ( const FreeTrajectoryState state,
const Surface sur 
) const
inlinevirtual

Propagate from a free state (e.g. position and momentum in in global cartesian coordinates) to a surface.Only use the generic method if the surface type (plane or cylinder) is not known at the calling point.

Reimplemented from Propagator.

Definition at line 32 of file StraightLinePropagator.h.

References Propagator::propagate().

Referenced by MultipleScatteringGeometry::detLayers().

33  {
34  return Propagator::propagate(fts, surface);
35  }
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
virtual TSOS StraightLinePropagator::propagate ( const FreeTrajectoryState fts,
const Plane plane 
) const
inlinevirtual

Implements Propagator.

Definition at line 37 of file StraightLinePropagator.h.

References propagateWithPath().

38  {
39  return propagateWithPath(fts,plane).first;
40  }
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Surface &surface) const
virtual TSOS StraightLinePropagator::propagate ( const FreeTrajectoryState fts,
const Cylinder cylinder 
) const
inlinevirtual

Implements Propagator.

Definition at line 42 of file StraightLinePropagator.h.

References propagateWithPath().

43  {
44  return propagateWithPath(fts,cylinder).first;
45  }
std::pair< TSOS, double > propagateWithPath(const FreeTrajectoryState &fts, const Surface &surface) const
TrajectoryStateOnSurface StraightLinePropagator::propagatedState ( const FreeTrajectoryState fts,
const Surface surface,
const AlgebraicMatrix jacobian,
const GlobalPoint x,
const GlobalVector p 
) const
private

Definition at line 80 of file StraightLinePropagator.cc.

Referenced by propagatedState(), and propagateWithPath().

84  {
85  return propagatedState(fts,surface,asSMatrix<5,5>(jacobian),x,p);
86 }
TrajectoryStateOnSurface propagatedState(const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix &jacobian, const GlobalPoint &x, const GlobalVector &p) const
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface StraightLinePropagator::propagatedState ( const FreeTrajectoryState fts,
const Surface surface,
const AlgebraicMatrix jacobian,
const LocalPoint x,
const LocalVector p 
) const
private

Definition at line 51 of file StraightLinePropagator.cc.

References propagatedState().

55  {
56  return propagatedState(fts,surface,asSMatrix<5,5>(jacobian),x,p);
57 }
TrajectoryStateOnSurface propagatedState(const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix &jacobian, const GlobalPoint &x, const GlobalVector &p) const
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface StraightLinePropagator::propagatedState ( const FreeTrajectoryState fts,
const Surface surface,
const AlgebraicMatrix55 jacobian,
const GlobalPoint x,
const GlobalVector p 
) const
private

Definition at line 89 of file StraightLinePropagator.cc.

References FreeTrajectoryState::charge(), FreeTrajectoryState::hasError(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), LocalTrajectoryError::matrix(), theField, and tmp.

93  {
94 
95  if(fts.hasError()) {
96  // propagate error
97  TSOS tmp(fts, surface);
98  const AlgebraicSymMatrix55 & eLocal =tmp.localError().matrix();
99  AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian,eLocal);
100  LocalTrajectoryError eloc(lte);
101 
102  TSOS tmp2(tmp.localParameters(), eloc, surface, theField);
103  GlobalTrajectoryParameters gtp(x, p, fts.charge(), theField);
104  return TSOS(gtp, tmp2.cartesianError(), surface);
105  } else {
106  // return state without errors
107  return TSOS(GlobalTrajectoryParameters(x, p, fts.charge(), theField), surface);
108  }
109 }
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrackCharge charge() const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
TrajectoryStateOnSurface StraightLinePropagator::propagatedState ( const FreeTrajectoryState fts,
const Surface surface,
const AlgebraicMatrix55 jacobian,
const LocalPoint x,
const LocalVector p 
) const
private

Definition at line 60 of file StraightLinePropagator.cc.

References FreeTrajectoryState::charge(), FreeTrajectoryState::hasError(), TrajectoryStateOnSurface::localError(), LocalTrajectoryError::matrix(), theField, and tmp.

64  {
65  if(fts.hasError()) {
66  // propagate error
67  TSOS tmp( fts, surface);
68  const AlgebraicSymMatrix55 & eLocal =tmp.localError().matrix();
69  AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian,eLocal);
70  LocalTrajectoryError eloc(lte);
71  LocalTrajectoryParameters ltp(x, p, fts.charge());
72  return TSOS(ltp, eloc, surface, theField);
73  } else {
74  // return state without errors
75  return TSOS(LocalTrajectoryParameters(x, p, fts.charge()), surface, theField);
76  }
77 }
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrackCharge charge() const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
bool StraightLinePropagator::propagateParametersOnCylinder ( const FreeTrajectoryState fts,
const Cylinder cylinder,
GlobalPoint x,
GlobalVector p,
double &  s 
) const
private

Definition at line 128 of file StraightLinePropagator.cc.

References alongMomentum, dir, dt, FreeTrajectoryState::momentum(), PV3DBase< T, PVType, FrameType >::perp(), FreeTrajectoryState::position(), Propagator::propagationDirection(), Cylinder::radius(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by propagateWithPath().

132  {
133  GlobalPoint sp = cylinder.toGlobal(LocalPoint(0., 0.));
134  if (sp.x()!=0. || sp.y()!=0.) {
135  throw PropagationException("Cannot propagate to an arbitrary cylinder");
136  }
137 
138  x = fts.position();
139  p = fts.momentum();
140  s = cylinder.radius() - x.perp();
141 
142  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
143  if(s*dir < 0.) return false;
144 
145  double dt = s/p.perp();
146  x = GlobalPoint(x.x() + p.x()*dt,
147  x.y() + p.y()*dt,
148  x.z() + p.z()*dt);
149 
150  return true;
151 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
float dt
Definition: AMPTWrapper.h:126
T perp() const
Definition: PV3DBase.h:66
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:57
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
T z() const
Definition: PV3DBase.h:58
Common base class.
GlobalVector momentum() const
GlobalPoint position() const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
string s
Definition: asciidump.py:422
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:56
bool StraightLinePropagator::propagateParametersOnPlane ( const FreeTrajectoryState fts,
const Plane plane,
LocalPoint x,
LocalVector p,
double &  s 
) const
private

Definition at line 153 of file StraightLinePropagator.cc.

References FreeTrajectoryState::momentum(), FreeTrajectoryState::position(), asciidump::s, GloballyPositioned< T >::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by propagateWithPath().

157  {
158 
159  //Do extrapolation in local frame of plane
160  // LocalPoint sp = plane.toLocal(plane.position());
161  x = plane.toLocal(fts.position());
162  p = plane.toLocal(fts.momentum());
163  s = -x.z(); // sp.z() - x.z(); local z of plane always 0
164 
165  //double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
166  //if(s*dir < 0.) return false;
167  if ((p.x() != 0 || p.y() != 0) && p.z() == 0 && s!= 0) return false;
168 
169  x = LocalPoint( x.x() + (p.x()/p.z())*s,
170  x.y() + (p.y()/p.z())*s,
171  x.z() + s);
172 
173  return true;
174 }
T y() const
Definition: PV3DBase.h:57
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:58
GlobalVector momentum() const
GlobalPoint position() const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
string s
Definition: asciidump.py:422
T x() const
Definition: PV3DBase.h:56
std::pair<TSOS,double> StraightLinePropagator::propagateWithPath ( const FreeTrajectoryState state,
const Surface sur 
) const
inlinevirtual

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.

Reimplemented from Propagator.

Definition at line 47 of file StraightLinePropagator.h.

References Propagator::propagateWithPath().

Referenced by propagate().

48  {
49  return Propagator::propagateWithPath(fts,surface);
50  }
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:74
std::pair< TrajectoryStateOnSurface, double > StraightLinePropagator::propagateWithPath ( const FreeTrajectoryState fts,
const Plane surface 
) const
virtual

Implements Propagator.

Definition at line 9 of file StraightLinePropagator.cc.

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

11 {
12  // propagate parameters
13  LocalPoint x;
14  LocalVector p;
15  double s = 0;
16  bool parametersOK = propagateParametersOnPlane(fts, plane, x, p, s);
17  if(!parametersOK) return std::make_pair(TrajectoryStateOnSurface(), 0.);
18 
19  // compute propagated state
20  if (fts.hasError()) {
21  return std::make_pair( propagatedState(fts, plane, jacobian(s), x, p), s);
22  } else {
23  // return state without errors
24  return std::make_pair(TSOS(LocalTrajectoryParameters(x, p, fts.charge()),
25  plane, theField), s);
26  }
27 }
TrackCharge charge() const
TrajectoryStateOnSurface propagatedState(const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix &jacobian, const GlobalPoint &x, const GlobalVector &p) const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
string s
Definition: asciidump.py:422
Definition: DDAxes.h:10
bool propagateParametersOnPlane(const FreeTrajectoryState &fts, const Plane &plane, LocalPoint &x, LocalVector &p, double &s) const
std::pair< TrajectoryStateOnSurface, double > StraightLinePropagator::propagateWithPath ( const FreeTrajectoryState fts,
const Cylinder surface 
) const
virtual

Implements Propagator.

Definition at line 30 of file StraightLinePropagator.cc.

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

32 {
33  // propagate parameters
34  GlobalPoint x;
36  double s = 0;
37  bool parametersOK = propagateParametersOnCylinder(fts, cylinder, x, p, s);
38  if(!parametersOK) return std::make_pair(TrajectoryStateOnSurface(), 0.);
39 
40  // compute propagated state
41  if (fts.hasError()) {
42  return std::make_pair( propagatedState(fts, cylinder, jacobian(s), x, p), s);
43  } else {
44  // return state without errors
45  return std::make_pair(TSOS(GlobalTrajectoryParameters(x, p, fts.charge(),theField),
46  cylinder), s);
47  }
48 }
bool propagateParametersOnCylinder(const FreeTrajectoryState &fts, const Cylinder &cylinder, GlobalPoint &x, GlobalVector &p, double &s) const
TrackCharge charge() const
TrajectoryStateOnSurface propagatedState(const FreeTrajectoryState &fts, const Surface &surface, const AlgebraicMatrix &jacobian, const GlobalPoint &x, const GlobalVector &p) const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
string s
Definition: asciidump.py:422
Definition: DDAxes.h:10

Member Data Documentation

const MagneticField* StraightLinePropagator::theField
private

Definition at line 67 of file StraightLinePropagator.h.

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