CMS 3D CMS Logo

AnalyticalPropagator Class Reference

(Mostly) analytical helix propagation to cylindrical or planar surfaces. More...

#include <TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h>

Inheritance diagram for AnalyticalPropagator:

Propagator

List of all members.

Public Member Functions

 AnalyticalPropagator (const MagneticField *field, PropagationDirection dir=alongMomentum, float maxDPhi=1.6)
virtual AnalyticalPropagatorclone () const
TrajectoryStateOnSurface propagate (const FreeTrajectoryState &fts, const Cylinder &cylinder) const
 propagation to cylinder
TrajectoryStateOnSurface propagate (const FreeTrajectoryState &fts, const Plane &plane) const
 propagation to plane
std::pair
< TrajectoryStateOnSurface,
double > 
propagateWithPath (const FreeTrajectoryState &fts, const Cylinder &cylinder) const
 propagation to cylinder with path length
std::pair
< TrajectoryStateOnSurface,
double > 
propagateWithPath (const FreeTrajectoryState &fts, const Plane &plane) const
 propagation to plane with path length
virtual bool setMaxDirectionChange (float phiMax)
 limitation of change in transverse direction (to avoid loops).
void setMaxRelativeChangeInBz (const float maxDBz)
 Set the maximum relative change in Bz (Bz_at_end-Bz_at_start)/Bz_at_start for a single propagation.
 ~AnalyticalPropagator ()

Private Types

typedef std::pair
< TrajectoryStateOnSurface,
double > 
TsosWP

Private Member Functions

virtual const MagneticFieldmagneticField () const
std::pair
< TrajectoryStateOnSurface,
double > 
propagatedStateWithPath (const FreeTrajectoryState &fts, const Surface &surface, const GlobalTrajectoryParameters &gtp, const double &s) const
 propagation of errors (if needed) and generation of a new TSOS
bool propagateParametersOnCylinder (const FreeTrajectoryState &fts, const Cylinder &cylinder, GlobalPoint &x, GlobalVector &p, double &s) const
 parameter propagation to cylinder (returns position, momentum and path length)
bool propagateParametersOnPlane (const FreeTrajectoryState &fts, const Plane &plane, GlobalPoint &x, GlobalVector &p, double &s) const
 parameter propagation to plane (returns position, momentum and path length)
bool propagateWithHelixCrossing (HelixPlaneCrossing &, const Plane &, const float, GlobalPoint &, GlobalVector &, double &s) const
 helix parameter propagation to a plane using HelixPlaneCrossing
bool propagateWithLineCrossing (const GlobalPoint &, const GlobalVector &, const Cylinder &, GlobalPoint &, double &) const
 straight line parameter propagation to a cylinder
bool propagateWithLineCrossing (const GlobalPoint &, const GlobalVector &, const Plane &, GlobalPoint &, double &) const
 straight line parameter propagation to a plane

Private Attributes

const MagneticFieldtheField
float theMaxDBzRatio
float theMaxDPhi2


Detailed Description

(Mostly) analytical helix propagation to cylindrical or planar surfaces.

Based on GtfGeometricalPropagator with successive replacement of components (currently: propagation to arbitrary plane).

Definition at line 22 of file AnalyticalPropagator.h.


Member Typedef Documentation

typedef std::pair<TrajectoryStateOnSurface,double> AnalyticalPropagator::TsosWP [private]

Definition at line 124 of file AnalyticalPropagator.h.


Constructor & Destructor Documentation

AnalyticalPropagator::AnalyticalPropagator ( const MagneticField field,
PropagationDirection  dir = alongMomentum,
float  maxDPhi = 1.6 
) [inline]

Definition at line 26 of file AnalyticalPropagator.h.

Referenced by clone().

00028                                              :
00029     Propagator(dir),
00030     theMaxDPhi2(maxDPhi*maxDPhi),
00031     theMaxDBzRatio(0.5),
00032     theField(field) {}

AnalyticalPropagator::~AnalyticalPropagator (  )  [inline]

Definition at line 34 of file AnalyticalPropagator.h.

00034 {}


Member Function Documentation

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

Implements Propagator.

Definition at line 73 of file AnalyticalPropagator.h.

References AnalyticalPropagator().

