ATLAS Offline Software
ActsExtrapolationTool.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 
39 #include <cmath>
40 
41 namespace Acts {
42 class Surface;
43 class BoundaryCheck;
44 class Logger;
45 }
46 
47 
49  class VariantPropagator;
50 }
51 
52 
53 class ActsExtrapolationTool : public extends<AthAlgTool, IActsExtrapolationTool>
54 {
55 public:
56  virtual StatusCode initialize() override;
57 
58  ActsExtrapolationTool(const std::string& type, const std::string& name,
59  const IInterface* parent);
60 
62 
63 private:
64  // set up options for propagation
65  using SteppingLogger = Acts::detail::SteppingLogger;
66  using EndOfWorld = Acts::EndOfWorldReached;
67  using ResultType = Acts::Result<ActsPropagationOutput>;
68 
69 
70 public:
71  virtual
73  propagationSteps(const EventContext& ctx,
74  const Acts::BoundTrackParameters& startParameters,
75  Acts::Direction navDir = Acts::Direction::Forward,
76  double pathLimit = std::numeric_limits<double>::max()) const override;
77 
78  virtual
79  std::optional<const Acts::CurvilinearTrackParameters>
80  propagate(const EventContext& ctx,
81  const Acts::BoundTrackParameters& startParameters,
82  Acts::Direction navDir = Acts::Direction::Forward,
83  double pathLimit = std::numeric_limits<double>::max()) const override;
84 
85  virtual
87  propagationSteps(const EventContext& ctx,
88  const Acts::BoundTrackParameters& startParameters,
89  const Acts::Surface& target,
90  Acts::Direction navDir = Acts::Direction::Forward,
91  double pathLimit = std::numeric_limits<double>::max()) const override;
92 
93  virtual
94  std::optional<const Acts::BoundTrackParameters>
95  propagate(const EventContext& ctx,
96  const Acts::BoundTrackParameters& startParameters,
97  const Acts::Surface& target,
98  Acts::Direction navDir = Acts::Direction::Forward,
99  double pathLimit = std::numeric_limits<double>::max()) const override;
100 
101  virtual
103  trackingGeometryTool() const override
104  {
105  return m_trackingGeometryTool.get();
106  }
107 
108 
109  virtual
110  Acts::MagneticFieldContext
111  getMagneticFieldContext(const EventContext& ctx) const override;
112 
113  private:
114  const Acts::Logger& logger() const { return *m_logger; }
115 
116 private:
117  std::unique_ptr<const ActsExtrapolationDetail::VariantPropagator> m_varProp;
118  std::unique_ptr<const Acts::Logger> m_logger{nullptr};
119 
120  SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj", "Name of the Magnetic Field conditions object key"};
121 
122  ToolHandle<IActsTrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "ActsTrackingGeometryTool"};
123 
124  Gaudi::Property<std::string> m_fieldMode{this, "FieldMode", "ATLAS", "Either ATLAS or Constant"};
125  Gaudi::Property<std::vector<double>> m_constantFieldVector{this, "ConstantFieldVector", {0, 0, 0}, "Constant field value to use if FieldMode == Constant"};
126 
127  Gaudi::Property<double> m_ptLoopers{this, "PtLoopers", 300, "PT loop protection threshold. Will be converted to Acts MeV unit"};
128  Gaudi::Property<double> m_maxStepSize{this, "MaxStepSize", 10, "Max step size in Acts m unit"};
129  Gaudi::Property<double> m_maxStep{this, "MaxSteps", 4000, "Max number of steps"};
130 
131  // Material inteaction option
132  Gaudi::Property<bool> m_interactionMultiScatering{this, "InteractionMultiScatering", false, "Whether to consider multiple scattering in the interactor"};
133  Gaudi::Property<bool> m_interactionEloss{this, "InteractionEloss", false, "Whether to consider energy loss in the interactor"};
134  Gaudi::Property<bool> m_interactionRecord{this, "InteractionRecord", false, "Whether to record all material interactions"};
135 };
136 
137 #endif
ActsExtrapolationTool::propagate
virtual std::optional< const Acts::CurvilinearTrackParameters > propagate(const EventContext &ctx, const Acts::BoundTrackParameters &startParameters, Acts::Direction navDir=Acts::Direction::Forward, double pathLimit=std::numeric_limits< double >::max()) const override
Definition: ActsExtrapolationTool.cxx:213
max
#define max(a, b)
Definition: cfImp.cxx:41
ActsExtrapolationTool::trackingGeometryTool
virtual const IActsTrackingGeometryTool * trackingGeometryTool() const override
Definition: ActsExtrapolationTool.h:103
ActsExtrapolationTool::ActsExtrapolationTool
ActsExtrapolationTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ActsExtrapolationTool.cxx:64
ActsExtrapolationTool::SteppingLogger
Acts::detail::SteppingLogger SteppingLogger
Definition: ActsExtrapolationTool.h:65
ActsExtrapolationTool::getMagneticFieldContext
virtual Acts::MagneticFieldContext getMagneticFieldContext(const EventContext &ctx) const override
Definition: ActsExtrapolationTool.cxx:377
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:7
ATLASMagneticFieldWrapper.h
ActsExtrapolationTool::ResultType
Acts::Result< ActsPropagationOutput > ResultType
Definition: ActsExtrapolationTool.h:67
PdgToParticleHypothesis.h
IActsTrackingGeometryTool
Definition: IActsTrackingGeometryTool.h:18
ActsExtrapolationTool::propagationSteps
virtual ActsPropagationOutput propagationSteps(const EventContext &ctx, const Acts::BoundTrackParameters &startParameters, Acts::Direction navDir=Acts::Direction::Forward, double pathLimit=std::numeric_limits< double >::max()) const override
Definition: ActsExtrapolationTool.cxx:139
ActsExtrapolationTool::logger
const Acts::Logger & logger() const
Definition: ActsExtrapolationTool.h:114
GeoPrimitives.h
ActsExtrapolationTool::m_maxStep
Gaudi::Property< double > m_maxStep
Definition: ActsExtrapolationTool.h:129
Acts
Definition: MultiTrajectory.h:45
ActsExtrapolationTool::~ActsExtrapolationTool
~ActsExtrapolationTool()
Definition: ActsExtrapolationTool.cxx:71
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsExtrapolationTool::m_ptLoopers
Gaudi::Property< double > m_ptLoopers
Definition: ActsExtrapolationTool.h:127
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ActsExtrapolationTool::m_trackingGeometryTool
ToolHandle< IActsTrackingGeometryTool > m_trackingGeometryTool
Definition: ActsExtrapolationTool.h:122
ParticleHypothesis.h
ActsExtrapolationTool::m_interactionMultiScatering
Gaudi::Property< bool > m_interactionMultiScatering
Definition: ActsExtrapolationTool.h:132
ActsExtrapolationTool::initialize
virtual StatusCode initialize() override
Definition: ActsExtrapolationTool.cxx:77
ActsExtrapolationDetail
Definition: ActsExtrapolationTool.h:48
ActsExtrapolationDetail::VariantPropagator
Definition: ActsExtrapolationTool.cxx:54
ActsExtrapolationTool::m_interactionRecord
Gaudi::Property< bool > m_interactionRecord
Definition: ActsExtrapolationTool.h:134
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ActsExtrapolationTool::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: ActsExtrapolationTool.h:120
ActsExtrapolationTool::m_interactionEloss
Gaudi::Property< bool > m_interactionEloss
Definition: ActsExtrapolationTool.h:133
ActsExtrapolationTool::m_fieldMode
Gaudi::Property< std::string > m_fieldMode
Definition: ActsExtrapolationTool.h:124
ActsExtrapolationTool::m_varProp
std::unique_ptr< const ActsExtrapolationDetail::VariantPropagator > m_varProp
Definition: ActsExtrapolationTool.h:117
ActsExtrapolationTool::m_maxStepSize
Gaudi::Property< double > m_maxStepSize
Definition: ActsExtrapolationTool.h:128
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
ActsExtrapolationTool
Definition: ActsExtrapolationTool.h:54
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ActsExtrapolationTool::m_logger
std::unique_ptr< const Acts::Logger > m_logger
Definition: ActsExtrapolationTool.h:118
ActsExtrapolationTool::m_constantFieldVector
Gaudi::Property< std::vector< double > > m_constantFieldVector
Definition: ActsExtrapolationTool.h:125
COOLRates.target
target
Definition: COOLRates.py:1106
IActsTrackingGeometryTool.h
ActsPropagationOutput
std::pair< std::vector< Acts::detail::Step >, ActsRecordedMaterial > ActsPropagationOutput
Finally the output of the propagation test.
Definition: IActsExtrapolationTool.h:25
IActsExtrapolationTool.h
ActsExtrapolationTool::EndOfWorld
Acts::EndOfWorldReached EndOfWorld
Definition: ActsExtrapolationTool.h:66