ATLAS Offline Software
IntersectorWrapper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3  */
4 
6 // wrapper to IIntersector tool to provide IPropagator functionality
7 // default configuration wraps the RungeKutta intersector
8 // (c) ATLAS Detector software
10 
11 #ifndef TRKEXRUNGEKUTTAINTERSECTOR_INTERSECTORWRAPPER_H
12 #define TRKEXRUNGEKUTTAINTERSECTOR_INTERSECTORWRAPPER_H
13 
15 #include "GaudiKernel/ToolHandle.h"
18 
19 namespace Trk {
20 class IIntersector;
21 class TrackSurfaceIntersection;
22 
23 class IntersectorWrapper final
24  : public AthAlgTool
25  , virtual public IPropagator
26 {
27 
28 public:
29  IntersectorWrapper(const std::string& type,
30  const std::string& name,
31  const IInterface* parent);
32  ~IntersectorWrapper(void); // destructor
33 
34  virtual StatusCode initialize() override final;
35  virtual StatusCode finalize() override final;
36 
41  virtual std::unique_ptr<NeutralParameters> propagate(
43  const Surface&,
46  bool) const override final;
53  virtual std::unique_ptr<TrackParameters> propagate(
54  const EventContext& ctx,
55  const TrackParameters& parm,
56  const Surface& sf,
58  const BoundaryCheck& bcheck,
61  bool returnCurv,
62  const TrackingVolume*) const override final;
63 
68  virtual std::unique_ptr<TrackParameters> propagate(
69  const EventContext&,
71  std::vector<DestSurf>&,
75  std::vector<unsigned int>&,
76  double&,
77  bool,
78  bool,
79  const TrackingVolume*) const override final
80  {
81  ATH_MSG_ERROR("Call to non-implemented propagate");
82  return nullptr;
83  }
84 
85  // unimplemented propagateT
86  virtual std::unique_ptr<TrackParameters> propagateT(
87  const EventContext&,
88  const TrackParameters&,
89  std::vector<DestSurf>&,
93  std::vector<unsigned int>&,
94  PathLimit&,
95  TimeLimit&,
96  bool,
97  const TrackingVolume*,
98  std::vector<Trk::HitInfo>*&) const override final
99  {
100  ATH_MSG_ERROR("Call to non-implemented propagate");
101  return nullptr;
102  }
103 
107  virtual std::unique_ptr<TrackParameters> propagate(
108  const EventContext& ctx,
109  const TrackParameters&,
110  const Surface&,
112  const BoundaryCheck&,
114  std::optional<TransportJacobian>&,
115  double&,
117  bool,
118  const TrackingVolume*) const override final;
119 
123  virtual std::unique_ptr<TrackParameters> propagateParameters(
124  const EventContext& ctx,
125  const TrackParameters& parm,
126  const Surface& sf,
128  const BoundaryCheck& bcheck,
129  const MagneticFieldProperties& mprop,
131  bool returnCurv = false,
132  const TrackingVolume* tVol = nullptr) const override final;
133 
135  virtual std::unique_ptr<TrackParameters> propagateParameters(
136  const EventContext& ctx,
137  const TrackParameters& parm,
138  const Surface& sf,
140  const BoundaryCheck& bcheck,
142  std::optional<TransportJacobian>&,
144  bool returnCurv = false,
145  const TrackingVolume* tVol = nullptr) const override final;
146 
151  virtual std::optional<Trk::TrackSurfaceIntersection> intersect(
152  const EventContext& ctx,
153  const TrackParameters& parm,
154  const Surface& sf,
157  const TrackingVolume* tVol = nullptr) const override final;
158 
159  // unimplemented globalPositions
160  virtual void globalPositions(const EventContext&,
161  std::deque<Amg::Vector3D>&,
165  double,
167  const TrackingVolume*) const override final
168  {
169  ATH_MSG_ERROR("Call to non-implemented globalPositions");
170  return;
171  }
172 
173  // unimplemented intersectSurface
174  virtual std::optional<TrackSurfaceIntersection> intersectSurface(
175  const EventContext&,
176  const Surface&,
178  const double,
180  ParticleHypothesis) const override final
181  {
182  ATH_MSG_ERROR("Call to non-implemented intersectSurface");
183  return std::nullopt;
184  }
186  virtual std::unique_ptr<Trk::TrackParameters> propagateM(
187  const EventContext&,
188  const TrackParameters&,
189  std::vector<DestSurf>&,
193  std::vector<unsigned int>&,
194  std::vector<const Trk::TrackStateOnSurface*>*&,
195  std::vector<std::pair<std::unique_ptr<Trk::TrackParameters>, int>>*,
196  double&,
197  bool,
198  bool,
199  const Trk::TrackingVolume*,
200  Trk::ExtrapolationCache*) const override final
201  {
202  ATH_MSG_ERROR("Call to non-implemented propagateM");
203  return nullptr;
204  }
207  const EventContext&,
208  const MultiComponentState&,
209  const Surface&,
211  const PropDirection,
212  const BoundaryCheck&,
213  const ParticleHypothesis) const override final
214  {
215  ATH_MSG_ERROR("Call to non-implemented multiStatePropagate");
216  return {};
217  }
218 
220  const EventContext&,
223  Trk::TargetSurfaceVector&) const override final
224  {
226  }
227 
228 private:
229  struct Cache
230  {
231  double m_charge;
232  double m_qOverP;
233  std::optional<TrackSurfaceIntersection> m_intersection;
234  std::unique_ptr<TrackParameters> m_parameters;
237 
239  : m_charge{}
240  , m_qOverP{}
241  , m_intersection{ std::nullopt }
242  , m_parameters{ nullptr }
243  , m_position{}
244  , m_momentum{}
245  {
246  }
247  };
248  // private methods
249  void createParameters(Cache& cache,
250  const Surface& surface,
251  const BoundaryCheck& boundsCheck,
252  bool curvilinear) const;
253  void findIntersection(Cache& cache,
255  const Surface& surface,
257 
258  // helpers, managers, tools
259  ToolHandle<IIntersector> m_intersector;
260  ToolHandle<IPropagator> m_linePropagator;
261 };
262 
263 } // end of namespace
264 
265 #endif // TRKEXRUNGEKUTTAINTERSECTOR_INTERSECTORWRAPPER_H
Trk::anyDirection
@ anyDirection
Definition: PropDirection.h:22
Trk::TransportJacobian
Definition: TransportJacobian.h:46
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
Trk::IntersectorWrapper::propagateParameters
virtual std::unique_ptr< TrackParameters > propagateParameters(const EventContext &ctx, const TrackParameters &parm, const Surface &sf, PropDirection dir, const BoundaryCheck &bcheck, const MagneticFieldProperties &mprop, ParticleHypothesis particle=pion, bool returnCurv=false, const TrackingVolume *tVol=nullptr) const override final
Propagation interface without Covariance matrix propagation the pathlength has to be returned for eve...
Definition: IntersectorWrapper.cxx:116
Trk::MagneticFieldProperties
Definition: MagneticFieldProperties.h:31
Trk::IntersectorWrapper::Cache::m_position
Amg::Vector3D m_position
Definition: IntersectorWrapper.h:235
Trk::IntersectorWrapper::Cache::m_qOverP
double m_qOverP
Definition: IntersectorWrapper.h:232
Trk::IntersectorWrapper::intersectSurface
virtual std::optional< TrackSurfaceIntersection > intersectSurface(const EventContext &, const Surface &, const TrackSurfaceIntersection &, const double, const MagneticFieldProperties &, ParticleHypothesis) const override final
Intersection and Intersector interface:
Definition: IntersectorWrapper.h:174
Trk::IntersectorWrapper::createParameters
void createParameters(Cache &cache, const Surface &surface, const BoundaryCheck &boundsCheck, bool curvilinear) const
Definition: IntersectorWrapper.cxx:168
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
Trk::IntersectorWrapper
Definition: IntersectorWrapper.h:26
Trk::IntersectorWrapper::initialize
virtual StatusCode initialize() override final
Definition: IntersectorWrapper.cxx:50
IPropagator.h
Trk::TrackSurfaceIntersection
Definition: TrackSurfaceIntersection.h:32
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Trk::IntersectorWrapper::~IntersectorWrapper
~IntersectorWrapper(void)
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
GeoPrimitives.h
Trk::PropDirection
PropDirection
Definition: PropDirection.h:19
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::IntersectorWrapper::m_intersector
ToolHandle< IIntersector > m_intersector
Definition: IntersectorWrapper.h:259
Trk::IPropagator
Definition: IPropagator.h:55
Trk::IntersectorWrapper::Cache::m_momentum
Amg::Vector3D m_momentum
Definition: IntersectorWrapper.h:236
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
Trk::CylinderBounds
Definition: CylinderBounds.h:46
Trk::pion
@ pion
Definition: ParticleHypothesis.h:29
AthAlgTool.h
Trk::ExtrapolationCode
Definition: ExtrapolationCell.h:105
Trk::IntersectorWrapper::multiStatePropagate
virtual Trk::MultiComponentState multiStatePropagate(const EventContext &, const MultiComponentState &, const Surface &, const MagneticFieldProperties &, const PropDirection, const BoundaryCheck &, const ParticleHypothesis) const override final
unimplemented multiStatePropagate
Definition: IntersectorWrapper.h:206
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Trk::MultiComponentState
std::vector< ComponentParameters > MultiComponentState
Definition: ComponentParameters.h:27
Trk::IntersectorWrapper::Cache::m_intersection
std::optional< TrackSurfaceIntersection > m_intersection
Definition: IntersectorWrapper.h:233
Trk::IntersectorWrapper::intersect
virtual std::optional< Trk::TrackSurfaceIntersection > intersect(const EventContext &ctx, const TrackParameters &parm, const Surface &sf, const MagneticFieldProperties &mprop, ParticleHypothesis particle=pion, const TrackingVolume *tVol=nullptr) const override final
Intersection interface: The intersection interface might be used by the material service as well to e...
Definition: IntersectorWrapper.cxx:152
Trk::IntersectorWrapper::propagateM
virtual std::unique_ptr< Trk::TrackParameters > propagateM(const EventContext &, const TrackParameters &, std::vector< DestSurf > &, PropDirection, const MagneticFieldProperties &, ParticleHypothesis, std::vector< unsigned int > &, std::vector< const Trk::TrackStateOnSurface * > *&, std::vector< std::pair< std::unique_ptr< Trk::TrackParameters >, int >> *, double &, bool, bool, const Trk::TrackingVolume *, Trk::ExtrapolationCache *) const override final
unimplemented propagateM
Definition: IntersectorWrapper.h:186
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::IntersectorWrapper::propagateT
virtual std::unique_ptr< TrackParameters > propagateT(const EventContext &, const TrackParameters &, std::vector< DestSurf > &, PropDirection, const MagneticFieldProperties &, ParticleHypothesis, std::vector< unsigned int > &, PathLimit &, TimeLimit &, bool, const TrackingVolume *, std::vector< Trk::HitInfo > *&) const override final
Propagate parameters and covariance with search of closest surface time included.
Definition: IntersectorWrapper.h:86
Trk::DestSurf
std::pair< const Surface *, BoundaryCheck > DestSurf
typedef for input surfaces, boundary check
Definition: IPropagator.h:45
Trk::TimeLimit
Definition: HelperStructs.h:58
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::IntersectorWrapper::m_linePropagator
ToolHandle< IPropagator > m_linePropagator
Definition: IntersectorWrapper.h:260
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::IntersectorWrapper::finalize
virtual StatusCode finalize() override final
Definition: IntersectorWrapper.cxx:64
Trk::IntersectorWrapper::findIntersection
void findIntersection(Cache &cache, const TrackParameters &parameters, const Surface &surface, PropDirection dir=Trk::anyDirection) const
Definition: IntersectorWrapper.cxx:194
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::TrackParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:27
Trk::PathLimit
Definition: HelperStructs.h:34
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::ExtrapolationCode::FailureConfiguration
@ FailureConfiguration
Definition: ExtrapolationCell.h:124
Trk::IntersectorWrapper::globalPositions
virtual void globalPositions(const EventContext &, std::deque< Amg::Vector3D > &, const TrackParameters &, const MagneticFieldProperties &, const CylinderBounds &, double, ParticleHypothesis, const TrackingVolume *) const override final
GlobalPositions list interface: This is used mostly in pattern recognition in the road finder,...
Definition: IntersectorWrapper.h:160
Trk::IntersectorWrapper::Cache::m_parameters
std::unique_ptr< TrackParameters > m_parameters
Definition: IntersectorWrapper.h:234
Trk::IntersectorWrapper::Cache
Definition: IntersectorWrapper.h:230
Trk::ExtrapolationCell
Definition: ExtrapolationCell.h:231
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
Trk::TargetSurfaceVector
std::vector< TargetSurface > TargetSurfaceVector
Definition: TargetSurfaces.h:121
Trk::BoundaryCheck
Definition: BoundaryCheck.h:51
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::TargetSurfaces
Definition: TargetSurfaces.h:126
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
Trk::IntersectorWrapper::propagate
virtual std::unique_ptr< NeutralParameters > propagate(const NeutralParameters &, const Surface &, PropDirection, const BoundaryCheck &, bool) const override final
N 0) Neutral parameters method
Definition: IntersectorWrapper.cxx:70
Trk::IntersectorWrapper::Cache::Cache
Cache()
Definition: IntersectorWrapper.h:238
AthAlgTool
Definition: AthAlgTool.h:26
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
Trk::IntersectorWrapper::IntersectorWrapper
IntersectorWrapper(const std::string &type, const std::string &name, const IInterface *parent)
Definition: IntersectorWrapper.cxx:32
Trk::TrackingVolume
Definition: TrackingVolume.h:121
Trk::ExtrapolationCache
Definition: ExtrapolationCache.h:26
Trk::IntersectorWrapper::propagate
virtual Trk::ExtrapolationCode propagate(const EventContext &, Trk::ExCellCharged &, Trk::TargetSurfaces &, Trk::TargetSurfaceVector &) const override final
Propagation method needed for StepEngine.
Definition: IntersectorWrapper.h:219
Trk::IntersectorWrapper::Cache::m_charge
double m_charge
Definition: IntersectorWrapper.h:231