Macros | Functions
geoidmapper_test.cxx File Reference

Unit test for geo::GeoIDmapper. More...

#include <boost/test/unit_test.hpp>
#include "larcorealg/Geometry/GeometryIDmapper.h"
#include "larcorealg/CoreUtils/counter.h"
#include "larcoreobj/SimpleTypesAndConstants/geo_types.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (geo ID mapper test)
 

Functions

void TPCIDmappingTest (geo::TPCIDmapper<> mapper, std::size_t const NCryostats, std::size_t const NTPCs)
 
void PlaneIDmappingTest (geo::PlaneIDmapper<> mapper, std::size_t const NCryostats, std::size_t const NTPCs, std::size_t const NPlanes)
 
 BOOST_AUTO_TEST_CASE (TPCIDmappingTestCase)
 
 BOOST_AUTO_TEST_CASE (PlaneIDmappingTestCase)
 

Detailed Description

Unit test for geo::GeoIDmapper.

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov)
Date
October 26, 2019
See also
larcorealg/Geometry/GeometryDataContainers.h

Definition in file geoidmapper_test.cxx.

Macro Definition Documentation

#define BOOST_TEST_MODULE   (geo ID mapper test)

Definition at line 10 of file geoidmapper_test.cxx.

Function Documentation

BOOST_AUTO_TEST_CASE ( TPCIDmappingTestCase  )

Definition at line 299 of file geoidmapper_test.cxx.

299  {
300 
301  constexpr std::size_t NCryostats = 2U;
302  constexpr std::size_t NTPCs = 3U;
303 
304  //
305  // size constructor
306  //
307  geo::TPCIDmapper<> mapper1(NCryostats, NTPCs);
308  TPCIDmappingTest(mapper1, NCryostats, NTPCs);
309 
310  //
311  // default constructor + resize
312  //
313  geo::TPCIDmapper<> mapper2;
314  BOOST_TEST(mapper2.empty());
315 
316  mapper2.resizeAs(mapper1);
317  TPCIDmappingTest(mapper2, NCryostats, NTPCs);
318 
319 } // TPCIDmappingTestCase
void TPCIDmappingTest(geo::TPCIDmapper<> mapper, std::size_t const NCryostats, std::size_t const NTPCs)
void resizeAs(geo::GeoIDmapper< OIDType, OIndex > const &other)
Resizes the mapping to reflect the one from another mapping.
bool empty() const
Returns whether the mapping has no elements (false by assumptions).
BOOST_AUTO_TEST_CASE ( PlaneIDmappingTestCase  )

Definition at line 323 of file geoidmapper_test.cxx.

323  {
324 
325  constexpr std::size_t NCryostats = 2U;
326  constexpr std::size_t NTPCs = 3U;
327  constexpr std::size_t NPlanes = 2U;
328 
329  //
330  // size constructor
331  //
332  geo::PlaneIDmapper<> mapper1(NCryostats, NTPCs, NPlanes);
333  PlaneIDmappingTest(mapper1, NCryostats, NTPCs, NPlanes);
334 
335  //
336  // default constructor + resize
337  //
338  geo::PlaneIDmapper<> mapper2;
339  BOOST_TEST(mapper2.empty());
340 
341  mapper2.resizeAs(mapper1);
342  PlaneIDmappingTest(mapper2, NCryostats, NTPCs, NPlanes);
343 
344 } // PlaneIDmappingTestCase
void PlaneIDmappingTest(geo::PlaneIDmapper<> mapper, std::size_t const NCryostats, std::size_t const NTPCs, std::size_t const NPlanes)
void resizeAs(geo::GeoIDmapper< OIDType, OIndex > const &other)
Resizes the mapping to reflect the one from another mapping.
bool empty() const
Returns whether the mapping has no elements (false by assumptions).
void PlaneIDmappingTest ( geo::PlaneIDmapper<>  mapper,
std::size_t const  NCryostats,
std::size_t const  NTPCs,
std::size_t const  NPlanes 
)

Definition at line 106 of file geoidmapper_test.cxx.

