LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
GeometryIterationPolicy.h
Go to the documentation of this file.
1 #ifndef LARCOREALG_GEOMETRY_DETAILS_GEOMETRYITERATIONPOLICY_H
2 #define LARCOREALG_GEOMETRY_DETAILS_GEOMETRYITERATIONPOLICY_H
3 
4 // LArSoft libraries
7 
8 namespace geo::details {
10  public:
11  GeometryIterationPolicy() = default; // Required for subranges
12  explicit GeometryIterationPolicy(GeometryCore const* geom);
13  unsigned int NSiblings(CryostatID const& id) const;
14  unsigned int NSiblings(TPCID const& id) const;
15 
16  template <typename GeoID>
17  GeoID GetEndID() const;
18 
19  template <typename GeoID, typename ContextID>
20  GeoID GetEndID(ContextID const& id) const;
21 
22  protected:
23  CryostatID EndCryostatID() const;
24 
25  TPCID EndTPCID() const;
26  TPCID EndTPCID(CryostatID const& id) const;
27 
28  GeometryCore const* fGeom{nullptr};
29  };
30 
32  template <>
33  inline CryostatID GeometryIterationPolicy::GetEndID<CryostatID>() const
34  {
35  return EndCryostatID();
36  }
37 
38  // TPCID
39  template <>
40  inline TPCID GeometryIterationPolicy::GetEndID<TPCID>() const
41  {
42  return EndTPCID();
43  }
44 
45  template <>
46  inline TPCID GeometryIterationPolicy::GetEndID<TPCID, CryostatID>(CryostatID const& id) const
47  {
48  return EndTPCID(id);
49  }
50 
51  CryostatGeo const* getElementPtr(GeometryCore const* geom, CryostatID const& id);
52  TPCGeo const* getElementPtr(GeometryCore const* geom, TPCID const& id);
53 
54  bool validElement(GeometryCore const* geom, CryostatID const& id);
55  bool validElement(GeometryCore const* geom, TPCID const& id);
56 }
57 
58 #endif // LARCOREALG_GEOMETRY_DETAILS_GEOMETRYITERATIONPOLICY_H
bool validElement(GeometryCore const *geom, CryostatID const &id)
CryostatGeo const * getElementPtr(GeometryCore const *geom, CryostatID const &id)
unsigned int NSiblings(CryostatID const &id) const
Geometry information for a single TPC.
Definition: TPCGeo.h:33
Geometry information for a single cryostat.
Definition: CryostatGeo.h:42
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
Definition of data types for geometry description.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:187