13 #ifndef LARCOREOBJ_SIMPLETYPESANDCONSTANTS_GEO_TYPES_H 14 #define LARCOREOBJ_SIMPLETYPESANDCONSTANTS_GEO_TYPES_H 33 template <
typename ID>
36 template <
typename ID>
38 if constexpr(isTopGeoElementID<ID>)
return 0U;
39 else return geoElementLevel<typename ID::ParentID_t>() + 1U;
42 template <
typename ID, std::
size_t Index,
typename =
void>
45 template <std::
size_t Index,
typename ID>
48 template <
typename ID, std::
size_t UpIndex>
51 template <std::
size_t UpIndex,
typename ID>
54 template <std::
size_t Index,
typename ID>
57 static_assert(
Index <=
ID::Level,
"Index not available for this type.");
59 else return getAbsIDindex<Index>(
id.parentID());
62 template <std::
size_t Index,
typename ID>
65 static_assert(
Index <=
ID::Level,
"Index not available for this type.");
67 else return getAbsIDindex<Index>(
id.parentID());
70 template <std::
size_t UpIndex,
typename ID>
74 (UpIndex <=
ID::Level,
"Index not available for this type.");
75 if constexpr (UpIndex == 0)
return id.deepestIndex();
197 template <std::
size_t L>
201 template <std::
size_t A>
211 bool isValid =
false;
222 : isValid(valid), Cryostat(c) {}
228 explicit constexpr
operator bool()
const {
return isValid; }
261 template <std::
size_t Index = 0U>
262 constexpr
auto getIndex()
const;
264 template <std::
size_t Index = 0U>
267 template <std::
size_t Above>
268 constexpr
auto getRelIndex()
const;
272 {
return ThreeWayComparison(deepestIndex(), other.
deepestIndex()); }
289 template <
typename T>
291 {
return (a == b)? 0: ((a <
b)? -1: +1); }
304 template <std::
size_t L>
308 template <std::
size_t A>
350 template <std::
size_t Index = 0U>
351 constexpr
auto getIndex()
const;
353 template <std::
size_t Index = 0U>
356 template <std::
size_t Above>
357 constexpr
auto getRelIndex()
const;
371 return ThreeWayComparison(deepestIndex(), other.
deepestIndex());
393 template <std::
size_t L>
397 template <std::
size_t A>
409 constexpr
TPCID() =
default;
436 template <std::
size_t Index = 0U>
437 constexpr
auto getIndex()
const;
439 template <std::
size_t Index = 0U>
442 template <std::
size_t Above>
443 constexpr
auto getRelIndex()
const;
457 return ThreeWayComparison(deepestIndex(), other.
deepestIndex());
479 template <std::
size_t L>
483 template <std::
size_t A>
500 :
TPCID(tpcid), Plane(p) {}
504 :
TPCID(c, t), Plane(p) {}
524 template <std::
size_t Index = 0U>
525 constexpr
auto getIndex()
const;
527 template <std::
size_t Index = 0U>
530 template <std::
size_t Above>
531 constexpr
auto getRelIndex()
const;
545 return ThreeWayComparison(deepestIndex(), other.
deepestIndex());
567 template <std::
size_t L>
571 template <std::
size_t A>
583 constexpr
WireID() =
default;
610 template <std::
size_t Index = 0U>
611 constexpr
auto getIndex()
const;
613 template <std::
size_t Index = 0U>
616 template <std::
size_t Above>
617 constexpr
auto getRelIndex()
const;
631 return ThreeWayComparison(deepestIndex(), other.
deepestIndex());
675 out << ((
TPCID const&) pid) <<
" P:" << pid.
Plane;
682 out << ((
PlaneID const&) wid) <<
" W:" << wid.
Wire;
731 (static_cast<CryostatID const&>(a) == static_cast<CryostatID const&>(b))
738 (static_cast<CryostatID const&>(a) != static_cast<CryostatID const&>(b))
755 (static_cast<TPCID const&>(a) == static_cast<TPCID const&>(b))
762 (static_cast<TPCID const&>(a) != static_cast<TPCID const&>(b))
768 int cmp_res = (
static_cast<TPCID const&
>(
a)).cmp(b);
779 (static_cast<PlaneID const&>(a) == static_cast<PlaneID const&>(b))
786 (static_cast<PlaneID const&>(a) != static_cast<PlaneID const&>(b))
833 template <
typename ID, std::size_t
Index,
typename >
834 struct AbsIDtypeStruct {
835 static_assert(Index <=
ID::Level,
"Requested ID index is not available.");
841 template <
typename ID, std::
size_t Index>
848 template <
typename ID, std::
size_t UpIndex>
851 (UpIndex <=
ID::Level,
"Requested parent ID index is not available.");
857 template <
typename ID>
863 template <
typename T>
865 std::ostringstream sstr;
880 template <std::size_t
Index >
883 (
Index <=
Level,
"This ID type does not have the requested Index level.");
884 return details::getAbsIDindex<Index>(*this);
887 template <std::size_t
Index >
890 (
Index <=
Level,
"This ID type does not have the requested Index level.");
891 return details::getAbsIDindex<Index>(*this);
894 template <std::
size_t Above>
897 (Above <=
Level,
"This ID type does not have the requested Index level.");
898 return getIndex<
Level - Above>();
903 template <std::size_t
Index >
906 (
Index <=
Level,
"This ID type does not have the requested Index level.");
907 return details::getAbsIDindex<Index>(*this);
910 template <std::size_t
Index >
913 (
Index <=
Level,
"This ID type does not have the requested Index level.");
914 return details::getAbsIDindex<Index>(*this);
917 template <std::
size_t Above>
920 (Above <=
Level,
"This ID type does not have the requested Index level.");
921 return getIndex<
Level - Above>();
926 template <std::size_t
Index >
929 (
Index <=
Level,
"This ID type does not have the requested Index level.");
930 return details::getAbsIDindex<Index>(*this);
933 template <std::size_t
Index >
936 (
Index <=
Level,
"This ID type does not have the requested Index level.");
937 return details::getAbsIDindex<Index>(*this);
940 template <std::
size_t Above>
943 (Above <=
Level,
"This ID type does not have the requested Index level.");
944 return getIndex<
Level - Above>();
949 template <std::size_t
Index >
952 (
Index <=
Level,
"This ID type does not have the requested Index level.");
953 return details::getAbsIDindex<Index>(*this);
956 template <std::size_t
Index >
959 (
Index <=
Level,
"This ID type does not have the requested Index level.");
960 return details::getAbsIDindex<Index>(*this);
963 template <std::
size_t Above>
966 (Above <=
Level,
"This ID type does not have the requested Index level.");
967 return getIndex<
Level - Above>();
972 template <std::size_t
Index >
975 (
Index <=
Level,
"This ID type does not have the requested Index level.");
976 return details::getAbsIDindex<Index>(*this);
979 template <std::size_t
Index >
982 (
Index <=
Level,
"This ID type does not have the requested Index level.");
983 return details::getAbsIDindex<Index>(*this);
986 template <std::
size_t Above>
989 (Above <=
Level,
"This ID type does not have the requested Index level.");
990 return getIndex<
Level - Above>();
996 #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.
ParentID_t & parentID()
Return the parent ID of this one (a plane ID).
constexpr int cmp(TPCID const &other) const
Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger.
constexpr auto getIndex() const
Returns the index level Index of this type.
IDparameter< geo::CryostatID > CryostatID
Member type of validated geo::CryostatID parameter.
constexpr auto getIndex() const
Returns the index level Index of this type.
double z
z position of intersection
constexpr WireID const & asWireID() const
Conversion to WireID (for convenience of notation).
typename RelIDtypeStruct< ID, UpIndex >::type RelIDtype
Drift direction is unknown.
static void writeIndex(OutputList &ol)
static constexpr TPCID_t InvalidID
Special code for an invalid ID.
TPCID & asTPCID()
Conversion to TPCID (for convenience of notation).
std::string toString() const
Human-readable representation of the plane ID.
auto & writeIndex()
Returns the index level Index of this type.
constexpr PlaneID(TPCID const &tpcid, PlaneID_t p)
Constructor: plane with index p in the TPC identified by tpcid.
details::AbsIDtype< L, ThisID_t > ID_t
Type of the ID with the specified level L.
void setValidity(bool valid)
Sets the validity of the ID.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
auto & writeIndex()
Returns the index level Index of this type.
static constexpr int ThreeWayComparison(T a, T b)
Returns < 0 if a < b, 0 if a == b, > 0 if a > b.
constexpr std::size_t geoElementLevel()
constexpr WireID(PlaneID const &planeid, WireID_t w)
Constructor: wire with index w in the plane identified by planeid.
Drift towards positive values.
enum geo::_plane_orient Orient_t
std::string toString() const
Human-readable representation of the optical detector ID.
constexpr bool operator<(CryostatID const &a, CryostatID const &b)
Order cryostats with increasing ID.
constexpr int cmp(OpDetID const &other) const
Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger.
std::enable_if_t< is_selector< A >, NotHelper< A > > operator!(A const &a)
auto & deepestIndex()
Returns the deepest ID available (plane's).
ParentID_t & parentID()
Return the parent ID of this one (a TPC ID).
constexpr WireID const & asConstWireID()
Conversion to WireID (for convenience of notation).
unsigned int PlaneID_t
Type for the ID number.
Planes which measure X direction.
The data type to uniquely identify a Plane.
CryostatID & asCryostatID()
Conversion to CryostatID (for convenience of notation).
constexpr auto getIndex() const
Returns the index level Index of this type.
OpDetID & asOpDetID()
Conversion to OpDetID (for convenience of notation).
constexpr WireID(CryostatID_t c, TPCID_t t, PlaneID_t p, WireID_t w)
CryostatID_t Cryostat
Index of cryostat.
_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.
constexpr auto getRelIndex() const
Returns the index Above levels higher than Level.
WireID_t Wire
Index of the wire within its plane.
enum geo::coordinates Coord_t
constexpr ParentID_t const & parentID() const
Return the parent ID of this one (a cryostat ID).
Drift towards negative X values.
unsigned int TPC
TPC of intersection.
static constexpr Level_t Plane
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.
details::RelIDtype< A, ThisID_t > UpperID_t
Type of the ID A levels above this one.
constexpr int cmp(WireID const &other) const
Returns < 0 if this is smaller than tpcid, 0 if equal, > 0 if larger.
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.
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.
constexpr TPCID const & asConstTPCID()
Conversion to TPCID (for convenience of notation).
driftdir
Drift direction: positive or negative.
static constexpr Level_t OpDet
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
enum geo::driftdir DriftDirection_t
Drift direction: positive or negative.
Signal from induction planes.
Planes that are in the vertical plane (e.g. ArgoNeuT).
static constexpr Level_t TPC
auto & writeIndex()
Returns the index level Index of this type.
enum geo::_plane_sigtype SigType_t
constexpr CryostatID const & asConstCryostatID()
Conversion to CryostatID (for convenience of notation).
std::string toString() const
Human-readable representation of the cryostat ID.
void markValid()
Sets the ID as valid.
constexpr auto getIndex() const
Returns the index level Index of this type.
constexpr CryostatID const & asCryostatID() const
Conversion to CryostatID (for convenience of notation).
constexpr PlaneID const & asPlaneID() const
Conversion to PlaneID (for convenience of notation).
std::string toString() const
Human-readable representation of the wire ID.
static int max(int a, int b)
PlaneID & asPlaneID()
Conversion to PlaneID (for convenience of notation).
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
static constexpr Level_t Cryostat
constexpr ParentID_t parentID() const
Return the parent ID of this one (void).
void markInvalid()
Sets the ID as invalid.
string toString(const TVector3 &xyz, int w=9)
constexpr auto getRelIndex() const
Returns the index Above levels higher than Level.
constexpr CryostatID(CryostatID_t c, bool valid)
Constructor: valid ID of cryostat with index c.
ParentID_t & parentID()
Return the parent ID of this one (a cryostat ID).
constexpr auto getRelIndex() const
Returns the index Above levels higher than Level.
constexpr auto getAbsIDindex(ID const &id)
constexpr TPCID const & asTPCID() const
Conversion to TPCID (for convenience of notation).
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.
typename RelIDtypeStruct< typename ID::ParentID_t, UpIndex-1U >::type type
auto & writeIndex()
Returns the index level Index of this type.
unsigned int CryostatID_t
Type for the ID number.
bool operator!=(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to different IDs.
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.
Drift towards positive X values.
bool operator<(const WireIDIntersection &otherIntersect) const
static constexpr OpDetID_t InvalidID
Special code for an invalid ID.
double y
y position of intersection
WireID & asWireID()
Conversion to WireID (for convenience of notation).
static constexpr Level_t Wire
constexpr ParentID_t const & parentID() const
Return the parent ID of this one (a plane ID).
Drift towards negative values.
constexpr OpDetID const & asOpDetID() const
Conversion to OpDetID (for convenience of notation).
ParentID_t & parentID()
Return the parent ID of this one (a cryostat 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 PlaneID const & asConstPlaneID()
Conversion to PlaneID (for convenience of notation).
void ParentID_t
Type of the parent ID (none!).
unsigned int WireID_t
Type for the ID number.
detail::Node< FrameID, bool > PlaneID
constexpr auto getRelIndex() const
Returns the index Above levels higher than Level.
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
static constexpr CryostatID_t InvalidID
Special code for an invalid ID.
auto getRelIDindex(ID const &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.
auto & writeIndex()
Returns the index level Index of this type.
The data type to uniquely identify a optical detector.
constexpr auto getRelIndex() const
Returns the index Above levels higher than Level.
recob::tracking::Plane Plane
LArSoft geometry interface.
constexpr int cmp(CryostatID const &other) const
Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger.
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 OpDetID const & asConstOpDetID()
Conversion to OpDetID (for convenience of notation).
std::string toString() const
Human-readable representation of the TPC ID.
std::ostream & operator<<(std::ostream &out, CryostatID const &cid)
Generic output of CryostatID to stream.
constexpr TPCID(CryostatID const &cryoid, TPCID_t t)
Constructor: TPC with index t in the cryostat identified by cryoid.
constexpr int cmp(PlaneID const &other) const
Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger.
bool operator==(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to the same ID.
constexpr auto getIndex() const
Returns the index level Index of this type.
ParentID_t parentID()
Return the parent ID of this one (void).
std::string SignalTypeName(geo::SigType_t sigType)
Returns the name of the specified signal type.
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 auto const & deepestIndex() const
Returns the value of the deepest ID available (cryostat's).