ATLAS Offline Software
PhysicsValidationUserAction.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 ISF_GEANT4TOOLS_PHYSICSVALIDATIONUSERACTION_H
6 #define ISF_GEANT4TOOLS_PHYSICSVALIDATIONUSERACTION_H
7 
9 
11 
12 #include "GaudiKernel/ToolHandle.h"
13 #include "GaudiKernel/ServiceHandle.h"
14 #include "GaudiKernel/ITHistSvc.h"
15 
16 #ifndef MAXCHILDREN
17 #define MAXCHILDREN 40
18 #endif
19 
20 #include <string>
21 
22 // ROOT forward declarations
23 class TTree;
24 
25 #include "G4UserEventAction.hh"
26 #include "G4UserRunAction.hh"
27 #include "G4UserSteppingAction.hh"
28 #include "G4UserTrackingAction.hh"
30 
31 namespace G4UA{
32  namespace iGeant4 {
33  class PhysicsValidationUserAction: public G4UserEventAction, public G4UserRunAction, public G4UserSteppingAction, public G4UserTrackingAction, public AthMessaging
34  {
35 
36  public:
37 
38  struct Config
39  {
41  bool validationOutput = true;
42  std::string validationStream="ISFG4SimKernel";
43  ServiceHandle<ITHistSvc> thistSvc=ServiceHandle<ITHistSvc>("THistSvc", "PhysicsValidationUserAction");
45  ServiceHandle<ISF::IGeoIDSvc>("ISF::GeoIDSvc/ISF_GeoIDSvc", "PhysicsValidationUserAction");
46 
47  double idR=1150.-1.e-5;
48  double idZ=3490.;
49  double caloRmean=0.5*(40.+4250.);
50  double caloZmean=0.5*(3490.+6740.);
51  double muonRmean=0.5*(60.+30000.);
52  double muonZmean=0.5*(6740.+30000.);
53  double cavernRmean=300000.0;
54  double cavernZmean=300000.0;
55 
56  };
57 
59  virtual void BeginOfEventAction(const G4Event*) override final;
60  virtual void EndOfEventAction(const G4Event*) override final;
61  virtual void BeginOfRunAction(const G4Run*) override final;
62  virtual void UserSteppingAction(const G4Step*) override final;
63  virtual void PreUserTrackingAction(const G4Track*) override final;
64  private:
65 
67 
70 
71  TTree *m_particles;
72  int m_pdg;
73  int m_scIn;
74  int m_scEnd;
75  int m_gen;
76  int m_geoID;
77  float m_pth;
78  float m_pph;
79  float m_p;
80  float m_eloss;
81  float m_radloss;
82  float m_ionloss;
83  float m_wzOaTr;
84  float m_thIn;
85  float m_phIn;
86  float m_dIn;
87  float m_thEnd;
88  float m_phEnd;
89  float m_dEnd;
90  float m_X0;
91  float m_L0;
92  float m_wZ;
93  float m_dt;
94 
95  TTree *m_interactions;
96  int m_process;
99  int m_nChild;
100  float m_vtx_dist;
101  float m_vtx_theta;
102  float m_vtx_phi;
107  float m_p_mother;
108  float m_radLength;
109  int m_pdg_child[MAXCHILDREN] ={}; // decay product pdg code
110  float m_fp_child[MAXCHILDREN] ={}; // fraction of incoming momentum
111  float m_oa_child[MAXCHILDREN] ={}; // opening angle wrt the mother
112 
113 
116 
118  std::map<int, int> m_trackGenMap;
119 
120  }; // class PhysicsValidationUserAction
121 
122  } // namespace iGeant4
123 
124 } // namespace G4UA
125 
126 #endif // ISF_GEANT4TOOLS_PHYSICSVALIDATIONUSERACTION_H
G4UA::iGeant4::PhysicsValidationUserAction::m_L0
float m_L0
Definition: PhysicsValidationUserAction.h:91
G4UA::iGeant4::PhysicsValidationUserAction::PreUserTrackingAction
virtual void PreUserTrackingAction(const G4Track *) override final
Definition: PhysicsValidationUserAction.cxx:504
G4UA::iGeant4::PhysicsValidationUserAction::Config::muonZmean
double muonZmean
Definition: PhysicsValidationUserAction.h:52
G4UA::iGeant4::PhysicsValidationUserAction::m_geoIDSvcQuick
ISF::IGeoIDSvc * m_geoIDSvcQuick
access to the central ISF GeoID serice
Definition: PhysicsValidationUserAction.h:69
G4UA::iGeant4::PhysicsValidationUserAction::m_pth
float m_pth
Definition: PhysicsValidationUserAction.h:77
G4UA::iGeant4::PhysicsValidationUserAction::m_p
float m_p
Definition: PhysicsValidationUserAction.h:79
G4UA::iGeant4::PhysicsValidationUserAction::m_currentTrack
int m_currentTrack
Definition: PhysicsValidationUserAction.h:117
G4UA::iGeant4::PhysicsValidationUserAction::m_wZ
float m_wZ
Definition: PhysicsValidationUserAction.h:92
G4UA::iGeant4::PhysicsValidationUserAction::m_geoID
int m_geoID
Definition: PhysicsValidationUserAction.h:76
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::iGeant4::PhysicsValidationUserAction::Config::thistSvc
ServiceHandle< ITHistSvc > thistSvc
Definition: PhysicsValidationUserAction.h:43
G4UA::iGeant4::PhysicsValidationUserAction::m_scEnd
int m_scEnd
Definition: PhysicsValidationUserAction.h:74
G4UA::iGeant4::PhysicsValidationUserAction::Config::validationOutput
bool validationOutput
Definition: PhysicsValidationUserAction.h:41
G4UA::iGeant4::PhysicsValidationUserAction::m_vtx_phi
float m_vtx_phi
Definition: PhysicsValidationUserAction.h:102
G4UA::iGeant4::PhysicsValidationUserAction::m_vtx_plong_diff
float m_vtx_plong_diff
Definition: PhysicsValidationUserAction.h:105
MAXCHILDREN
#define MAXCHILDREN
Definition: PhysicsValidationUserAction.h:17
G4UA::iGeant4::PhysicsValidationUserAction::m_pdg_mother
int m_pdg_mother
Definition: PhysicsValidationUserAction.h:97
G4UA::iGeant4::PhysicsValidationUserAction::m_radLength
float m_radLength
Definition: PhysicsValidationUserAction.h:108
G4UA::iGeant4::PhysicsValidationUserAction
Definition: PhysicsValidationUserAction.h:34
G4UA::iGeant4::PhysicsValidationUserAction::Config::cavernZmean
double cavernZmean
Definition: PhysicsValidationUserAction.h:54
G4UA::iGeant4::PhysicsValidationUserAction::m_eloss
float m_eloss
Definition: PhysicsValidationUserAction.h:80
G4UA::iGeant4::PhysicsValidationUserAction::m_ionloss
float m_ionloss
Definition: PhysicsValidationUserAction.h:82
G4UA::iGeant4::PhysicsValidationUserAction::Config::muonRmean
double muonRmean
Definition: PhysicsValidationUserAction.h:51
G4UA::iGeant4::PhysicsValidationUserAction::m_phIn
float m_phIn
Definition: PhysicsValidationUserAction.h:85
G4UA::iGeant4::PhysicsValidationUserAction::m_minHistoryDepth
int m_minHistoryDepth
Definition: PhysicsValidationUserAction.h:115
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
G4UA::iGeant4::PhysicsValidationUserAction::Config::caloRmean
double caloRmean
Definition: PhysicsValidationUserAction.h:49
G4UA::iGeant4::PhysicsValidationUserAction::m_radloss
float m_radloss
Definition: PhysicsValidationUserAction.h:81
G4UA::iGeant4::PhysicsValidationUserAction::m_X0
float m_X0
Definition: PhysicsValidationUserAction.h:90
G4UA::iGeant4::PhysicsValidationUserAction::m_p_mother
float m_p_mother
Definition: PhysicsValidationUserAction.h:107
G4UA::iGeant4::PhysicsValidationUserAction::m_nChild
int m_nChild
Definition: PhysicsValidationUserAction.h:99
G4UA::iGeant4::PhysicsValidationUserAction::m_volumeOffset
int m_volumeOffset
Definition: PhysicsValidationUserAction.h:114
G4UA::iGeant4::PhysicsValidationUserAction::m_dt
float m_dt
Definition: PhysicsValidationUserAction.h:93
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
G4UA::iGeant4::PhysicsValidationUserAction::m_pdg_child
int m_pdg_child[MAXCHILDREN]
Definition: PhysicsValidationUserAction.h:109
AthAlgTool.h
G4UA::iGeant4::PhysicsValidationUserAction::m_oa_child
float m_oa_child[MAXCHILDREN]
Definition: PhysicsValidationUserAction.h:111
G4UA::iGeant4::PhysicsValidationUserAction::m_dEnd
float m_dEnd
Definition: PhysicsValidationUserAction.h:89
ISF::IGeoIDSvc
Definition: IGeoIDSvc.h:41
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
G4UA::iGeant4::PhysicsValidationUserAction::BeginOfEventAction
virtual void BeginOfEventAction(const G4Event *) override final
Definition: PhysicsValidationUserAction.cxx:76
IGeoIDSvc.h
G4UA::iGeant4::PhysicsValidationUserAction::m_thIn
float m_thIn
Definition: PhysicsValidationUserAction.h:84
G4UA::iGeant4::PhysicsValidationUserAction::m_vtx_p_diff
float m_vtx_p_diff
Definition: PhysicsValidationUserAction.h:104
G4UA::iGeant4::PhysicsValidationUserAction::m_vtx_pperp_diff
float m_vtx_pperp_diff
Definition: PhysicsValidationUserAction.h:106
G4UA::iGeant4::PhysicsValidationUserAction::m_vtx_theta
float m_vtx_theta
Definition: PhysicsValidationUserAction.h:101
G4UA::iGeant4::PhysicsValidationUserAction::m_pdg
int m_pdg
Definition: PhysicsValidationUserAction.h:72
G4UA::iGeant4::PhysicsValidationUserAction::m_particles
TTree * m_particles
ROOT tree containing track info.
Definition: PhysicsValidationUserAction.h:71
G4UA::iGeant4::PhysicsValidationUserAction::BeginOfRunAction
virtual void BeginOfRunAction(const G4Run *) override final
Definition: PhysicsValidationUserAction.cxx:106
G4UA::iGeant4::PhysicsValidationUserAction::m_gen
int m_gen
Definition: PhysicsValidationUserAction.h:75
G4UA::iGeant4::PhysicsValidationUserAction::m_vtx_e_diff
float m_vtx_e_diff
Definition: PhysicsValidationUserAction.h:103
G4UA::iGeant4::PhysicsValidationUserAction::m_pph
float m_pph
Definition: PhysicsValidationUserAction.h:78
G4UA::iGeant4::PhysicsValidationUserAction::PhysicsValidationUserAction
PhysicsValidationUserAction(const Config &config)
Definition: PhysicsValidationUserAction.cxx:43
G4UA::iGeant4::PhysicsValidationUserAction::m_wzOaTr
float m_wzOaTr
Definition: PhysicsValidationUserAction.h:83
G4UA::iGeant4::PhysicsValidationUserAction::m_gen_mother
int m_gen_mother
Definition: PhysicsValidationUserAction.h:98
G4UA::iGeant4::PhysicsValidationUserAction::m_trackGenMap
std::map< int, int > m_trackGenMap
Definition: PhysicsValidationUserAction.h:118
G4UA::iGeant4::PhysicsValidationUserAction::m_interactions
TTree * m_interactions
ROOT tree containing vertex info.
Definition: PhysicsValidationUserAction.h:95
G4UA::iGeant4::PhysicsValidationUserAction::Config::validationStream
std::string validationStream
Definition: PhysicsValidationUserAction.h:42
G4UA::iGeant4::PhysicsValidationUserAction::m_phEnd
float m_phEnd
Definition: PhysicsValidationUserAction.h:88
G4UA::iGeant4::PhysicsValidationUserAction::Config::cavernRmean
double cavernRmean
Definition: PhysicsValidationUserAction.h:53
AthMessaging.h
G4UA::iGeant4::PhysicsValidationUserAction::Config::idR
double idR
Definition: PhysicsValidationUserAction.h:47
G4UA::iGeant4::PhysicsValidationUserAction::UserSteppingAction
virtual void UserSteppingAction(const G4Step *) override final
Definition: PhysicsValidationUserAction.cxx:202
G4UA::iGeant4::PhysicsValidationUserAction::m_process
int m_process
Definition: PhysicsValidationUserAction.h:96
G4UA::iGeant4::PhysicsValidationUserAction::Config::idZ
double idZ
Definition: PhysicsValidationUserAction.h:48
G4UA::iGeant4::PhysicsValidationUserAction::m_fp_child
float m_fp_child[MAXCHILDREN]
Definition: PhysicsValidationUserAction.h:110
G4UA::iGeant4::PhysicsValidationUserAction::m_dIn
float m_dIn
Definition: PhysicsValidationUserAction.h:86
G4UA::iGeant4::PhysicsValidationUserAction::Config::caloZmean
double caloZmean
Definition: PhysicsValidationUserAction.h:50
G4UA::iGeant4::PhysicsValidationUserAction::Config::geoIDSvc
ServiceHandle< ISF::IGeoIDSvc > geoIDSvc
Definition: PhysicsValidationUserAction.h:44
G4UA::iGeant4::PhysicsValidationUserAction::m_config
Config m_config
Definition: PhysicsValidationUserAction.h:66
G4UA::iGeant4::PhysicsValidationUserAction::m_vtx_dist
float m_vtx_dist
Definition: PhysicsValidationUserAction.h:100
G4UA::iGeant4::PhysicsValidationUserAction::Config::verboseLevel
MSG::Level verboseLevel
Definition: PhysicsValidationUserAction.h:40
G4UA::iGeant4::PhysicsValidationUserAction::m_scIn
int m_scIn
Definition: PhysicsValidationUserAction.h:73
G4UA::iGeant4::PhysicsValidationUserAction::EndOfEventAction
virtual void EndOfEventAction(const G4Event *) override final
Definition: PhysicsValidationUserAction.cxx:93
G4UA::iGeant4::PhysicsValidationUserAction::Config
Definition: PhysicsValidationUserAction.h:39
ServiceHandle< ITHistSvc >
iGeant4
Definition: Geant4TruthIncident.h:35
G4UA::iGeant4::PhysicsValidationUserAction::m_thEnd
float m_thEnd
Definition: PhysicsValidationUserAction.h:87