00077   {
00078     return new AnalyticalPropagator(*this);

virtual const MagneticField* AnalyticalPropagator::magneticField (  )  const [inline, private, virtual]

Implements Propagator.

Definition at line 121 of file AnalyticalPropagator.h.

References theField.

00122 {return theField;}

TrajectoryStateOnSurface AnalyticalPropagator::propagate ( const FreeTrajectoryState fts,
const Cylinder cylinder 
) const [inline, virtual]

propagation to cylinder

Implements Propagator.

Definition at line 56 of file AnalyticalPropagator.h.

References propagateWithPath().

00057                                                                      {
00058     return propagateWithPath(fts,cylinder).first;
00059   }

TrajectoryStateOnSurface AnalyticalPropagator::propagate ( const FreeTrajectoryState fts,
const Plane plane 
) const [inline, virtual]

propagation to plane

Implements Propagator.

Definition at line 46 of file AnalyticalPropagator.h.

References propagateWithPath().

Referenced by EMEnrichingFilterAlgo::applyBFieldCurv(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), TrackingRecHitPropagator::project(), RecHitPropagator::propagate(), SeedGeneratorForLaserBeams::propagateAnalytical(), TauTagTools::propagTrackECALSurfContactPoint(), KalmanAlignmentTrackRefitter::refitSingleTracklet(), and PerigeeRefittedTrackState::trajectoryStateOnSurface().

00047                                                                {
00048     return propagateWithPath(fts,plane).first;
00049   }

std::pair< TrajectoryStateOnSurface, double > AnalyticalPropagator::propagatedStateWithPath ( const FreeTrajectoryState fts,
const Surface surface,
const GlobalTrajectoryParameters gtp,
const double &  s 
) const [private]

propagation of errors (if needed) and generation of a new TSOS

Definition at line 98 of file AnalyticalPropagator.cc.

References SurfaceSideDefinition::afterSurface, alongMomentum, SurfaceSideDefinition::beforeSurface, FreeTrajectoryState::curvilinearError(), FreeTrajectoryState::hasError(), CurvilinearTrajectoryError::matrix(), GlobalTrajectoryParameters::momentum(), FreeTrajectoryState::parameters(), GlobalTrajectoryParameters::position(), and Propagator::propagationDirection().

Referenced by propagateWithPath().

00102 {
00103   //
00104   // for forward propagation: state is before surface,
00105   // for backward propagation: state is after surface
00106   //
00107   SurfaceSide side = PropagationDirectionFromPath()(s,propagationDirection())==alongMomentum 
00108     ? beforeSurface : afterSurface;
00109   // 
00110   //
00111   // error propagation (if needed) and conversion to a TrajectoryStateOnSurface
00112   //
00113   if (fts.hasError()) {
00114     //
00115     // compute jacobian
00116     //
00117     AnalyticalCurvilinearJacobian analyticalJacobian(fts.parameters(), gtp.position(), gtp.momentum(), s);
00118     const AlgebraicMatrix55 &jacobian = analyticalJacobian.jacobian();
00119     CurvilinearTrajectoryError cte(ROOT::Math::Similarity(jacobian, fts.curvilinearError().matrix()));
00120     return TsosWP(TrajectoryStateOnSurface(gtp,cte,surface,side),s);
00121   }
00122   else {
00123     //
00124     // return state without errors
00125     //
00126     return TsosWP(TrajectoryStateOnSurface(gtp,surface,side),s);
00127   }
00128 }

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

parameter propagation to cylinder (returns position, momentum and path length)

Definition at line 130 of file AnalyticalPropagator.cc.

References e, PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), FreeTrajectoryState::position(), propagateWithLineCrossing(), Propagator::propagationDirection(), rho, Surface::toGlobal(), FreeTrajectoryState::transverseCurvature(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by propagateWithPath().

00133 {
00134 
00135   GlobalPoint sp = cylinder.toGlobal(LocalPoint(0.,0.));
00136   if (sp.x()!=0. || sp.y()!=0.) {
00137     throw PropagationException("Cannot propagate to an arbitrary cylinder");
00138   }
00139   // preset output
00140   x = fts.position();
00141   p = fts.momentum();
00142   s = 0;
00143   // (transverse) curvature
00144   double rho = fts.transverseCurvature();
00145   //
00146   // Straight line approximation? |rho|<1.e-10 equivalent to ~ 1um 
00147   // difference in transversal position at 10m.
00148   //
00149   if( fabs(rho)<1.e-10 )
00150     return propagateWithLineCrossing(fts.position(),p,cylinder,x,s);
00151   //
00152   // Helix case
00153   //
00154   // check for possible intersection
00155   const double tolerance = 1.e-4; // 1 micron distance
00156   double rdiff = x.perp() - cylinder.radius();
00157   if ( fabs(rdiff) < tolerance )  return true;
00158   //
00159   // Instantiate HelixBarrelCylinderCrossing and get solutions
00160   //
00161   HelixBarrelCylinderCrossing cylinderCrossing(fts.position(),fts.momentum(),rho,
00162                                                propagationDirection(),cylinder);
00163   if ( !cylinderCrossing.hasSolution() )  return false;
00164   // path length
00165   s = cylinderCrossing.pathLength();
00166   // point
00167   x = cylinderCrossing.position();
00168   // direction (renormalised)
00169   p = cylinderCrossing.direction().unit()*fts.momentum().mag();
00170   return true;
00171 }

bool AnalyticalPropagator::propagateParametersOnPlane ( const FreeTrajectoryState fts,
const Plane plane,
GlobalPoint x,
GlobalVector p,
double &  s 
) const [private]

parameter propagation to plane (returns position, momentum and path length)

Definition at line 174 of file AnalyticalPropagator.cc.

References e, PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), FreeTrajectoryState::position(), propagateWithHelixCrossing(), propagateWithLineCrossing(), Propagator::propagationDirection(), rho, and FreeTrajectoryState::transverseCurvature().

