ATLAS Offline Software
ExtrapolationTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ACTSGEOMETRY_ACTSEXTRAPOLATIONTOOL_H
6 #define ACTSGEOMETRY_ACTSEXTRAPOLATIONTOOL_H
7 
8 // ATHENA
11 #include "GaudiKernel/IInterface.h"
12 #include "GaudiKernel/ServiceHandle.h"
13 #include "Gaudi/Property.h"
14 #include "GaudiKernel/EventContext.h"
17 
18 // Need to include this early; otherwise, we run into errors with
19 // ReferenceWrapperAnyCompat in clang builds due the is_constructable
20 // specialization defined there getting implicitly instantiated earlier.
21 #include "Acts/Propagator/Propagator.hpp"
22 
23 // PACKAGE
27 
28 // ACTS
29 #include "Acts/MagneticField/ConstantBField.hpp"
30 #include "Acts/MagneticField/MagneticFieldContext.hpp"
31 #include "Acts/Propagator/detail/SteppingLogger.hpp"
32 #include "Acts/Propagator/StandardAborters.hpp"
33 #include "Acts/Propagator/SurfaceCollector.hpp"
34 #include "Acts/Utilities/Result.hpp"
35 #include "Acts/Definitions/Units.hpp"
36 #include "Acts/Utilities/Helpers.hpp"
37 #include "Acts/Utilities/Logger.hpp"
38 #include "Acts/Definitions/Tolerance.hpp"
39 
40 #include <cmath>
41 
42 namespace Acts {
43 class Surface;
44 class BoundaryCheck;
45 class Logger;
46 }
47 
48 
50  class VariantPropagator;
51 }
52 
53 namespace ActsTrk {
54 class ExtrapolationTool : public extends<AthAlgTool, IExtrapolationTool>
55 {
56 public:
57  virtual StatusCode initialize() override;
58 
59  ExtrapolationTool(const std::string& type,
60  const std::string& name,
61  const IInterface* parent);
62 
63 
65 
66 private:
67  // set up options for propagation
68  using SteppingLogger = Acts::detail::SteppingLogger;
69  using EndOfWorld = Acts::EndOfWorldReached;
70  using ResultType = Acts::Result<PropagationOutput>;
71 
72 
73 public:
74  virtual PropagationOutput
75  propagationSteps(const EventContext& ctx,
76  const Acts::BoundTrackParameters& startParameters,
77  Acts::Direction navDir = Acts::Direction::Forward(),
78  double pathLimit = std::numeric_limits<double>::max()) const override;
79 
80  virtual
81  std::optional<Acts::BoundTrackParameters>
82  propagate(const EventContext& ctx,
83  const Acts::BoundTrackParameters& startParameters,
84  Acts::Direction navDir = Acts::Direction::Forward(),
85  double pathLimit = std::numeric_limits<double>::max()) const override;
86 
87  virtual PropagationOutput
88  propagationSteps(const EventContext& ctx,
89  const Acts::BoundTrackParameters& startParameters,
90  const Acts::Surface& target,
91  Acts::Direction navDir = Acts::Direction::Forward(),
92  double pathLimit = std::numeric_limits<double>::max()) const override;
93 
94  virtual
95  std::optional<Acts::BoundTrackParameters>
96  propagate(const EventContext& ctx,
97  const Acts::BoundTrackParameters& startParameters,
98  const Acts::Surface& target,
99  Acts::Direction navDir = Acts::Direction::Forward(),
100  double pathLimit = std::numeric_limits<double>::max()) const override;
101 
102 
103  virtual
104  Acts::MagneticFieldContext
105  getMagneticFieldContext(const EventContext& ctx) const override;
106 
107  private:
108  const Acts::Logger& logger() const { return *m_logger; }
109 
110  std::unique_ptr<const ActsExtrapolationDetail::VariantPropagator> m_varProp;
111  std::unique_ptr<const Acts::Logger> m_logger{nullptr};
112 
113  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"};
114 
115  PublicToolHandle<ActsTrk::ITrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "ActsTrackingGeometryTool"};
116 
117  Gaudi::Property<std::string> m_fieldMode{this, "FieldMode", "ATLAS", "Either ATLAS or Constant or StraightLine"};
118  Gaudi::Property<std::vector<double>> m_constantFieldVector{this, "ConstantFieldVector", {0, 0, 0}, "Constant field value to use if FieldMode == Constant"};
119 
120  Gaudi::Property<double> m_ptLoopers{this, "PtLoopers", 300, "PT loop protection threshold. Will be converted to Acts MeV unit"};
121  Gaudi::Property<double> m_maxStepSize{this, "MaxStepSize", 10, "Max step size in Acts m unit"};
122  Gaudi::Property<unsigned> m_maxStep{this, "MaxSteps", 100000, "Max number of steps"};
123  Gaudi::Property<unsigned> m_maxSurfSkip{this, "MaxSurfaceSkip" ,100, "Maximum number of surfaces to be tried by the navigator"};
124  Gaudi::Property<double> m_surfTolerance{this, "OnSurfaceTolerance", Acts::s_onSurfaceTolerance,
125  "Tolerance to consider track parameters on surface"};
126  Gaudi::Property<unsigned> m_pathLimit{this, "PathLimit", 50, "Maximum path length to be considered during propagation in Acts m unit"};
127  // Material inteaction option
128  Gaudi::Property<bool> m_interactionMultiScatering{this, "InteractionMultiScatering", false, "Whether to consider multiple scattering in the interactor"};
129  Gaudi::Property<bool> m_interactionEloss{this, "InteractionEloss", false, "Whether to consider energy loss in the interactor"};
130  Gaudi::Property<bool> m_interactionRecord{this, "InteractionRecord", false, "Whether to record all material interactions"};
131 
132  template<typename OptionsType>
133  OptionsType
134  prepareOptions( const Acts::GeometryContext& gctx,
135  const Acts::MagneticFieldContext& mctx,
136  const Acts::BoundTrackParameters& startParameters,
137  Acts::Direction navDir,
138  double pathLimit) const;
139 };
140 }
141 #endif
ActsTrk::ExtrapolationTool::getMagneticFieldContext
virtual Acts::MagneticFieldContext getMagneticFieldContext(const EventContext &ctx) const override
Definition: ExtrapolationTool.cxx:319
ActsTrk::ExtrapolationTool::propagationSteps
virtual PropagationOutput propagationSteps(const EventContext &ctx, const Acts::BoundTrackParameters &startParameters, Acts::Direction navDir=Acts::Direction::Forward(), double pathLimit=std::numeric_limits< double >::max()) const override
Definition: ExtrapolationTool.cxx:127
ActsTrk::ExtrapolationTool::m_constantFieldVector
Gaudi::Property< std::vector< double > > m_constantFieldVector
Definition: ExtrapolationTool.h:118
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
ActsTrk::ExtrapolationTool::m_maxStepSize
Gaudi::Property< double > m_maxStepSize
Definition: ExtrapolationTool.h:121
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
ATLASMagneticFieldWrapper.h
ActsTrk::ExtrapolationTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
Definition: ExtrapolationTool.h:111
IExtrapolationTool.h
ActsTrk::ExtrapolationTool::m_trackingGeometryTool
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
Definition: ExtrapolationTool.h:115
ActsTrk::ExtrapolationTool::logger
const Acts::Logger & logger() const
Definition: ExtrapolationTool.h:108
PdgToParticleHypothesis.h
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ActsTrk::ExtrapolationTool::m_interactionRecord
Gaudi::Property< bool > m_interactionRecord
Definition: ExtrapolationTool.h:130
GeoPrimitives.h
ActsTrk::ExtrapolationTool
Definition: ExtrapolationTool.h:55
ActsTrk::ExtrapolationTool::m_maxStep
Gaudi::Property< unsigned > m_maxStep
Definition: ExtrapolationTool.h:122
Acts
Definition: MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODMuonPrepData/xAODMuonPrepData/UtilFunctions.h:20
ActsTrk::ExtrapolationTool::ResultType
Acts::Result< PropagationOutput > ResultType
Definition: ExtrapolationTool.h:70
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
ActsTrk::ExtrapolationTool::m_varProp
std::unique_ptr< const ActsExtrapolationDetail::VariantPropagator > m_varProp
Definition: ExtrapolationTool.h:110
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsTrk::ExtrapolationTool::~ExtrapolationTool
~ExtrapolationTool()
ActsTrk::ExtrapolationTool::m_interactionEloss
Gaudi::Property< bool > m_interactionEloss
Definition: ExtrapolationTool.h:129
ParticleHypothesis.h
ActsExtrapolationDetail
Definition: ExtrapolationTool.h:49
ActsTrk::ExtrapolationTool::m_surfTolerance
Gaudi::Property< double > m_surfTolerance
Definition: ExtrapolationTool.h:124
ActsExtrapolationDetail::VariantPropagator
Definition: ExtrapolationTool.cxx:50
ActsTrk::ExtrapolationTool::propagate
virtual std::optional< Acts::BoundTrackParameters > propagate(const EventContext &ctx, const Acts::BoundTrackParameters &startParameters, Acts::Direction navDir=Acts::Direction::Forward(), double pathLimit=std::numeric_limits< double >::max()) const override
Definition: ExtrapolationTool.cxx:187
ActsTrk::ExtrapolationTool::prepareOptions
OptionsType prepareOptions(const Acts::GeometryContext &gctx, const Acts::MagneticFieldContext &mctx, const Acts::BoundTrackParameters &startParameters, Acts::Direction navDir, double pathLimit) const
Definition: ExtrapolationTool.cxx:328
ActsTrk::ExtrapolationTool::m_fieldMode
Gaudi::Property< std::string > m_fieldMode
Definition: ExtrapolationTool.h:117
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ActsTrk::ExtrapolationTool::initialize
virtual StatusCode initialize() override
Definition: ExtrapolationTool.cxx:70
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
ActsTrk::ExtrapolationTool::SteppingLogger
Acts::detail::SteppingLogger SteppingLogger
Definition: ExtrapolationTool.h:68
ActsTrk::ExtrapolationTool::EndOfWorld
Acts::EndOfWorldReached EndOfWorld
Definition: ExtrapolationTool.h:69
copySelective.target
string target
Definition: copySelective.py:36
ITrackingGeometryTool.h
ActsTrk::ExtrapolationTool::m_maxSurfSkip
Gaudi::Property< unsigned > m_maxSurfSkip
Definition: ExtrapolationTool.h:123
ActsTrk::ExtrapolationTool::m_pathLimit
Gaudi::Property< unsigned > m_pathLimit
Definition: ExtrapolationTool.h:126
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MdtCalibInput.h:31
ActsTrk::ExtrapolationTool::m_ptLoopers
Gaudi::Property< double > m_ptLoopers
Definition: ExtrapolationTool.h:120
ActsTrk::ExtrapolationTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: ExtrapolationTool.h:113
ActsTrk::ExtrapolationTool::ExtrapolationTool
ExtrapolationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ExtrapolationTool.cxx:62
ActsTrk::ExtrapolationTool::m_interactionMultiScatering
Gaudi::Property< bool > m_interactionMultiScatering
Definition: ExtrapolationTool.h:128