Public Member Functions | Protected Attributes | List of all members
geo::GeometryIteratorTestAlg Class Reference

#include <GeometryIteratorTestAlg.h>

Public Member Functions

 GeometryIteratorTestAlg (fhicl::ParameterSet const &)
 Constructor: reads configuration, does nothing. More...
 
virtual ~GeometryIteratorTestAlg ()=default
 Virtual destructor. More...
 
virtual void Setup (geo::GeometryCore const &new_geo)
 Algorithm set up. More...
 
virtual unsigned int Run () const
 Executes the test. More...
 
ID iterator tests
void CryostatIDIteratorsTest () const
 
void TPCIDIteratorsTest () const
 
void PlaneIDIteratorsTest () const
 
void WireIDIteratorsTest () const
 
void TPCsetIDIteratorsTest () const
 
void ROPIDIteratorsTest () const
 
Element iterator tests
void CryostatIteratorsTest () const
 
void TPCIteratorsTest () const
 
void PlaneIteratorsTest () const
 
void WireIteratorsTest () const
 

Protected Attributes

GeometryCore const * geom = nullptr
 pointer to the geometry description More...
 

Detailed Description

Definition at line 22 of file GeometryIteratorTestAlg.h.

Constructor & Destructor Documentation

geo::GeometryIteratorTestAlg::GeometryIteratorTestAlg ( fhicl::ParameterSet const &  )
inline

Constructor: reads configuration, does nothing.

Definition at line 26 of file GeometryIteratorTestAlg.h.

26 {}
virtual geo::GeometryIteratorTestAlg::~GeometryIteratorTestAlg ( )
virtualdefault

Virtual destructor.

Member Function Documentation

void geo::GeometryIteratorTestAlg::CryostatIDIteratorsTest ( ) const

Definition at line 118 of file GeometryIteratorTestAlg.cxx.