Referenced by propagateWithPath().

00179 {
00180   // initialisation of position, momentum and path length
00181   x = fts.position();
00182   p = fts.momentum();
00183   s = 0;
00184   // (transverse) curvature
00185   double rho = fts.transverseCurvature();
00186   //
00187   // Straight line approximation? |rho|<1.e-10 equivalent to ~ 1um 
00188   // difference in transversal position at 10m.
00189   //
00190   if( fabs(rho)<1.e-10 )
00191     return propagateWithLineCrossing(fts.position(),p,plane,x,s);
00192   //
00193   // Helix case 
00194   //
00195   GlobalVector u = plane.normalVector();
00196   const double small = 1.e-6; // for orientation of planes
00197   //
00198   // Frame-independant point and vector are created explicitely to 
00199   // avoid confusing gcc (refuses to compile with temporary objects
00200   // in the constructor).
00201   //
00202   HelixPlaneCrossing::PositionType helixPos(x);
00203   HelixPlaneCrossing::DirectionType helixDir(p);
00204   if (fabs(u.z()) < small) {
00205     // barrel plane:
00206     // instantiate HelixBarrelPlaneCrossing, get vector of solutions and check for existance
00207     HelixBarrelPlaneCrossingByCircle planeCrossing(helixPos,helixDir,rho,propagationDirection());
00208     return propagateWithHelixCrossing(planeCrossing,plane,fts.momentum().mag(),x,p,s);
00209   }
00210   if (fabs(u.x()) < small && fabs(u.y()) < small) {
00211     // forward plane:
00212     // instantiate HelixForwardPlaneCrossing, get vector of solutions and check for existance
00213     HelixForwardPlaneCrossing planeCrossing(helixPos,helixDir,rho,propagationDirection());
00214     return propagateWithHelixCrossing(planeCrossing,plane,fts.momentum().mag(),x,p,s);
00215   }
00216   else {
00217     // arbitrary plane:
00218     // instantiate HelixArbitraryPlaneCrossing, get vector of solutions and check for existance
00219     HelixArbitraryPlaneCrossing planeCrossing(helixPos,helixDir,rho,propagationDirection());
00220     return propagateWithHelixCrossing(planeCrossing,plane,fts.momentum().mag(),x,p,s);
00221   }
00222 }

bool AnalyticalPropagator::propagateWithHelixCrossing ( HelixPlaneCrossing planeCrossing,
const Plane plane,
const   float,
GlobalPoint x,
GlobalVector p,
double &  s 
) const [private]

helix parameter propagation to a plane using HelixPlaneCrossing

Definition at line 275 of file AnalyticalPropagator.cc.

References HelixPlaneCrossing::direction(), Basic3DVector< T >::mag(), HelixPlaneCrossing::pathLength(), and HelixPlaneCrossing::position().

Referenced by propagateParametersOnPlane().

00280                                                                    {
00281   // get solution
00282   std::pair<bool,double> propResult = planeCrossing.pathLength(plane);
00283   if ( !propResult.first )  return false;
00284   s = propResult.second;
00285   // point (reconverted to GlobalPoint)
00286   HelixPlaneCrossing::PositionType xGen = planeCrossing.position(s);
00287   x = GlobalPoint(xGen);
00288   // direction (reconverted to GlobalVector, renormalised)
00289   HelixPlaneCrossing::DirectionType pGen = planeCrossing.direction(s);
00290   pGen *= pmag/pGen.mag();
00291   p = GlobalVector(pGen);
00292   //
00293   return true;
00294 }

