File indexing completed on 2025-01-18 09:14:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DDG4/Geant4HitHandler.h>
0016 #include <DD4hep/DD4hepUnits.h>
0017 #include <CLHEP/Units/SystemOfUnits.h>
0018
0019
0020 #include <G4NavigationHistory.hh>
0021
0022 using namespace dd4hep::sim;
0023
0024
0025 dd4hep::Position Geant4HitHandler::localToGlobal(const DDSegmentation::Vector3D& local) const {
0026 return localToGlobal(G4ThreeVector(local.X / dd4hep::mm,local.Y / dd4hep::mm,local.Z / dd4hep::mm));
0027 }
0028
0029
0030 dd4hep::Position Geant4HitHandler::localToGlobal(const Position& local) const {
0031 return localToGlobal(G4ThreeVector(local.X(),local.Y(),local.Z()));
0032 }
0033
0034
0035 dd4hep::Position Geant4HitHandler::localToGlobal(double x, double y, double z) const {
0036 return localToGlobal(G4ThreeVector(x,y,z));
0037 }
0038
0039
0040 dd4hep::Position Geant4HitHandler::localToGlobal(const G4ThreeVector& loc) const {
0041 G4ThreeVector p = touchable_ptr->GetHistory()->GetTopTransform().Inverse().TransformPoint(loc);
0042 return Position(p.x(),p.y(),p.z());
0043 }
0044
0045
0046 dd4hep::Position Geant4HitHandler::globalToLocal(double x, double y, double z) const {
0047 G4ThreeVector p = globalToLocalG4(G4ThreeVector(x,y,z));
0048 return Position(p.x(),p.y(),p.z());
0049 }
0050
0051
0052 dd4hep::Position Geant4HitHandler::globalToLocal(const Position& global) const {
0053 G4ThreeVector p = globalToLocalG4(G4ThreeVector(global.X(),global.Y(),global.Z()));
0054 return Position(p.x(),p.y(),p.z());
0055 }
0056
0057
0058 dd4hep::Position Geant4HitHandler::globalToLocal(const G4ThreeVector& global) const {
0059 G4ThreeVector p = globalToLocalG4(global);
0060 return Position(p.x(),p.y(),p.z());
0061 }
0062
0063
0064 G4ThreeVector Geant4HitHandler::globalToLocalG4(double x, double y, double z) const {
0065 return globalToLocalG4(G4ThreeVector(x,y,z));
0066 }
0067
0068
0069 G4ThreeVector Geant4HitHandler::globalToLocalG4(const G4ThreeVector& global) const {
0070 return touchable_ptr->GetHistory()->GetTopTransform().TransformPoint(global);
0071 }