DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4PlacementParameterisation.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 #ifndef DDG4_GEANT4PLACEMENTPARAMETERISATION_H
14 #define DDG4_GEANT4PLACEMENTPARAMETERISATION_H
15 
17 #include <DD4hep/Volumes.h>
18 
20 #include <G4Transform3D.hh>
21 #include <G4PVParameterised.hh>
22 #include <G4VPVParameterisation.hh>
23 
25 #include <vector>
26 
28 namespace dd4hep {
29 
31  namespace sim {
32 
34 
39  class Geant4PlacementParameterisation : public G4VPVParameterisation {
40  public:
41 
43  struct Dimension {
44  G4Transform3D delta { };
45  G4ThreeVector translation { };
46  std::size_t count { 0 };
47 
48  public:
50  Dimension(const G4Transform3D& d, std::size_t c)
51  : delta(d), translation(d.getTranslation()), count(c) {}
53  Dimension() = default;
55  Dimension(Dimension&&) = default;
57  Dimension(const Dimension&) = default;
59  Dimension& operator=(Dimension&&) = default;
61  Dimension& operator=(const Dimension&) = default;
62  };
63 
65  using Rotations = std::vector<G4RotationMatrix>;
66  using Translations = std::vector<G4ThreeVector>;
67  using Dimensions = std::vector<Dimension>;
68 
77 
79  EAxis m_axis { kUndefined };
81  size_t m_num_cells { 0UL };
83  bool m_have_rotation { false };
84 
88 
90  void operator()(const G4Transform3D& transform);
91 
92  public:
96  virtual ~Geant4PlacementParameterisation() = default;
98  EAxis axis() const { return m_axis; }
100  std::size_t count() const;
102  virtual void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* vol) const override;
103  };
104  } // End namespace sim
105 } // End namespace dd4hep
106 #endif // DDG4_GEANT4PLACEMENTPARAMETERISATION_H
dd4hep::sim::Geant4PlacementParameterisation::m_params
const Parameters & m_params
Setup parameters: Reference to the DD4hep placement parameters.
Definition: Geant4PlacementParameterisation.h:72
dd4hep::sim::Geant4PlacementParameterisation::Geant4PlacementParameterisation
Geant4PlacementParameterisation(PlacedVolume pv)
Initializing constructor.
Definition: Geant4PlacementParameterisation.cpp:24
Volumes.h
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:163
dd4hep::sim::Geant4PlacementParameterisation
Class to dump the records of the intrinsic Geant4 event model.
Definition: Geant4PlacementParameterisation.h:39
dd4hep::sim::Geant4PlacementParameterisation::Dimension::translation
G4ThreeVector translation
Definition: Geant4PlacementParameterisation.h:45
dd4hep::sim::Geant4PlacementParameterisation::m_placement
PlacedVolume m_placement
Setup parameters: Reference to the DD4hep placement handle.
Definition: Geant4PlacementParameterisation.h:70
dd4hep::sim::Geant4PlacementParameterisation::Dimension::operator=
Dimension & operator=(Dimension &&)=default
Assignment operator.
dd4hep::sim::Geant4PlacementParameterisation::Dimension
Helper structure to cache dimension variabled from setup parameters.
Definition: Geant4PlacementParameterisation.h:43
dd4hep::sim::Geant4PlacementParameterisation::Translations
std::vector< G4ThreeVector > Translations
Definition: Geant4PlacementParameterisation.h:66
dd4hep::sim::Geant4PlacementParameterisation::Dimensions
std::vector< Dimension > Dimensions
Definition: Geant4PlacementParameterisation.h:67
dd4hep::sim::Geant4PlacementParameterisation::m_axis
EAxis m_axis
Axis definition.
Definition: Geant4PlacementParameterisation.h:79
dd4hep::sim::Geant4PlacementParameterisation::m_translations
Translations m_translations
Definition: Geant4PlacementParameterisation.h:87
dd4hep::sim::Geant4PlacementParameterisation::Dimension::Dimension
Dimension(Dimension &&)=default
Move Constructor.
dd4hep::sim::Geant4PlacementParameterisation::m_dimensions
Dimensions m_dimensions
Setup parameters: Dimensional parameter setup.
Definition: Geant4PlacementParameterisation.h:76
dd4hep::sim::Geant4PlacementParameterisation::Dimension::Dimension
Dimension(const Dimension &)=default
Copy Constructor.
dd4hep::sim::Geant4PlacementParameterisation::Dimension::operator=
Dimension & operator=(const Dimension &)=default
Assignment operator.
dd4hep::sim::Geant4PlacementParameterisation::m_start
Dimension m_start
Setup parameters: Initial parameterisation position.
Definition: Geant4PlacementParameterisation.h:74
dd4hep::sim::Geant4PlacementParameterisation::~Geant4PlacementParameterisation
virtual ~Geant4PlacementParameterisation()=default
Standard destructor.
dd4hep::sim::Geant4PlacementParameterisation::m_num_cells
size_t m_num_cells
Total number of parameterized cells.
Definition: Geant4PlacementParameterisation.h:81
dd4hep::sim::Geant4PlacementParameterisation::Dimension::count
std::size_t count
Definition: Geant4PlacementParameterisation.h:46
dd4hep::sim::Geant4PlacementParameterisation::axis
EAxis axis() const
Access Axis direction.
Definition: Geant4PlacementParameterisation.h:98
dd4hep::sim::Geant4PlacementParameterisation::Rotations
std::vector< G4RotationMatrix > Rotations
Definition: Geant4PlacementParameterisation.h:65
dd4hep::sim::Geant4PlacementParameterisation::count
std::size_t count() const
Access number of replicas.
Definition: Geant4PlacementParameterisation.cpp:69
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4PlacementParameterisation::Dimension::delta
G4Transform3D delta
Definition: Geant4PlacementParameterisation.h:44
dd4hep::sim::Geant4PlacementParameterisation::Dimension::Dimension
Dimension()=default
Default constructor.
dd4hep::sim::Geant4PlacementParameterisation::m_rotations
Rotations m_rotations
Cached rotations and translations for complex parameterisations.
Definition: Geant4PlacementParameterisation.h:86
dd4hep::sim::Geant4PlacementParameterisation::operator()
void operator()(const G4Transform3D &transform)
Callback to store resulting rotation.
Definition: Geant4PlacementParameterisation.cpp:74
dd4hep::sim::Geant4PlacementParameterisation::ComputeTransformation
virtual void ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *vol) const override
G4VPVParameterisation overload: Compute copy transformation.
Definition: Geant4PlacementParameterisation.cpp:83
dd4hep::sim::Geant4PlacementParameterisation::Dimension::Dimension
Dimension(const G4Transform3D &d, std::size_t c)
Initializing constructor.
Definition: Geant4PlacementParameterisation.h:50
dd4hep::PlacedVolumeExtension::Parameterisation
Optional parameters to implement special features such as parametrization.
Definition: Volumes.h:246
dd4hep::sim::Geant4PlacementParameterisation::m_have_rotation
bool m_have_rotation
Optimization flag for simple parameteristions.
Definition: Geant4PlacementParameterisation.h:83