13 #ifndef LARCOREOBJ_SIMPLETYPESANDCONSTANTS_GEO_TYPES_H 14 #define LARCOREOBJ_SIMPLETYPESANDCONSTANTS_GEO_TYPES_H 24 #include <type_traits> 31 template <
typename T,
typename =
void>
35 struct has_parent<T,
std::void_t<typename T::ParentID_t>> : std::true_type {};
38 template <
typename ID>
55 template <
typename ID, std::
size_t Index,
typename =
void>
58 template <std::
size_t Index,
typename ID>
61 template <std::
size_t Index,
typename ID>
64 static_assert(Index <=
ID::Level,
"Index not available for this type.");
66 return id.deepestIndex();
68 return getAbsIDindex<Index>(
id.parentID());
71 template <std::
size_t Index,
typename ID>
74 static_assert(Index <=
ID::Level,
"Index not available for this type.");
76 return id.deepestIndex();
78 return getAbsIDindex<Index>(
id.parentID());
126 return static_cast<int>(
coord);
192 static constexpr
CryostatID_t InvalidID = std::numeric_limits<CryostatID_t>::max();
194 bool isValid =
false;
211 explicit constexpr
operator bool()
const {
return isValid; }
228 explicit operator std::string()
const {
return toString(); }
237 template <std::
size_t Index>
238 constexpr
auto getIndex()
const;
241 static constexpr
auto Level = details::index_for<CryostatID>();
256 static constexpr
OpDetID_t InvalidID = std::numeric_limits<OpDetID_t>::max();
278 explicit operator std::string()
const {
return toString(); }
290 template <std::
size_t Index>
291 constexpr
auto getIndex()
const;
298 static constexpr
auto Level = details::index_for<OpDetID>();
313 static constexpr
TPCID_t InvalidID = std::numeric_limits<TPCID_t>::max();
318 constexpr
TPCID() =
default;
336 explicit operator std::string()
const {
return toString(); }
348 template <std::
size_t Index>
349 constexpr
auto getIndex()
const;
356 static constexpr
auto Level = details::index_for<TPCID>();
371 static constexpr
PlaneID_t InvalidID = std::numeric_limits<PlaneID_t>::max();
393 explicit operator std::string()
const {
return toString(); }
405 template <std::
size_t Index>
406 constexpr
auto getIndex()
const;
413 static constexpr
auto Level = details::index_for<PlaneID>();
428 static constexpr
WireID_t InvalidID = std::numeric_limits<WireID_t>::max();
433 constexpr
WireID() =
default;
450 explicit operator std::string()
const {
return toString(); }
462 template <std::
size_t Index>
463 constexpr
auto getIndex()
const;
474 static constexpr
auto Level = details::index_for<WireID>();
548 template <
typename BaseID,
typename GeoID>
550 !std::is_same<BaseID, GeoID>{}};
553 template <
typename GeoID>
554 inline constexpr std::enable_if_t<is_base_of_strict<CryostatID, GeoID>,
bool>
operator==(
558 return std::tie(a.parentID(), a.deepestIndex()) == std::tie(b.parentID(), b.deepestIndex());
562 template <
typename GeoID>
563 inline constexpr std::enable_if_t<is_base_of_strict<CryostatID, GeoID>,
bool>
operator!=(
571 template <
typename GeoID>
572 inline constexpr std::enable_if_t<is_base_of_strict<CryostatID, GeoID>,
bool>
operator<(
576 return std::tie(a.parentID(), a.deepestIndex()) < std::tie(b.parentID(), b.deepestIndex());
597 std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity(), -1u};
614 template <
typename ID, std::size_t Index,
typename >
615 struct AbsIDtypeStruct {
616 static_assert(Index <=
ID::Level,
"Requested ID index is not available.");
620 template <
typename ID, std::
size_t Index>
626 template <
typename T>
629 std::ostringstream sstr;
641 template <std::
size_t Index>
644 static_assert(Index <=
Level,
"This ID type does not have the requested Index level.");
645 return details::getAbsIDindex<Index>(*this);
649 template <std::
size_t Index>
652 static_assert(Index <=
Level,
"This ID type does not have the requested Index level.");
653 return details::getAbsIDindex<Index>(*this);
657 template <std::
size_t Index>
660 static_assert(Index <=
Level,
"This ID type does not have the requested Index level.");
661 return details::getAbsIDindex<Index>(*this);
665 template <std::
size_t Index>
668 static_assert(Index <=
Level,
"This ID type does not have the requested Index level.");
669 return details::getAbsIDindex<Index>(*this);
673 template <std::
size_t Index>
676 static_assert(Index <=
Level,
"This ID type does not have the requested Index level.");
677 return details::getAbsIDindex<Index>(*this);
682 #endif // LARCOREOBJ_SIMPLETYPESANDCONSTANTS_GEO_TYPES_H constexpr CryostatID(CryostatID_t c)
Constructor: valid ID of cryostat with index c.
IDparameter< geo::OpDetID > OpDetID
Member type of validated geo::OpDetID parameter.
static constexpr OpDetID_t getInvalidID()
Return the value of the invalid optical detector ID as a r-value.
static constexpr auto first(TPCID const &id)
constexpr auto getIndex() const
Returns the index level Index of this type.
IDparameter< geo::CryostatID > CryostatID
Member type of validated geo::CryostatID parameter.
Coordinate
Enumerate the possible plane projections.
constexpr auto getIndex() const
Returns the index level Index of this type.
double z
z position of intersection
static constexpr auto first(CryostatID const &id)
static constexpr TPCID_t InvalidID
Special code for an invalid ID.
_plane_orient
Enumerate the possible plane projections.
constexpr PlaneID(TPCID const &tpcid, PlaneID_t p)
Constructor: plane with index p in the TPC identified by tpcid.
constexpr ParentID_t & parentID()
void setValidity(bool valid)
Sets the validity of the ID.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
constexpr WireID(PlaneID const &planeid, WireID_t w)
Constructor: wire with index w in the plane identified by planeid.
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
enum geo::_plane_orient Orient_t
Enumerate the possible plane projections.
constexpr bool operator<(CryostatID const &a, CryostatID const &b)
Order cryostats with increasing ID.
_plane_sigtype
Enumerate the possible plane projections.
auto & deepestIndex()
Returns the deepest ID available (plane's).
unsigned int PlaneID_t
Type for the ID number.
Planes which measure X direction.
The data type to uniquely identify a Plane.
bool operator==(geometry_element_iterator< Owner, Element, GEOIDITER > const &a, geometry_element_iterator< Owner, Element, GEOIDITER > const &b)
constexpr auto abs(T v)
Returns the absolute value of the argument.
constexpr TPCID & asTPCID()
constexpr auto getIndex() const
Returns the index level Index of this type.
constexpr WireID(CryostatID_t c, TPCID_t t, PlaneID_t p, WireID_t w)
Constructor: wire with index w in cryostat index c, TPC index t, plane index p.
bool operator<(WireIDIntersection const &otherIntersect) const
CryostatID_t Cryostat
Index of cryostat.
static constexpr auto first(CryostatID const &id)
_plane_proj
Enumerate the possible plane projections.
Planes which measure Z direction.
constexpr auto const & deepestIndex() const
Returns the value of the deepest ID available (plane's).
static constexpr WireID_t InvalidID
Special code for an invalid ID.
WireID_t Wire
Index of the wire within its plane.
constexpr ParentID_t const & parentID() const
Return the parent ID of this one (a cryostat ID).
unsigned int TPC
TPC of intersection.
constexpr ParentID_t & parentID()
constexpr CryostatID & asCryostatID()
typename AbsIDtypeStruct< typename ID::ParentID_t, Index >::type type
constexpr auto const & deepestIndex() const
Returns the value of the deepest ID available (wire's).
constexpr auto const & deepestIndex() const
Returns the value of the deepest ID available (OpDet's).
auto & deepestIndex()
Returns the deepest ID available (TPC's).
Planes which measure Y direction.
constexpr CryostatID & asCryostatID()
constexpr ParentID_t & parentID()
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
constexpr TPCID(CryostatID_t c, TPCID_t t)
Constructor: TPC with index t in the cryostat index c.
3-dimensional objects, potentially hits, clusters, prongs, etc.
std::string writeToString(T const &value)
Write the argument into a string.
static constexpr CryostatID_t getInvalidID()
Return the value of the invalid ID as a r-value.
static constexpr auto first()
static constexpr OpDetID first()
constexpr bool isTopGeoElementID
Whether ID represents an element on top of the hierarchy.
auto & deepestIndex()
Returns the deepest ID available (cryostat's).
OpDetID_t OpDet
Index of the optical detector within its cryostat.
typename AbsIDtypeStruct< ID, Index >::type AbsIDtype
auto & deepestIndex()
Returns the deepest ID available (wire's).
Planes that are in the horizontal plane.
static constexpr TPCID_t getInvalidID()
Return the value of the invalid TPC ID as a r-value.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
static constexpr auto first()
static constexpr auto first(TPCID const &id)
Signal from induction planes.
constexpr CryostatID const & asCryostatID() const
Conversion to CryostatID (for convenience of notation).
Planes that are in the vertical plane (e.g. ArgoNeuT).
static constexpr auto first(CryostatID const &id)
std::ostream & operator<<(std::ostream &out, id_sentinel< ID > const &sentinel)
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
static constexpr bool is_base_of_strict
Comparison: the IDs point to the same cryostat (validity is ignored)
constexpr CryostatID const & asCryostatID() const
Conversion to TPCID (for convenience of notation).
Drift towards negative values.
static constexpr auto first()
constexpr int to_int(Coordinate const coord) noexcept
Enumerate the possible plane projections.
void markValid()
Sets the ID as valid.
constexpr auto getIndex() const
Returns the index level Index of this type.
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
void markInvalid()
Sets the ID as invalid.
constexpr CryostatID(CryostatID_t c, bool valid)
Constructor: valid ID of cryostat with index c.
constexpr auto getAbsIDindex(ID const &id)
static constexpr auto first(PlaneID const &id)
constexpr PlaneID & asPlaneID()
constexpr PlaneID(CryostatID_t c, TPCID_t t, PlaneID_t p)
Constructor: plane with index p in the cryostat index c, TPC index t.
static constexpr WireID_t getInvalidID()
Return the value of the invalid wire ID as a r-value.
bool operator!=(geometry_element_iterator< Owner, Element, GEOIDITER > const &a, geometry_element_iterator< Owner, Element, GEOIDITER > const &b)
Drift towards positive values.
unsigned int CryostatID_t
Type for the ID number.
DriftSign
Drift sign: positive or negative.
unsigned int OpDetID_t
Type for the ID number.
constexpr ParentID_t const & parentID() const
Return the parent ID of this one (a cryostat ID).
unsigned int TPCID_t
Type for the ID number.
static constexpr OpDetID_t InvalidID
Special code for an invalid ID.
double y
y position of intersection
constexpr ParentID_t const & parentID() const
Return the parent ID of this one (a plane ID).
constexpr auto const & deepestIndex() const
Returns the value of the deepest ID available (TPC's).
constexpr OpDetID(CryostatID const &cryoid, OpDetID_t o)
constexpr ParentID_t & parentID()
unsigned int WireID_t
Type for the ID number.
static constexpr WireIDIntersection invalid()
static constexpr auto first()
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
static constexpr CryostatID_t InvalidID
Special code for an invalid ID.
constexpr OpDetID(CryostatID_t c, OpDetID_t o)
Constructor: opdtical detector with index o in the cryostat index c
Planes which measure W (third view for Bo, MicroBooNE, etc).
constexpr PlaneID const & planeID() const
static constexpr PlaneID_t InvalidID
Special code for an invalid ID.
TPCID_t TPC
Index of the TPC within its cryostat.
The data type to uniquely identify a optical detector.
recob::tracking::Plane Plane
auto & deepestIndex()
Returns the deepest ID available (OpDet's).
static constexpr PlaneID_t getInvalidID()
Return the value of the invalid plane ID as a r-value.
constexpr auto index_impl(std::size_t &index)
constexpr TPCID(CryostatID const &cryoid, TPCID_t t)
Constructor: TPC with index t in the cryostat identified by cryoid.
constexpr auto getIndex() const
Returns the index level Index of this type.
constexpr auto const index_for()
Drift direction is unknown.
std::string SignalTypeName(SigType_t sigType)
Returns the name of the specified signal type.
constexpr TPCID const & asTPCID() const
Conversion to PlaneID (for convenience of notation).
The data type to uniquely identify a cryostat.
constexpr ParentID_t const & parentID() const
Return the parent ID of this one (a TPC ID).
Signal from collection planes.
constexpr PlaneID const & asPlaneID() const
Conversion to WireID (for convenience of notation).
constexpr auto const & deepestIndex() const
Returns the value of the deepest ID available (cryostat's).