118  {
119 
120  /*
121  * public interface (cryostat_id_iterator_base):
122  *
123  * /// Default constructor; effect not defined: assign to it before using!
124  * cryostat_id_iterator_base();
125  *
126  * /// Constructor: points to begin
127  * cryostat_id_iterator_base(geo::GeometryCore const* geom);
128  *
129  * /// Constructor: points to the specified cryostat
130  * cryostat_id_iterator_base
131  * (geo::GeometryCore const* geom, GEOID const& start_from);
132  *
133  * /// Constructor: points to begin
134  * cryostat_id_iterator_base(geo::GeometryCore const* geom, BeginPos_t);
135  *
136  * /// Constructor: points to end
137  * cryostat_id_iterator_base(geo::GeometryCore const* geom, EndPos_t);
138  *
139  * /// Returns true if the two iterators point to the same cryostat
140  * template <typename OTHERID>
141  * bool operator== (cryostat_id_iterator_base<OTHERID> const& as) const;
142  *
143  * /// Returns true if the two iterators point to different cryostats
144  * template <typename OTHERID>
145  * bool operator!= (cryostat_id_iterator_base<OTHERID> const& as) const;
146  *
147  * /// Returns the ID the iterator points to
148  * LocalID_t const& operator* () const;
149  *
150  * /// Returns a pointer to the ID the iterator points to
151  * LocalID_t const* operator-> () const;
152  *
153  *
154  * /// Returns whether the iterator is pointing to a valid cryostat
155  * operator bool() const;
156  *
157  * /// Returns a pointer to cryostat, or nullptr if invalid
158  * ElementPtr_t get() const;
159  *
160  */
161 
162  //
163  // default constructed
164  //
165  {
167  BOOST_TEST_CHECKPOINT
168  ("Default created cryostat ID iterator: " << std::string(*iCryo));
169 
170  BOOST_TEST(iCryo->Cryostat == geo::CryostatID::getInvalidID());
171 
172  // check that the iterator tests false
173  BOOST_TEST(!iCryo);
174  BOOST_TEST(!(bool(iCryo)));
175 
176  /*
177  // this is more of a curiosity, since this behaviour is undefined
178  ++iCryo;
179  BOOST_TEST_CHECKPOINT(" (incremented: " << std::string(*iCryo) << ")");
180  */
181  }
182 
183  //
184  // begin-constructed
185  //
186  {
188  BOOST_TEST_CHECKPOINT
189  ("Begin-created cryostat ID iterator: " << std::string(*iCryo));
190 
191  BOOST_TEST(iCryo->Cryostat == geo::CryostatID::CryostatID_t(0));
192 
193  // check that the iterator tests true
194  BOOST_TEST(bool(iCryo));
195  BOOST_TEST(!!iCryo);
196 
197  // initialize to the beginning directly; this has probably ID's isValid true
198  geo::CryostatID BeginID;
199  geom->GetBeginID(BeginID);
201  BOOST_TEST(iCryoD->Cryostat == geo::CryostatID::CryostatID_t(0));
202  BOOST_TEST(iCryoD == iCryo);
203 
204  // construct from explicit begin position
207  BOOST_TEST(iCryoBC == iCryo);
208 
209  // construct at begin position by geometry
211  BOOST_TEST(iCryoGB == iCryo);
212 
213  // check access to ID
214  BOOST_TEST(*iCryo == BeginID);
215  BOOST_TEST(iCryo->Cryostat == BeginID.Cryostat);
216 
217  // check access to geometry element
218  geo::CryostatGeo const* pCryo = geom->CryostatPtr(BeginID);
219  BOOST_TEST(iCryo.get() == pCryo);
220 
221  // test copy and postfix increment
223 
224  BOOST_TEST(iCryo->Cryostat == geo::CryostatID::CryostatID_t(1));
225  BOOST_TEST(iCryoI->Cryostat == geo::CryostatID::CryostatID_t(0));
226  BOOST_TEST(iCryoI != iCryo);
227 
228  // test copy and prefix increment
229  ++iCryoI;
230  BOOST_TEST(iCryoI->Cryostat == geo::CryostatID::CryostatID_t(1));
231  BOOST_TEST(iCryoI == iCryo);
232 
233  if (geom->Ncryostats() > 1) {
234  ++iCryoI;
235  BOOST_TEST(iCryoI->Cryostat == geo::CryostatID::CryostatID_t(2));
236  BOOST_TEST(iCryoI != iCryo);
237  }
238 
239  }
240 
241  //
242  // constructed from starting point
243  //
244  {
245  // test iterator to last TPC
246  geo::CryostatID LastID(geom->Ncryostats() - 1); // last cryostat
247 
249  BOOST_TEST_CHECKPOINT("Position-created iterator to last cryostat ID: "
250  << std::string(*iLastCryo));
251 
252  // check that the iterator tests true
253  BOOST_TEST(bool(iLastCryo));
254  BOOST_TEST(!!iLastCryo);
255 
256  // check that the pointed ID is as expected
257  BOOST_TEST(*iLastCryo == LastID);
258  BOOST_TEST(iLastCryo->Cryostat == LastID.Cryostat);
259  BOOST_TEST(iLastCryo.get() == geom->CryostatPtr(LastID));
260 
261  // test increment to past-the-end
262  geo::GeometryCore::cryostat_id_iterator iEndCryo = iLastCryo;
263  ++iEndCryo;
264 
265  // check that the iterator tests false
266  BOOST_TEST(!bool(iEndCryo));
267  BOOST_TEST(!iEndCryo);
268 
269  BOOST_TEST(iEndCryo->Cryostat == geom->Ncryostats());
270  BOOST_TEST(iEndCryo == geom->end_cryostat_id());
271  BOOST_TEST(!iEndCryo.get());
272 
273  }
274 
275  //
276  // end-constructed
277  //
278  {
279  // construct from end position
282  BOOST_TEST_CHECKPOINT
283  ("End-created cryostat ID iterator: " << std::string(*iCryo));
284 
285  BOOST_TEST(iCryo->Cryostat == geom->Ncryostats());
286 
287  // check that the iterator tests false
288  BOOST_TEST(!bool(iCryo));
289  BOOST_TEST(!iCryo);
290 
291  // check access to geometry element (result of operator* is not defined)
292  BOOST_TEST(!(iCryo.get())); // should get nullptr
293 
294  // construct at end position by geometry
296  BOOST_TEST(iCryoGE == iCryo);
297 
298  // initialize to the end directly; this has probably ID's isValid true
301  BOOST_TEST(iCryo2->Cryostat == geom->Ncryostats());
302  BOOST_TEST(iCryo2 == iCryo);
303  /*
304  // this is more of a curiosity, since this behaviour is undefined
305  ++iCryo;
306  BOOST_TEST_CHECKPOINT(" (incremented: " << std::string(*iCryo) << ")");
307  */
308 
309  }
310 
311 } // GeometryIteratorTestAlg::CryostatIDIteratorsTest()
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeometryCore const * geom
pointer to the geometry description
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
std::string string
Definition: nybbler.cc:12
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
static constexpr CryostatID_t getInvalidID()
Return the value of the invalid ID as a r-value.
Definition: geo_types.h:285
Base forward iterator browsing all cryostat IDs in the detector.
Definition: GeometryCore.h:148
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
ElementPtr_t get() const
Returns a pointer to cryostat, or nullptr if invalid.
cryostat_id_iterator begin_cryostat_id() const
Returns an iterator pointing to the first cryostat ID.
CryostatGeo const * CryostatPtr(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
cryostat_id_iterator end_cryostat_id() const
Returns an iterator pointing after the last cryostat ID.
void geo::GeometryIteratorTestAlg::CryostatIteratorsTest ( ) const

Definition at line 316 of file GeometryIteratorTestAlg.cxx.

316  {
317 
318  /*
319  * This test is extensively based on the assumption that the iterators should
320  * behave like the corresponding ID iterators, including "corner cases".
321  *
322  * public interface (geometry_element_iterator<>)
323  *
324  * /// Default constructor; effect not defined: assign to it before using!
325  * geometry_element_iterator()
326  *
327  * /// Constructor: points to begin
328  * geometry_element_iterator(geo::GeometryCore const* geom)
329  *
330  * /// Constructor: points to the same element as the specified ID iterator
331  * geometry_element_iterator(id_iterator_t const& iter)
332  *
333  * /// Constructor: points to the same element as the specified ID iterator
334  * geometry_element_iterator(id_iterator_t&& iter)
335  *
336  * /// Constructor: points to the specified geometry element
337  * geometry_element_iterator
338  * (geo::GeometryCore const* geom, GeoID_t const& start_from)
339  *
340  * /// Constructor: points to beginning
341  * geometry_element_iterator
342  * (geo::GeometryCore const* geom, BeginPos_t const pos)
343  *
344  * /// Constructor: points to end
345  * geometry_element_iterator
346  * (geo::GeometryCore const* geom, EndPos_t const pos)
347  *
348  * /// Returns true if the two iterators point to the same object
349  * bool operator== (iterator const& as) const
350  *
351  * /// Returns true if the two iterators point to the same object
352  * bool operator== (id_iterator_t const& as) const
353  *
354  * /// Returns true if the two iterators point to different objects
355  * bool operator!= (iterator const& as) const
356  *
357  * /// Returns true if the two iterators point to different objects
358  * bool operator!= (id_iterator_t const& as) const
359  *
360  * /// Returns the geometry element the iterator points to
361  * Element_t const& operator* () const
362  *
363  * /// Returns a pointer to the element the iterator points to (or nullptr)
364  * Element_t const* operator-> () const
365  *
366  * /// Prefix increment: returns this iterator pointing to the next element
367  * iterator& operator++ ()
368  *
369  * /// Postfix increment: returns the current iterator, then increments it
370  * iterator operator++ (int)
371  *
372  * /// Returns whether the iterator is pointing to a valid geometry element
373  * operator bool() const
374  *
375  * /// Returns a pointer to the geometry element, or nullptr if invalid
376  * ElementPtr_t get() const
377  *
378  * /// Returns the ID of the pointed geometry element
379  * LocalID_t const& ID() const
380  *
381  */
382 
383  //
384  // default constructed
385  //
386  {
388  BOOST_TEST_CHECKPOINT
389  ("Default created cryostat iterator: " << std::string(*iCryoID));
390 
392 
393  // direct comparison
394  BOOST_TEST(iCryo == iCryoID);
395  BOOST_TEST(!(iCryo != iCryoID));
396 
397  // ID comparison
398  BOOST_TEST(iCryo.ID() == *iCryoID);
399 
400  // check copy assignment
401  geo::GeometryCore::cryostat_iterator iCryo_copy(iCryo);
402  geo::GeometryCore::cryostat_id_iterator iCryoID_copy(iCryoID);
403 
404  // check comparisons too
405  BOOST_TEST(iCryo == iCryo_copy);
406  BOOST_TEST(iCryo_copy == iCryo);
407  BOOST_TEST(!(iCryo != iCryo_copy));
408  BOOST_TEST(!(iCryo_copy != iCryo));
409 
410  BOOST_TEST(iCryo == iCryo_copy);
411 
412  }
413 
414  //
415  // begin-constructed
416  //
417  {
418  geo::CryostatID BeginID;
419  geom->GetBeginID(BeginID);
420 
422 
423 
424  BOOST_TEST_CHECKPOINT
425  ("Begin-created cryostat iterator (" << std::string(BeginID) << ")");
426 
427  // initialize to the beginning directly
429  CompareIteratorAndIteratorID(iCryoD, iCryoID);
430 
431  // initialize to the beginning with implicit initialization
433  CompareIteratorAndIteratorID(iCryo, iCryoID);
434 
435  // construct from explicit begin position
438  CompareIteratorAndIteratorID(iCryoBC, iCryoID);
439 
440  // construct at begin position by geometry
442  CompareIteratorAndIteratorID(iCryoGB, iCryoID);
443 
444  }
445 
446  //
447  // constructed from starting point
448  //
449  {
450  // test iterator to last TPC
451  geo::CryostatID LastID(geom->Ncryostats() - 1); // last cryostat
452  geo::GeometryCore::cryostat_id_iterator iLastCryoID(geom, LastID);
453 
454  BOOST_TEST_CHECKPOINT("Position-created iterator to last cryostat: "
455  << std::string(LastID));
456  geo::GeometryCore::cryostat_iterator iLastCryo(geom, LastID);
457  CompareIteratorAndIteratorID(iLastCryo, iLastCryoID);
458 
459  // test increment to past-the-end
460  geo::GeometryCore::cryostat_id_iterator iEndCryoID = iLastCryoID;
461  ++iEndCryoID;
462 
463  geo::GeometryCore::cryostat_iterator iEndCryo = iLastCryo;
464  ++iEndCryo;
465 
466  CompareIteratorAndIteratorID(iEndCryo, iEndCryoID);
467 
468  }
469 
470  //
471  // end-constructed
472  //
473  {
475 
476  // construct from end position
477  BOOST_TEST_CHECKPOINT
478  ("End-created cryostat iterator: " << std::string(*iCryoID));
481  CompareIteratorAndIteratorID(iCryo, iCryoID);
482 
483  // construct at end position by geometry
485  CompareIteratorAndIteratorID(iCryoGE, iCryoID);
486 
487  }
488 
489 } // GeometryIteratorTestAlg::CryostatIteratorsTest()
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeometryCore const * geom
pointer to the geometry description
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
std::string string
Definition: nybbler.cc:12
cryostat_iterator end_cryostat() const
Returns an iterator pointing after the last cryostat.
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Base forward iterator browsing all cryostat IDs in the detector.
Definition: GeometryCore.h:148
cryostat_iterator begin_cryostat() const
Returns an iterator pointing to the first cryostat.
LocalID_t const & ID() const
Returns the ID of the pointed geometry element.
Definition: GeometryCore.h:883
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:719
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
cryostat_id_iterator end_cryostat_id() const
Returns an iterator pointing after the last cryostat ID.
void geo::GeometryIteratorTestAlg::PlaneIDIteratorsTest ( ) const

Definition at line 893 of file GeometryIteratorTestAlg.cxx.

893  {
894 
895  /*
896  * public interface (plane_id_iterator_base):
897  *
898  * /// Default constructor; effect not defined: assign to it before using!
899  * plane_id_iterator_base()
900  *
901  * /// Constructor: points to begin
902  * plane_id_iterator_base(geo::GeometryCore const* geom)
903  *
904  * /// Constructor: points to the specified cryostat
905  * plane_id_iterator_base
906  * (geo::GeometryCore const* geom, GEOID const& start_from)
907  *
908  * /// Constructor: points to begin
909  * plane_id_iterator_base(geo::GeometryCore const* geom, BeginPos_t)
910  *
911  * /// Constructor: points to end
912  * plane_id_iterator_base(geo::GeometryCore const* geom, EndPos_t)
913  *
914  * // TODO reconsider if the additional template is indeed needed
915  * /// Returns true if the two iterators point to the same plane
916  * template <typename OTHERID>
917  * bool operator== (plane_id_iterator_base<OTHERID> const& as) const
918  *
919  * /// Returns true if the two iterators point to different planes
920  * template <typename OTHERID>
921  * bool operator!= (plane_id_iterator_base<OTHERID> const& as) const
922  *
923  * /// Returns the PlaneID the iterator points to
924  * LocalID_t const& operator* () const
925  *
926  * /// Returns the PlaneID the iterator points to
927  * LocalID_t const* operator-> () const
928  *
929  * /// Prefix increment: returns this iterator pointing to the next plane
930  * iterator& operator++ ()
931  *
932  * /// Postfix increment: returns the current iterator, then increments it
933  * iterator operator++ (int)
934  *
935  * /// Returns whether the iterator is pointing to a valid plane
936  * operator bool() const
937  *
938  * /// Returns a pointer to plane, or nullptr if invalid
939  * ElementPtr_t get() const
940  *
941  */
942 
943  //
944  // default constructed
945  //
946  {
948  BOOST_TEST_CHECKPOINT
949  ("Default created plane ID iterator: " << std::string(*iPlane));
950 
951  BOOST_TEST(iPlane->Cryostat == geo::CryostatID::getInvalidID());
952  BOOST_TEST(iPlane->TPC == geo::TPCID::getInvalidID());
953  BOOST_TEST(iPlane->Plane == geo::PlaneID::getInvalidID());
954 
955  // check that the iterator tests false
956  BOOST_TEST(!iPlane);
957  BOOST_TEST(!(bool(iPlane)));
958 
959  }
960 
961  //
962  // begin-constructed
963  //
964  {
966  BOOST_TEST_CHECKPOINT
967  ("Begin-created plane ID iterator: " << std::string(*iPlane));
968 
969  BOOST_TEST(iPlane->Cryostat == geo::CryostatID::CryostatID_t(0));
970  BOOST_TEST(iPlane->TPC == geo::TPCID::TPCID_t(0));
971  BOOST_TEST(iPlane->Plane == geo::PlaneID::PlaneID_t(0));
972 
973  // check that the iterator tests true
974  BOOST_TEST(bool(iPlane));
975  BOOST_TEST(!!iPlane);
976 
977  // initialize to the beginning directly; this has probably ID's isValid true
978  geo::PlaneID BeginID;
979  geom->GetBeginID(BeginID);
980  geo::GeometryCore::plane_id_iterator iPlaneD(geom, BeginID);
981  BOOST_TEST(iPlaneD->Cryostat == geo::CryostatID::CryostatID_t(0));
982  BOOST_TEST(iPlaneD->TPC == geo::TPCID::TPCID_t(0));
983  BOOST_TEST(iPlaneD->Plane == geo::PlaneID::PlaneID_t(0));
984  BOOST_TEST(iPlaneD == iPlane);
985 
986  // construct from explicit begin position
989  BOOST_TEST(iPlaneBC == iPlane);
990 
991  // construct at begin position by geometry
993  BOOST_TEST(iPlaneGB == iPlane);
994 
995  // check access to ID
996  BOOST_TEST(*iPlane == BeginID);
997  BOOST_TEST(iPlane->Cryostat == BeginID.Cryostat);
998  BOOST_TEST(iPlane->TPC == BeginID.TPC);
999  BOOST_TEST(iPlane->Plane == BeginID.Plane);
1000 
1001  // check access to geometry element
1002  geo::PlaneGeo const* pPlane = geom->PlanePtr(BeginID);
1003  BOOST_TEST(iPlane.get() == pPlane);
1004 
1005  // test copy and postfix increment
1006  geo::GeometryCore::plane_id_iterator iPlaneI(iPlane++);
1007 
1008  const unsigned int nPlanesInC0T0 = geom->Nplanes(geo::TPCID(0, 0));
1009  if (nPlanesInC0T0 > 1) {
1010  BOOST_TEST(iPlaneI->Cryostat == geo::CryostatID::CryostatID_t(0));
1011  BOOST_TEST(iPlaneI->TPC == geo::TPCID::TPCID_t(0));
1012  BOOST_TEST(iPlaneI->Plane == geo::PlaneID::PlaneID_t(0));
1013  BOOST_TEST(iPlane->Cryostat == geo::CryostatID::CryostatID_t(0));
1014  BOOST_TEST(iPlane->TPC == geo::TPCID::TPCID_t(0));
1015  BOOST_TEST(iPlane->Plane == geo::PlaneID::PlaneID_t(1));
1016  }
1017  BOOST_TEST(iPlaneI != iPlane);
1018 
1019  // test copy and prefix increment
1020  ++iPlaneI;
1021  BOOST_TEST(iPlaneI == iPlane); // arguable if both are end-iterators by now
1022 
1023  }
1024 
1025  //
1026  // constructed from starting point
1027  //
1028  {
1029  // test increment flipping TPC
1030  geo::PlaneID ID(0, 0, 0);
1031  ID.Plane = geom->Nplanes(ID) - 1; // last plane of first TPC
1032 
1034 
1035  // check that the iterator tests true
1036  BOOST_TEST(bool(iPlane));
1037  BOOST_TEST(!!iPlane);
1038 
1039  // check that the pointed ID is as expected
1040  BOOST_TEST(*iPlane == ID);
1041  BOOST_TEST(iPlane->Cryostat == ID.Cryostat);
1042  BOOST_TEST(iPlane->TPC == ID.TPC);
1043  BOOST_TEST(iPlane->Plane == ID.Plane);
1044  BOOST_TEST(iPlane.get() == geom->PlanePtr(ID));
1045 
1046  // check that the pointed ID is as expected
1047  ++iPlane;
1048  if (ID.TPC + 1 < geom->NTPC(ID)) {
1049  BOOST_TEST(iPlane->Cryostat == ID.Cryostat);
1050  BOOST_TEST(iPlane->TPC == ID.TPC + 1);
1051  BOOST_TEST(iPlane->Plane == geo::PlaneID::PlaneID_t(0));
1052  }
1053  else {
1054  BOOST_TEST(iPlane->Cryostat == ID.Cryostat + 1);
1055  BOOST_TEST(iPlane->TPC == geo::TPCID::TPCID_t(0));
1056  BOOST_TEST(iPlane->Plane == geo::PlaneID::PlaneID_t(0));
1057  }
1058 
1059  // test iterator to last plane
1060  geo::PlaneID LastID(geom->Ncryostats() - 1, 0, 0);
1061  LastID.TPC = geom->NTPC(LastID) - 1; // last TPC of last cryostat
1062  LastID.Plane = geom->Nplanes(LastID) - 1; // last plane of last TPC
1063  geo::GeometryCore::plane_id_iterator iLastPlane(geom, LastID);
1064  BOOST_TEST_CHECKPOINT("Position-created iterator to last plane ID: "
1065  << std::string(*iLastPlane));
1066 
1067  // check that the iterator tests true
1068  BOOST_TEST(bool(iLastPlane));
1069  BOOST_TEST(!!iLastPlane);
1070 
1071  // check that the pointed ID is as expected
1072  BOOST_TEST(*iLastPlane == LastID);
1073  BOOST_TEST(iLastPlane->Cryostat == LastID.Cryostat);
1074  BOOST_TEST(iLastPlane->TPC == LastID.TPC);
1075  BOOST_TEST(iLastPlane->Plane == LastID.Plane);
1076  BOOST_TEST(iLastPlane.get() == geom->PlanePtr(LastID));
1077 
1078  // test increment to past-the-end
1079  geo::GeometryCore::plane_id_iterator iEndPlane = iLastPlane;
1080  ++iEndPlane;
1081 
1082  // check that the iterator tests false
1083  BOOST_TEST(!bool(iEndPlane));
1084  BOOST_TEST(!iEndPlane);
1085 
1086  BOOST_TEST(iEndPlane->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1087  BOOST_TEST(iEndPlane->TPC == geo::TPCID::TPCID_t(0));
1088  BOOST_TEST(iEndPlane->Plane == geo::PlaneID::PlaneID_t(0));
1089  BOOST_TEST(iEndPlane == geom->end_plane_id());
1090  BOOST_TEST(!iEndPlane.get());
1091 
1092  }
1093 
1094  //
1095  // end-constructed
1096  //
1097  {
1098  // construct from end position
1101  BOOST_TEST_CHECKPOINT
1102  ("End-created plane ID iterator: " << std::string(*iPlane));
1103 
1104  BOOST_TEST(iPlane->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1105  BOOST_TEST(iPlane->TPC == geo::TPCID::TPCID_t(0));
1106  BOOST_TEST(iPlane->Plane == geo::PlaneID::PlaneID_t(0));
1107 
1108  // check that the iterator tests false
1109  BOOST_TEST(!bool(iPlane));
1110  BOOST_TEST(!iPlane);
1111 
1112  // check access to geometry element (result of operator* is not defined)
1113  BOOST_TEST(!(iPlane.get())); // should get nullptr
1114 
1115  // construct at end position by geometry
1117  BOOST_TEST(iPlaneGE == iPlane);
1118 
1119  // initialize to the end directly; this has probably ID's isValid true
1121  (geom, geo::PlaneID(geom->Ncryostats(), 0, 0));
1122  BOOST_TEST(iPlane2->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1123  BOOST_TEST(iPlane2->TPC == geo::TPCID::TPCID_t(0));
1124  BOOST_TEST(iPlane2->Plane == geo::PlaneID::PlaneID_t(0));
1125  BOOST_TEST(iPlane2 == iPlane);
1126 
1127  }
1128 } // GeometryIteratorTestAlg::PlaneIDIteratorsTest()
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeometryCore const * geom
pointer to the geometry description
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
std::string string
Definition: nybbler.cc:12
unsigned int ID
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:473
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
static constexpr CryostatID_t getInvalidID()
Return the value of the invalid ID as a r-value.
Definition: geo_types.h:285
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
PlaneGeo const * PlanePtr(geo::PlaneID const &planeid) const
Returns the specified plane.
static constexpr TPCID_t getInvalidID()
Return the value of the invalid TPC ID as a r-value.
Definition: geo_types.h:466
ElementPtr_t get() const
Returns a pointer to plane, or nullptr if invalid.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:82
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
Base forward iterator browsing all plane IDs in the detector.
Definition: GeometryCore.h:439
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:387
plane_id_iterator end_plane_id() const
Returns an iterator pointing after the last plane ID in the detector.
plane_id_iterator begin_plane_id() const
Returns an iterator pointing to the first plane ID in the detector.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
static constexpr PlaneID_t getInvalidID()
Return the value of the invalid plane ID as a r-value.
Definition: geo_types.h:554
void geo::GeometryIteratorTestAlg::PlaneIteratorsTest ( ) const

Definition at line 1133 of file GeometryIteratorTestAlg.cxx.

1133  {
1134 
1135  /*
1136  * This test is extensively based on the assumption that the iterators should
1137  * behave like the corresponding ID iterators, including "corner cases".
1138  *
1139  * public interface (geometry_element_iterator<>)
1140  *
1141  * /// Default constructor; effect not defined: assign to it before using!
1142  * geometry_element_iterator()
1143  *
1144  * /// Constructor: points to begin
1145  * geometry_element_iterator(geo::GeometryCore const* geom)
1146  *
1147  * /// Constructor: points to the same element as the specified ID iterator
1148  * geometry_element_iterator(id_iterator_t const& iter)
1149  *
1150  * /// Constructor: points to the same element as the specified ID iterator
1151  * geometry_element_iterator(id_iterator_t&& iter)
1152  *
1153  * /// Constructor: points to the specified geometry element
1154  * geometry_element_iterator
1155  * (geo::GeometryCore const* geom, GeoID_t const& start_from)
1156  *
1157  * /// Constructor: points to beginning
1158  * geometry_element_iterator
1159  * (geo::GeometryCore const* geom, BeginPos_t const pos)
1160  *
1161  * /// Constructor: points to end
1162  * geometry_element_iterator
1163  * (geo::GeometryCore const* geom, EndPos_t const pos)
1164  *
1165  * /// Returns true if the two iterators point to the same object
1166  * bool operator== (iterator const& as) const
1167  *
1168  * /// Returns true if the two iterators point to the same object
1169  * bool operator== (id_iterator_t const& as) const
1170  *
1171  * /// Returns true if the two iterators point to different objects
1172  * bool operator!= (iterator const& as) const
1173  *
1174  * /// Returns true if the two iterators point to different objects
1175  * bool operator!= (id_iterator_t const& as) const
1176  *
1177  * /// Returns the geometry element the iterator points to
1178  * Element_t const& operator* () const
1179  *
1180  * /// Returns a pointer to the element the iterator points to (or nullptr)
1181  * Element_t const* operator-> () const
1182  *
1183  * /// Prefix increment: returns this iterator pointing to the next element
1184  * iterator& operator++ ()
1185  *
1186  * /// Postfix increment: returns the current iterator, then increments it
1187  * iterator operator++ (int)
1188  *
1189  * /// Returns whether the iterator is pointing to a valid geometry element
1190  * operator bool() const
1191  *
1192  * /// Returns a pointer to the geometry element, or nullptr if invalid
1193  * ElementPtr_t get() const
1194  *
1195  * /// Returns the ID of the pointed geometry element
1196  * LocalID_t const& ID() const
1197  *
1198  */
1199 
1200  //
1201  // default constructed
1202  //
1203  {
1205  BOOST_TEST_CHECKPOINT
1206  ("Default created plane iterator: " << std::string(*iPlaneID));
1207 
1209 
1210  // direct comparison
1211  BOOST_TEST(iPlane == iPlaneID);
1212  BOOST_TEST(!(iPlane != iPlaneID));
1213 
1214  // ID comparison
1215  BOOST_TEST(iPlane.ID() == *iPlaneID);
1216 
1217  // check copy assignment
1218  geo::GeometryCore::plane_iterator iPlane_copy(iPlane);
1219  geo::GeometryCore::plane_id_iterator iPlaneID_copy(iPlaneID);
1220 
1221  // check comparisons too
1222  BOOST_TEST(iPlane == iPlane_copy);
1223  BOOST_TEST(iPlane_copy == iPlane);
1224  BOOST_TEST(!(iPlane != iPlane_copy));
1225  BOOST_TEST(!(iPlane_copy != iPlane));
1226 
1227  BOOST_TEST(iPlane == iPlane_copy);
1228 
1229  }
1230 
1231  //
1232  // begin-constructed
1233  //
1234  {
1235  geo::PlaneID BeginID;
1236  geom->GetBeginID(BeginID);
1237 
1238  geo::GeometryCore::plane_id_iterator iPlaneID(geom, BeginID);
1239 
1240 
1241  BOOST_TEST_CHECKPOINT
1242  ("Begin-created plane iterator (" << std::string(BeginID) << ")");
1243 
1244  // initialize to the beginning directly
1245  geo::GeometryCore::plane_iterator iPlaneD(geom, BeginID);
1246  CompareIteratorAndIteratorID(iPlaneD, iPlaneID);
1247 
1248  // initialize to the beginning with implicit initialization
1250  CompareIteratorAndIteratorID(iPlane, iPlaneID);
1251 
1252  // construct from explicit begin position
1255  CompareIteratorAndIteratorID(iPlaneBC, iPlaneID);
1256 
1257  // construct at begin position by geometry
1259  CompareIteratorAndIteratorID(iPlaneGB, iPlaneID);
1260 
1261  }
1262 
1263  //
1264  // constructed from starting point
1265  //
1266  {
1267  // test iterator to last plane
1268  geo::PlaneID LastID(geom->Ncryostats() - 1, 0, 0);
1269  LastID.TPC = geom->NTPC(LastID) - 1; // last TPC of last cryostat
1270  LastID.Plane = geom->Nplanes(LastID) - 1; // last plane of last TPC
1271  geo::GeometryCore::plane_id_iterator iLastPlaneID(geom, LastID);
1272 
1273  BOOST_TEST_CHECKPOINT("Position-created iterator to last plane: "
1274  << std::string(LastID));
1275  geo::GeometryCore::plane_iterator iLastPlane(geom, LastID);
1276  CompareIteratorAndIteratorID(iLastPlane, iLastPlaneID);
1277 
1278  // test increment to past-the-end
1279  geo::GeometryCore::plane_id_iterator iEndPlaneID = iLastPlaneID;
1280  ++iEndPlaneID;
1281 
1282  geo::GeometryCore::plane_iterator iEndPlane = iLastPlane;
1283  ++iEndPlane;
1284 
1285  CompareIteratorAndIteratorID(iEndPlane, iEndPlaneID);
1286 
1287  }
1288 
1289  //
1290  // end-constructed
1291  //
1292  {
1294 
1295  // construct from end position
1296  BOOST_TEST_CHECKPOINT
1297  ("End-created plane iterator: " << std::string(*iPlaneID));
1300  CompareIteratorAndIteratorID(iPlane, iPlaneID);
1301 
1302  // construct at end position by geometry
1304  CompareIteratorAndIteratorID(iPlaneGE, iPlaneID);
1305 
1306  }
1307 
1308 } // GeometryIteratorTestAlg::PlaneIteratorsTest()
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeometryCore const * geom
pointer to the geometry description
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
std::string string
Definition: nybbler.cc:12
plane_iterator end_plane() const
Returns an iterator pointing after the last plane in the detector.
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
Base forward iterator browsing all plane IDs in the detector.
Definition: GeometryCore.h:439
LocalID_t const & ID() const
Returns the ID of the pointed geometry element.
Definition: GeometryCore.h:883
plane_id_iterator end_plane_id() const
Returns an iterator pointing after the last plane ID in the detector.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:719
plane_iterator begin_plane() const
Returns an iterator pointing to the first plane in the detector.
void geo::GeometryIteratorTestAlg::ROPIDIteratorsTest ( ) const

Definition at line 1965 of file GeometryIteratorTestAlg.cxx.

1965  {
1966 
1967  /*
1968  * public interface (ROP_id_iterator_base):
1969  *
1970  * /// Default constructor; effect not defined: assign to it before using!
1971  * ROP_id_iterator_base()
1972  *
1973  * /// Constructor: points to begin.
1974  * ROP_id_iterator_base(geo::GeometryCore const* geom)
1975  *
1976  * /// Constructor: points to the specified readout plane.
1977  * ROP_id_iterator_base
1978  * (geo::GeometryCore const* geom, GeoID_t const& start_from)
1979  *
1980  * /// Constructor: points to begin.
1981  * ROP_id_iterator_base(geo::GeometryCore const* geom, BeginPos_t const)
1982  *
1983  * /// Constructor: points to end.
1984  * ROP_id_iterator_base(geo::GeometryCore const* geom, EndPos_t)
1985  *
1986  * /// Returns true if the two iterators point to the same readout plane.
1987  * template <typename OTHERID>
1988  * bool operator== (ROP_id_iterator_base<OTHERID> const& as) const
1989  *
1990  * /// Returns true if the two iterators point to different readout planes.
1991  * template <typename OTHERID>
1992  * bool operator!= (ROP_id_iterator_base<OTHERID> const& as) const
1993  *
1994  * /// Returns the PlaneID the iterator points to
1995  * LocalID_t const& operator* ()
1996  *
1997  * /// Returns the PlaneID the iterator points to
1998  * LocalID_t const* operator-> () const
1999  *
2000  * /// Prefix increment: returns this iterator pointing to the next plane
2001  * iterator& operator++ ()
2002  *
2003  * /// Postfix increment: returns the current iterator, then increments it.
2004  * iterator operator++ (int)
2005  *
2006  * /// Returns whether the iterator is pointing to a valid plane.
2007  * operator bool() const
2008  *
2009  */
2010 
2011  //
2012  // default constructed
2013  //
2014  {
2015  geo::ROP_id_iterator iROP;
2016  BOOST_TEST_CHECKPOINT
2017  ("Default created readout plane ID iterator: " << std::string(*iROP));
2018 
2019  BOOST_TEST(iROP->Cryostat == geo::CryostatID::getInvalidID());
2020  BOOST_TEST(iROP->TPCset == readout::TPCsetID::getInvalidID());
2021  BOOST_TEST(iROP->ROP == readout::ROPID::getInvalidID());
2022 
2023  // check that the iterator tests false
2024  BOOST_TEST(!iROP);
2025  BOOST_TEST(!(bool(iROP)));
2026 
2027  }
2028 
2029  //
2030  // begin-constructed
2031  //
2032  {
2033  geo::ROP_id_iterator iROP(geom);
2034  BOOST_TEST_CHECKPOINT
2035  ("Begin-created readout plane ID iterator: " << std::string(*iROP));
2036 
2037  BOOST_TEST(iROP->Cryostat == geo::CryostatID::CryostatID_t(0));
2038  BOOST_TEST(iROP->TPCset == readout::TPCsetID::TPCsetID_t(0));
2039  BOOST_TEST(iROP->ROP == readout::ROPID::ROPID_t(0));
2040 
2041  // check that the iterator tests true
2042  BOOST_TEST(bool(iROP));
2043  BOOST_TEST(!!iROP);
2044 
2045  // initialize to the beginning directly; this has probably ID's isValid true
2046  readout::ROPID BeginID;
2047  geom->GetBeginID(BeginID);
2048  geo::ROP_id_iterator iROPD(geom, BeginID);
2049  BOOST_TEST(iROPD->Cryostat == geo::CryostatID::CryostatID_t(0));
2050  BOOST_TEST(iROPD->TPCset == readout::TPCsetID::TPCsetID_t(0));
2051  BOOST_TEST(iROPD->ROP == readout::ROPID::ROPID_t(0));
2052  BOOST_TEST(iROPD == iROP);
2053 
2054  // construct from explicit begin position
2056  BOOST_TEST(iROPBC == iROP);
2057 
2058  // construct at begin position by geometry
2060  BOOST_TEST(iROPGB == iROP);
2061 
2062  // check access to ID
2063  BOOST_TEST(*iROP == BeginID);
2064  BOOST_TEST(iROP->Cryostat == BeginID.Cryostat);
2065  BOOST_TEST(iROP->TPCset == BeginID.TPCset);
2066  BOOST_TEST(iROP->ROP == BeginID.ROP);
2067 
2068  // test copy and postfix increment
2069  geo::ROP_id_iterator iROPI(iROP++);
2070 
2071  const unsigned int nReadoutPlanesInC0S0
2072  = geom->NROPs(readout::TPCsetID(0, 0));
2073  if (nReadoutPlanesInC0S0 > 1) {
2074  BOOST_TEST(iROPI->Cryostat == geo::CryostatID::CryostatID_t(0));
2075  BOOST_TEST(iROPI->TPCset == readout::TPCsetID::TPCsetID_t(0));
2076  BOOST_TEST(iROPI->ROP == readout::ROPID::ROPID_t(0));
2077  BOOST_TEST(iROP->Cryostat == geo::CryostatID::CryostatID_t(0));
2078  BOOST_TEST(iROP->TPCset == readout::TPCsetID::TPCsetID_t(0));
2079  BOOST_TEST(iROP->ROP == readout::ROPID::ROPID_t(1));
2080  }
2081  BOOST_TEST(iROPI != iROP);
2082 
2083  // test copy and prefix increment
2084  ++iROPI;
2085  BOOST_TEST(iROPI == iROP); // arguable if both are end-iterators by now
2086 
2087  }
2088 
2089  //
2090  // constructed from starting point
2091  //
2092  {
2093  // test increment flipping TPC
2094  readout::ROPID ID(0, 0, 0);
2095  ID.ROP = geom->NROPs(ID) - 1; // last plane of first TPC set
2096 
2097  geo::ROP_id_iterator iROP(geom, ID);
2098 
2099  // check that the iterator tests true
2100  BOOST_TEST(bool(iROP));
2101  BOOST_TEST(!!iROP);
2102 
2103  // check that the pointed ID is as expected
2104  BOOST_TEST(*iROP == ID);
2105  BOOST_TEST(iROP->Cryostat == ID.Cryostat);
2106  BOOST_TEST(iROP->TPCset == ID.TPCset);
2107  BOOST_TEST(iROP->ROP == ID.ROP);
2108 
2109  // check that the pointed ID is as expected
2110  ++iROP;
2111  if (ID.TPCset + 1 < (int) geom->NTPCsets(ID)) {
2112  BOOST_TEST(iROP->Cryostat == ID.Cryostat);
2113  BOOST_TEST(iROP->TPCset == ID.TPCset + 1);
2114  BOOST_TEST(iROP->ROP == readout::ROPID::ROPID_t(0));
2115  }
2116  else {
2117  BOOST_TEST(iROP->Cryostat == ID.Cryostat + 1);
2118  BOOST_TEST(iROP->TPCset == readout::TPCsetID::TPCsetID_t(0));
2119  BOOST_TEST(iROP->ROP == readout::ROPID::ROPID_t(0));
2120  }
2121 
2122  // test iterator to last plane
2123  readout::ROPID LastID(geom->Ncryostats() - 1, 0, 0);
2124  LastID.TPCset = geom->NTPCsets(LastID) - 1; // last TPC set of last cryostat
2125  LastID.ROP = geom->NROPs(LastID) - 1; // last readout plane of last TPC set
2126  geo::ROP_id_iterator iLastROP(geom, LastID);
2127  BOOST_TEST_CHECKPOINT("Position-created iterator to last readout plane ID: "
2128  << std::string(*iLastROP));
2129 
2130  // check that the iterator tests true
2131  BOOST_TEST(bool(iLastROP));
2132  BOOST_TEST(!!iLastROP);
2133 
2134  // check that the pointed ID is as expected
2135  BOOST_TEST(*iLastROP == LastID);
2136  BOOST_TEST(iLastROP->Cryostat == LastID.Cryostat);
2137  BOOST_TEST(iLastROP->TPCset == LastID.TPCset);
2138  BOOST_TEST(iLastROP->ROP == LastID.ROP);
2139 
2140  // test increment to past-the-end
2141  geo::ROP_id_iterator iEndROP = iLastROP;
2142  ++iEndROP;
2143 
2144  // check that the iterator tests false
2145  BOOST_TEST(!bool(iEndROP));
2146  BOOST_TEST(!iEndROP);
2147 
2148  BOOST_TEST
2149  (iEndROP->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
2150  BOOST_TEST(iEndROP->TPCset == readout::TPCsetID::TPCsetID_t(0));
2151  BOOST_TEST(iEndROP->ROP == readout::ROPID::ROPID_t(0));
2152  BOOST_TEST(iEndROP == geom->end_ROP_id());
2153 
2154  }
2155 
2156  //
2157  // end-constructed
2158  //
2159  {
2160  // construct from end position
2162  BOOST_TEST_CHECKPOINT
2163  ("End-created readout plane ID iterator: " << std::string(*iROP));
2164 
2165  BOOST_TEST
2166  (iROP->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
2167  BOOST_TEST(iROP->TPCset == readout::TPCsetID::TPCsetID_t(0));
2168  BOOST_TEST(iROP->ROP == readout::ROPID::ROPID_t(0));
2169 
2170  // check that the iterator tests false
2171  BOOST_TEST(!bool(iROP));
2172  BOOST_TEST(!iROP);
2173 
2174  // construct at end position by geometry
2175  geo::ROP_id_iterator iROPGE = geom->end_ROP_id();
2176  BOOST_TEST(iROPGE == iROP);
2177 
2178  // initialize to the end directly; this has probably ID's isValid true
2179  geo::ROP_id_iterator iROP2
2180  (geom, readout::ROPID(geom->Ncryostats(), 0, 0));
2181  BOOST_TEST
2182  (iROP->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
2183  BOOST_TEST(iROP->TPCset == readout::TPCsetID::TPCsetID_t(0));
2184  BOOST_TEST(iROP->ROP == readout::ROPID::ROPID_t(0));
2185  BOOST_TEST(iROP2 == iROP);
2186 
2187  }
2188 } // GeometryIteratorTestAlg::ROPIDIteratorsTest()
ROP_id_iterator begin_ROP_id() const
Returns an iterator pointing to the first ROP ID in the detector.
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
constexpr auto end_pos
GeometryCore const * geom
pointer to the geometry description
static constexpr ROPID_t getInvalidID()
Return the value of the invalid ROP ID as a r-value.
std::string string
Definition: nybbler.cc:12
unsigned int ID
Base forward iterator browsing all readout plane IDs in the detector.
unsigned int ROPID_t
Type for the ID number.
unsigned short TPCsetID_t
Type for the ID number.
Definition: readout_types.h:71
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:70
unsigned int NTPCsets(readout::CryostatID const &cryoid) const
Returns the total number of TPC sets in the specified cryostat.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
ROP_id_iterator end_ROP_id() const
Returns an iterator pointing after the last ROP ID in the detector.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
static constexpr CryostatID_t getInvalidID()
Return the value of the invalid ID as a r-value.
Definition: geo_types.h:285
ROPID_t ROP
Index of the readout plane within its TPC set.
constexpr auto begin_pos
Class identifying a set of planes sharing readout channels.
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
Definition: readout_types.h:90
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
static constexpr TPCsetID_t getInvalidID()
Return the value of the invalid TPC ID as a r-value.
unsigned int NROPs(readout::TPCsetID const &tpcsetid) const
Returns the total number of ROP in the specified TPC set.
unsigned int geo::GeometryIteratorTestAlg::Run ( ) const
virtual

Executes the test.

Definition at line 95 of file GeometryIteratorTestAlg.cxx.

95  {
96  // All the tests
97 
98  // - geometry ID iterators
105 
106  // - geometry element iterators
111 
112  return 0;
113 } // GeometryIteratorTestAlg::Run()
virtual void geo::GeometryIteratorTestAlg::Setup ( geo::GeometryCore const &  new_geo)
inlinevirtual

Algorithm set up.

Definition at line 32 of file GeometryIteratorTestAlg.h.

32 { geom = &new_geo; }
GeometryCore const * geom
pointer to the geometry description
void geo::GeometryIteratorTestAlg::TPCIDIteratorsTest ( ) const

Definition at line 494 of file GeometryIteratorTestAlg.cxx.

494  {
495 
496  /*
497  * public interface (TPC_id_iterator_base):
498  *
499  * /// Default constructor; effect not defined: assign to it before using!
500  * TPC_id_iterator_base()
501  *
502  * /// Constructor: points to begin
503  * TPC_id_iterator_base(geo::GeometryCore const* geom)
504  *
505  * /// Constructor: points to the specified cryostat
506  * TPC_id_iterator_base
507  * (geo::GeometryCore const* geom, GEOID const& start_from)
508  *
509  * /// Constructor: points to begin
510  * TPC_id_iterator_base(geo::GeometryCore const* geom, BeginPos_t)
511  *
512  * /// Constructor: points to end
513  * TPC_id_iterator_base(geo::GeometryCore const* geom, EndPos_t)
514  *
515  * /// Returns true if the two iterators point to the same TPC
516  * template <typename OTHERID>
517  * bool operator== (TPC_id_iterator_base<OTHERID> const& as) const
518  *
519  * /// Returns true if the two iterators point to different TPCs
520  * template <typename OTHERID>
521  * bool operator!= (TPC_id_iterator_base<OTHERID> const& as) const
522  *
523  * /// Returns the TPCID the iterator points to
524  * LocalID_t const& operator* () const
525  *
526  * /// Returns the TPCID the iterator points to
527  * LocalID_t const* operator-> () const
528  *
529  * /// Prefix increment: returns this iterator pointing to the next TPC
530  * iterator& operator++ ()
531  *
532  * /// Postfix increment: returns the current iterator, then increments it
533  * iterator operator++ (int)
534  *
535  * /// Returns whether the iterator is pointing to a valid TPC
536  * operator bool() const
537  *
538  * /// Returns a pointer to TPC, or nullptr if invalid
539  * ElementPtr_t get() const
540  *
541  */
542 
543  //
544  // default constructed
545  //
546  {
548  BOOST_TEST_CHECKPOINT
549  ("Default created TPC ID iterator: " << std::string(*iTPC));
550 
551  BOOST_TEST(iTPC->Cryostat == geo::CryostatID::getInvalidID());
552  BOOST_TEST(iTPC->TPC == geo::TPCID::getInvalidID());
553 
554  // check that the iterator tests false
555  BOOST_TEST(!iTPC);
556  BOOST_TEST(!(bool(iTPC)));
557 
558  }
559 
560  //
561  // begin-constructed
562  //
563  {
565  BOOST_TEST_CHECKPOINT
566  ("Begin-created TPC ID iterator: " << std::string(*iTPC));
567 
568  BOOST_TEST(iTPC->Cryostat == geo::CryostatID::CryostatID_t(0));
569  BOOST_TEST(iTPC->TPC == geo::TPCID::TPCID_t(0));
570 
571  // check that the iterator tests true
572  BOOST_TEST(bool(iTPC));
573  BOOST_TEST(!!iTPC);
574 
575  // initialize to the beginning directly; this has probably ID's isValid true
576  geo::TPCID BeginID;
577  geom->GetBeginID(BeginID);
579  BOOST_TEST(iTPCD->Cryostat == geo::CryostatID::CryostatID_t(0));
580  BOOST_TEST(iTPCD->TPC == geo::TPCID::TPCID_t(0));
581  BOOST_TEST(iTPCD == iTPC);
582 
583  // construct from explicit begin position
586  BOOST_TEST(iTPCBC == iTPC);
587 
588  // construct at begin position by geometry
590  BOOST_TEST(iTPCGB == iTPC);
591 
592  // check access to ID
593  BOOST_TEST(*iTPC == BeginID);
594  BOOST_TEST(iTPC->Cryostat == BeginID.Cryostat);
595  BOOST_TEST(iTPC->TPC == BeginID.TPC);
596 
597  // check access to geometry element
598  geo::TPCGeo const* pTPC = geom->TPCPtr(BeginID);
599  BOOST_TEST(iTPC.get() == pTPC);
600 
601  // test copy and postfix increment
603 
604  const unsigned int nTPCsInC0 = geom->NTPC(geo::CryostatID(0));
605  if (nTPCsInC0 > 1) {
606  BOOST_TEST(iTPCI->Cryostat == geo::CryostatID::CryostatID_t(0));
607  BOOST_TEST(iTPCI->TPC == geo::TPCID::TPCID_t(0));
608  BOOST_TEST(iTPC->Cryostat == geo::CryostatID::CryostatID_t(0));
609  BOOST_TEST(iTPC->TPC == geo::TPCID::TPCID_t(1));
610  }
611  BOOST_TEST(iTPCI != iTPC);
612 
613  // test copy and prefix increment
614  ++iTPCI;
615  BOOST_TEST(iTPCI == iTPC); // arguable if both are end-iterators by now
616 
617  }
618 
619  //
620  // constructed from starting point
621  //
622  {
623  // test increment flipping cryostat
624  geo::TPCID ID(0, 0);
625  ID.TPC = geom->NTPC(ID) - 1; // last TPC of first cryostat
626 
628 
629  // check that the iterator tests true
630  BOOST_TEST(bool(iTPC));
631  BOOST_TEST(!!iTPC);
632 
633  // check that the pointed ID is as expected
634  BOOST_TEST(*iTPC == ID);
635  BOOST_TEST(iTPC->Cryostat == ID.Cryostat);
636  BOOST_TEST(iTPC->TPC == ID.TPC);
637  BOOST_TEST(iTPC.get() == geom->TPCPtr(ID));
638 
639  ++iTPC;
640  // check that the pointed ID is as expected
641  BOOST_TEST(iTPC->Cryostat == geo::CryostatID::CryostatID_t(ID.Cryostat + 1));
642  BOOST_TEST(iTPC->TPC == geo::TPCID::TPCID_t(0));
643 
644 
645  // test iterator to last TPC
646  geo::TPCID LastID(geom->Ncryostats() - 1, 0);
647  LastID.TPC = geom->NTPC(LastID) - 1; // last TPC of last cryostat
648  geo::GeometryCore::TPC_id_iterator iLastTPC(geom, LastID);
649  BOOST_TEST_CHECKPOINT("Position-created iterator to last TPC ID: "
650  << std::string(*iLastTPC));
651 
652  // check that the iterator tests true
653  BOOST_TEST(bool(iLastTPC));
654  BOOST_TEST(!!iLastTPC);
655 
656  // check that the pointed ID is as expected
657  BOOST_TEST(*iLastTPC == LastID);
658  BOOST_TEST(iLastTPC->Cryostat == LastID.Cryostat);
659  BOOST_TEST(iLastTPC->TPC == LastID.TPC);
660  BOOST_TEST(iLastTPC.get() == geom->TPCPtr(LastID));
661 
662  // test increment to past-the-end
663  geo::GeometryCore::TPC_id_iterator iEndTPC = iLastTPC;
664  ++iEndTPC;
665 
666  // check that the iterator tests false
667  BOOST_TEST(!bool(iEndTPC));
668  BOOST_TEST(!iEndTPC);
669 
670  BOOST_TEST(iEndTPC->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
671  BOOST_TEST(iEndTPC->TPC == geo::TPCID::TPCID_t(0));
672  BOOST_TEST(iEndTPC == geom->end_TPC_id());
673  BOOST_TEST(!iEndTPC.get());
674 
675  }
676 
677  //
678  // end-constructed
679  //
680  {
681  // construct from end position
684  BOOST_TEST_CHECKPOINT
685  ("End-created TPC ID iterator: " << std::string(*iTPC));
686 
687  BOOST_TEST(iTPC->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
688  BOOST_TEST(iTPC->TPC == geo::TPCID::TPCID_t(0));
689 
690  // check that the iterator tests false
691  BOOST_TEST(!bool(iTPC));
692  BOOST_TEST(!iTPC);
693 
694  // check access to geometry element (result of operator* is not defined)
695  BOOST_TEST(!(iTPC.get())); // should get nullptr
696 
697  // construct at end position by geometry
699  BOOST_TEST(iTPCGE == iTPC);
700 
701  // initialize to the end directly; this has probably ID's isValid true
703  (geom, geo::TPCID(geom->Ncryostats(), 0));
704  BOOST_TEST(iTPC2->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
705  BOOST_TEST(iTPC2->TPC == geo::TPCID::TPCID_t(0));
706  BOOST_TEST(iTPC2 == iTPC);
707 
708  }
709 
710 } // GeometryIteratorTestAlg::TPCIDIteratorsTest()
TPC_id_iterator begin_TPC_id() const
Returns an iterator pointing to the first TPC ID in the detector.
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeometryCore const * geom
pointer to the geometry description
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
std::string string
Definition: nybbler.cc:12
unsigned int ID
Base forward iterator browsing all TPC IDs in the detector.
Definition: GeometryCore.h:292
Geometry information for a single TPC.
Definition: TPCGeo.h:38
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
static constexpr CryostatID_t getInvalidID()
Return the value of the invalid ID as a r-value.
Definition: geo_types.h:285
static constexpr TPCID_t getInvalidID()
Return the value of the invalid TPC ID as a r-value.
Definition: geo_types.h:466
TPCGeo const * TPCPtr(geo::TPCID const &tpcid) const
Returns the specified TPC.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
TPC_id_iterator end_TPC_id() const
Returns an iterator pointing after the last TPC ID in the detector.
ElementPtr_t get() const
Returns a pointer to TPC, or nullptr if invalid.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:387
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
void geo::GeometryIteratorTestAlg::TPCIteratorsTest ( ) const

Definition at line 715 of file GeometryIteratorTestAlg.cxx.

715  {
716 
717  /*
718  * This test is extensively based on the assumption that the iterators should
719  * behave like the corresponding ID iterators, including "corner cases".
720  *
721  * public interface (geometry_element_iterator<>)
722  *
723  * /// Default constructor; effect not defined: assign to it before using!
724  * geometry_element_iterator()
725  *
726  * /// Constructor: points to begin
727  * geometry_element_iterator(geo::GeometryCore const* geom)
728  *
729  * /// Constructor: points to the same element as the specified ID iterator
730  * geometry_element_iterator(id_iterator_t const& iter)
731  *
732  * /// Constructor: points to the same element as the specified ID iterator
733  * geometry_element_iterator(id_iterator_t&& iter)
734  *
735  * /// Constructor: points to the specified geometry element
736  * geometry_element_iterator
737  * (geo::GeometryCore const* geom, GeoID_t const& start_from)
738  *
739  * /// Constructor: points to beginning
740  * geometry_element_iterator
741  * (geo::GeometryCore const* geom, BeginPos_t const pos)
742  *
743  * /// Constructor: points to end
744  * geometry_element_iterator
745  * (geo::GeometryCore const* geom, EndPos_t const pos)
746  *
747  * /// Returns true if the two iterators point to the same object
748  * bool operator== (iterator const& as) const
749  *
750  * /// Returns true if the two iterators point to the same object
751  * bool operator== (id_iterator_t const& as) const
752  *
753  * /// Returns true if the two iterators point to different objects
754  * bool operator!= (iterator const& as) const
755  *
756  * /// Returns true if the two iterators point to different objects
757  * bool operator!= (id_iterator_t const& as) const
758  *
759  * /// Returns the geometry element the iterator points to
760  * Element_t const& operator* () const
761  *
762  * /// Returns a pointer to the element the iterator points to (or nullptr)
763  * Element_t const* operator-> () const
764  *
765  * /// Prefix increment: returns this iterator pointing to the next element
766  * iterator& operator++ ()
767  *
768  * /// Postfix increment: returns the current iterator, then increments it
769  * iterator operator++ (int)
770  *
771  * /// Returns whether the iterator is pointing to a valid geometry element
772  * operator bool() const
773  *
774  * /// Returns a pointer to the geometry element, or nullptr if invalid
775  * ElementPtr_t get() const
776  *
777  * /// Returns the ID of the pointed geometry element
778  * LocalID_t const& ID() const
779  *
780  */
781 
782  //
783  // default constructed
784  //
785  {
787  BOOST_TEST_CHECKPOINT
788  ("Default created TPC iterator: " << std::string(*iTPCID));
789 
791 
792  // direct comparison
793  BOOST_TEST(iTPC == iTPCID);
794  BOOST_TEST(!(iTPC != iTPCID));
795 
796  // ID comparison
797  BOOST_TEST(iTPC.ID() == *iTPCID);
798 
799  // check copy assignment
800  geo::GeometryCore::TPC_iterator iTPC_copy(iTPC);
801  geo::GeometryCore::TPC_id_iterator iTPCID_copy(iTPCID);
802 
803  // check comparisons too
804  BOOST_TEST(iTPC == iTPC_copy);
805  BOOST_TEST(iTPC_copy == iTPC);
806  BOOST_TEST(!(iTPC != iTPC_copy));
807  BOOST_TEST(!(iTPC_copy != iTPC));
808 
809  BOOST_TEST(iTPC == iTPC_copy);
810 
811  }
812 
813  //
814  // begin-constructed
815  //
816  {
817  geo::TPCID BeginID;
818  geom->GetBeginID(BeginID);
819 
820  geo::GeometryCore::TPC_id_iterator iTPCID(geom, BeginID);
821 
822 
823  BOOST_TEST_CHECKPOINT
824  ("Begin-created TPC iterator (" << std::string(BeginID) << ")");
825 
826  // initialize to the beginning directly
827  geo::GeometryCore::TPC_iterator iTPCD(geom, BeginID);
828  CompareIteratorAndIteratorID(iTPCD, iTPCID);
829 
830  // initialize to the beginning with implicit initialization
832  CompareIteratorAndIteratorID(iTPC, iTPCID);
833 
834  // construct from explicit begin position
837  CompareIteratorAndIteratorID(iTPCBC, iTPCID);
838 
839  // construct at begin position by geometry
841  CompareIteratorAndIteratorID(iTPCGB, iTPCID);
842 
843  }
844 
845  //
846  // constructed from starting point
847  //
848  {
849  // test iterator to last TPC
850  geo::TPCID LastID(geom->Ncryostats() - 1, 0);
851  LastID.TPC = geom->NTPC(LastID) - 1; // last TPC of last cryostat
852  geo::GeometryCore::TPC_id_iterator iLastTPCID(geom, LastID);
853 
854  BOOST_TEST_CHECKPOINT("Position-created iterator to last TPC: "
855  << std::string(LastID));
856  geo::GeometryCore::TPC_iterator iLastTPC(geom, LastID);
857  CompareIteratorAndIteratorID(iLastTPC, iLastTPCID);
858 
859  // test increment to past-the-end
860  geo::GeometryCore::TPC_id_iterator iEndTPCID = iLastTPCID;
861  ++iEndTPCID;
862 
863  geo::GeometryCore::TPC_iterator iEndTPC = iLastTPC;
864  ++iEndTPC;
865 
866  CompareIteratorAndIteratorID(iEndTPC, iEndTPCID);
867 
868  }
869 
870  //
871  // end-constructed
872  //
873  {
875 
876  // construct from end position
877  BOOST_TEST_CHECKPOINT("End-created TPC iterator: " << std::string(*iTPCID));
880  CompareIteratorAndIteratorID(iTPC, iTPCID);
881 
882  // construct at end position by geometry
884  CompareIteratorAndIteratorID(iTPCGE, iTPCID);
885 
886  }
887 
888 } // GeometryIteratorTestAlg::TPCIteratorsTest()
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeometryCore const * geom
pointer to the geometry description
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
std::string string
Definition: nybbler.cc:12
Base forward iterator browsing all TPC IDs in the detector.
Definition: GeometryCore.h:292
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
TPC_iterator begin_TPC() const
Returns an iterator pointing to the first TPC in the detector.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
TPC_id_iterator end_TPC_id() const
Returns an iterator pointing after the last TPC ID in the detector.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
LocalID_t const & ID() const
Returns the ID of the pointed geometry element.
Definition: GeometryCore.h:883
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:719
TPC_iterator end_TPC() const
Returns an iterator pointing after the last TPC in the detector.
void geo::GeometryIteratorTestAlg::TPCsetIDIteratorsTest ( ) const

Definition at line 1753 of file GeometryIteratorTestAlg.cxx.

1753  {
1754 
1755  /*
1756  * public interface (TPCset_id_iterator_base):
1757  *
1758  *
1759  * /// Default constructor; effect not defined: assign to it before using!
1760  * TPCset_id_iterator_base()
1761  *
1762  * /// Constructor: points to begin.
1763  * TPCset_id_iterator_base(geo::GeometryCore const* geom)
1764  *
1765  * /// Constructor: points to the specified cryostat.
1766  * TPCset_id_iterator_base
1767  * (geo::GeometryCore const* geom, GeoID_t const& start_from)
1768  *
1769  * /// Constructor: points to begin.
1770  * TPCset_id_iterator_base(geo::GeometryCore const* geom, BeginPos_t const)
1771  *
1772  * /// Constructor: points to end.
1773  * TPCset_id_iterator_base(geo::GeometryCore const* geom, EndPos_t)
1774  *
1775  * /// Returns true if the two iterators point to the same TPC set.
1776  * template <typename OTHERID>
1777  * bool operator== (TPCset_id_iterator_base<OTHERID> const& as) const
1778  *
1779  * /// Returns true if the two iterators point to different TPC sets.
1780  * template <typename OTHERID>
1781  * bool operator!= (TPCset_id_iterator_base<OTHERID> const& as) const
1782  *
1783  * /// Returns the TPCsetID the iterator points to.
1784  * LocalID_t const& operator* () const
1785  *
1786  * /// Returns the TPCsetID the iterator points to.
1787  * LocalID_t const* operator-> () const
1788  *
1789  * /// Prefix increment: returns this iterator pointing to the next TPC set.
1790  * iterator& operator++ ()
1791  *
1792  * /// Postfix increment: returns the current iterator, then increments it.
1793  * iterator operator++ (int)
1794  *
1795  * /// Returns whether the iterator is pointing to a valid TPC set.
1796  * operator bool() const
1797  *
1798  *
1799  */
1800 
1801  //
1802  // default constructed
1803  //
1804  {
1805  geo::TPCset_id_iterator iTPCset;
1806  BOOST_TEST_CHECKPOINT
1807  ("Default created TPC set ID iterator: " << std::string(*iTPCset));
1808 
1809  BOOST_TEST(iTPCset->Cryostat == geo::CryostatID::getInvalidID());
1810  BOOST_TEST(iTPCset->TPCset == readout::TPCsetID::getInvalidID());
1811 
1812  // check that the iterator tests false
1813  BOOST_TEST(!iTPCset);
1814  BOOST_TEST(!(bool(iTPCset)));
1815 
1816  }
1817 
1818  //
1819  // begin-constructed
1820  //
1821  {
1822  geo::TPCset_id_iterator iTPCset(geom);
1823  BOOST_TEST_CHECKPOINT
1824  ("Begin-created TPC set ID iterator: " << std::string(*iTPCset));
1825 
1826  BOOST_TEST(iTPCset->Cryostat == geo::CryostatID::CryostatID_t(0));
1827  BOOST_TEST(iTPCset->TPCset == readout::TPCsetID::TPCsetID_t(0));
1828 
1829  // check that the iterator tests true
1830  BOOST_TEST(bool(iTPCset));
1831  BOOST_TEST(!!iTPCset);
1832 
1833  // initialize to the beginning directly; this has probably ID's isValid true
1834  readout::TPCsetID BeginID;
1835  geom->GetBeginID(BeginID);
1836  geo::TPCset_id_iterator iTPCsetD(geom, BeginID);
1837  BOOST_TEST(iTPCsetD->Cryostat == geo::CryostatID::CryostatID_t(0));
1838  BOOST_TEST(iTPCsetD->TPCset == readout::TPCsetID::TPCsetID_t(0));
1839  BOOST_TEST(iTPCsetD == iTPCset);
1840 
1841  // construct from explicit begin position
1843  BOOST_TEST(iTPCsetBC == iTPCset);
1844 
1845  // construct at begin position by geometry
1847  BOOST_TEST(iTPCsetGB == iTPCset);
1848 
1849  // check access to ID
1850  BOOST_TEST(*iTPCset == BeginID);
1851  BOOST_TEST(iTPCset->Cryostat == BeginID.Cryostat);
1852  BOOST_TEST(iTPCset->TPCset == BeginID.TPCset);
1853 
1854  // test copy and postfix increment
1855  geo::TPCset_id_iterator iTPCsetI(iTPCset++);
1856 
1857  const unsigned int nTPCsetsInC0 = geom->NTPCsets(geo::CryostatID(0));
1858  if (nTPCsetsInC0 > 1) {
1859  BOOST_TEST(iTPCsetI->Cryostat == geo::CryostatID::CryostatID_t(0));
1860  BOOST_TEST(iTPCsetI->TPCset == readout::TPCsetID::TPCsetID_t(0));
1861  BOOST_TEST(iTPCset->Cryostat == geo::CryostatID::CryostatID_t(0));
1862  BOOST_TEST(iTPCset->TPCset == readout::TPCsetID::TPCsetID_t(1));
1863  }
1864  BOOST_TEST(iTPCsetI != iTPCset);
1865 
1866  // test copy and prefix increment
1867  ++iTPCsetI;
1868  BOOST_TEST(iTPCsetI == iTPCset); // arguable if both are end-iterators by now
1869 
1870  }
1871 
1872  //
1873  // constructed from starting point
1874  //
1875  {
1876  // test increment flipping cryostat
1877  readout::TPCsetID ID(0, 0);
1878  ID.TPCset = geom->NTPCsets(ID) - 1; // last TPC set of first cryostat
1879 
1880  geo::TPCset_id_iterator iTPCset(geom, ID);
1881 
1882  // check that the iterator tests true
1883  BOOST_TEST(bool(iTPCset));
1884  BOOST_TEST(!!iTPCset);
1885 
1886  // check that the pointed ID is as expected
1887  BOOST_TEST(*iTPCset == ID);
1888  BOOST_TEST(iTPCset->Cryostat == ID.Cryostat);
1889  BOOST_TEST(iTPCset->TPCset == ID.TPCset);
1890 
1891  ++iTPCset;
1892  // check that the pointed ID is as expected
1893  BOOST_TEST
1894  (iTPCset->Cryostat == geo::CryostatID::CryostatID_t(ID.Cryostat + 1));
1895  BOOST_TEST(iTPCset->TPCset == readout::TPCsetID::TPCsetID_t(0));
1896 
1897 
1898  // test iterator to last TPC
1899  readout::TPCsetID LastID(geom->Ncryostats() - 1, 0);
1900  LastID.TPCset = geom->NTPCsets(LastID) - 1; // last TPC set of last cryostat
1901  geo::TPCset_id_iterator iLastTPCset(geom, LastID);
1902  BOOST_TEST_CHECKPOINT("Position-created iterator to last TPC set ID: "
1903  << std::string(*iLastTPCset));
1904 
1905  // check that the iterator tests true
1906  BOOST_TEST(bool(iLastTPCset));
1907  BOOST_TEST(!!iLastTPCset);
1908 
1909  // check that the pointed ID is as expected
1910  BOOST_TEST(*iLastTPCset == LastID);
1911  BOOST_TEST(iLastTPCset->Cryostat == LastID.Cryostat);
1912  BOOST_TEST(iLastTPCset->TPCset == LastID.TPCset);
1913 
1914  // test increment to past-the-end
1915  geo::TPCset_id_iterator iEndTPCset = iLastTPCset;
1916  ++iEndTPCset;
1917 
1918  // check that the iterator tests false
1919  BOOST_TEST(!bool(iEndTPCset));
1920  BOOST_TEST(!iEndTPCset);
1921 
1922  BOOST_TEST
1923  (iEndTPCset->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1924  BOOST_TEST(iEndTPCset->TPCset == readout::TPCsetID::TPCsetID_t(0));
1925  BOOST_TEST(iEndTPCset == geom->end_TPCset_id());
1926 
1927  }
1928 
1929  //
1930  // end-constructed
1931  //
1932  {
1933  // construct from end position
1935  BOOST_TEST_CHECKPOINT
1936  ("End-created TPC set ID iterator: " << std::string(*iTPCset));
1937 
1938  BOOST_TEST
1939  (iTPCset->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1940  BOOST_TEST(iTPCset->TPCset == readout::TPCsetID::TPCsetID_t(0));
1941 
1942  // check that the iterator tests false
1943  BOOST_TEST(!bool(iTPCset));
1944  BOOST_TEST(!iTPCset);
1945 
1946  // construct at end position by geometry
1948  BOOST_TEST(iTPCsetGE == iTPCset);
1949 
1950  // initialize to the end directly; this has probably ID's isValid true
1951  geo::TPCset_id_iterator iTPCset2
1953  BOOST_TEST
1954  (iTPCset2->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1955  BOOST_TEST(iTPCset2->TPCset == readout::TPCsetID::TPCsetID_t(0));
1956  BOOST_TEST(iTPCset2 == iTPCset);
1957 
1958  }
1959 
1960 } // GeometryIteratorTestAlg::TPCsetIDIteratorsTest()
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
constexpr auto end_pos
GeometryCore const * geom
pointer to the geometry description
std::string string
Definition: nybbler.cc:12
unsigned int ID
unsigned short TPCsetID_t
Type for the ID number.
Definition: readout_types.h:71
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:70
unsigned int NTPCsets(readout::CryostatID const &cryoid) const
Returns the total number of TPC sets in the specified cryostat.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
TPCset_id_iterator end_TPCset_id() const
Returns an iterator pointing after the last TPC set ID in the detector.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
static constexpr CryostatID_t getInvalidID()
Return the value of the invalid ID as a r-value.
Definition: geo_types.h:285
constexpr auto begin_pos
TPCset_id_iterator begin_TPCset_id() const
Returns an iterator pointing to the first TPC set ID in the detector.
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
Definition: readout_types.h:90
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
static constexpr TPCsetID_t getInvalidID()
Return the value of the invalid TPC ID as a r-value.
Base forward iterator browsing all TPC set IDs in the detector.
Definition: GeometryCore.h:925
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
void geo::GeometryIteratorTestAlg::WireIDIteratorsTest ( ) const

Definition at line 1313 of file GeometryIteratorTestAlg.cxx.

1313  {
1314 
1315  /*
1316  * public interface (wire_id_iterator_base):
1317  *
1318  * /// Default constructor; effect not defined: assign to it before using!
1319  * wire_id_iterator_base()
1320  *
1321  * /// Constructor: points to begin
1322  * wire_id_iterator_base(geo::GeometryCore const* geom)
1323  *
1324  * /// Constructor: points to the specified cryostat
1325  * wire_id_iterator_base
1326  * (geo::GeometryCore const* geom, GEOID const& start_from)
1327  *
1328  * /// Constructor: points to begin
1329  * wire_id_iterator_base(geo::GeometryCore const* geom, BeginPos_t)
1330  *
1331  * /// Constructor: points to end
1332  * wire_id_iterator_base(geo::GeometryCore const* geom, EndPos_t)
1333  *
1334  * // TODO reconsider if the additional template is indeed needed
1335  * /// Returns true if the two iterators point to the same wire
1336  * template <typename OTHERID>
1337  * bool operator== (wire_id_iterator_base<OTHERID> const& as) const
1338  *
1339  * /// Returns true if the two iterators point to different wires
1340  * template <typename OTHERID>
1341  * bool operator!= (wire_id_iterator_base<OTHERID> const& as) const
1342  *
1343  * /// Returns the WireID the iterator points to
1344  * LocalID_t const& operator* () const
1345  *
1346  * /// Returns the WireID the iterator points to
1347  * LocalID_t const* operator-> () const
1348  *
1349  * /// Prefix increment: returns this iterator pointing to the next wire
1350  * iterator& operator++ ()
1351  *
1352  * /// Postfix increment: returns the current iterator, then increments it
1353  * iterator operator++ (int)
1354  *
1355  * /// Returns whether the iterator is pointing to a valid wire
1356  * operator bool() const
1357  *
1358  * /// Returns a pointer to wire, or nullptr if invalid
1359  * ElementPtr_t get() const
1360  *
1361  */
1362 
1363  //
1364  // default constructed
1365  //
1366  {
1368  BOOST_TEST_CHECKPOINT
1369  ("Default created wire ID iterator: " << std::string(*iWire));
1370 
1371  BOOST_TEST(iWire->Cryostat == geo::CryostatID::getInvalidID());
1372  BOOST_TEST(iWire->TPC == geo::TPCID::getInvalidID());
1373  BOOST_TEST(iWire->Plane == geo::PlaneID::getInvalidID());
1374  BOOST_TEST(iWire->Wire == geo::WireID::getInvalidID());
1375 
1376  // check that the iterator tests false
1377  BOOST_TEST(!iWire);
1378  BOOST_TEST(!(bool(iWire)));
1379 
1380  }
1381 
1382  //
1383  // begin-constructed
1384  //
1385  {
1387  BOOST_TEST_CHECKPOINT
1388  ("Begin-created wire ID iterator: " << std::string(*iWire));
1389 
1390  BOOST_TEST(iWire->Cryostat == geo::CryostatID::CryostatID_t(0));
1391  BOOST_TEST(iWire->TPC == geo::TPCID::TPCID_t(0));
1392  BOOST_TEST(iWire->Plane == geo::PlaneID::PlaneID_t(0));
1393  BOOST_TEST(iWire->Wire == geo::WireID::WireID_t(0));
1394 
1395  // check that the iterator tests true
1396  BOOST_TEST(bool(iWire));
1397  BOOST_TEST(!!iWire);
1398 
1399  // initialize to the beginning directly; this has probably ID's isValid true
1400  geo::WireID BeginID;
1401  geom->GetBeginID(BeginID);
1402  geo::GeometryCore::wire_id_iterator iWireD(geom, BeginID);
1403  BOOST_TEST(iWireD->Cryostat == geo::CryostatID::CryostatID_t(0));
1404  BOOST_TEST(iWireD->TPC == geo::TPCID::TPCID_t(0));
1405  BOOST_TEST(iWireD->Plane == geo::PlaneID::PlaneID_t(0));
1406  BOOST_TEST(iWireD->Wire == geo::WireID::WireID_t(0));
1407  BOOST_TEST(iWireD == iWire);
1408 
1409  // construct from explicit begin position
1412  BOOST_TEST(iWireBC == iWire);
1413 
1414  // construct at begin position by geometry
1416  BOOST_TEST(iWireGB == iWire);
1417 
1418  // check access to ID
1419  BOOST_TEST(*iWire == BeginID);
1420  BOOST_TEST(iWire->Cryostat == BeginID.Cryostat);
1421  BOOST_TEST(iWire->TPC == BeginID.TPC);
1422  BOOST_TEST(iWire->Plane == BeginID.Plane);
1423  BOOST_TEST(iWire->Wire == BeginID.Wire);
1424 
1425  // check access to geometry element
1426  geo::WireGeo const* pWire = geom->WirePtr(BeginID);
1427  BOOST_TEST(iWire.get() == pWire);
1428 
1429  // test copy and postfix increment
1430  geo::GeometryCore::wire_id_iterator iWireI(iWire++);
1431 
1432  const unsigned int nWiresInC0T0P0 = geom->Nwires(geo::PlaneID(0, 0, 0));
1433  if (nWiresInC0T0P0 > 1) {
1434  BOOST_TEST(iWireI->Cryostat == geo::CryostatID::CryostatID_t(0));
1435  BOOST_TEST(iWireI->TPC == geo::TPCID::TPCID_t(0));
1436  BOOST_TEST(iWireI->Plane == geo::PlaneID::PlaneID_t(0));
1437  BOOST_TEST(iWireI->Wire == geo::WireID::WireID_t(0));
1438  BOOST_TEST(iWire->Cryostat == geo::CryostatID::CryostatID_t(0));
1439  BOOST_TEST(iWire->TPC == geo::TPCID::TPCID_t(0));
1440  BOOST_TEST(iWire->Plane == geo::PlaneID::PlaneID_t(0));
1441  BOOST_TEST(iWire->Wire == geo::WireID::WireID_t(1));
1442  }
1443  BOOST_TEST(iWireI != iWire);
1444 
1445  // test copy and prefix increment
1446  ++iWireI;
1447  BOOST_TEST(iWireI == iWire); // arguable if both are end-iterators by now
1448 
1449  }
1450 
1451  //
1452  // constructed from starting point
1453  //
1454  {
1455  // test increment flipping plane
1456  geo::WireID ID(0, 0, 0, 0);
1457  ID.Wire = geom->Nwires(ID) - 1; // last wire of first plane
1458 
1460 
1461  // check that the iterator tests true
1462  BOOST_TEST(bool(iWire));
1463  BOOST_TEST(!!iWire);
1464 
1465  // check that the pointed ID is as expected
1466  BOOST_TEST(*iWire == ID);
1467  BOOST_TEST(iWire->Cryostat == ID.Cryostat);
1468  BOOST_TEST(iWire->TPC == ID.TPC);
1469  BOOST_TEST(iWire->Plane == ID.Plane);
1470  BOOST_TEST(iWire->Wire == ID.Wire);
1471  BOOST_TEST(iWire.get() == geom->WirePtr(ID));
1472 
1473  ++iWire;
1474  // check that the pointed ID is as expected
1475  if (ID.Plane + 1 < geom->Nplanes(ID)) {
1476  BOOST_TEST(iWire->Cryostat == geo::CryostatID::CryostatID_t(0));
1477  BOOST_TEST(iWire->TPC == geo::TPCID::TPCID_t(0));
1478  BOOST_TEST(iWire->Plane == ID.Plane + 1);
1479  BOOST_TEST(iWire->Wire == geo::WireID::WireID_t(0));
1480  } else if (ID.TPC + 1 < geom->NTPC(ID)) {
1481  BOOST_TEST(iWire->Cryostat == geo::CryostatID::CryostatID_t(0));
1482  BOOST_TEST(iWire->TPC == ID.TPC + 1);
1483  BOOST_TEST(iWire->Plane == geo::PlaneID::PlaneID_t(0));
1484  BOOST_TEST(iWire->Wire == geo::WireID::WireID_t(0));
1485  } else {
1486  BOOST_TEST(iWire->Cryostat == ID.Cryostat + 1);
1487  BOOST_TEST(iWire->TPC == geo::TPCID::TPCID_t(0));
1488  BOOST_TEST(iWire->Plane == geo::PlaneID::PlaneID_t(0));
1489  BOOST_TEST(iWire->Wire == geo::WireID::WireID_t(0));
1490  }
1491 
1492  // test iterator to last wire
1493  geo::WireID LastID(geom->Ncryostats() - 1, 0, 0, 0);
1494  LastID.TPC = geom->NTPC(LastID) - 1; // last TPC of last cryostat
1495  LastID.Plane = geom->Nplanes(LastID) - 1; // last plane of last TPC
1496  LastID.Wire = geom->Nwires(LastID) - 1; // last wire of last plane
1497  geo::GeometryCore::wire_id_iterator iLastWire(geom, LastID);
1498  BOOST_TEST_CHECKPOINT("Position-created iterator to last wire ID: "
1499  << std::string(*iLastWire));
1500 
1501  // check that the iterator tests true
1502  BOOST_TEST(bool(iLastWire));
1503  BOOST_TEST(!!iLastWire);
1504 
1505  // check that the pointed ID is as expected
1506  BOOST_TEST(*iLastWire == LastID);
1507  BOOST_TEST(iLastWire->Cryostat == LastID.Cryostat);
1508  BOOST_TEST(iLastWire->TPC == LastID.TPC);
1509  BOOST_TEST(iLastWire->Plane == LastID.Plane);
1510  BOOST_TEST(iLastWire->Wire == LastID.Wire);
1511  BOOST_TEST(iLastWire.get() == geom->WirePtr(LastID));
1512 
1513  // test increment to past-the-end
1514  geo::GeometryCore::wire_id_iterator iEndWire = iLastWire;
1515  ++iEndWire;
1516 
1517  // check that the iterator tests false
1518  BOOST_TEST(!bool(iEndWire));
1519  BOOST_TEST(!iEndWire);
1520 
1521  BOOST_TEST(iEndWire->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1522  BOOST_TEST(iEndWire->TPC == geo::TPCID::TPCID_t(0));
1523  BOOST_TEST(iEndWire->Plane == geo::PlaneID::PlaneID_t(0));
1524  BOOST_TEST(iEndWire->Wire == geo::WireID::WireID_t(0));
1525  BOOST_TEST(iEndWire == geom->end_wire_id());
1526  BOOST_TEST(!iEndWire.get());
1527 
1528  }
1529 
1530  //
1531  // end-constructed
1532  //
1533  {
1534  // construct from end position
1537  BOOST_TEST_CHECKPOINT
1538  ("End-created end ID iterator: " << std::string(*iWire));
1539 
1540  BOOST_TEST(iWire->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1541  BOOST_TEST(iWire->TPC == geo::TPCID::TPCID_t(0));
1542  BOOST_TEST(iWire->Plane == geo::PlaneID::PlaneID_t(0));
1543  BOOST_TEST(iWire->Wire == geo::WireID::WireID_t(0));
1544 
1545  // check that the iterator tests false
1546  BOOST_TEST(!bool(iWire));
1547  BOOST_TEST(!iWire);
1548 
1549  // check access to geometry element (result of operator* is not defined)
1550  BOOST_TEST(!(iWire.get())); // should get nullptr
1551 
1552  // construct at end position by geometry
1554  BOOST_TEST(iWireGE == iWire);
1555 
1556  // initialize to the end directly; this has probably ID's isValid true
1558  (geom, geo::WireID(geom->Ncryostats(), 0, 0, 0));
1559  BOOST_TEST(iWire2->Cryostat == geo::CryostatID::CryostatID_t(geom->Ncryostats()));
1560  BOOST_TEST(iWire2->TPC == geo::TPCID::TPCID_t(0));
1561  BOOST_TEST(iWire2->Plane == geo::PlaneID::PlaneID_t(0));
1562  BOOST_TEST(iWire2->Wire == geo::WireID::WireID_t(0));
1563  BOOST_TEST(iWire2 == iWire);
1564 
1565  }
1566 
1567 } // GeometryIteratorTestAlg::WireIDIteratorsTest()
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:65
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeometryCore const * geom
pointer to the geometry description
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
Base forward iterator browsing all wire IDs in the detector.
Definition: GeometryCore.h:587
std::string string
Definition: nybbler.cc:12
unsigned int ID
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:473
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
static constexpr CryostatID_t getInvalidID()
Return the value of the invalid ID as a r-value.
Definition: geo_types.h:285
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
static constexpr TPCID_t getInvalidID()
Return the value of the invalid TPC ID as a r-value.
Definition: geo_types.h:466
wire_id_iterator end_wire_id() const
Returns an iterator pointing after the last wire ID in the detector.
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
static constexpr WireID_t getInvalidID()
Return the value of the invalid wire ID as a r-value.
Definition: geo_types.h:644
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:191
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:387
ElementPtr_t get() const
Returns a pointer to wire, or nullptr if invalid.
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:561
wire_id_iterator begin_wire_id() const
Returns an iterator pointing to the first wire ID in the detector.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
static constexpr PlaneID_t getInvalidID()
Return the value of the invalid plane ID as a r-value.
Definition: geo_types.h:554
WireGeo const * WirePtr(geo::WireID const &wireid) const
Returns the specified wire.
void geo::GeometryIteratorTestAlg::WireIteratorsTest ( ) const

Definition at line 1572 of file GeometryIteratorTestAlg.cxx.

1572  {
1573 
1574  /*
1575  * This test is extensively based on the assumption that the iterators should
1576  * behave like the corresponding ID iterators, including "corner cases".
1577  *
1578  * public interface (geometry_element_iterator<>)
1579  *
1580  * /// Default constructor; effect not defined: assign to it before using!
1581  * geometry_element_iterator()
1582  *
1583  * /// Constructor: points to begin
1584  * geometry_element_iterator(geo::GeometryCore const* geom)
1585  *
1586  * /// Constructor: points to the same element as the specified ID iterator
1587  * geometry_element_iterator(id_iterator_t const& iter)
1588  *
1589  * /// Constructor: points to the same element as the specified ID iterator
1590  * geometry_element_iterator(id_iterator_t&& iter)
1591  *
1592  * /// Constructor: points to the specified geometry element
1593  * geometry_element_iterator
1594  * (geo::GeometryCore const* geom, GeoID_t const& start_from)
1595  *
1596  * /// Constructor: points to beginning
1597  * geometry_element_iterator
1598  * (geo::GeometryCore const* geom, BeginPos_t const pos)
1599  *
1600  * /// Constructor: points to end
1601  * geometry_element_iterator
1602  * (geo::GeometryCore const* geom, EndPos_t const pos)
1603  *
1604  * /// Returns true if the two iterators point to the same object
1605  * bool operator== (iterator const& as) const
1606  *
1607  * /// Returns true if the two iterators point to the same object
1608  * bool operator== (id_iterator_t const& as) const
1609  *
1610  * /// Returns true if the two iterators point to different objects
1611  * bool operator!= (iterator const& as) const
1612  *
1613  * /// Returns true if the two iterators point to different objects
1614  * bool operator!= (id_iterator_t const& as) const
1615  *
1616  * /// Returns the geometry element the iterator points to
1617  * Element_t const& operator* () const
1618  *
1619  * /// Returns a pointer to the element the iterator points to (or nullptr)
1620  * Element_t const* operator-> () const
1621  *
1622  * /// Prefix increment: returns this iterator pointing to the next element
1623  * iterator& operator++ ()
1624  *
1625  * /// Postfix increment: returns the current iterator, then increments it
1626  * iterator operator++ (int)
1627  *
1628  * /// Returns whether the iterator is pointing to a valid geometry element
1629  * operator bool() const
1630  *
1631  * /// Returns a pointer to the geometry element, or nullptr if invalid
1632  * ElementPtr_t get() const
1633  *
1634  * /// Returns the ID of the pointed geometry element
1635  * LocalID_t const& ID() const
1636  *
1637  */
1638 
1639  //
1640  // default constructed
1641  //
1642  {
1644  BOOST_TEST_CHECKPOINT
1645  ("Default created wire iterator: " << std::string(*iWireID));
1646 
1648 
1649  // direct comparison
1650  BOOST_TEST(iWire == iWireID);
1651  BOOST_TEST(!(iWire != iWireID));
1652 
1653  // ID comparison
1654  BOOST_TEST(iWire.ID() == *iWireID);
1655 
1656  // check copy assignment
1657  geo::GeometryCore::wire_iterator iWire_copy(iWire);
1658  geo::GeometryCore::wire_id_iterator iWireID_copy(iWireID);
1659 
1660  // check comparisons too
1661  BOOST_TEST(iWire == iWire_copy);
1662  BOOST_TEST(iWire_copy == iWire);
1663  BOOST_TEST(!(iWire != iWire_copy));
1664  BOOST_TEST(!(iWire_copy != iWire));
1665 
1666  BOOST_TEST(iWire == iWire_copy);
1667 
1668  }
1669 
1670  //
1671  // begin-constructed
1672  //
1673  {
1674  geo::WireID BeginID;
1675  geom->GetBeginID(BeginID);
1676 
1677  geo::GeometryCore::wire_id_iterator iWireID(geom, BeginID);
1678 
1679 
1680  BOOST_TEST_CHECKPOINT
1681  ("Begin-created wire iterator (" << std::string(BeginID) << ")");
1682 
1683  // initialize to the beginning directly
1684  geo::GeometryCore::wire_iterator iWireD(geom, BeginID);
1685  CompareIteratorAndIteratorID(iWireD, iWireID);
1686 
1687  // initialize to the beginning with implicit initialization
1689  CompareIteratorAndIteratorID(iWire, iWireID);
1690 
1691  // construct from explicit begin position
1694  CompareIteratorAndIteratorID(iWireBC, iWireID);
1695 
1696  // construct at begin position by geometry
1698  CompareIteratorAndIteratorID(iWireGB, iWireID);
1699 
1700  }
1701 
1702  //
1703  // constructed from starting point
1704  //
1705  {
1706  // test iterator to last wire
1707  geo::WireID LastID(geom->Ncryostats() - 1, 0, 0, 0);
1708  LastID.TPC = geom->NTPC(LastID) - 1; // last TPC of last cryostat
1709  LastID.Plane = geom->Nplanes(LastID) - 1; // last plane of last TPC
1710  LastID.Wire = geom->Nwires(LastID) - 1; // last wire of last plane
1711  geo::GeometryCore::wire_id_iterator iLastWireID(geom, LastID);
1712 
1713  BOOST_TEST_CHECKPOINT
1714  ("Position-created iterator to last wire: " << std::string(LastID));
1715  geo::GeometryCore::wire_iterator iLastWire(geom, LastID);
1716  CompareIteratorAndIteratorID(iLastWire, iLastWireID);
1717 
1718  // test increment to past-the-end
1719  geo::GeometryCore::wire_id_iterator iEndWireID = iLastWireID;
1720  ++iEndWireID;
1721 
1722  geo::GeometryCore::wire_iterator iEndWire = iLastWire;
1723  ++iEndWire;
1724 
1725  CompareIteratorAndIteratorID(iEndWire, iEndWireID);
1726 
1727  }
1728 
1729  //
1730  // end-constructed
1731  //
1732  {
1734 
1735  // construct from end position
1736  BOOST_TEST_CHECKPOINT
1737  ("End-created wire iterator: " << std::string(*iWireID));
1740  CompareIteratorAndIteratorID(iWire, iWireID);
1741 
1742  // construct at end position by geometry
1744  CompareIteratorAndIteratorID(iWireGE, iWireID);
1745 
1746  }
1747 
1748 } // GeometryIteratorTestAlg::WireIteratorsTest()
wire_iterator begin_wire() const
Returns an iterator pointing to the first wire in the detector.
wire_iterator end_wire() const
Returns an iterator pointing after the last wire in the detector.
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeometryCore const * geom
pointer to the geometry description
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
Base forward iterator browsing all wire IDs in the detector.
Definition: GeometryCore.h:587
std::string string
Definition: nybbler.cc:12
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
wire_id_iterator end_wire_id() const
Returns an iterator pointing after the last wire ID in the detector.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
LocalID_t const & ID() const
Returns the ID of the pointed geometry element.
Definition: GeometryCore.h:883
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:719

Member Data Documentation

GeometryCore const* geo::GeometryIteratorTestAlg::geom = nullptr
protected

pointer to the geometry description

Definition at line 56 of file GeometryIteratorTestAlg.h.


The documentation for this class was generated from the following files: