LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::details Namespace Reference

Classes

struct  AbsIDtypeStruct
 
struct  AbsIDtypeStruct< ID, Index, std::enable_if_t<(Index==ID::Level)> >
 
struct  ActiveAreaCalculator
 Class computing the active area of the plane. More...
 
struct  Comparer
 Class managing comparisons between T objects via a Key key. More...
 
class  GeoContainerData
 
class  GeoIDdataContainerItemIterator
 Item iterator for geo::GeoIDdataContainer class. More...
 
class  GeoIDdataContainerIterator
 Iterator for geo::GeoIDdataContainer class. More...
 
class  geometry_element_iterator
 Forward iterator browsing all geometry elements in the detector. More...
 
class  geometry_iterator_base
 Base class for geometry iterators (note: this is not an iterator) More...
 
class  id_iterator_base
 Base forward iterator browsing all cryostat IDs in the detector. More...
 
class  id_iterator_base< CryostatID, GEOID >
 
struct  IteratorMaker
 
struct  IteratorMaker< T, std::enable_if_t< std::is_base_of_v< CryostatID, T > > >
 
struct  RelIDtypeStruct
 
struct  RelIDtypeStruct< ID, 0U >
 
struct  TransformationMatrixConverter
 

Typedefs

template<typename T >
using begin_type = typename IteratorMaker< T >::begin_type
 
template<typename T >
using end_type = typename IteratorMaker< T >::end_type
 
template<typename T >
using range_type = typename IteratorMaker< T >::range_type
 
template<typename LocalID >
using id_iterator = id_iterator_base< LocalID, LocalID >
 
template<typename Element >
using element_iterator_for = details::geometry_element_iterator< Element, details::id_iterator< typename Element::ID_t >>
 
template<std::size_t Index, typename ID >
using AbsIDtype = typename AbsIDtypeStruct< ID, Index >::type
 
template<std::size_t UpIndex, typename ID >
using RelIDtype = typename RelIDtypeStruct< ID, UpIndex >::type
 

Functions

template<std::size_t Levels = 4U>
static std::array< unsigned int, Levels > extractMaxGeometryElements (geo::GeometryData_t::CryostatList_t const &Cryostats)
 Extracts the maximum number of elements per type. More...
 
template<typename GEOIT >
std::enable_if_t< std::is_base_of_v< geometry_iterator_base, GEOIT >, std::ostream & > operator<< (std::ostream &out, GEOIT const &it)
 Stream output for all geometry ID iterator types: prints the pointed ID. More...
 
unsigned int NSiblings (GeometryCore const *geom, CryostatID const &id)
 
unsigned int NSiblings (GeometryCore const *geom, TPCID const &id)
 
unsigned int NSiblings (GeometryCore const *geom, PlaneID const &id)
 
unsigned int NSiblings (GeometryCore const *geom, WireID const &id)
 
unsigned int NSiblings (GeometryCore const *geom, readout::TPCsetID const &id)
 
unsigned int NSiblings (GeometryCore const *geom, readout::ROPID const &id)
 
CryostatGeo const * getElementPtr (GeometryCore const *geom, CryostatID const &id)
 
TPCGeo const * getElementPtr (GeometryCore const *geom, TPCID const &id)
 
PlaneGeo const * getElementPtr (GeometryCore const *geom, PlaneID const &id)
 
WireGeo const * getElementPtr (GeometryCore const *geom, WireID const &id)
 
bool validElement (GeometryCore const *geom, CryostatID const &id)
 
bool validElement (GeometryCore const *geom, TPCID const &id)
 
bool validElement (GeometryCore const *geom, PlaneID const &id)
 
bool validElement (GeometryCore const *geom, WireID const &id)
 
template<typename T >
auto static_less (T a, T b)
 Function translation of std::less. More...
 
template<std::size_t N, typename T >
auto initializerListToArray (std::initializer_list< T > values)
 Returns a STL array of size N filled with values from the argument. More...
 
