LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
GeometryIterationPolicy.cxx
Go to the documentation of this file.
3 
4 namespace geo::details {
5 
7 
8  unsigned int GeometryIterationPolicy::NSiblings(CryostatID const& id) const
9  {
10  return fGeom->NSiblingElements(id);
11  }
12 
13  unsigned int GeometryIterationPolicy::NSiblings(TPCID const& id) const
14  {
15  return fGeom->NSiblingElements(id);
16  }
17 
18  // CryostatID
20  {
21  return CryostatID{fGeom->Ncryostats()};
22  }
23 
24  // TPCID
26  {
27  auto id = TPCID::first();
28  if (fGeom->MaxTPCs() != 0) { id.Cryostat = fGeom->Ncryostats(); }
29  return id;
30  }
31 
33  {
34  return {GetNextID(id, *this), 0};
35  }
36 
37  // ......
38  CryostatGeo const* getElementPtr(GeometryCore const* geom, CryostatID const& id)
39  {
40  assert(geom);
41  return geom->GetElementPtr(id);
42  }
43 
44  TPCGeo const* getElementPtr(GeometryCore const* geom, TPCID const& id)
45  {
46  assert(geom);
47  return geom->GetElementPtr(id);
48  }
49 
50  bool validElement(GeometryCore const* geom, CryostatID const& id)
51  {
52  return geom && getElementPtr(geom, id) != nullptr;
53  }
54 
55  bool validElement(GeometryCore const* geom, TPCID const& id)
56  {
57  return geom && getElementPtr(geom, id) != nullptr;
58  }
59 
60 }
bool validElement(GeometryCore const *geom, CryostatID const &id)
CryostatGeo const * getElementPtr(GeometryCore const *geom, CryostatID const &id)
unsigned int NSiblings(CryostatID const &id) const
CryostatGeo const * GetElementPtr(CryostatID const &cryoid) const
Returns the specified cryostat.
Definition: GeometryCore.h:349
Geometry information for a single TPC.
Definition: TPCGeo.h:33
Geometry information for a single cryostat.
Definition: CryostatGeo.h:42
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
Access the description of the physical detector geometry.
static constexpr auto first()
Definition: geo_types.h:328
unsigned int NSiblingElements(CryostatID const &) const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:305
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
Description of the physical geometry of one entire detector.
Definition: GeometryCore.h:91
GeoID GetNextID(GeoID const &id, IterationPolicy const &policy)
Returns the ID next to the specified one.
Definition: id_iterators.h:285
unsigned int MaxTPCs() const
Returns the largest number of TPCs a cryostat in the detector has.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:187