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
 
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 93 of file StraightLinePropagator.cc.

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

Referenced by propagateWithPath().

93  {
94  //Jacobian for 5*5 local error matrix
95  AlgebraicMatrix55 j = AlgebraicMatrixID(); //Jacobian
96 
97  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
98  if (s*dir < 0.) return j;
99 
100  j(3,1) = s;
101  j(4,2) = s;
102 
103  return j;
104 }
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
int j
Definition: DBlmapReader.cc:9
dbl *** dir
Definition: mlp_gen.cc:35
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
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:12
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 AlgebraicMatrix55 jacobian,
const GlobalPoint x,
const GlobalVector p 
) const
private

Definition at line 71 of file StraightLinePropagator.cc.

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

Referenced by propagateWithPath().

75  {
76 
77  if(fts.hasError()) {
78  // propagate error
79  TSOS tmp(fts, surface);
80  const AlgebraicSymMatrix55 & eLocal =tmp.localError().matrix();
81  AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian,eLocal);
82  LocalTrajectoryError eloc(lte);
83 
84  TSOS tmp2(tmp.localParameters(), eloc, surface, theField);
85  GlobalTrajectoryParameters gtp(x, p, fts.charge(), theField);
86  return TSOS(gtp, tmp2.cartesianError(), surface);
87  } else {
88  // return state without errors
89  return TSOS(GlobalTrajectoryParameters(x, p, fts.charge(), theField), surface);
90  }
91 }
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 51 of file StraightLinePropagator.cc.

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

55  {
56  if(fts.hasError()) {
57  // propagate error
58  TSOS tmp( fts, surface);
59  const AlgebraicSymMatrix55 & eLocal =tmp.localError().matrix();
60  AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian,eLocal);
61  LocalTrajectoryError eloc(lte);
62  LocalTrajectoryParameters ltp(x, p, fts.charge());
63  return TSOS(ltp, eloc, surface, theField);
64  } else {
65  // return state without errors
66  return TSOS(LocalTrajectoryParameters(x, p, fts.charge()), surface, theField);
67  }
68 }
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 106 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().

110  {
111  GlobalPoint sp = cylinder.toGlobal(LocalPoint(0., 0.));
112  if (sp.x()!=0. || sp.y()!=0.) {
113  throw PropagationException("Cannot propagate to an arbitrary cylinder");
114  }
115 
116  x = fts.position();
117  p = fts.momentum();
118  s = cylinder.radius() - x.perp();
119 
120  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
121  if(s*dir < 0.) return false;
122 
123  double dt = s/p.perp();
124  x = GlobalPoint(x.x() + p.x()*dt,
125  x.y() + p.y()*dt,
126  x.z() + p.z()*dt);
127 
128  return true;
129 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
float dt
Definition: AMPTWrapper.h:126
T perp() const
Definition: PV3DBase.h:71
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:62
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
T z() const
Definition: PV3DBase.h:63
Common base class.
GlobalVector momentum() const
GlobalPoint position() const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:61
bool StraightLinePropagator::propagateParametersOnPlane ( const FreeTrajectoryState fts,
const Plane plane,
LocalPoint x,
LocalVector p,
double &  s 
) const
private

Definition at line 131 of file StraightLinePropagator.cc.

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

Referenced by propagateWithPath().

135  {
136 
137  //Do extrapolation in local frame of plane
138  // LocalPoint sp = plane.toLocal(plane.position());
139  x = plane.toLocal(fts.position());
140  p = plane.toLocal(fts.momentum());
141  s = -x.z(); // sp.z() - x.z(); local z of plane always 0
142 
143  //double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
144  //if(s*dir < 0.) return false;
145  if ((p.x() != 0 || p.y() != 0) && p.z() == 0 && s!= 0) return false;
146 
147  x = LocalPoint( x.x() + (p.x()/p.z())*s,
148  x.y() + (p.y()/p.z())*s,
149  x.z() + s);
150 
151  return true;
152 }
T y() const
Definition: PV3DBase.h:62
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:63
GlobalVector momentum() const
GlobalPoint position() const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
T x() const
Definition: PV3DBase.h:61
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:77
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(), AlCaHLTBitMon_ParallelJobs::p, propagatedState(), propagateParametersOnPlane(), alignCSCRings::s, theField, and vdt::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 AlgebraicMatrix55 &jacobian, const GlobalPoint &x, const GlobalVector &p) const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
x
Definition: VDTMath.h:216
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(), AlCaHLTBitMon_ParallelJobs::p, propagatedState(), propagateParametersOnCylinder(), alignCSCRings::s, theField, and vdt::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 AlgebraicMatrix55 &jacobian, const GlobalPoint &x, const GlobalVector &p) const
const MagneticField * theField
AlgebraicMatrix55 jacobian(double &s) const
TrajectoryStateOnSurface TSOS
x
Definition: VDTMath.h:216

Member Data Documentation

const MagneticField* StraightLinePropagator::theField
private

Definition at line 67 of file StraightLinePropagator.h.

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