bool AnalyticalPropagator::propagateWithLineCrossing ( const GlobalPoint x0,
const GlobalVector p0,
const Cylinder cylinder,
GlobalPoint x,
double &  s 
) const [private]

straight line parameter propagation to a cylinder

Definition at line 251 of file AnalyticalPropagator.cc.

References StraightLineBarrelCylinderCrossing::pathLength(), StraightLineBarrelCylinderCrossing::position(), and Propagator::propagationDirection().

00254                                                                                   {
00255   //
00256   // Instantiate auxiliary object for finding intersection.
00257   // Frame-independant point and vector are created explicitely to 
00258   // avoid confusing gcc (refuses to compile with temporary objects
00259   // in the constructor).
00260   //
00261   StraightLineBarrelCylinderCrossing cylCrossing(x0,p0,propagationDirection());
00262   //
00263   // get solution
00264   //
00265   std::pair<bool,double> propResult = cylCrossing.pathLength(cylinder);
00266   if ( !propResult.first )  return false;
00267   s = propResult.second;
00268   // point (reconverted to GlobalPoint)
00269   x = cylCrossing.position(s);
00270   //
00271   return true;
00272 }

bool AnalyticalPropagator::propagateWithLineCrossing ( const GlobalPoint x0,
const GlobalVector p0,
const Plane plane,
GlobalPoint x,
double &  s 
) const [private]

straight line parameter propagation to a plane

Definition at line 225 of file AnalyticalPropagator.cc.

References dir, StraightLinePlaneCrossing::pathLength(), StraightLinePlaneCrossing::position(), and Propagator::propagationDirection().

Referenced by propagateParametersOnCylinder(), and propagateParametersOnPlane().

00228                                                                                   {
00229   //
00230   // Instantiate auxiliary object for finding intersection.
00231   // Frame-independant point and vector are created explicitely to 
00232   // avoid confusing gcc (refuses to compile with temporary objects
00233   // in the constructor).
00234   //
00235   StraightLinePlaneCrossing::PositionType pos(x0);
00236   StraightLinePlaneCrossing::DirectionType dir(p0);
00237   StraightLinePlaneCrossing planeCrossing(pos,dir,propagationDirection());
00238   //
00239   // get solution
00240   //
00241   std::pair<bool,double> propResult = planeCrossing.pathLength(plane);
00242   if ( !propResult.first )  return false;
00243   s = propResult.second;
00244   // point (reconverted to GlobalPoint)
00245   x = GlobalPoint(planeCrossing.position(s));
00246   //
00247   return true;
00248 }

std::pair< TrajectoryStateOnSurface, double > AnalyticalPropagator::propagateWithPath ( const FreeTrajectoryState fts,
const Cylinder cylinder 
) const [virtual]

propagation to cylinder with path length

Implements Propagator.

Definition at line 68 of file AnalyticalPropagator.cc.

References FreeTrajectoryState::charge(), PV3DBase< T, PVType, FrameType >::mag2(), FreeTrajectoryState::momentum(), p, PV3DBase< T, PVType, FrameType >::perp2(), propagatedStateWithPath(), propagateParametersOnCylinder(), rho, s, Cylinder::tangentPlane(), theField, theMaxDBzRatio, theMaxDPhi2, FreeTrajectoryState::transverseCurvature(), and x.

00070 {
00071   // check curvature
00072   double rho = fts.transverseCurvature();
00073 
00074   // propagate parameters
00075   GlobalPoint x;
00076   GlobalVector p;
00077   double s = 0;
00078 
00079   bool parametersOK = this->propagateParametersOnCylinder(fts, cylinder, x, p, s);
00080   // check status and deltaPhi limit
00081   float dphi2 = s*rho;
00082   dphi2 = dphi2*dphi2*fts.momentum().perp2()/fts.momentum().mag2();
00083   if ( !parametersOK || dphi2>theMaxDPhi2 )  return TsosWP(TrajectoryStateOnSurface(),0.);
00084   //
00085   // Compute propagated state and check change in curvature
00086   //
00087   GlobalTrajectoryParameters gtp(x,p,fts.charge(),theField);
00088   if ( fabs(rho)>1.e-10 && fabs((gtp.transverseCurvature()-rho)/rho)>theMaxDBzRatio ) 
00089     return TsosWP(TrajectoryStateOnSurface(),0.);
00090   //
00091   // create result on TangentPlane (local parameters & errors are better defined)
00092   //
00093   ReferenceCountingPointer<TangentPlane> plane(cylinder.tangentPlane(x));
00094   return propagatedStateWithPath(fts,*plane,gtp,s);
00095 }

