DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4Helpers.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 
14 #ifndef DDG4_GEANT4HELPERS_H
15 #define DDG4_GEANT4HELPERS_H
16 
18 #include <DD4hep/Objects.h>
19 
21 #include <G4ThreeVector.hh>
22 #include <G4Transform3D.hh>
23 #include <G4RotationMatrix.hh>
24 #include <geomdefs.hh>
25 
27 #include <functional>
28 
30 namespace dd4hep {
31 
33  namespace sim {
34 
36  G4RotationMatrix g4Rotation(const TGeoMatrix* matrix);
37  G4RotationMatrix g4Rotation(const TGeoMatrix& matrix);
38  G4RotationMatrix g4Rotation(const TGeoRotation* rot);
39  G4RotationMatrix g4Rotation(const TGeoRotation& rot);
40  G4RotationMatrix g4Rotation(const Rotation3D& rot);
41  G4RotationMatrix g4Rotation(const RotationZYX& rot);
42 
44  G4Transform3D
45  generate_placements(const G4Transform3D& start,
46  const G4Transform3D& delta,
47  std::size_t count,
48  const std::function<void(const G4Transform3D& delta)>& callback);
49 
51  G4Transform3D
52  generate_placements(const G4Transform3D& start,
53  const G4Transform3D& delta1,
54  std::size_t count1,
55  const G4Transform3D& delta2,
56  std::size_t count2,
57  const std::function<void(const G4Transform3D& delta)>& callback);
58 
60  G4Transform3D
61  generate_placements(const G4Transform3D& start,
62  const G4Transform3D& delta1,
63  std::size_t count1,
64  const G4Transform3D& delta2,
65  std::size_t count2,
66  const G4Transform3D& delta3,
67  std::size_t count3,
68  const std::function<void(const G4Transform3D& delta)>& callback);
69 
71 
72  void g4Transform(const double* translation, const double* rotation, G4Transform3D& transform);
73  void g4Transform(const Position& pos, const Rotation3D& rot, G4Transform3D& transform);
74  void g4Transform(const double* translation, G4Transform3D& transform);
75  void g4Transform(const Transform3D& matrix, G4Transform3D& transform);
76  void g4Transform(const TGeoMatrix* matrix, G4Transform3D& transform);
77  void g4Transform(const TGeoMatrix& matrix, G4Transform3D& transform);
78 
79  G4Transform3D g4Transform(const double* translation);
80  G4Transform3D g4Transform(const double* translation, const double* rotation);
81 
82  G4Transform3D g4Transform(const Transform3D& matrix);
83  G4Transform3D g4Transform(const Position& pos, const Rotation3D& rot);
84  G4Transform3D g4Transform(const Position& pos, const RotationZYX& rot);
85 
86  G4Transform3D g4Transform(const TGeoMatrix* matrix);
87  G4Transform3D g4Transform(const TGeoMatrix& matrix);
88  G4Transform3D g4Transform(const TGeoTranslation* translation, const TGeoRotation* rotation);
89  G4Transform3D g4Transform(const TGeoTranslation& translation, const TGeoRotation& rotation);
90 
91  std::pair<double, EAxis> extract_axis(const Transform3D& trafo);
92 
93  } // End namespace sim
94 } // End namespace dd4hep
95 #endif // DDG4_GEANT4HELPERS_H
dd4hep::sim::g4Rotation
G4RotationMatrix g4Rotation(const TGeoMatrix *matrix)
Extract G4 rotation matrix from ROOT matrices.
Definition: Geant4Helpers.cpp:53
Objects.h
delta
const Delta * delta
Definition: AlignmentsCalculator.cpp:67
dd4hep::Rotation3D
ROOT::Math::Rotation3D Rotation3D
Definition: Objects.h:113
dd4hep::sim::g4Transform
void g4Transform(const double *translation, const double *rotation, G4Transform3D &transform)
These conversions automatically apply the conversion from CM to MM!
Definition: Geant4Helpers.cpp:91
dd4hep::sim::extract_axis
std::pair< double, EAxis > extract_axis(const Transform3D &trafo)
Definition: Geant4Helpers.cpp:208
dd4hep::Transform3D
ROOT::Math::Transform3D Transform3D
Definition: Objects.h:117
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:81
dd4hep::sim::generate_placements
G4Transform3D generate_placements(const G4Transform3D &start, const G4Transform3D &delta, std::size_t count, const std::function< void(const G4Transform3D &delta)> &callback)
Generate parameterised placements in 1 dimension according to transformation delta.
Definition: Geant4Helpers.cpp:157
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::RotationZYX
ROOT::Math::RotationZYX RotationZYX
Definition: Objects.h:105