ATLAS Offline Software
ActsGeantFollowerHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ActsGeantFollowerHelper_H
6 #define ActsGeantFollowerHelper_H
7 
9 #include "GaudiKernel/ToolHandle.h"
10 #include "TrkParameters/TrackParameters.h" //typedef, can't fwd declare
12 #include "G4ThreeVector.hh" //typedef, can't fwd declare
15 
16 #include "Acts/Surfaces/Surface.hpp"
17 #include "Acts/EventData/TrackParameters.hpp"
18 #include "Acts/Propagator/SurfaceCollector.hpp"
19 
20 // FIXME: header-global macro for an array size constant!
21 #ifndef MAXPROBES
22 #define MAXPROBES 50000
23 #endif
24 
25 class TTree;
26 
27 namespace Trk
28 {
29  class IExtrapolator;
30  class IExtrapolationEngine;
31 } // namespace Trk
32 
34 
35 class ActsGeantFollowerHelper : public extends<AthAlgTool, IActsGeantFollowerHelper>
36 {
37 
38  public:
39  // constructor, destructor
40  ActsGeantFollowerHelper(const std::string&,const std::string&,const IInterface*);
41  virtual ~ActsGeantFollowerHelper ();
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  // ToolHandle<Trk::IExtrapolator> m_extrapolator;
58  ToolHandle<Trk::IExtrapolationEngine> m_extrapolationEngine;
59  ToolHandle<IActsExtrapolationTool> m_actsExtrapolator;
62 
64  std::optional<Acts::BoundTrackParameters> m_actsParameterCache;
65  std::unique_ptr<std::vector<Acts::SurfaceHit>> m_actsSurfaceCache;
67  // Hypothesis to pdg converter
69  float m_tX0Cache;
74 
75  // put some validation code is
76  std::string m_validationTreeName;
78  std::string m_validationTreeFolder;
79 
81 
85  struct TreeData {
86  float m_t_x {0};
87  float m_t_y {0};
88  float m_t_z {0};
89  float m_t_theta {0};
90  float m_t_eta {0};
91  float m_t_phi {0};
92  float m_t_p {0};
93  float m_t_charge {0};
94  int m_t_pdg {0};
96  int m_g4_steps {0};
97  float m_g4_pt[MAXPROBES] {0};
98  float m_g4_eta[MAXPROBES] {0};
99  float m_g4_theta[MAXPROBES] {0};
100  float m_g4_phi[MAXPROBES] {0};
101  float m_g4_x[MAXPROBES] {0};
102  float m_g4_y[MAXPROBES] {0};
103  float m_g4_z[MAXPROBES] {0};
104  float m_g4_tX0[MAXPROBES] {0};
105  float m_g4_accX0[MAXPROBES] {0};
106  float m_g4_t[MAXPROBES] {0};
107  float m_g4_X0[MAXPROBES] {0};
110  float m_trk_pt[MAXPROBES] {0};
111  float m_trk_eta[MAXPROBES] {0};
112  float m_trk_theta[MAXPROBES] {0};
113  float m_trk_phi[MAXPROBES] {0};
114  float m_trk_x[MAXPROBES] {0};
115  float m_trk_y[MAXPROBES] {0};
116  float m_trk_z[MAXPROBES] {0};
117  float m_trk_lx[MAXPROBES] {0};
118  float m_trk_ly[MAXPROBES] {0};
119  float m_trk_tX0[MAXPROBES] {0};
120  float m_trk_accX0[MAXPROBES] {0};
121  float m_trk_t[MAXPROBES] {0};
122  float m_trk_X0[MAXPROBES] {0};
126  float m_acts_pt[MAXPROBES] {0};
127  float m_acts_eta[MAXPROBES] {0};
129  float m_acts_phi[MAXPROBES] {0};
130  float m_acts_x[MAXPROBES] {0};
131  float m_acts_y[MAXPROBES] {0};
132  float m_acts_z[MAXPROBES] {0};
133  float m_acts_tX0[MAXPROBES] {0};
135  float m_acts_t[MAXPROBES] {0};
136  float m_acts_X0[MAXPROBES] {0};
137  };
138  std::unique_ptr<TreeData> m_treeData;
139 };
140 
141 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
ActsGeantFollowerHelper::TreeData::m_g4_accX0
float m_g4_accX0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:105
ActsGeantFollowerHelper::TreeData::m_trk_eta
float m_trk_eta[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:111
ActsGeantFollowerHelper::m_extrapolateIncrementally
bool m_extrapolateIncrementally
Definition: ActsGeantFollowerHelper.h:61
ActsGeantFollowerHelper::TreeData::m_t_y
float m_t_y
Definition: ActsGeantFollowerHelper.h:87
TrackParameters.h
ActsGeantFollowerHelper::TreeData::m_g4_eta
float m_g4_eta[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:98
ActsGeantFollowerHelper::~ActsGeantFollowerHelper
virtual ~ActsGeantFollowerHelper()
Definition: ActsGeantFollowerHelper.cxx:62
ActsGeantFollowerHelper::TreeData::m_trk_theta
float m_trk_theta[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:112
ActsGeantFollowerHelper::TreeData
Ntuple variables : initial parameters Split this out into a separate, dynamically-allocated block.
Definition: ActsGeantFollowerHelper.h:85
ActsGeantFollowerHelper::TreeData::m_t_eta
float m_t_eta
Definition: ActsGeantFollowerHelper.h:90
ActsGeantFollowerHelper::m_extrapolateDirectly
bool m_extrapolateDirectly
Definition: ActsGeantFollowerHelper.h:60
ActsGeantFollowerHelper::TreeData::m_acts_x
float m_acts_x[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:130
ActsGeantFollowerHelper::m_actsSurfaceIterator
std::vector< Acts::SurfaceHit >::iterator m_actsSurfaceIterator
Definition: ActsGeantFollowerHelper.h:66
ActsGeantFollowerHelper::m_tX0CacheATLAS
float m_tX0CacheATLAS
Definition: ActsGeantFollowerHelper.h:73
ActsGeantFollowerHelper::m_treeData
std::unique_ptr< TreeData > m_treeData
Definition: ActsGeantFollowerHelper.h:138
ActsGeantFollowerHelper::beginEvent
virtual void beginEvent() override
Definition: ActsGeantFollowerHelper.cxx:160
ActsGeantFollowerHelper::TreeData::m_acts_z
float m_acts_z[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:132
ActsGeantFollowerHelper::initialize
virtual StatusCode initialize() override
Definition: ActsGeantFollowerHelper.cxx:67
ActsGeantFollowerHelper::TreeData::m_trk_x
float m_trk_x[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:114
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ActsGeantFollowerHelper::TreeData::m_acts_theta
float m_acts_theta[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:128
ActsGeantFollowerHelper::TreeData::m_trk_lx
float m_trk_lx[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:117
ActsGeantFollowerHelper::TreeData::m_g4_steps
int m_g4_steps
Ntuple variables : g4 step parameters.
Definition: ActsGeantFollowerHelper.h:96
PdgToParticleHypothesis.h
ActsGeantFollowerHelper::TreeData::m_acts_phi
float m_acts_phi[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:129
ActsGeantFollowerHelper::m_actsExtrapolator
ToolHandle< IActsExtrapolationTool > m_actsExtrapolator
Definition: ActsGeantFollowerHelper.h:59
ActsGeantFollowerHelper::TreeData::m_trk_y
float m_trk_y[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:115
ActsGeantFollowerHelper::m_tX0Cache
float m_tX0Cache
Definition: ActsGeantFollowerHelper.h:69
ActsGeantFollowerHelper::TreeData::m_trk_status
int m_trk_status[MAXPROBES]
Ntuple variables : trk follow up parameters.
Definition: ActsGeantFollowerHelper.h:109
ActsGeantFollowerHelper::m_tX0NonSensitiveCache
float m_tX0NonSensitiveCache
Definition: ActsGeantFollowerHelper.h:70
IActsExtrapolationTool
Definition: IActsExtrapolationTool.h:31
ActsGeantFollowerHelper::m_parameterCache
Trk::TrackParameters * m_parameterCache
Definition: ActsGeantFollowerHelper.h:63
ActsGeantFollowerHelper::ActsGeantFollowerHelper
ActsGeantFollowerHelper(const std::string &, const std::string &, const IInterface *)
Definition: ActsGeantFollowerHelper.cxx:36
ActsGeantFollowerHelper::finalize
virtual StatusCode finalize() override
Definition: ActsGeantFollowerHelper.cxx:155
pdg_comparison.X0
X0
Definition: pdg_comparison.py:314
IActsGeantFollowerHelper.h
ActsGeantFollowerHelper::TreeData::m_trk_X0
float m_trk_X0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:122
ActsGeantFollowerHelper::TreeData::m_trk_ly
float m_trk_ly[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:118
ActsGeantFollowerHelper::TreeData::m_acts_t
float m_acts_t[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:135
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
ActsGeantFollowerHelper::endEvent
virtual void endEvent() override
Definition: ActsGeantFollowerHelper.cxx:379
ActsGeantFollowerHelper::TreeData::m_t_phi
float m_t_phi
Definition: ActsGeantFollowerHelper.h:91
ActsGeantFollowerHelper::TreeData::m_g4_phi
float m_g4_phi[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:100
ActsGeantFollowerHelper::m_extrapolationEngine
ToolHandle< Trk::IExtrapolationEngine > m_extrapolationEngine
Definition: ActsGeantFollowerHelper.h:58
ActsGeantFollowerHelper::m_actsSurfaceCache
std::unique_ptr< std::vector< Acts::SurfaceHit > > m_actsSurfaceCache
Definition: ActsGeantFollowerHelper.h:65
ActsGeantFollowerHelper::TreeData::m_g4_x
float m_g4_x[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:101
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsGeantFollowerHelper::TreeData::m_g4_z
float m_g4_z[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:103
AthAlgTool.h
ActsGeantFollowerHelper::TreeData::m_trk_pt
float m_trk_pt[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:110
ActsGeantFollowerHelper::m_validationTree
TTree * m_validationTree
Root Validation Tree.
Definition: ActsGeantFollowerHelper.h:80
ActsGeantFollowerHelper::TreeData::m_trk_t
float m_trk_t[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:121
ActsGeantFollowerHelper::m_validationTreeFolder
std::string m_validationTreeFolder
stream/folder to for the TTree to be written out
Definition: ActsGeantFollowerHelper.h:78
ActsGeantFollowerHelper::TreeData::m_acts_status
int m_acts_status[MAXPROBES]
Ntuple variables : acts follow up parameters.
Definition: ActsGeantFollowerHelper.h:124
ActsGeantFollowerHelper::TreeData::m_t_pdg
int m_t_pdg
Definition: ActsGeantFollowerHelper.h:94
Trk::ParametersBase
Definition: ParametersBase.h:55
ActsGeantFollowerHelper::m_validationTreeDescription
std::string m_validationTreeDescription
validation tree description - second argument in TTree
Definition: ActsGeantFollowerHelper.h:77
ParticleHypothesis.h
ActsGeantFollowerHelper::m_tNonSensitiveCache
float m_tNonSensitiveCache
Definition: ActsGeantFollowerHelper.h:71
ActsGeantFollowerHelper::TreeData::m_acts_tX0
float m_acts_tX0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:133
ActsGeantFollowerHelper::TreeData::m_t_z
float m_t_z
Definition: ActsGeantFollowerHelper.h:88
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
ActsGeantFollowerHelper::TreeData::m_trk_tX0
float m_trk_tX0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:119
Trk::PdgToParticleHypothesis
Definition: PdgToParticleHypothesis.h:29
ActsGeantFollowerHelper::TreeData::m_trk_phi
float m_trk_phi[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:113
ActsGeantFollowerHelper
Definition: ActsGeantFollowerHelper.h:36
charge
double charge(const T &p)
Definition: AtlasPID.h:538
ActsGeantFollowerHelper::TreeData::m_g4_pt
float m_g4_pt[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:97
ActsGeantFollowerHelper::m_pdgToParticleHypothesis
Trk::PdgToParticleHypothesis m_pdgToParticleHypothesis
Definition: ActsGeantFollowerHelper.h:68
ActsGeantFollowerHelper::m_validationTreeName
std::string m_validationTreeName
validation tree name - to be acessed by this from root
Definition: ActsGeantFollowerHelper.h:76
ActsGeantFollowerHelper::TreeData::m_trk_z
float m_trk_z[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:116
ActsGeantFollowerHelper::m_actsParameterCache
std::optional< Acts::BoundTrackParameters > m_actsParameterCache
Definition: ActsGeantFollowerHelper.h:64
ActsGeantFollowerHelper::TreeData::m_t_theta
float m_t_theta
Definition: ActsGeantFollowerHelper.h:89
ActsGeantFollowerHelper::m_tX0CacheActs
float m_tX0CacheActs
Definition: ActsGeantFollowerHelper.h:72
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ActsGeantFollowerHelper::TreeData::m_g4_t
float m_g4_t[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:106
MAXPROBES
#define MAXPROBES
Definition: ActsGeantFollowerHelper.h:22
ActsGeantFollowerHelper::TreeData::m_g4_tX0
float m_g4_tX0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:104
ActsGeantFollowerHelper::TreeData::m_acts_pt
float m_acts_pt[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:126
ActsGeantFollowerHelper::TreeData::m_t_charge
float m_t_charge
Definition: ActsGeantFollowerHelper.h:93
ActsGeantFollowerHelper::TreeData::m_g4_theta
float m_g4_theta[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:99
ActsGeantFollowerHelper::TreeData::m_g4_X0
float m_g4_X0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:107
ActsGeantFollowerHelper::TreeData::m_t_x
float m_t_x
Definition: ActsGeantFollowerHelper.h:86
ActsGeantFollowerHelper::TreeData::m_trk_accX0
float m_trk_accX0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:120
ActsGeantFollowerHelper::TreeData::m_acts_X0
float m_acts_X0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:136
ActsGeantFollowerHelper::TreeData::m_g4_y
float m_g4_y[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:102
ActsGeantFollowerHelper::TreeData::m_acts_eta
float m_acts_eta[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:127
ActsGeantFollowerHelper::TreeData::m_acts_accX0
float m_acts_accX0[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:134
ActsGeantFollowerHelper::TreeData::m_acts_y
float m_acts_y[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:131
ActsGeantFollowerHelper::TreeData::m_t_p
float m_t_p
Definition: ActsGeantFollowerHelper.h:92
ActsGeantFollowerHelper::trackParticle
virtual void trackParticle(const G4ThreeVector &pos, const G4ThreeVector &mom, int pdg, double charge, float t, float X0, bool isSensitive) override
Definition: ActsGeantFollowerHelper.cxx:179
ActsGeantFollowerHelper::TreeData::m_acts_volumeID
int m_acts_volumeID[MAXPROBES]
Definition: ActsGeantFollowerHelper.h:125