File indexing completed on 2025-01-18 09:55:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef DDG4_GEANT4HELPERS_H
0015 #define DDG4_GEANT4HELPERS_H
0016
0017
0018 #include <DD4hep/Objects.h>
0019
0020
0021 #include <G4ThreeVector.hh>
0022 #include <G4Transform3D.hh>
0023 #include <G4RotationMatrix.hh>
0024 #include <geomdefs.hh>
0025
0026
0027 #include <functional>
0028
0029
0030 namespace dd4hep {
0031
0032
0033 namespace sim {
0034
0035
0036 G4RotationMatrix g4Rotation(const TGeoMatrix* matrix);
0037 G4RotationMatrix g4Rotation(const TGeoMatrix& matrix);
0038 G4RotationMatrix g4Rotation(const TGeoRotation* rot);
0039 G4RotationMatrix g4Rotation(const TGeoRotation& rot);
0040 G4RotationMatrix g4Rotation(const Rotation3D& rot);
0041 G4RotationMatrix g4Rotation(const RotationZYX& rot);
0042
0043
0044 G4Transform3D
0045 generate_placements(const G4Transform3D& start,
0046 const G4Transform3D& delta,
0047 std::size_t count,
0048 const std::function<void(const G4Transform3D& delta)>& callback);
0049
0050
0051 G4Transform3D
0052 generate_placements(const G4Transform3D& start,
0053 const G4Transform3D& delta1,
0054 std::size_t count1,
0055 const G4Transform3D& delta2,
0056 std::size_t count2,
0057 const std::function<void(const G4Transform3D& delta)>& callback);
0058
0059
0060 G4Transform3D
0061 generate_placements(const G4Transform3D& start,
0062 const G4Transform3D& delta1,
0063 std::size_t count1,
0064 const G4Transform3D& delta2,
0065 std::size_t count2,
0066 const G4Transform3D& delta3,
0067 std::size_t count3,
0068 const std::function<void(const G4Transform3D& delta)>& callback);
0069
0070
0071
0072 void g4Transform(const double* translation, const double* rotation, G4Transform3D& transform);
0073 void g4Transform(const Position& pos, const Rotation3D& rot, G4Transform3D& transform);
0074 void g4Transform(const double* translation, G4Transform3D& transform);
0075 void g4Transform(const Transform3D& matrix, G4Transform3D& transform);
0076 void g4Transform(const TGeoMatrix* matrix, G4Transform3D& transform);
0077 void g4Transform(const TGeoMatrix& matrix, G4Transform3D& transform);
0078
0079 G4Transform3D g4Transform(const double* translation);
0080 G4Transform3D g4Transform(const double* translation, const double* rotation);
0081
0082 G4Transform3D g4Transform(const Transform3D& matrix);
0083 G4Transform3D g4Transform(const Position& pos, const Rotation3D& rot);
0084 G4Transform3D g4Transform(const Position& pos, const RotationZYX& rot);
0085
0086 G4Transform3D g4Transform(const TGeoMatrix* matrix);
0087 G4Transform3D g4Transform(const TGeoMatrix& matrix);
0088 G4Transform3D g4Transform(const TGeoTranslation* translation, const TGeoRotation* rotation);
0089 G4Transform3D g4Transform(const TGeoTranslation& translation, const TGeoRotation& rotation);
0090
0091 std::pair<double, EAxis> extract_axis(const Transform3D& trafo);
0092
0093 }
0094 }
0095 #endif