File indexing completed on 2025-01-18 09:55:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDG4_GEANT4HITHANDLER_H
0014 #define DDG4_GEANT4HITHANDLER_H
0015
0016
0017 #include <DDG4/Defs.h>
0018
0019
0020 #include <G4EmSaturation.hh>
0021 #include <G4Version.hh>
0022
0023
0024 namespace dd4hep {
0025
0026
0027 namespace sim {
0028
0029
0030 class Geant4HitHandler;
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 class Geant4HitHandler {
0043 protected:
0044 public:
0045 const G4Track* track;
0046 const G4VTouchable* touchable_ptr;
0047
0048 Geant4HitHandler() = delete;
0049
0050 Geant4HitHandler(const G4Track* t, const G4VTouchable* h)
0051 : track(t), touchable_ptr(h)
0052 {
0053 }
0054
0055 Geant4HitHandler(const Geant4HitHandler& copy) = delete;
0056
0057 Geant4HitHandler(Geant4HitHandler&& copy) = delete;
0058
0059 Geant4HitHandler& operator=(const Geant4HitHandler& copy) = delete;
0060
0061 Geant4HitHandler& operator=(Geant4HitHandler&& copy) = delete;
0062
0063 const G4VTouchable* touchable() const {
0064 return touchable_ptr;
0065 }
0066 G4ParticleDefinition* trackDef() const {
0067 return track->GetDefinition();
0068 }
0069 int trkPdgID() const {
0070 return track->GetDefinition()->GetPDGEncoding();
0071 }
0072
0073 int trkID() const {
0074 return track->GetTrackID();
0075 }
0076
0077 int parentID() const {
0078 return track->GetParentID();
0079 }
0080 double trkTime() const {
0081 return track->GetGlobalTime();
0082 }
0083 double trkEnergy() const {
0084 return track->GetTotalEnergy();
0085 }
0086 double trkKineEnergy() const {
0087 return track->GetKineticEnergy();
0088 }
0089 int trkStatus() const {
0090 return track->GetTrackStatus();
0091 }
0092 bool trkAlive() const {
0093 return track->GetTrackStatus() == fAlive;
0094 }
0095 const G4VProcess* trkProcess() const {
0096 return track->GetCreatorProcess();
0097 }
0098 Momentum trkMom() const {
0099 const G4ThreeVector& p = track->GetMomentum();
0100 return Momentum(p.x(), p.y(), p.z());
0101 }
0102 bool isSensitive(const G4LogicalVolume* lv) const {
0103 return lv ? (0 != lv->GetSensitiveDetector()) : false;
0104 }
0105 bool isSensitive(const G4VPhysicalVolume* pv) const {
0106 return pv ? isSensitive(pv->GetLogicalVolume()) : false;
0107 }
0108
0109
0110
0111 Position localToGlobal(const Position& local) const;
0112
0113
0114 Position localToGlobal(const DDSegmentation::Vector3D& local) const;
0115
0116 Position localToGlobal(const G4ThreeVector& local) const;
0117
0118 Position localToGlobal(double x, double y, double z) const;
0119
0120
0121 Position globalToLocal(double x, double y, double z) const;
0122
0123 Position globalToLocal(const Position& global) const;
0124
0125 Position globalToLocal(const G4ThreeVector& global) const;
0126
0127 G4ThreeVector globalToLocalG4(double x, double y, double z) const;
0128
0129 G4ThreeVector globalToLocalG4(const G4ThreeVector& loc) const;
0130 };
0131
0132 }
0133 }
0134
0135 #endif