template<typename T >
std::string writeToString (T const &value)
 Write the argument into a string. More...
 
template<typename ID >
constexpr std::size_t geoElementLevel ()
 
template<std::size_t Index, typename ID >
constexpr auto getAbsIDindex (ID const &id)
 
template<std::size_t Index, typename ID >
auto & getAbsIDindex (ID &id)
 
template<std::size_t UpIndex, typename ID >
auto getRelIDindex (ID const &id)
 

Variables

template<typename BaseID , typename GeoID >
static constexpr bool is_base_of_strict
 
template<typename ID >
constexpr bool isTopGeoElementID = std::is_void_v<typename ID::ParentID_t>
 Whether ID represents an element on top of the hierarchy. More...
 

Detailed Description

The purpose of this file is to enable the separation of the geometry iterators from the GeometryCore header. The iterators are defined before the GeometryCore class is defined, and because the iterators require the GeometryCore object as part of the implementation, there is a circularity that must be broken.

To do this, we create free functions that call member functions of the GeometryCore object in a separate compilation unit. The functions are resolved at link-time, avoiding the circularity.

N.B. If it should be decided that the functionalities here should be templated (i.e. more than just GeometryCore might support the concept), then the circularity would be removed because GeometryCore woould become a dependent type.

Typedef Documentation

template<std::size_t Index, typename ID >
using geo::details::AbsIDtype = typedef typename AbsIDtypeStruct<ID, Index>::type

Definition at line 47 of file geo_types.h.

template<typename T >
using geo::details::begin_type = typedef typename IteratorMaker<T>::begin_type

Definition at line 106 of file geometry_iterator_maker.h.

template<typename Element >
using geo::details::element_iterator_for = typedef details::geometry_element_iterator<Element, details::id_iterator<typename Element::ID_t>>

Definition at line 382 of file geometry_iterators.h.

template<typename T >
using geo::details::end_type = typedef typename IteratorMaker<T>::end_type

Definition at line 109 of file geometry_iterator_maker.h.

template<typename LocalID >
using geo::details::id_iterator = typedef id_iterator_base<LocalID, LocalID>

Definition at line 255 of file geometry_iterators.h.

template<typename T >
using geo::details::range_type = typedef typename IteratorMaker<T>::range_type

Definition at line 112 of file geometry_iterator_maker.h.

template<std::size_t UpIndex, typename ID >
using geo::details::RelIDtype = typedef typename RelIDtypeStruct<ID, UpIndex>::type

Definition at line 53 of file geo_types.h.

Function Documentation

template<std::size_t Levels = 4U>
static std::array<unsigned int, Levels> geo::details::extractMaxGeometryElements ( geo::GeometryData_t::CryostatList_t const &  Cryostats)
static

Extracts the maximum number of elements per type.

Template Parameters
Levelsthe number of detector elements to discover
Parameters
Cryostatsthe sorted list of cryostats in the detector
Returns
an array with maximum number of cryostats, TPCs, planes and wires

The returned array includes:

  • index [0]: number of cryostats
  • index [1]: maximum number of TPCs in any of the cryostats (enabled only if Levels is 2 or higher)
  • index [2]: maximum number of wire planes in any of the TPCs (enabled only if Levels is 3 or higher)
  • index [3]: maximum number of wires in any of the wire planes (enabled only if Levels is 4)
template<typename ID >
constexpr std::size_t geo::details::geoElementLevel ( )

Definition at line 35 of file geo_types.h.

36  {
37  if constexpr (isTopGeoElementID<ID>)
38  return 0U;
39  else
40  return geoElementLevel<typename ID::ParentID_t>() + 1U;
41  } // geoElementLevel()
constexpr std::size_t geoElementLevel()
Definition: geo_types.h:35
template<std::size_t Index, typename ID >
constexpr auto geo::details::getAbsIDindex ( ID const &  id)

Definition at line 56 of file geo_types.h.

