CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/TrackingTools/GeomPropagators/src/Propagator.cc

Go to the documentation of this file.
00001 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00002 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00003 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00004 #include "TrackingTools/GeomPropagators/interface/PropagationExceptions.h"
00005 #include "DataFormats/GeometrySurface/interface/Cylinder.h"
00006 #include "DataFormats/GeometrySurface/interface/Plane.h"
00007 
00008 
00009 Propagator::~Propagator() {}
00010 
00011 TrajectoryStateOnSurface 
00012 Propagator::propagate( const FreeTrajectoryState& state, 
00013                        const Surface& sur) const
00014 {
00015   // try plane first, most probable case (disk "is a" plane too) 
00016   const Plane* bp = dynamic_cast<const Plane*>(&sur);
00017   if (bp != 0) return propagate( state, *bp);
00018   
00019   // if not plane try cylinder
00020   const Cylinder* bc = dynamic_cast<const Cylinder*>(&sur);
00021   if (bc != 0) return propagate( state, *bc);
00022 
00023   // unknown surface - can't do it!
00024   throw PropagationException("The surface is neither Cylinder nor Plane");
00025 }
00026 
00027 TrajectoryStateOnSurface 
00028 Propagator::propagate (const TrajectoryStateOnSurface& state, 
00029                        const Surface& sur) const
00030 {
00031   // exactly same code as for FreeTrajectoryState
00032 
00033   // try plane first, most probable case (disk "is a" plane too) 
00034   const Plane* bp = dynamic_cast<const Plane*>(&sur);
00035   if (bp != 0) return propagate( state, *bp);
00036   
00037   // if not plane try cylinder
00038   const Cylinder* bc = dynamic_cast<const Cylinder*>(&sur);
00039   if (bc != 0) return propagate( state, *bc);
00040 
00041   // unknown surface - can't do it!
00042   throw PropagationException("The surface is neither Cylinder nor Plane");
00043 }
00044 
00045 
00046 // default impl. avoids the need to redefinition in concrete
00047 // propagators that don't benefit from TSOS vs. FTS
00048 TrajectoryStateOnSurface 
00049 Propagator::propagate (const TrajectoryStateOnSurface& tsos, 
00050                        const Plane& sur) const
00051 {
00052   // Protect against null propagations
00053   if (fabs(sur.toLocal(tsos.globalPosition()).z())<1e-5) {
00054     // Still have to tarnsform the r.f.!
00055     return TrajectoryStateOnSurface(*tsos.freeState(), sur);
00056   }
00057   return propagate( *tsos.freeState(), sur);
00058 }
00059 
00060 // default impl. avoids the need to redefinition in concrete
00061 // propagators that don't benefit from TSOS vs. FTS
00062 TrajectoryStateOnSurface 
00063 Propagator::propagate (const TrajectoryStateOnSurface& tsos, 
00064                        const Cylinder& sur) const
00065 {
00066   return propagate( *tsos.freeState(), sur);
00067 }
00068 
00069 FreeTrajectoryState 
00070 Propagator::propagate(const FreeTrajectoryState& ftsStart, 
00071     const reco::BeamSpot& beamSpot) const{
00072   throw cms::Exception("Propagator::propagate(FTS,beamSpot) not implemented");
00073 }
00074 
00075 
00076 std::pair< TrajectoryStateOnSurface, double> 
00077 Propagator::propagateWithPath (const FreeTrajectoryState& state, 
00078                                const Surface& sur) const
00079 {
00080   // same code as above, only method name changes
00081 
00082   // try plane first, most probable case (disk "is a" plane too) 
00083   const Plane* bp = dynamic_cast<const Plane*>(&sur);
00084   if (bp != 0) return propagateWithPath( state, *bp);
00085   
00086   // if not plane try cylinder
00087   const Cylinder* bc = dynamic_cast<const Cylinder*>(&sur);
00088   if (bc != 0) return propagateWithPath( state, *bc);
00089 
00090   // unknown surface - can't do it!
00091   throw PropagationException("The surface is neither Cylinder nor Plane");
00092 }
00093 
00094 std::pair< TrajectoryStateOnSurface, double> 
00095 Propagator::propagateWithPath (const TrajectoryStateOnSurface& state, 
00096                                const Surface& sur) const
00097 {
00098   // same code as above, only method name changes
00099 
00100   // try plane first, most probable case (disk "is a" plane too) 
00101   const Plane* bp = dynamic_cast<const Plane*>(&sur);
00102   if (bp != 0) return propagateWithPath( state, *bp);
00103   
00104   // if not plane try cylinder
00105   const Cylinder* bc = dynamic_cast<const Cylinder*>(&sur);
00106   if (bc != 0) return propagateWithPath( state, *bc);
00107 
00108   // unknown surface - can't do it!
00109   throw PropagationException("The surface is neither Cylinder nor Plane");
00110 }
00111 
00112 // default impl. avoids the need to redefinition in concrete
00113 // propagators that don't benefit from TSOS vs. FTS
00114 std::pair< TrajectoryStateOnSurface, double> 
00115 Propagator::propagateWithPath (const TrajectoryStateOnSurface& tsos, 
00116                                const Plane& sur) const
00117 {
00118   return propagateWithPath( *tsos.freeState(), sur);
00119 }
00120 
00121 // default impl. avoids the need to redefinition in concrete
00122 // propagators that don't benefit from TSOS vs. FTS
00123 std::pair< TrajectoryStateOnSurface, double> 
00124 Propagator::propagateWithPath (const TrajectoryStateOnSurface& tsos, 
00125                                const Cylinder& sur) const
00126 {
00127   return propagateWithPath( *tsos.freeState(), sur);
00128 }
00129 
00130 std::pair<FreeTrajectoryState, double> 
00131 Propagator::propagateWithPath(const FreeTrajectoryState& ftsStart, 
00132                               const GlobalPoint& pDest1, const GlobalPoint& pDest2) const{
00133   throw cms::Exception("Propagator::propagate(FTS,GlobalPoint,GlobalPoint) not implemented");
00134 }