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.");
58 if constexpr (Index == ID::Level)
return id.deepestIndex();
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.");
66 if constexpr (Index == ID::Level)
return id.deepestIndex();
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>
208 = std::numeric_limits<CryostatID_t>::max();
248 explicit operator std::string()
const {
return toString(); }
261 template <std::
size_t Index = 0U>
264 template <std::
size_t Index = 0U>
267 template <std::
size_t Above>
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>
315 = std::numeric_limits<OpDetID_t>::max();
337 explicit operator std::string()
const {
return toString(); }
350 template <std::
size_t Index = 0U>
353 template <std::
size_t Index = 0U>
356 template <std::
size_t Above>
393 template <std::
size_t L>
397 template <std::
size_t A>
409 constexpr
TPCID() =
default;
423 explicit operator std::string()
const {
return toString(); }
436 template <std::
size_t Index = 0U>
439 template <std::
size_t Index = 0U>
442 template <std::
size_t Above>
479 template <std::
size_t L>
483 template <std::
size_t A>
490 = std::numeric_limits<PlaneID_t>::max();
511 explicit operator std::string()
const {
return toString(); }
524 template <std::
size_t Index = 0U>
527 template <std::
size_t Index = 0U>
530 template <std::
size_t Above>
567 template <std::
size_t L>
571 template <std::
size_t A>
583 constexpr
WireID() =
default;
597 explicit operator std::string()
const {
return toString(); }
610 template <std::
size_t Index = 0U>
613 template <std::
size_t Index = 0U>
616 template <std::
size_t Above>
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.
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.
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
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 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.
static constexpr Level_t NLevels
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.
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.
bool isValid
Whether this ID points to a valid element.
CryostatID & asCryostatID()
Conversion to CryostatID (for convenience of notation).
constexpr bool operator==(CryostatID const &a, CryostatID const &b)
Comparison: the IDs point to the same cryostat (validity is ignored)
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
static constexpr auto Level
Level of this element.
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.
constexpr bool operator!() const
Returns true if the ID is not valid.
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.
static constexpr auto Level
Level of this element.
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 Level
Level of this element.
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
constexpr PlaneID()=default
Default constructor: an invalid plane ID.
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
enum geo::driftdir DriftDirection_t
Drift direction: positive or negative.
Signal from induction planes.
constexpr CryostatID()=default
Default constructor: an invalid cryostat.
Planes that are in the vertical plane (e.g. ArgoNeuT).
constexpr bool operator!=(CryostatID const &a, CryostatID const &b)
Comparison: the IDs point to different cryostats (validity is ignored)
static constexpr Level_t TPC
auto & writeIndex()
Returns the index level Index of this type.
enum geo::_plane_sigtype SigType_t
static constexpr auto Level
Level of this element.
constexpr CryostatID const & asConstCryostatID()
Conversion to CryostatID (for convenience of notation).
std::string toString() const
Human-readable representation of the cryostat ID.
typename std::enable_if< B, T >::type enable_if_t
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.
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.
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.
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).
constexpr OpDetID()=default
Default constructor: an invalid optical detector 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!).
constexpr WireID()=default
Default constructor: an invalid TPC ID.
unsigned int WireID_t
Type for the ID number.
constexpr auto getRelIndex() const
Returns the index Above levels higher than Level.
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 auto Level
Level of this element.
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.
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.
constexpr auto getIndex() const
Returns the index level Index of this type.
constexpr TPCID()=default
Default constructor: an invalid TPC ID.
ParentID_t parentID()
Return the parent ID of this one (void).
BEGIN_PROLOG don t mess with this pandoraTrackGausCryoW true
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).