Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:30

0001 #include "TrackingTools/GsfTools/interface/GsfPropagatorAdapter.h"
0002 
0003 #include "TrackingTools/GsfTools/src/MultiStatePropagation.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 
0006 #include <atomic>
0007 
0008 GsfPropagatorAdapter::GsfPropagatorAdapter(const Propagator& aPropagator)
0009     : Propagator(aPropagator.propagationDirection()), thePropagator(aPropagator.clone()) {}
0010 
0011 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorAdapter::propagateWithPath(
0012     const TrajectoryStateOnSurface& tsos, const Plane& plane) const {
0013   MultiStatePropagation<Plane> multiPropagator(*thePropagator);
0014   return multiPropagator.propagateWithPath(tsos, plane);
0015 }
0016 
0017 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorAdapter::propagateWithPath(
0018     const TrajectoryStateOnSurface& tsos, const Cylinder& cylinder) const {
0019   MultiStatePropagation<Cylinder> multiPropagator(*thePropagator);
0020   return multiPropagator.propagateWithPath(tsos, cylinder);
0021 }
0022 
0023 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorAdapter::propagateWithPath(const FreeTrajectoryState& fts,
0024                                                                                     const Plane& plane) const {
0025   /// use counter in MessageLogger?
0026   static std::atomic<int> nWarn{0};
0027   if (nWarn++ < 5)
0028     edm::LogInfo("GsfPropagatorAdapter") << "GsfPropagator used from FTS = single state mode!";
0029   return thePropagator->propagateWithPath(fts, plane);
0030 }
0031 
0032 std::pair<TrajectoryStateOnSurface, double> GsfPropagatorAdapter::propagateWithPath(const FreeTrajectoryState& fts,
0033                                                                                     const Cylinder& cylinder) const {
0034   /// use counter in MessageLogger?
0035   static std::atomic<int> nWarn{0};
0036   if (nWarn++ < 5)
0037     edm::LogInfo("GsfPropagatorAdapter") << "GsfPropagator used from FTS = single state mode!";
0038   return thePropagator->propagateWithPath(fts, cylinder);
0039 }
0040 
0041 void GsfPropagatorAdapter::setPropagationDirection(PropagationDirection dir) {
0042   thePropagator->setPropagationDirection(dir);
0043   Propagator::setPropagationDirection(dir);
0044 }