111  {
112 
113  using Mapper_t = geo::PlaneIDmapper<>;
114 
115  std::size_t const N = NCryostats * NTPCs * NPlanes;
116 
117  static_assert(mapper.dimensions() == 3U);
118  BOOST_TEST(mapper.dimSize<0U>() == NCryostats);
119  BOOST_TEST(mapper.dimSize<1U>() == NTPCs);
120  BOOST_TEST(mapper.dimSize<2U>() == NPlanes);
121  BOOST_TEST(mapper.dimSize<3U>() == 0U);
122 
123  BOOST_TEST(!mapper.empty());
124  BOOST_TEST(mapper.size() == N);
125 
126  auto expected_index = Mapper_t::index_type{ 0 };
127  for (auto c: util::counter<unsigned int>(NCryostats)) {
128  for (auto t: util::counter<unsigned int>(NTPCs)) {
129  for (auto p: util::counter<unsigned int>(NPlanes)) {
130  geo::PlaneID const expected_ID { c, t, p };
131 
132  BOOST_TEST(mapper.index(expected_ID) == expected_index);
133  BOOST_TEST(mapper.ID(expected_index) == expected_ID);
134 
135  ++expected_index;
136  } // for planes
137  } // for TPCs
138  } // for cryostats
139  BOOST_TEST(mapper.size() == expected_index);
140 
141  BOOST_TEST(mapper.firstID() == geo::PlaneID(0, 0, 0));
142  BOOST_TEST(mapper.lastID() == geo::PlaneID(1, 2, 1));
143 
144  BOOST_TEST( mapper.hasPlane({ 0, 0, 0}));
145  BOOST_TEST( mapper.hasPlane({ 0, 0, 1}));
146  BOOST_TEST(!mapper.hasPlane({ 0, 0, 2}));
147  BOOST_TEST( mapper.hasPlane({ 0, 1, 0}));
148  BOOST_TEST( mapper.hasPlane({ 0, 1, 1}));
149  BOOST_TEST(!mapper.hasPlane({ 0, 1, 2}));
150  BOOST_TEST( mapper.hasPlane({ 0, 2, 0}));
151  BOOST_TEST( mapper.hasPlane({ 0, 2, 1}));
152  BOOST_TEST(!mapper.hasPlane({ 0, 2, 2}));
153  BOOST_TEST(!mapper.hasPlane({ 0, 3, 0}));
154  BOOST_TEST(!mapper.hasPlane({ 0, 3, 1}));
155  BOOST_TEST(!mapper.hasPlane({ 0, 3, 2}));
156  BOOST_TEST(!mapper.hasPlane({ 0, 4, 0}));
157  BOOST_TEST(!mapper.hasPlane({ 0, 4, 1}));
158  BOOST_TEST(!mapper.hasPlane({ 0, 4, 2}));
159  BOOST_TEST( mapper.hasPlane({ 1, 0, 0}));
160  BOOST_TEST( mapper.hasPlane({ 1, 0, 1}));
161  BOOST_TEST(!mapper.hasPlane({ 1, 0, 2}));
162  BOOST_TEST( mapper.hasPlane({ 1, 1, 0}));
163  BOOST_TEST( mapper.hasPlane({ 1, 1, 1}));
164  BOOST_TEST(!mapper.hasPlane({ 1, 1, 2}));
165  BOOST_TEST( mapper.hasPlane({ 1, 2, 0}));
166  BOOST_TEST( mapper.hasPlane({ 1, 2, 1}));
167  BOOST_TEST(!mapper.hasPlane({ 1, 2, 2}));
168  BOOST_TEST(!mapper.hasPlane({ 1, 3, 0}));
169  BOOST_TEST(!mapper.hasPlane({ 1, 3, 1}));
170  BOOST_TEST(!mapper.hasPlane({ 1, 3, 2}));
171  BOOST_TEST(!mapper.hasPlane({ 1, 4, 0}));
172  BOOST_TEST(!mapper.hasPlane({ 1, 4, 1}));
173  BOOST_TEST(!mapper.hasPlane({ 1, 4, 2}));
174  BOOST_TEST(!mapper.hasPlane({ 2, 0, 0}));
175  BOOST_TEST(!mapper.hasPlane({ 2, 0, 1}));
176  BOOST_TEST(!mapper.hasPlane({ 2, 0, 2}));
177  BOOST_TEST(!mapper.hasPlane({ 2, 1, 0}));
178  BOOST_TEST(!mapper.hasPlane({ 2, 1, 1}));
179  BOOST_TEST(!mapper.hasPlane({ 2, 1, 2}));
180  BOOST_TEST(!mapper.hasPlane({ 2, 2, 0}));
181  BOOST_TEST(!mapper.hasPlane({ 2, 2, 1}));
182  BOOST_TEST(!mapper.hasPlane({ 2, 2, 2}));
183  BOOST_TEST(!mapper.hasPlane({ 2, 3, 0}));
184  BOOST_TEST(!mapper.hasPlane({ 2, 3, 1}));
185  BOOST_TEST(!mapper.hasPlane({ 2, 3, 2}));
186  BOOST_TEST(!mapper.hasPlane({ 2, 4, 0}));
187  BOOST_TEST(!mapper.hasPlane({ 2, 4, 1}));
188  BOOST_TEST(!mapper.hasPlane({ 2, 4, 2}));
189 
190  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 0, 0}));
191  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 0, 1}));
192  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 0, 2}));
193  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 1, 0}));
194  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 1, 1}));
195  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 1, 2}));
196  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 2, 0}));
197  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 2, 1}));
198  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 0, 2, 2}));
199  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 0, 3, 0}));
200  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 0, 3, 1}));
201  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 0, 3, 2}));
202  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 0, 4, 0}));
203  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 0, 4, 1}));
204  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 0, 4, 2}));
205  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 0, 0}));
206  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 0, 1}));
207  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 0, 2}));
208  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 1, 0}));
209  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 1, 1}));
210  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 1, 2}));
211  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 2, 0}));
212  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 2, 1}));
213  BOOST_TEST( mapper.hasTPC(geo::PlaneID{ 1, 2, 2}));
214  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 1, 3, 0}));
215  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 1, 3, 1}));
216  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 1, 3, 2}));
217  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 1, 4, 0}));
218  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 1, 4, 1}));
219  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 1, 4, 2}));
220  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 0, 0}));
221  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 0, 1}));
222  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 0, 2}));
223  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 1, 0}));
224  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 1, 1}));
225  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 1, 2}));
226  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 2, 0}));
227  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 2, 1}));
228  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 2, 2}));
229  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 3, 0}));
230  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 3, 1}));
231  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 3, 2}));
232  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 4, 0}));
233  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 4, 1}));
234  BOOST_TEST(!mapper.hasTPC(geo::PlaneID{ 2, 4, 2}));
235 
236  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 0, 0}));
237  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 0, 1}));
238  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 0, 2}));
239  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 1, 0}));
240  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 1, 1}));
241  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 1, 2}));
242  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 2, 0}));
243  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 2, 1}));
244  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 2, 2}));
245  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 3, 0}));
246  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 3, 1}));
247  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 3, 2}));
248  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 4, 0}));
249  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 4, 1}));
250  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 0, 4, 2}));
251  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 0, 0}));
252  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 0, 1}));
253  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 0, 2}));
254  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 1, 0}));
255  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 1, 1}));
256  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 1, 2}));
257  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 2, 0}));
258  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 2, 1}));
259  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 2, 2}));
260  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 3, 0}));
261  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 3, 1}));
262  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 3, 2}));
263  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 4, 0}));
264  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 4, 1}));
265  BOOST_TEST( mapper.hasCryostat(geo::PlaneID{ 1, 4, 2}));
266  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 0, 0}));
267  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 0, 1}));
268  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 0, 2}));
269  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 1, 0}));
270  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 1, 1}));
271  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 1, 2}));
272  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 2, 0}));
273  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 2, 1}));
274  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 2, 2}));
275  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 3, 0}));
276  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 3, 1}));
277  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 3, 2}));
278  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 4, 0}));
279  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 4, 1}));
280  BOOST_TEST(!mapper.hasCryostat(geo::PlaneID{ 2, 4, 2}));
281 
282 
283  auto const& constMapper = mapper;
284 
285  BOOST_TEST(constMapper.dimSize<0U>() == NCryostats);
286  BOOST_TEST(constMapper.dimSize<1U>() == NTPCs);
287  BOOST_TEST(constMapper.dimSize<2U>() == NPlanes);
288  BOOST_TEST(constMapper.dimSize<3U>() == 0U);
289 
290  mapper.clear();
291  BOOST_TEST(mapper.empty());
292 
293 } // PlaneIDmappingTest()
ID_t ID(index_type const index) const
Returns the ID corresponding to the specified linear index.
bool hasCryostat(geo::CryostatID const &cryoid) const
Returns whether this mapping covers the specified cryostat.
index_type size() const
Returns the number of elements in the mapping.
GeoID firstID() const
Returns the ID of the first element with GeoID type.
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
static constexpr unsigned int dimensions()
Dimensions of the ID of this mapping.
unsigned int dimSize() const
Dimensions of the Level dimension of this mapping.
p
Definition: test.py:223
GeoID lastID() const
Returns the ID of the last covered element with GeoID type.
bool empty() const
Returns whether the mapping has no elements (false by assumptions).
detail::Node< FrameID, bool > PlaneID
Definition: CRTID.h:125
index_type index(ID_t const &id) const
Returns the linear index corresponding to the specified ID.
bool hasPlane(geo::PlaneID const &planeid) const
Returns whether this mapping covers the specified plane.
bool hasTPC(geo::TPCID const &tpcid) const
Returns whether this mapping covers the specified TPC.
void clear()
Sets all dimension sizes to 0.
void TPCIDmappingTest ( geo::TPCIDmapper<>  mapper,
std::size_t const  NCryostats,
std::size_t const  NTPCs 
)

