DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4HitHandler.cpp
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 
14 // Framework include files
15 #include <DDG4/Geant4HitHandler.h>
16 #include <DD4hep/DD4hepUnits.h>
17 #include <CLHEP/Units/SystemOfUnits.h>
18 
19 // Geant4 include files
20 #include <G4NavigationHistory.hh>
21 
22 using namespace dd4hep::sim;
23 
26  return localToGlobal(G4ThreeVector(local.X / dd4hep::mm,local.Y / dd4hep::mm,local.Z / dd4hep::mm));
27 }
28 
31  return localToGlobal(G4ThreeVector(local.X(),local.Y(),local.Z()));
32 }
33 
35 dd4hep::Position Geant4HitHandler::localToGlobal(double x, double y, double z) const {
36  return localToGlobal(G4ThreeVector(x,y,z));
37 }
38 
40 dd4hep::Position Geant4HitHandler::localToGlobal(const G4ThreeVector& loc) const {
41  G4ThreeVector p = touchable_ptr->GetHistory()->GetTopTransform().Inverse().TransformPoint(loc);
42  return Position(p.x(),p.y(),p.z());
43 }
44 
46 dd4hep::Position Geant4HitHandler::globalToLocal(double x, double y, double z) const {
47  G4ThreeVector p = globalToLocalG4(G4ThreeVector(x,y,z));
48  return Position(p.x(),p.y(),p.z());
49 }
50 
53  G4ThreeVector p = globalToLocalG4(G4ThreeVector(global.X(),global.Y(),global.Z()));
54  return Position(p.x(),p.y(),p.z());
55 }
56 
58 dd4hep::Position Geant4HitHandler::globalToLocal(const G4ThreeVector& global) const {
59  G4ThreeVector p = globalToLocalG4(global);
60  return Position(p.x(),p.y(),p.z());
61 }
62 
64 G4ThreeVector Geant4HitHandler::globalToLocalG4(double x, double y, double z) const {
65  return globalToLocalG4(G4ThreeVector(x,y,z));
66 }
67 
69 G4ThreeVector Geant4HitHandler::globalToLocalG4(const G4ThreeVector& global) const {
70  return touchable_ptr->GetHistory()->GetTopTransform().TransformPoint(global);
71 }
dd4hep::DDSegmentation::Vector3D
Simple container for a physics vector.
Definition: Segmentation.h:48
dd4hep::sim::Geant4HitHandler::globalToLocalG4
G4ThreeVector globalToLocalG4(double x, double y, double z) const
Coordinate transformation to local coordinates.
Definition: Geant4HitHandler.cpp:64
Geant4HitHandler.h
dd4hep::sim::Geant4HitHandler::touchable_ptr
const G4VTouchable * touchable_ptr
Definition: Geant4HitHandler.h:46
dd4hep::sim::Geant4HitHandler::globalToLocal
Position globalToLocal(double x, double y, double z) const
Coordinate transformation to local coordinates.
Definition: Geant4HitHandler.cpp:46
dd4hep::DDSegmentation::Vector3D::Y
double Y
Definition: Segmentation.h:71
dd4hep::sim::Geant4HitHandler::localToGlobal
Position localToGlobal(const Position &local) const
Coordinate transformation to global coordinates.
Definition: Geant4HitHandler.cpp:30
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:81
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: Geant4Output2EDM4hep.cpp:49
dd4hep::DDSegmentation::Vector3D::X
double X
Definition: Segmentation.h:71
DD4hepUnits.h
dd4hep::DDSegmentation::Vector3D::Z
double Z
Definition: Segmentation.h:71