File indexing completed on 2025-08-05 08:18:13
0001 #ifndef PHG4MICROMEGASSURVEY_H
0002 #define PHG4MICROMEGASSURVEY_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <Geant4/G4Transform3D.hh>
0017
0018 #include <array>
0019 #include <string>
0020 #include <unordered_map>
0021
0022 class PHG4MicromegasSurvey
0023 {
0024 public:
0025
0026 PHG4MicromegasSurvey();
0027
0028
0029 std::string get_module_name(int layer, uint tile) const;
0030
0031
0032 G4Transform3D get_transformation(int layer, uint tile) const;
0033
0034 private:
0035
0036 struct tile_id_t
0037 {
0038 tile_id_t(int layer, uint tile)
0039 : m_layer(layer)
0040 , m_tile(tile)
0041 {
0042 }
0043 int m_layer = 0;
0044 uint m_tile = 0;
0045
0046 bool operator==(const tile_id_t& other) const
0047 {
0048 return other.m_layer == m_layer && other.m_tile == m_tile;
0049 }
0050 };
0051
0052 struct tile_id_hash_t
0053 {
0054 std::size_t operator()(const tile_id_t& id) const noexcept
0055 {
0056 return id.m_tile + (id.m_layer << 4);
0057 }
0058 };
0059
0060
0061 using tile_map_t = std::unordered_map<tile_id_t, std::string, tile_id_hash_t>;
0062 tile_map_t m_tile_map;
0063
0064
0065 using rotation_t = std::array<double, 3>;
0066 using translation_t = std::array<double, 3>;
0067 struct transformation_t
0068 {
0069 transformation_t(const rotation_t& rotation, const translation_t& translation)
0070 : m_rotation(rotation)
0071 , m_translation(translation)
0072 {
0073 }
0074
0075
0076 rotation_t m_rotation = {{0}};
0077
0078
0079 translation_t m_translation = {{0}};
0080 };
0081
0082
0083 using transformation_map_t = std::unordered_map<std::string, transformation_t>;
0084 transformation_map_t m_transformation_map;
0085 };
0086
0087 #endif