ATLAS Offline Software
Loading...
Searching...
No Matches
ActsGeantFollowerHelper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ActsGeantFollowerHelper_H
6#define ActsGeantFollowerHelper_H
7
9
11
12#include "TrkParameters/TrackParameters.h" //typedef, can't fwd declare
14#include "G4ThreeVector.hh" //typedef, can't fwd declare
17
18#include "Acts/Surfaces/Surface.hpp"
19#include "Acts/EventData/BoundTrackParameters.hpp"
20#include "Acts/Propagator/SurfaceCollector.hpp"
24// FIXME: header-global macro for an array size constant!
25#ifndef MAXPROBES
26#define MAXPROBES 50000
27#endif
28
29class TTree;
30
31namespace Trk {
32 class IExtrapolator;
33} // namespace Trk
34
35
36class ActsGeantFollowerHelper : public extends<AthAlgTool, IActsGeantFollowerHelper> {
37
38 public:
39 // constructor, destructor
40 ActsGeantFollowerHelper(const std::string&,const std::string&,const IInterface*);
41 virtual ~ActsGeantFollowerHelper() = default;
42
43 // Athena hooks
44 virtual StatusCode initialize() override;
45 virtual StatusCode finalize () override;
46
47 // Follower interface
48 // a) begin event - initialize follower process
49 virtual void beginEvent() override;
50 // b) track the particle
51 virtual void trackParticle(const G4ThreeVector& pos, const G4ThreeVector& mom, int pdg, double charge, float t, float X0, bool isSensitive) override;
52 // c) end event - ntuple writing
53 virtual void endEvent() override;
54
55 private:
56
57 ServiceHandle<ActsTrk::ITrackingGeometrySvc> m_trackingGeometrySvc{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};
60
61
62 ToolHandle<Trk::IExtrapolationEngine> m_extrapolationEngine{this, "ExtrapolationEngine", ""};
63 ToolHandle<ActsTrk::IExtrapolationTool> m_actsExtrapolator{this, "ActsExtrapolator", ""};
64 Gaudi::Property<bool> m_extrapolateDirectly{this, "ExtrapolateDirectly", true};
65 Gaudi::Property<bool> m_extrapolateIncrementally{this, "ExtrapolateIncrementally", true};
66
67 std::unique_ptr<Trk::TrackParameters> m_parameterCache{nullptr};
68 std::optional<Acts::BoundTrackParameters> m_actsParameterCache{std::nullopt};
69 std::unique_ptr<std::vector<Acts::SurfaceHit>> m_actsSurfaceCache{};
70 std::vector<Acts::SurfaceHit>::iterator m_actsSurfaceIterator{};
71 // Hypothesis to pdg converter
73 float m_tX0Cache{0.f};
76 float m_tX0CacheActs{0.f};
77 float m_tX0CacheATLAS{0.f};
78
79 // put some validation code is
83
84 TTree* m_validationTree{nullptr};
89 struct TreeData {
90 float m_t_x {0};
91 float m_t_y {0};
92 float m_t_z {0};
93 float m_t_theta {0};
94 float m_t_eta {0};
95 float m_t_phi {0};
96 float m_t_p {0};
97 float m_t_charge {0};
98 int m_t_pdg {0};
100 int m_g4_steps {0};
101 float m_g4_pt[MAXPROBES] {0};
102 float m_g4_eta[MAXPROBES] {0};
104 float m_g4_phi[MAXPROBES] {0};
105 float m_g4_x[MAXPROBES] {0};
106 float m_g4_y[MAXPROBES] {0};
107 float m_g4_z[MAXPROBES] {0};
108 float m_g4_tX0[MAXPROBES] {0};
110 float m_g4_t[MAXPROBES] {0};
111 float m_g4_X0[MAXPROBES] {0};
114 float m_trk_pt[MAXPROBES] {0};
118 float m_trk_x[MAXPROBES] {0};
119 float m_trk_y[MAXPROBES] {0};
120 float m_trk_z[MAXPROBES] {0};
121 float m_trk_lx[MAXPROBES] {0};
122 float m_trk_ly[MAXPROBES] {0};
125 float m_trk_t[MAXPROBES] {0};
126 float m_trk_X0[MAXPROBES] {0};
134 float m_acts_x[MAXPROBES] {0};
135 float m_acts_y[MAXPROBES] {0};
136 float m_acts_z[MAXPROBES] {0};
139 float m_acts_t[MAXPROBES] {0};
141 };
142 std::unique_ptr<TreeData> m_treeData;
143};
144
145#endif
#define MAXPROBES
double charge(const T &p)
Definition AtlasPID.h:997
std::string m_validationTreeFolder
stream/folder to for the TTree to be written out
virtual StatusCode finalize() override
std::string m_validationTreeName
validation tree name - to be acessed by this from root
ToolHandle< ActsTrk::IExtrapolationTool > m_actsExtrapolator
Trk::PdgToParticleHypothesis m_pdgToParticleHypothesis
std::vector< Acts::SurfaceHit >::iterator m_actsSurfaceIterator
std::string m_validationTreeDescription
validation tree description - second argument in TTree
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
TTree * m_validationTree
Root Validation Tree.
ToolHandle< Trk::IExtrapolationEngine > m_extrapolationEngine
virtual void trackParticle(const G4ThreeVector &pos, const G4ThreeVector &mom, int pdg, double charge, float t, float X0, bool isSensitive) override
std::unique_ptr< std::vector< Acts::SurfaceHit > > m_actsSurfaceCache
std::unique_ptr< TreeData > m_treeData
std::unique_ptr< Trk::TrackParameters > m_parameterCache
ActsTrk::ContextUtility m_ctxProvider
Context provider for geometry, magnetic field and calibration contexts.
Gaudi::Property< bool > m_extrapolateDirectly
virtual void endEvent() override
virtual ~ActsGeantFollowerHelper()=default
std::optional< Acts::BoundTrackParameters > m_actsParameterCache
Gaudi::Property< bool > m_extrapolateIncrementally
virtual void beginEvent() override
ActsGeantFollowerHelper(const std::string &, const std::string &, const IInterface *)
virtual StatusCode initialize() override
Utility class to handle the three contexts neeeded in an ACTS reconstruction job 1) GeometryContext -...
small converter from the (abs) PDG code to the particle hypothsis used in Tracking
Ensure that the ATLAS eigen extensions are properly loaded.
Ntuple variables : initial parameters Split this out into a separate, dynamically-allocated block.
int m_g4_steps
Ntuple variables : g4 step parameters.
int m_trk_status[MAXPROBES]
Ntuple variables : trk follow up parameters.
int m_acts_status[MAXPROBES]
Ntuple variables : acts follow up parameters.