File indexing completed on 2025-01-18 09:55:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDG4_GEANT4PLACEMENTPARAMETERISATION_H
0014 #define DDG4_GEANT4PLACEMENTPARAMETERISATION_H
0015
0016
0017 #include <DD4hep/Volumes.h>
0018
0019
0020 #include <G4Transform3D.hh>
0021 #include <G4PVParameterised.hh>
0022 #include <G4VPVParameterisation.hh>
0023
0024
0025 #include <vector>
0026
0027
0028 namespace dd4hep {
0029
0030
0031 namespace sim {
0032
0033
0034
0035
0036
0037
0038
0039 class Geant4PlacementParameterisation : public G4VPVParameterisation {
0040 public:
0041
0042
0043 struct Dimension {
0044 G4Transform3D delta { };
0045 G4ThreeVector translation { };
0046 std::size_t count { 0 };
0047
0048 public:
0049
0050 Dimension(const G4Transform3D& d, std::size_t c)
0051 : delta(d), translation(d.getTranslation()), count(c) {}
0052
0053 Dimension() = default;
0054
0055 Dimension(Dimension&&) = default;
0056
0057 Dimension(const Dimension&) = default;
0058
0059 Dimension& operator=(Dimension&&) = default;
0060
0061 Dimension& operator=(const Dimension&) = default;
0062 };
0063
0064 using Parameters = PlacedVolume::Object::Parameterisation;
0065 using Rotations = std::vector<G4RotationMatrix>;
0066 using Translations = std::vector<G4ThreeVector>;
0067 using Dimensions = std::vector<Dimension>;
0068
0069
0070 PlacedVolume m_placement;
0071
0072 const Parameters& m_params;
0073
0074 Dimension m_start { };
0075
0076 Dimensions m_dimensions { };
0077
0078
0079 EAxis m_axis { kUndefined };
0080
0081 size_t m_num_cells { 0UL };
0082
0083 bool m_have_rotation { false };
0084
0085
0086 mutable Rotations m_rotations;
0087 mutable Translations m_translations;
0088
0089
0090 void operator()(const G4Transform3D& transform);
0091
0092 public:
0093
0094 Geant4PlacementParameterisation(PlacedVolume pv);
0095
0096 virtual ~Geant4PlacementParameterisation() = default;
0097
0098 EAxis axis() const { return m_axis; }
0099
0100 std::size_t count() const;
0101
0102 virtual void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* vol) const override;
0103 };
0104 }
0105 }
0106 #endif