CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

StraightLinePropagator Class Reference

#include <StraightLinePropagator.h>

Inheritance diagram for StraightLinePropagator:
Propagator

List of all members.

Public Member Functions

virtual StraightLinePropagatorclone () const
virtual const MagneticFieldmagneticField () const
virtual TSOS propagate (const FreeTrajectoryState &fts, const Cylinder &cylinder) const
virtual TSOS propagate (const FreeTrajectoryState &fts, const Plane &plane) const
virtual TSOS propagate (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
std::pair< TSOS, double > propagateWithPath (const FreeTrajectoryState &fts, const Surface &surface) const
 StraightLinePropagator (const MagneticField *field, PropagationDirection aDir=alongMomentum)
 ~StraightLinePropagator ()

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 AlgebraicMatrix55 &jacobian, const LocalPoint &x, const LocalVector &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
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().

                                                                     : 
    Propagator(aDir), theField(field) {}
StraightLinePropagator::~StraightLinePropagator ( ) [inline]

Definition at line 30 of file StraightLinePropagator.h.

{}

Member Function Documentation

virtual StraightLinePropagator* StraightLinePropagator::clone ( void  ) const [inline, virtual]

Implements Propagator.

Definition at line 58 of file StraightLinePropagator.h.

References StraightLinePropagator().

                                                 {
    return new StraightLinePropagator(*this);
  }
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().

                                                                  {
  //Jacobian for 5*5 local error matrix
  AlgebraicMatrix55 j = AlgebraicMatrixID(); //Jacobian
  
  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
  if (s*dir < 0.) return j;

  j(3,1) = s; 
  j(4,2) = s; 

  return j;
}
AlgebraicMatrix StraightLinePropagator::jacobian_old ( double &  s) const [private]

Definition at line 111 of file StraightLinePropagator.cc.

References asHepMatrix(), and jacobian().

                                                                    {
    return asHepMatrix(jacobian(s));
}
virtual const MagneticField* StraightLinePropagator::magneticField ( ) const [inline, virtual]

Implements Propagator.

Definition at line 63 of file StraightLinePropagator.h.

References theField.

{return theField;}
virtual TSOS StraightLinePropagator::propagate ( const FreeTrajectoryState fts,
const Plane plane 
) const [inline, virtual]

Implements Propagator.

Definition at line 37 of file StraightLinePropagator.h.

References propagateWithPath().

                                                   {
    return propagateWithPath(fts,plane).first;
  }
virtual TSOS StraightLinePropagator::propagate ( const FreeTrajectoryState state,
const Surface sur 
) const [inline, virtual]

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.

Referenced by MultipleScatteringGeometry::detLayers().

                                                       {
    return Propagator::propagate(fts, surface);
  }
virtual TSOS StraightLinePropagator::propagate ( const FreeTrajectoryState fts,
const Cylinder cylinder 
) const [inline, virtual]

Implements Propagator.

Definition at line 42 of file StraightLinePropagator.h.

References propagateWithPath().

                                                         {
    return propagateWithPath(fts,cylinder).first;
  }
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().

                                                                     {
    return propagatedState(fts,surface,asSMatrix<5,5>(jacobian),x,p);
}
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().

                                                                    {
    return propagatedState(fts,surface,asSMatrix<5,5>(jacobian),x,p);
}
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.

                                                                     {

  if(fts.hasError()) {
    // propagate error
    TSOS tmp(fts, surface);
    const AlgebraicSymMatrix55 & eLocal =tmp.localError().matrix();
    AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian,eLocal);
    LocalTrajectoryError eloc(lte);

    TSOS tmp2(tmp.localParameters(), eloc, surface, theField);
    GlobalTrajectoryParameters gtp(x, p, fts.charge(), theField);
    return TSOS(gtp, tmp2.cartesianError(), surface);
  } else {
    // return state without errors
    return TSOS(GlobalTrajectoryParameters(x, p, fts.charge(), theField), surface);
  }
}
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.

                                                                    {
  if(fts.hasError()) {
    // propagate error
    TSOS tmp( fts, surface);
    const AlgebraicSymMatrix55 & eLocal =tmp.localError().matrix();
    AlgebraicSymMatrix55 lte = ROOT::Math::Similarity(jacobian,eLocal);
    LocalTrajectoryError eloc(lte);
    LocalTrajectoryParameters ltp(x, p, fts.charge());
    return TSOS(ltp, eloc, surface, theField);
  } else {
    // return state without errors
    return TSOS(LocalTrajectoryParameters(x, p, fts.charge()), surface, theField);
  }
}
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().

                                                                            {
  GlobalPoint sp = cylinder.toGlobal(LocalPoint(0., 0.));
  if (sp.x()!=0. || sp.y()!=0.) {
    throw PropagationException("Cannot propagate to an arbitrary cylinder");
  }

  x = fts.position();
  p = fts.momentum();
  s = cylinder.radius() - x.perp();

  double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
  if(s*dir < 0.) return false;

  double dt = s/p.perp();
  x = GlobalPoint(x.x() + p.x()*dt, 
                  x.y() + p.y()*dt, 
                  x.z() + p.z()*dt);

  return true;
}
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().

                                                                         {
  
  //Do extrapolation in local frame of plane
  //  LocalPoint sp = plane.toLocal(plane.position());
  x = plane.toLocal(fts.position());
  p = plane.toLocal(fts.momentum());
  s = -x.z(); // sp.z() - x.z(); local z of plane always 0
  
  //double dir = (propagationDirection() == alongMomentum) ? 1. : -1.;
  //if(s*dir < 0.) return false;
  if ((p.x() != 0 || p.y() != 0) && p.z() == 0 && s!= 0) return false;

  x = LocalPoint( x.x() + (p.x()/p.z())*s,
                  x.y() + (p.y()/p.z())*s,
                  x.z() + s);    

  return true;
}
std::pair<TSOS,double> StraightLinePropagator::propagateWithPath ( const FreeTrajectoryState state,
const Surface sur 
) const [inline, virtual]

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.

Referenced by propagate().

                                                                    {
    return Propagator::propagateWithPath(fts,surface);
  }
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 ExpressReco_HICollisions_FallBack::x.

{
  // propagate parameters
  GlobalPoint x;
  GlobalVector p;
  double s = 0;
  bool parametersOK = propagateParametersOnCylinder(fts, cylinder,  x, p, s);
  if(!parametersOK) return std::make_pair(TrajectoryStateOnSurface(), 0.);

  // compute propagated state
  if (fts.hasError()) {
    return std::make_pair( propagatedState(fts, cylinder, jacobian(s), x,  p), s);
  } else {
    // return state without errors
    return std::make_pair(TSOS(GlobalTrajectoryParameters(x, p, fts.charge(),theField),
                          cylinder), s);
  }
}
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 ExpressReco_HICollisions_FallBack::x.

{
  // propagate parameters
  LocalPoint x;
  LocalVector p;
  double s = 0;
  bool parametersOK = propagateParametersOnPlane(fts, plane, x, p, s);
  if(!parametersOK) return std::make_pair(TrajectoryStateOnSurface(), 0.);

  // compute propagated state
  if (fts.hasError()) {
    return std::make_pair( propagatedState(fts, plane, jacobian(s), x,  p), s);
  } else {
    // return state without errors
    return std::make_pair(TSOS(LocalTrajectoryParameters(x, p, fts.charge()), 
                          plane, theField), s);
  }
}

Member Data Documentation

Definition at line 67 of file StraightLinePropagator.h.

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