57  {
58  static_assert(Index <= ID::Level, "Index not available for this type.");
59  if constexpr (Index == ID::Level)
60  return id.deepestIndex();
61  else
62  return getAbsIDindex<Index>(id.parentID());
63  }
Level
Definition: Level.h:13
auto & getAbsIDindex(ID &id)
Definition: geo_types.h:66
template<std::size_t Index, typename ID >
auto& geo::details::getAbsIDindex ( ID &  id)

Definition at line 66 of file geo_types.h.

67  {
68  static_assert(Index <= ID::Level, "Index not available for this type.");
69  if constexpr (Index == ID::Level)
70  return id.deepestIndex();
71  else
72  return getAbsIDindex<Index>(id.parentID());
73  }
Level
Definition: Level.h:13
auto & getAbsIDindex(ID &id)
Definition: geo_types.h:66
CryostatGeo const * geo::details::getElementPtr ( GeometryCore const *  geom,
CryostatID const &  id 
)

Definition at line 36 of file helpers.cxx.

References geo::GeometryCore::GetElementPtr().

Referenced by geo::details::geometry_element_iterator< Element, GEOIDITER >::get(), and validElement().

37  {
38  assert(geom);
39  return geom->GetElementPtr(id);
40  }
TPCGeo const * geo::details::getElementPtr ( GeometryCore const *  geom,
TPCID const &  id 
)

Definition at line 42 of file helpers.cxx.

References geo::GeometryCore::GetElementPtr().

43  {
44  assert(geom);
45  return geom->GetElementPtr(id);
46  }
PlaneGeo const * geo::details::getElementPtr ( GeometryCore const *  geom,
PlaneID const &  id 
)

Definition at line 48 of file helpers.cxx.

References geo::GeometryCore::GetElementPtr().

49  {
50  assert(geom);
51  return geom->GetElementPtr(id);
52  }
WireGeo const * geo::details::getElementPtr ( GeometryCore const *  geom,
WireID const &  id 
)

Definition at line 54 of file helpers.cxx.

References geo::GeometryCore::GetElementPtr().

55  {
56  assert(geom);
57  return geom->GetElementPtr(id);
58  }
template<std::size_t UpIndex, typename ID >
auto geo::details::getRelIDindex ( ID const &  id)

Definition at line 76 of file geo_types.h.

77  {
78  static_assert(UpIndex <= ID::Level, "Index not available for this type.");
79  if constexpr (UpIndex == 0)
80  return id.deepestIndex();
81  else
82  return getRelIDindex<UpIndex - 1U>(id.parentID());
83  }
Level
Definition: Level.h:13
auto getRelIDindex(ID const &id)
Definition: geo_types.h:76
template<std::size_t N, typename T >
auto geo::details::initializerListToArray ( std::initializer_list< T >  values)

Returns a STL array of size N filled with values from the argument.

Definition at line 394 of file GeometryIDmapper.h.

395 {
396  std::array<T, N> data;
397  std::copy(values.begin(), values.end(), data.begin());
398  return data;
399 } // geo::details::initializerListToArray()
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
unsigned int geo::details::NSiblings ( GeometryCore const *  geom,
CryostatID const &  id 
)
unsigned int geo::details::NSiblings ( GeometryCore const *  geom,
TPCID const &  id 
)

Definition at line 11 of file helpers.cxx.

References geo::GeometryCore::NSiblingElements().

12  {
13  return geom->NSiblingElements(id);
14  }
unsigned int geo::details::NSiblings ( GeometryCore const *  geom,
PlaneID const &  id 
)

Definition at line 16 of file helpers.cxx.

References geo::GeometryCore::NSiblingElements().

17  {
18  return geom->NSiblingElements(id);
19  }
unsigned int geo::details::NSiblings ( GeometryCore const *  geom,
WireID const &  id 
)

Definition at line 21 of file helpers.cxx.

