All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeometryGeoIDTestAlg.cxx
Go to the documentation of this file.
1 /**
2  * @file GeometryGeoIDTestAlg.cxx
3  * @brief Unit test for geometry iterators
4  * @date October 31, 2016
5  * @author Gianluca Petrillo (petrillo@fnal.gov)
6  *
7  * The methods require a Boost test environment.
8  */
9 
10 // LArSoft libraries
11 #include "GeometryGeoIDTestAlg.h"
14 
15 // Boost libraries
16 #include <boost/test/unit_test.hpp>
17 
18 // C/C++ standard libraries
19 #include <type_traits>
20 
21 
22 
23 //-----------------------------------------------------------------------------
24 unsigned int geo::GeometryGeoIDTestAlg::Run() const {
25  // All the tests
26 
28  TPCGeoIDTest();
30  WireGeoIDTest();
31 
32  return 0;
33 } // GeometryGeoIDTestAlg::Run()
34 
35 
36 
37 //-----------------------------------------------------------------------------
39 
40  auto iCryo = geom->begin_cryostat_id();
41  for (geo::CryostatGeo const& cryostat: geom->IterateCryostats()) {
42 
43  geo::CryostatID const& ID = cryostat.ID();
44 
45  // the ID of this CryostatGeo is the expected one in a sequential scheme:
46  BOOST_TEST(ID == *iCryo);
47 
48  // the ID of this CryostatGeo is associated to the CryostatGeo itself
49  auto const& cryostatFromID = geom->Cryostat(ID);
50  BOOST_TEST(&cryostat == &cryostatFromID);
51 
52 
53  ++iCryo;
54  } // for cryostat
55 
56 } // GeometryGeoIDTestAlg::CryostatGeoIDTest()
57 
58 
59 
60 //-----------------------------------------------------------------------------
62 
63  auto iTPC = geom->begin_TPC_id();
64  for (geo::TPCGeo const& tpc: geom->IterateTPCs()) {
65 
66  geo::TPCID const& ID = tpc.ID();
67 
68  // the ID of this TPCGeo is the expected one in a sequential scheme:
69  BOOST_TEST(ID == *iTPC);
70 
71  // the ID of this TPCGeo is associated to the TPCGeo itself
72  auto const& TPCFromID = geom->TPC(ID);
73  BOOST_TEST(&tpc == &TPCFromID);
74 
75 
76  ++iTPC;
77  } // for TPC
78 
79 } // GeometryGeoIDTestAlg::TPCGeoIDTest()
80 
81 
82 
83 //-----------------------------------------------------------------------------
85 
86  auto iPlane = geom->begin_plane_id();
87  for (geo::PlaneGeo const& plane: geom->IteratePlanes()) {
88 
89  geo::PlaneID const& ID = plane.ID();
90 
91  // the ID of this PlaneGeo is the expected one in a sequential scheme:
92  BOOST_TEST(ID == *iPlane);
93 
94  // the ID of this PlaneGeo is associated to the PlaneGeo itself
95  auto const& planeFromID = geom->Plane(ID);
96  BOOST_TEST(&plane == &planeFromID);
97 
98 
99  ++iPlane;
100  } // for plane
101 
102 } // GeometryGeoIDTestAlg::PlaneGeoIDTest()
103 
104 
105 
106 //-----------------------------------------------------------------------------
108 
109  auto iWire = geom->begin_wire_id();
110  for (geo::WireGeo const& wire [[gnu::unused]]: geom->IterateWires()) {
111 
112  // this test is disabled since geo::WireID does not support ID()
113  // (as of LArSoft 6.13)
114  /*
115  geo::WireID const& ID = wire.ID();
116 
117  // the ID of this WireGeo is the expected one in a sequential scheme:
118  BOOST_TEST(ID == *iWire);
119 
120  // the ID of this WireGeo is associated to the WireGeo itself
121  auto const& wireFromID = geom->Wire(ID);
122  BOOST_TEST(&wire == &wireFromID);
123  */
124 
125  ++iWire;
126  } // for wire
127 
128 } // GeometryGeoIDTestAlg::WireGeoIDTest()
129 
130 
131 //-----------------------------------------------------------------------------
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:65
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
Geometry information for a single TPC.
Definition: TPCGeo.h:38
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
Access the description of detector geometry.
Tests the correct assignment of IDs to detector geometry objects.
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
unsigned int Run() const
Executes the test.
Definition of data types for geometry description.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190