Definition at line 20 of file geoidmapper_test.cxx.

23  {
24 
25  using Mapper_t = geo::TPCIDmapper<>;
26 
27  std::size_t const N = NCryostats * NTPCs;
28 
29  static_assert(mapper.dimensions() == 2U);
30  BOOST_TEST(mapper.dimSize<0U>() == NCryostats);
31  BOOST_TEST(mapper.dimSize<1U>() == NTPCs);
32  BOOST_TEST(mapper.dimSize<2U>() == 0U);
33  BOOST_TEST(mapper.dimSize<3U>() == 0U);
34 
35  BOOST_TEST(!mapper.empty());
36  BOOST_TEST(mapper.size() == N);
37 
38  auto expected_index = Mapper_t::index_type{ 0 };
39  for (auto c: util::counter<unsigned int>(NCryostats)) {
40  for (auto t: util::counter<unsigned int>(NTPCs)) {
41  geo::TPCID const expected_ID { c, t };
42 
43  auto const& ID = mapper.ID(expected_index);
44 
45  BOOST_TEST(mapper.index(expected_ID) == expected_index);
46  BOOST_TEST(ID == expected_ID);
47  BOOST_TEST(ID.isValid);
48 
49  ++expected_index;
50  } // for TPCs
51  } // for cryostats
52  BOOST_TEST(mapper.size() == expected_index);
53  BOOST_TEST(!mapper.ID(expected_index).isValid);
54 
55  BOOST_TEST(mapper.firstID() == geo::TPCID(0, 0));
56  BOOST_TEST(mapper.lastID() == geo::TPCID(1, 2));
57 
58  BOOST_TEST( mapper.hasElement({ 0, 0 }));
59  BOOST_TEST( mapper.hasElement({ 0, 1 }));
60  BOOST_TEST( mapper.hasElement({ 0, 2 }));
61  BOOST_TEST(!mapper.hasElement({ 0, 3 }));
62  BOOST_TEST(!mapper.hasElement({ 0, 4 }));
63  BOOST_TEST( mapper.hasElement({ 1, 0 }));
64  BOOST_TEST( mapper.hasElement({ 1, 1 }));
65  BOOST_TEST( mapper.hasElement({ 1, 2 }));
66  BOOST_TEST(!mapper.hasElement({ 1, 3 }));
67  BOOST_TEST(!mapper.hasElement({ 1, 4 }));
68  BOOST_TEST(!mapper.hasElement({ 2, 0 }));
69  BOOST_TEST(!mapper.hasElement({ 2, 1 }));
70  BOOST_TEST(!mapper.hasElement({ 2, 2 }));
71  BOOST_TEST(!mapper.hasElement({ 2, 3 }));
72  BOOST_TEST(!mapper.hasElement({ 2, 4 }));
73 
74  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 0, 0 }));
75  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 0, 1 }));
76  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 0, 2 }));
77  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 0, 3 }));
78  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 0, 4 }));
79  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 1, 0 }));
80  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 1, 1 }));
81  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 1, 2 }));
82  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 1, 3 }));
83  BOOST_TEST( mapper.hasElement<geo::CryostatID>(geo::TPCID{ 1, 4 }));
84  BOOST_TEST(!mapper.hasElement<geo::CryostatID>(geo::TPCID{ 2, 0 }));
85  BOOST_TEST(!mapper.hasElement<geo::CryostatID>(geo::TPCID{ 2, 1 }));
86  BOOST_TEST(!mapper.hasElement<geo::CryostatID>(geo::TPCID{ 2, 2 }));
87  BOOST_TEST(!mapper.hasElement<geo::CryostatID>(geo::TPCID{ 2, 3 }));
88  BOOST_TEST(!mapper.hasElement<geo::CryostatID>(geo::TPCID{ 2, 4 }));
89 
90 
91  auto const& constMapper = mapper;
92 
93  BOOST_TEST(constMapper.dimSize<0U>() == NCryostats);
94  BOOST_TEST(constMapper.dimSize<1U>() == NTPCs);
95  BOOST_TEST(constMapper.dimSize<2U>() == 0U);
96  BOOST_TEST(constMapper.dimSize<3U>() == 0U);
97 
98 
99  mapper.clear();
100  BOOST_TEST(mapper.empty());
101 
102 } // TPCIDmappingTest()
ID_t ID(index_type const index) const
Returns the ID corresponding to the specified linear index.
index_type size() const
Returns the number of elements in the mapping.
unsigned int ID
GeoID firstID() const
Returns the ID of the first element with GeoID type.
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:211
static constexpr unsigned int dimensions()
Dimensions of the ID of this mapping.
unsigned int dimSize() const
Dimensions of the Level dimension of this mapping.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
GeoID lastID() const
Returns the ID of the last covered element with GeoID type.
bool hasElement(GeoID const &id) const
Returns whether this mapping hosts data for the specified ID.
bool empty() const
Returns whether the mapping has no elements (false by assumptions).
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
index_type index(ID_t const &id) const
Returns the linear index corresponding to the specified ID.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
void clear()
Sets all dimension sizes to 0.