References geo::GeometryCore::NSiblingElements().

22  {
23  return geom->NSiblingElements(id);
24  }
unsigned int geo::details::NSiblings ( GeometryCore const *  geom,
readout::TPCsetID const &  id 
)

Definition at line 26 of file helpers.cxx.

References geo::GeometryCore::NSiblingElements().

27  {
28  return geom->NSiblingElements(id);
29  }
unsigned int geo::details::NSiblings ( GeometryCore const *  geom,
readout::ROPID const &  id 
)

Definition at line 31 of file helpers.cxx.

References geo::GeometryCore::NSiblingElements().

32  {
33  return geom->NSiblingElements(id);
34  }
template<typename GEOIT >
std::enable_if_t<std::is_base_of_v<geometry_iterator_base, GEOIT>, std::ostream&> geo::details::operator<< ( std::ostream &  out,
GEOIT const &  it 
)

Stream output for all geometry ID iterator types: prints the pointed ID.

Definition at line 259 of file geometry_iterators.h.

262  {
263  return out << "geometry_iterator{ " << *it << " }";
264  }
template<typename T >
auto geo::details::static_less ( a,
b 
)

Function translation of std::less.

Definition at line 60 of file DriftPartitions.h.

61  {
62  return std::less<T>()(a, b);
63  }
bool geo::details::validElement ( GeometryCore const *  geom,
CryostatID const &  id 
)

Definition at line 60 of file helpers.cxx.

References getElementPtr().

Referenced by geo::details::geometry_element_iterator< Element, GEOIDITER >::operator bool().

61  {
62  return geom && getElementPtr(geom, id) != nullptr;
63  }
WireGeo const * getElementPtr(GeometryCore const *geom, WireID const &id)
Definition: helpers.cxx:54
bool geo::details::validElement ( GeometryCore const *  geom,
TPCID const &  id 
)

Definition at line 65 of file helpers.cxx.

References getElementPtr().

66  {
67  return geom && getElementPtr(geom, id) != nullptr;
68  }
WireGeo const * getElementPtr(GeometryCore const *geom, WireID const &id)
Definition: helpers.cxx:54
bool geo::details::validElement ( GeometryCore const *  geom,
PlaneID const &  id 
)

Definition at line 70 of file helpers.cxx.

References getElementPtr().

71  {
72  return geom && getElementPtr(geom, id) != nullptr;
73  }
WireGeo const * getElementPtr(GeometryCore const *geom, WireID const &id)
Definition: helpers.cxx:54
bool geo::details::validElement ( GeometryCore const *  geom,
WireID const &  id 
)

Definition at line 75 of file helpers.cxx.

References getElementPtr().

76  {
77  return geom && getElementPtr(geom, id) != nullptr;
78  }
WireGeo const * getElementPtr(GeometryCore const *geom, WireID const &id)
Definition: helpers.cxx:54
template<typename T >
std::string geo::details::writeToString ( T const &  value)
inline

Write the argument into a string.

Definition at line 842 of file geo_types.h.

References value.

Referenced by geo::CryostatID::markInvalid(), geo::OpDetID::OpDetID(), geo::PlaneID::PlaneID(), geo::TPCID::TPCID(), geo::WireID::WireID(), and readout::details::writeToString().

843  {
844  std::ostringstream sstr;
845  sstr << value;
846  return sstr.str();
847  } // writeToString()
double value
Definition: spectrum.C:18

Variable Documentation

template<typename BaseID , typename GeoID >
constexpr bool geo::details::is_base_of_strict
static
Initial value:
{std::is_base_of<BaseID, GeoID>{} &&
!std::is_same<BaseID, GeoID>{}}

Definition at line 11 of file geometry_iterator_maker.h.

template<typename ID >
constexpr bool geo::details::isTopGeoElementID = std::is_void_v<typename ID::ParentID_t>

Whether ID represents an element on top of the hierarchy.

Definition at line 32 of file geo_types.h.