ATLAS Offline Software
GeantFollowerHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // GeantFollowerHelper.h, (c) ATLAS Detector software
8 #ifndef GeantFollowerHelper_H
9 #define GeantFollowerHelper_H
10 
12 #include "GaudiKernel/ToolHandle.h"
13 #include "TrkParameters/TrackParameters.h" //typedef, can't fwd declare
15 #include "G4ThreeVector.hh" //typedef, can't fwd declare
16 
17 class TTree;
18 
19 namespace Trk
20 {
21 
22  class IExtrapolator;
23 
24  class GeantFollowerHelper : public extends<AthAlgTool, IGeantFollowerHelper>
25  {
26 
27  public:
28 
29  static constexpr int MAXPROBES{50000};
30 
31  // constructor, destructor
32  GeantFollowerHelper(const std::string&,const std::string&,const IInterface*);
34 
35  // Athena hooks
36  virtual StatusCode initialize() override;
37  virtual StatusCode finalize () override;
38 
39  // Follower interface
40  // a) begin event - initialize follower process
41  virtual void beginEvent() override;
42  // b) track the particle
43  virtual void trackParticle(const G4ThreeVector& pos, const G4ThreeVector& mom, int pdg, double charge, float t, float X0) override;
44  // c) end event - ntuple writing
45  virtual void endEvent() override;
46 
47  private:
48 
49  ToolHandle<IExtrapolator> m_extrapolator;
52 
54  float m_tX0Cache;
55 
56  // put some validation code is
57  std::string m_validationTreeName;
59  std::string m_validationTreeFolder;
60 
62 
66  struct TreeData {
67  float m_t_x {0};
68  float m_t_y {0};
69  float m_t_z {0};
70  float m_t_theta {0};
71  float m_t_eta {0};
72  float m_t_phi {0};
73  float m_t_p {0};
74  float m_t_charge {0};
75  int m_t_pdg {0};
77  int m_g4_steps {0};
78  float m_g4_p[MAXPROBES] {0};
79  float m_g4_eta[MAXPROBES] {0};
80  float m_g4_theta[MAXPROBES] {0};
81  float m_g4_phi[MAXPROBES] {0};
82  float m_g4_x[MAXPROBES] {0};
83  float m_g4_y[MAXPROBES] {0};
84  float m_g4_z[MAXPROBES] {0};
85  float m_g4_tX0[MAXPROBES] {0};
86  float m_g4_t[MAXPROBES] {0};
87  float m_g4_X0[MAXPROBES] {0};
90  float m_trk_p[MAXPROBES] {0};
91  float m_trk_eta[MAXPROBES] {0};
92  float m_trk_theta[MAXPROBES] {0};
93  float m_trk_phi[MAXPROBES] {0};
94  float m_trk_x[MAXPROBES] {0};
95  float m_trk_y[MAXPROBES] {0};
96  float m_trk_z[MAXPROBES] {0};
97  float m_trk_lx[MAXPROBES] {0};
98  float m_trk_ly[MAXPROBES] {0};
99  };
100  std::unique_ptr<TreeData> m_treeData;
101  };
102 
103 }
104 
105 #endif
Trk::GeantFollowerHelper::m_validationTreeFolder
std::string m_validationTreeFolder
stream/folder to for the TTree to be written out
Definition: GeantFollowerHelper.h:59
Trk::GeantFollowerHelper::m_validationTreeDescription
std::string m_validationTreeDescription
validation tree description - second argument in TTree
Definition: GeantFollowerHelper.h:58
Trk::GeantFollowerHelper::m_extrapolateIncrementally
bool m_extrapolateIncrementally
Definition: GeantFollowerHelper.h:51
TrackParameters.h
Trk::GeantFollowerHelper::beginEvent
virtual void beginEvent() override
Definition: GeantFollowerHelper.cxx:113
Trk::GeantFollowerHelper::TreeData::m_trk_y
float m_trk_y[MAXPROBES]
Definition: GeantFollowerHelper.h:95
Trk::GeantFollowerHelper::TreeData::m_g4_p
float m_g4_p[MAXPROBES]
Definition: GeantFollowerHelper.h:78
Trk::GeantFollowerHelper::TreeData::m_g4_eta
float m_g4_eta[MAXPROBES]
Definition: GeantFollowerHelper.h:79
Trk::GeantFollowerHelper::trackParticle
virtual void trackParticle(const G4ThreeVector &pos, const G4ThreeVector &mom, int pdg, double charge, float t, float X0) override
Definition: GeantFollowerHelper.cxx:128
Trk::GeantFollowerHelper::TreeData::m_trk_phi
float m_trk_phi[MAXPROBES]
Definition: GeantFollowerHelper.h:93
Trk::GeantFollowerHelper::m_parameterCache
const TrackParameters * m_parameterCache
Definition: GeantFollowerHelper.h:53
Trk::GeantFollowerHelper::TreeData::m_g4_x
float m_g4_x[MAXPROBES]
Definition: GeantFollowerHelper.h:82
Trk::GeantFollowerHelper::TreeData::m_trk_p
float m_trk_p[MAXPROBES]
Definition: GeantFollowerHelper.h:90
Trk::GeantFollowerHelper::TreeData::m_trk_eta
float m_trk_eta[MAXPROBES]
Definition: GeantFollowerHelper.h:91
Trk::GeantFollowerHelper::TreeData::m_t_charge
float m_t_charge
Definition: GeantFollowerHelper.h:74
Trk::GeantFollowerHelper::finalize
virtual StatusCode finalize() override
Definition: GeantFollowerHelper.cxx:108
Trk::GeantFollowerHelper::initialize
virtual StatusCode initialize() override
Definition: GeantFollowerHelper.cxx:48
Trk::GeantFollowerHelper::m_validationTree
TTree * m_validationTree
Root Validation Tree.
Definition: GeantFollowerHelper.h:61
Trk::GeantFollowerHelper::TreeData::m_t_y
float m_t_y
Definition: GeantFollowerHelper.h:68
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::GeantFollowerHelper::TreeData::m_g4_y
float m_g4_y[MAXPROBES]
Definition: GeantFollowerHelper.h:83
Trk::GeantFollowerHelper::m_extrapolateDirectly
bool m_extrapolateDirectly
Definition: GeantFollowerHelper.h:50
Trk::GeantFollowerHelper::TreeData::m_g4_t
float m_g4_t[MAXPROBES]
Definition: GeantFollowerHelper.h:86
pdg_comparison.X0
X0
Definition: pdg_comparison.py:314
Trk::GeantFollowerHelper::TreeData::m_t_phi
float m_t_phi
Definition: GeantFollowerHelper.h:72
Trk::GeantFollowerHelper::TreeData::m_t_p
float m_t_p
Definition: GeantFollowerHelper.h:73
Trk::GeantFollowerHelper::TreeData::m_trk_theta
float m_trk_theta[MAXPROBES]
Definition: GeantFollowerHelper.h:92
Trk::GeantFollowerHelper::TreeData::m_t_eta
float m_t_eta
Definition: GeantFollowerHelper.h:71
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Trk::GeantFollowerHelper::m_treeData
std::unique_ptr< TreeData > m_treeData
Definition: GeantFollowerHelper.h:100
Trk::GeantFollowerHelper::m_tX0Cache
float m_tX0Cache
Definition: GeantFollowerHelper.h:54
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::GeantFollowerHelper::m_extrapolator
ToolHandle< IExtrapolator > m_extrapolator
Definition: GeantFollowerHelper.h:49
AthAlgTool.h
Trk::GeantFollowerHelper::~GeantFollowerHelper
virtual ~GeantFollowerHelper()
Trk::GeantFollowerHelper::TreeData::m_g4_X0
float m_g4_X0[MAXPROBES]
Definition: GeantFollowerHelper.h:87
Trk::GeantFollowerHelper::MAXPROBES
static constexpr int MAXPROBES
Definition: GeantFollowerHelper.h:29
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::GeantFollowerHelper::TreeData::m_trk_x
float m_trk_x[MAXPROBES]
Definition: GeantFollowerHelper.h:94
Trk::GeantFollowerHelper::TreeData::m_trk_lx
float m_trk_lx[MAXPROBES]
Definition: GeantFollowerHelper.h:97
Trk::GeantFollowerHelper::TreeData::m_trk_ly
float m_trk_ly[MAXPROBES]
Definition: GeantFollowerHelper.h:98
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::GeantFollowerHelper::TreeData::m_g4_z
float m_g4_z[MAXPROBES]
Definition: GeantFollowerHelper.h:84
charge
double charge(const T &p)
Definition: AtlasPID.h:756
IGeantFollowerHelper.h
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::GeantFollowerHelper::TreeData::m_t_z
float m_t_z
Definition: GeantFollowerHelper.h:69
Trk::GeantFollowerHelper::TreeData::m_t_theta
float m_t_theta
Definition: GeantFollowerHelper.h:70
Trk::GeantFollowerHelper
Definition: GeantFollowerHelper.h:25
Trk::GeantFollowerHelper::TreeData::m_g4_theta
float m_g4_theta[MAXPROBES]
Definition: GeantFollowerHelper.h:80
Trk::GeantFollowerHelper::TreeData::m_g4_tX0
float m_g4_tX0[MAXPROBES]
Definition: GeantFollowerHelper.h:85
Trk::GeantFollowerHelper::GeantFollowerHelper
GeantFollowerHelper(const std::string &, const std::string &, const IInterface *)
Definition: GeantFollowerHelper.cxx:24
Trk::GeantFollowerHelper::TreeData::m_trk_status
int m_trk_status[MAXPROBES]
Ntuple variables : trk follow up parameters.
Definition: GeantFollowerHelper.h:89
Trk::GeantFollowerHelper::TreeData::m_g4_steps
int m_g4_steps
Ntuple variables : g4 step parameters.
Definition: GeantFollowerHelper.h:77
Trk::GeantFollowerHelper::m_validationTreeName
std::string m_validationTreeName
validation tree name - to be acessed by this from root
Definition: GeantFollowerHelper.h:57
Trk::GeantFollowerHelper::endEvent
virtual void endEvent() override
Definition: GeantFollowerHelper.cxx:215
Trk::GeantFollowerHelper::TreeData::m_t_pdg
int m_t_pdg
Definition: GeantFollowerHelper.h:75
Trk::GeantFollowerHelper::TreeData::m_g4_phi
float m_g4_phi[MAXPROBES]
Definition: GeantFollowerHelper.h:81
Trk::GeantFollowerHelper::TreeData::m_t_x
float m_t_x
Definition: GeantFollowerHelper.h:67
Trk::GeantFollowerHelper::TreeData
Ntuple variables : initial parameters Split this out into a separate, dynamically-allocated block.
Definition: GeantFollowerHelper.h:66
Trk::GeantFollowerHelper::TreeData::m_trk_z
float m_trk_z[MAXPROBES]
Definition: GeantFollowerHelper.h:96