LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
ReadoutIDmapper.h
Go to the documentation of this file.
1 
9 #ifndef LARCOREALG_GEOMETRY_READOUTIDMAPPER_H
10 #define LARCOREALG_GEOMETRY_READOUTIDMAPPER_H
11 
12 // LArSoft libraries
15 
16 // C/C++ standard libraries
17 #include <algorithm> // std::fill(), std::for_each()
18 #include <array>
19 #include <cassert>
20 #include <initializer_list>
21 #include <stdexcept> // std::out_of_range
22 #include <string>
23 #include <utility> // std::forward()
24 #include <vector>
25 
26 namespace readout {
27 
28  template <typename Index = std::size_t>
30 
31  template <typename Index = std::size_t>
32  class ROPIDmapper;
33 
34 } // namespace readout
35 
36 // --- BEGIN Readout ID mappers ------------------------------------------------
40 
49 template <typename Index /* = std::size_t */>
50 class readout::TPCsetIDmapper : public geo::GeoIDmapper<readout::TPCsetID, Index> {
51 
54 
55 public:
56  // import types
57  using ID_t = typename BaseMapper_t::ID_t;
59 
60  // import all constructors from `geo::GeoIDmapper`
61  using BaseMapper_t::BaseMapper_t;
62 
71  TPCsetIDmapper(unsigned int nCryo, unsigned int nTPCsets) : BaseMapper_t({nCryo, nTPCsets}) {}
72 
73  // --- BEGIN Mapping modification --------------------------------------------
76 
78 
88  void resize(unsigned int nCryo, unsigned int nTPCsets)
89  {
90  BaseMapper_t::resize({nCryo, nTPCsets});
91  }
92 
94  // --- END Mapping modification ----------------------------------------------
95 
96  // --- BEGIN Mapping status query --------------------------------------------
99 
101  bool hasCryostat(geo::CryostatID const& cryoid) const { return BaseMapper_t::hasElement(cryoid); }
102 
104  bool hasTPCset(readout::TPCsetID const& tpcsetid) const
105  {
106  return BaseMapper_t::hasElement(tpcsetid);
107  }
108 
110  // --- END Mapping status query ----------------------------------------------
111 
112 }; // readout::TPCsetIDmapper<>
113 
122 template <typename Index /* = std::size_t */>
123 class readout::ROPIDmapper : public geo::GeoIDmapper<readout::ROPID, Index> {
124 
127 
128 public:
129  // import types
130  using ID_t = typename BaseMapper_t::ID_t;
132 
133  // import all constructors from `geo::GeoIDmapper`
134  using BaseMapper_t::BaseMapper_t;
135 
145  ROPIDmapper(unsigned int nCryo, unsigned int nTPCsets, unsigned int nROPs)
146  : BaseMapper_t({nCryo, nTPCsets, nROPs})
147  {}
148 
149  // --- BEGIN Mapping modification --------------------------------------------
152 
153  using BaseMapper_t::resize;
154 
165  void resize(unsigned int nCryo, unsigned int nTPCsets, unsigned int nROPs)
166  {
167  BaseMapper_t::resize({nCryo, nTPCsets, nROPs});
168  }
169 
171  // --- END Mapping modification ----------------------------------------------
172 
173  // --- BEGIN Mapping status query --------------------------------------------
176 
178  bool hasCryostat(geo::CryostatID const& cryoid) const { return BaseMapper_t::hasElement(cryoid); }
179 
181  bool hasTPC(readout::TPCsetID const& tpcsetid) const
182  {
183  return BaseMapper_t::hasElement(tpcsetid);
184  }
185 
187  bool hasPlane(readout::ROPID const& ropid) const { return BaseMapper_t::hasElement(ropid); }
188 
190  // --- END Mapping status query ----------------------------------------------
191 
192 }; // readout::ROPIDmapper<>
193 
195 // --- END Readout ID mappers --------------------------------------------------
196 //------------------------------------------------------------------------------
197 
198 #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:54
Mapping between geometry/readout ID and flat index.This is a header-only library. ...
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:187
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.