std::pair< TrajectoryStateOnSurface, double > AnalyticalPropagator::propagateWithPath ( const FreeTrajectoryState fts,
const Plane plane 
) const [virtual]

propagation to plane with path length

Implements Propagator.

Definition at line 26 of file AnalyticalPropagator.cc.

References FreeTrajectoryState::charge(), e, Plane::localZ(), PV3DBase< T, PVType, FrameType >::mag2(), FreeTrajectoryState::momentum(), p, PV3DBase< T, PVType, FrameType >::perp2(), GloballyPositioned< T >::position(), FreeTrajectoryState::position(), propagatedStateWithPath(), propagateParametersOnPlane(), rho, s, theField, theMaxDBzRatio, theMaxDPhi2, FreeTrajectoryState::transverseCurvature(), and x.

Referenced by propagate(), ReferenceTrajectory::propagate(), DualBzeroTrajectoryFactory::propagateExternal(), DualTrajectoryFactory::propagateExternal(), and TwoBodyDecayTrajectoryState::propagateSingleState().

00028 {
00029   // check curvature
00030   double rho = fts.transverseCurvature();
00031   
00032   // propagate parameters
00033   GlobalPoint x;
00034   GlobalVector p;
00035   double s;
00036   
00037   // check if already on plane
00038   const float maxDistToPlane(0.1e-4);
00039   const float numericalPrecision(5.e-7);
00040   float maxDz = numericalPrecision*plane.position().mag();
00041   if ( fabs(plane.localZ(fts.position()))>(maxDistToPlane>maxDz?maxDistToPlane:maxDz) ) {
00042     // propagate
00043     bool parametersOK = this->propagateParametersOnPlane(fts, plane, x, p, s);
00044     // check status and deltaPhi limit
00045     float dphi2 = s*rho;
00046     dphi2 = dphi2*dphi2*fts.momentum().perp2()/fts.momentum().mag2();
00047     if ( !parametersOK || dphi2>theMaxDPhi2 )  return TsosWP(TrajectoryStateOnSurface(),0.);
00048   }
00049   else {
00050     x = fts.position();
00051     p = fts.momentum();
00052     s = 0.;
00053   }
00054   //
00055   // Compute propagated state and check change in curvature
00056   //
00057   GlobalTrajectoryParameters gtp(x,p,fts.charge(),theField);
00058   if ( fabs(rho)>1.e-10 && fabs((gtp.transverseCurvature()-rho)/rho)>theMaxDBzRatio ) 
00059     return TsosWP(TrajectoryStateOnSurface(),0.);
00060   //
00061   // construct TrajectoryStateOnSurface
00062   //
00063   return propagatedStateWithPath(fts,plane,gtp,s);
00064 }

virtual bool AnalyticalPropagator::setMaxDirectionChange ( float  phiMax  )  [inline, virtual]

limitation of change in transverse direction (to avoid loops).

Reimplemented from Propagator.

Definition at line 67 of file AnalyticalPropagator.h.

References theMaxDPhi2.

00067                                                     { 
00068     theMaxDPhi2 = phiMax*phiMax;
00069     return true;
00070   }

void AnalyticalPropagator::setMaxRelativeChangeInBz ( const float  maxDBz  )  [inline]

Set the maximum relative change in Bz (Bz_at_end-Bz_at_start)/Bz_at_start for a single propagation.

The default is no limit. NB: this propagator assumes constant, non-zero magnetic field parallel to the z-axis!

Definition at line 84 of file AnalyticalPropagator.h.

00085                                                      {
00086     theMaxDBzRatio = maxDBz;


Member Data Documentation

const MagneticField* AnalyticalPropagator::theField [private]

Definition at line 127 of file AnalyticalPropagator.h.

Referenced by magneticField(), and propagateWithPath().

float AnalyticalPropagator::theMaxDBzRatio [private]

Definition at line 126 of file AnalyticalPropagator.h.

Referenced by propagateWithPath().

float AnalyticalPropagator::theMaxDPhi2 [private]

Definition at line 125 of file AnalyticalPropagator.h.

Referenced by propagateWithPath(), and setMaxDirectionChange().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:14:40 2009 for CMSSW by  doxygen 1.5.4