DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4HitHandler.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDG4_GEANT4HITHANDLER_H
14 #define DDG4_GEANT4HITHANDLER_H
15 
16 // Framework include files
17 #include <DDG4/Defs.h>
18 
19 // Geant4 include files
20 #include <G4EmSaturation.hh>
21 #include <G4Version.hh>
22 
24 namespace dd4hep {
25 
27  namespace sim {
28 
29  // Forward declarations;
30  class Geant4HitHandler;
31 
33 
43  protected:
44  public:
45  const G4Track* track;
46  const G4VTouchable* touchable_ptr;
48  Geant4HitHandler() = delete;
50  Geant4HitHandler(const G4Track* t, const G4VTouchable* h)
51  : track(t), touchable_ptr(h)
52  {
53  }
62 
63  const G4VTouchable* touchable() const {
64  return touchable_ptr;
65  }
66  G4ParticleDefinition* trackDef() const {
67  return track->GetDefinition();
68  }
69  int trkPdgID() const {
70  return track->GetDefinition()->GetPDGEncoding();
71  }
73  int trkID() const {
74  return track->GetTrackID();
75  }
77  int parentID() const {
78  return track->GetParentID();
79  }
80  double trkTime() const {
81  return track->GetGlobalTime();
82  }
83  double trkEnergy() const {
84  return track->GetTotalEnergy();
85  }
86  double trkKineEnergy() const {
87  return track->GetKineticEnergy();
88  }
89  int trkStatus() const {
90  return track->GetTrackStatus();
91  }
92  bool trkAlive() const {
93  return track->GetTrackStatus() == fAlive;
94  }
95  const G4VProcess* trkProcess() const {
96  return track->GetCreatorProcess();
97  }
98  Momentum trkMom() const {
99  const G4ThreeVector& p = track->GetMomentum();
100  return Momentum(p.x(), p.y(), p.z());
101  }
102  bool isSensitive(const G4LogicalVolume* lv) const {
103  return lv ? (0 != lv->GetSensitiveDetector()) : false;
104  }
105  bool isSensitive(const G4VPhysicalVolume* pv) const {
106  return pv ? isSensitive(pv->GetLogicalVolume()) : false;
107  }
108 
110 
111  Position localToGlobal(const Position& local) const;
113 
114  Position localToGlobal(const DDSegmentation::Vector3D& local) const;
116  Position localToGlobal(const G4ThreeVector& local) const;
118  Position localToGlobal(double x, double y, double z) const;
119 
121  Position globalToLocal(double x, double y, double z) const;
123  Position globalToLocal(const Position& global) const;
125  Position globalToLocal(const G4ThreeVector& global) const;
127  G4ThreeVector globalToLocalG4(double x, double y, double z) const;
129  G4ThreeVector globalToLocalG4(const G4ThreeVector& loc) const;
130  };
131 
132  } // End namespace sim
133 } // End namespace dd4hep
134 
135 #endif // DDG4_GEANT4HITHANDLER_H
dd4hep::sim::Geant4HitHandler::operator=
Geant4HitHandler & operator=(const Geant4HitHandler &copy)=delete
Assignment operator inhibited. Should not be copied.
dd4hep::DDSegmentation::Vector3D
Simple container for a physics vector.
Definition: Segmentation.h:48
dd4hep::sim::Momentum
Position Momentum
Definition: Defs.h:27
dd4hep::sim::Geant4HitHandler::Geant4HitHandler
Geant4HitHandler(Geant4HitHandler &&copy)=delete
No move constructor.
dd4hep::sim::Geant4HitHandler::globalToLocalG4
G4ThreeVector globalToLocalG4(double x, double y, double z) const
Coordinate transformation to local coordinates.
Definition: Geant4HitHandler.cpp:64
dd4hep::sim::Geant4HitHandler::trkID
int trkID() const
Access the G4 track ID.
Definition: Geant4HitHandler.h:73
dd4hep::sim::Geant4HitHandler::trackDef
G4ParticleDefinition * trackDef() const
Definition: Geant4HitHandler.h:66
dd4hep::sim::Geant4HitHandler::trkTime
double trkTime() const
Definition: Geant4HitHandler.h:80
dd4hep::sim::Geant4HitHandler::touchable_ptr
const G4VTouchable * touchable_ptr
Definition: Geant4HitHandler.h:46
dd4hep::sim::Geant4HitHandler::trkEnergy
double trkEnergy() const
Definition: Geant4HitHandler.h:83
dd4hep::sim::Geant4HitHandler::Geant4HitHandler
Geant4HitHandler(const G4Track *t, const G4VTouchable *h)
Initializing constructor.
Definition: Geant4HitHandler.h:50
dd4hep::sim::Geant4HitHandler::trkStatus
int trkStatus() const
Definition: Geant4HitHandler.h:89
dd4hep::sim::Geant4HitHandler::isSensitive
bool isSensitive(const G4VPhysicalVolume *pv) const
Definition: Geant4HitHandler.h:105
dd4hep::sim::Geant4HitHandler::trkAlive
bool trkAlive() const
Definition: Geant4HitHandler.h:92
dd4hep::sim::Geant4HitHandler::Geant4HitHandler
Geant4HitHandler()=delete
Inhibit default constructor.
dd4hep::sim::Geant4HitHandler
Helper class to ease the extraction of information from a G4Hit object.
Definition: Geant4HitHandler.h:42
dd4hep::sim::Geant4HitHandler::touchable
const G4VTouchable * touchable() const
Definition: Geant4HitHandler.h:63
dd4hep::sim::Geant4HitHandler::globalToLocal
Position globalToLocal(double x, double y, double z) const
Coordinate transformation to local coordinates.
Definition: Geant4HitHandler.cpp:46
dd4hep::sim::Geant4HitHandler::trkMom
Momentum trkMom() const
Definition: Geant4HitHandler.h:98
dd4hep::sim::Geant4HitHandler::localToGlobal
Position localToGlobal(const Position &local) const
Coordinate transformation to global coordinates.
Definition: Geant4HitHandler.cpp:30
dd4hep::sim::Geant4HitHandler::isSensitive
bool isSensitive(const G4LogicalVolume *lv) const
Definition: Geant4HitHandler.h:102
dd4hep::sim::Geant4HitHandler::trkPdgID
int trkPdgID() const
Definition: Geant4HitHandler.h:69
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:81
dd4hep::sim::Geant4HitHandler::Geant4HitHandler
Geant4HitHandler(const Geant4HitHandler &copy)=delete
No copy constructor.
dd4hep::sim::Geant4HitHandler::operator=
Geant4HitHandler & operator=(Geant4HitHandler &&copy)=delete
Move operator inhibited. Should not be copied.
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4HitHandler::trkProcess
const G4VProcess * trkProcess() const
Definition: Geant4HitHandler.h:95
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::sim::Geant4HitHandler::track
const G4Track * track
Definition: Geant4HitHandler.h:45
dd4hep::sim::Geant4HitHandler::parentID
int parentID() const
Access the G4 track ID of the parent track.
Definition: Geant4HitHandler.h:77
Defs.h
dd4hep::sim::Geant4HitHandler::trkKineEnergy
double trkKineEnergy() const
Definition: Geant4HitHandler.h:86