LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ReadoutIDmapper.h
Go to the documentation of this file.
1 
11 #ifndef LARCOREALG_GEOMETRY_READOUTIDMAPPER_H
12 #define LARCOREALG_GEOMETRY_READOUTIDMAPPER_H
13 
14 // LArSoft libraries
17 
18 // C/C++ standard libraries
19 #include <algorithm> // std::fill(), std::for_each()
20 #include <array>
21 #include <cassert>
22 #include <initializer_list>
23 #include <stdexcept> // std::out_of_range
24 #include <string>
25 #include <utility> // std::forward()
26 #include <vector>
27 
28 namespace readout {
29 
30  template <typename Index = std::size_t>
32 
33  template <typename Index = std::size_t>
34  class ROPIDmapper;
35 
36 } // namespace readout
37 
38 // --- BEGIN Readout ID mappers ------------------------------------------------
42 
51 template <typename Index /* = std::size_t */>
52 class readout::TPCsetIDmapper : public geo::GeoIDmapper<readout::TPCsetID, Index> {
53 
56 
57 public:
58  // import types
59  using ID_t = typename BaseMapper_t::ID_t;
61 
62  // import all constructors from `geo::GeoIDmapper`
63  using BaseMapper_t::BaseMapper_t;
64 
73  TPCsetIDmapper(unsigned int nCryo, unsigned int nTPCsets) : BaseMapper_t({nCryo, nTPCsets}) {}
74 
75  // --- BEGIN Mapping modification --------------------------------------------
78 
80 
90  void resize(unsigned int nCryo, unsigned int nTPCsets)
91  {
92  BaseMapper_t::resize({nCryo, nTPCsets});
93  }
94 
96  // --- END Mapping modification ----------------------------------------------
97 
98  // --- BEGIN Mapping status query --------------------------------------------
101 
103  bool hasCryostat(geo::CryostatID const& cryoid) const { return BaseMapper_t::hasElement(cryoid); }
104 
106  bool hasTPCset(readout::TPCsetID const& tpcsetid) const
107  {
108  return BaseMapper_t::hasElement(tpcsetid);
109  }
110 
112  // --- END Mapping status query ----------------------------------------------
113 
114 }; // readout::TPCsetIDmapper<>
115 
124 template <typename Index /* = std::size_t */>
125 class readout::ROPIDmapper : public geo::GeoIDmapper<readout::ROPID, Index> {
126 
129 
130 public:
131  // import types
132  using ID_t = typename BaseMapper_t::ID_t;
134 
135  // import all constructors from `geo::GeoIDmapper`
136  using BaseMapper_t::BaseMapper_t;
137 
147  ROPIDmapper(unsigned int nCryo, unsigned int nTPCsets, unsigned int nROPs)
148  : BaseMapper_t({nCryo, nTPCsets, nROPs})
149  {}
150 
151  // --- BEGIN Mapping modification --------------------------------------------
154 
155  using BaseMapper_t::resize;
156 
167  void resize(unsigned int nCryo, unsigned int nTPCsets, unsigned int nROPs)
168  {
169  BaseMapper_t::resize({nCryo, nTPCsets, nROPs});
170  }
171 
173  // --- END Mapping modification ----------------------------------------------
174 
175  // --- BEGIN Mapping status query --------------------------------------------
178 
180  bool hasCryostat(geo::CryostatID const& cryoid) const { return BaseMapper_t::hasElement(cryoid); }
181 
183  bool hasTPC(readout::TPCsetID const& tpcsetid) const
184  {
185  return BaseMapper_t::hasElement(tpcsetid);
186  }
187 
189  bool hasPlane(readout::ROPID const& ropid) const { return BaseMapper_t::hasElement(ropid); }
190 
192  // --- END Mapping status query ----------------------------------------------
193 
194 }; // readout::ROPIDmapper<>
195 
197 // --- END Readout ID mappers --------------------------------------------------
198 //------------------------------------------------------------------------------
199 
200 #endif // LARCOREALG_GEOMETRY_READOUTIDMAPPER_H
bool hasCryostat(geo::CryostatID const &cryoid) const
Returns whether this mapping covers the specified cryostat.
ROPIDmapper(unsigned int nCryo, unsigned int nTPCsets, unsigned int nROPs)
Prepares the mapping with the specified sizes.
Classes identifying readout-related concepts.
bool hasTPC(readout::TPCsetID const &tpcsetid) const
Returns whether this mapping covers the specified TPC set.
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:72
Mapping between geometry/readout ID and flat index.
Mapping for readout plane identifiers.
bool hasPlane(readout::ROPID const &ropid) const
Returns whether this mapping covers the specified readout plane.
Class identifying a set of planes sharing readout channels.
bool hasElement(GeoID const &id) const
Returns whether this mapping hosts data for the specified ID.
readout::TPCsetID ID_t
Type used as ID for this mapping.
void resize(unsigned int nCryo, unsigned int nTPCsets)
Prepares the mapping for the specified sizes.
bool hasCryostat(geo::CryostatID const &cryoid) const
Returns whether this mapping covers the specified cryostat.
void resize(std::initializer_list< unsigned int > dims)
Resizes the mapping to accommodate the specified dimension sizes.
Mapping for TPC set identifiers.
void resize(unsigned int nCryo, unsigned int nTPCsets, unsigned int nROPs)
Prepares the mapping for the specified sizes.
bool hasTPCset(readout::TPCsetID const &tpcsetid) const
Returns whether this mapping covers the specified TPC set.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:192
TPCsetIDmapper(unsigned int nCryo, unsigned int nTPCsets)
Prepares the mapping with the specified sizes.
Class managing the mapping between geometry/readout ID and flat index.