CMS 3D CMS Logo

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