Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
geo::PlaneID Struct Reference

The data type to uniquely identify a Plane. More...

#include <geo_types.h>

Inheritance diagram for geo::PlaneID:
geo::TPCID geo::CryostatID geo::WireID

Public Types

using PlaneID_t = unsigned int
 Type for the ID number. More...
 
using ThisID_t = PlaneID
 Type of this ID. More...
 
using ParentID_t = TPCID
 Type of the parent ID. More...
 
template<std::size_t L>
using ID_t = details::AbsIDtype< L, ThisID_t >
 Type of the ID with the specified level L. More...
 
template<std::size_t A>
using UpperID_t = details::RelIDtype< A, ThisID_t >
 Type of the ID A levels above this one. More...
 
- Public Types inherited from geo::TPCID
using TPCID_t = unsigned int
 Type for the ID number. More...
 
using ThisID_t = TPCID
 Type of this ID. More...
 
using ParentID_t = CryostatID
 Type of the parent ID. More...
 
template<std::size_t L>
using ID_t = details::AbsIDtype< L, ThisID_t >
 Type of the ID with the specified level L. More...
 
template<std::size_t A>
using UpperID_t = details::RelIDtype< A, ThisID_t >
 Type of the ID A levels above this one. More...
 
- Public Types inherited from geo::CryostatID
using CryostatID_t = unsigned int
 Type for the ID number. More...
 
using ThisID_t = CryostatID
 Type of this ID. More...
 
using ParentID_t = void
 Type of the parent ID (none!). More...
 
template<std::size_t L>
using ID_t = details::AbsIDtype< L, ThisID_t >
 Type of the ID with the specified level L. More...
 
template<std::size_t A>
using UpperID_t = details::RelIDtype< A, ThisID_t >
 Type of the ID A levels above this one. More...
 

Public Member Functions

constexpr PlaneID ()=default
 Default constructor: an invalid plane ID. More...
 
constexpr PlaneID (TPCID const &tpcid, PlaneID_t p)
 Constructor: plane with index p in the TPC identified by tpcid. More...
 
constexpr PlaneID (CryostatID_t c, TPCID_t t, PlaneID_t p)
 Constructor: plane with index p in the cryostat index c, TPC index t. More...
 
constexpr auto const & deepestIndex () const
 Returns the value of the deepest ID available (plane's). More...
 
auto & deepestIndex ()
 Returns the deepest ID available (plane's). More...
 
constexpr ParentID_t const & parentID () const
 Return the parent ID of this one (a TPC ID). More...
 
ParentID_tparentID ()
 Return the parent ID of this one (a TPC ID). More...
 
template<std::size_t Index = 0U>
constexpr auto getIndex () const
 Returns the index level Index of this type. More...
 
template<std::size_t Index = 0U>
auto & writeIndex ()
 Returns the index level Index of this type. More...
 
template<std::size_t Above>
constexpr auto getRelIndex () const
 Returns the index Above levels higher than Level. More...
 
constexpr PlaneID const & asPlaneID () const
 Conversion to PlaneID (for convenience of notation). More...
 
PlaneIDasPlaneID ()
 Conversion to PlaneID (for convenience of notation). More...
 
constexpr PlaneID const & asConstPlaneID ()
 Conversion to PlaneID (for convenience of notation). More...
 
constexpr int cmp (PlaneID const &other) const
 Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger. More...
 
std::string toString () const
 Human-readable representation of the plane ID. More...
 
 operator std::string () const
 
- Public Member Functions inherited from geo::TPCID
constexpr TPCID ()=default
 Default constructor: an invalid TPC ID. More...
 
constexpr TPCID (CryostatID const &cryoid, TPCID_t t)
 Constructor: TPC with index t in the cryostat identified by cryoid. More...
 
constexpr TPCID (CryostatID_t c, TPCID_t t)
 Constructor: TPC with index t in the cryostat index c. More...
 
constexpr auto const & deepestIndex () const
 Returns the value of the deepest ID available (TPC's). More...
 
auto & deepestIndex ()
 Returns the deepest ID available (TPC's). More...
 
constexpr ParentID_t const & parentID () const
 Return the parent ID of this one (a cryostat ID). More...
 
ParentID_tparentID ()
 Return the parent ID of this one (a cryostat ID). More...
 
template<std::size_t Index = 0U>
constexpr auto getIndex () const
 Returns the index level Index of this type. More...
 
template<std::size_t Index = 0U>
auto & writeIndex ()
 Returns the index level Index of this type. More...
 
template<std::size_t Above>
constexpr auto getRelIndex () const
 Returns the index Above levels higher than Level. More...
 
constexpr TPCID const & asTPCID () const
 Conversion to TPCID (for convenience of notation). More...
 
TPCIDasTPCID ()
 Conversion to TPCID (for convenience of notation). More...
 
constexpr TPCID const & asConstTPCID ()
 Conversion to TPCID (for convenience of notation). More...
 
constexpr int cmp (TPCID const &other) const
 Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger. More...
 
std::string toString () const
 Human-readable representation of the TPC ID. More...
 
 operator std::string () const
 
- Public Member Functions inherited from geo::CryostatID
constexpr CryostatID ()=default
 Default constructor: an invalid cryostat. More...
 
constexpr CryostatID (CryostatID_t c)
 Constructor: valid ID of cryostat with index c. More...
 
constexpr CryostatID (CryostatID_t c, bool valid)
 Constructor: valid ID of cryostat with index c. More...
 
constexpr auto const & deepestIndex () const
 Returns the value of the deepest ID available (cryostat's). More...
 
auto & deepestIndex ()
 Returns the deepest ID available (cryostat's). More...
 
constexpr ParentID_t parentID () const
 Return the parent ID of this one (void). More...
 
ParentID_t parentID ()
 Return the parent ID of this one (void). More...
 
template<std::size_t Index = 0U>
constexpr auto getIndex () const
 Returns the index level Index of this type. More...
 
template<std::size_t Index = 0U>
auto & writeIndex ()
 Returns the index level Index of this type. More...
 
template<std::size_t Above>
constexpr auto getRelIndex () const
 Returns the index Above levels higher than Level. More...
 
constexpr int cmp (CryostatID const &other) const
 Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger. More...
 
constexpr CryostatID const & asCryostatID () const
 Conversion to CryostatID (for convenience of notation). More...
 
CryostatIDasCryostatID ()
 Conversion to CryostatID (for convenience of notation). More...
 
constexpr CryostatID const & asConstCryostatID ()
 Conversion to CryostatID (for convenience of notation). More...
 
constexpr operator bool () const
 Returns true if the ID is valid. More...
 
constexpr bool operator! () const
 Returns true if the ID is not valid. More...
 
void setValidity (bool valid)
 Sets the validity of the ID. More...
 
void markValid ()
 Sets the ID as valid. More...
 
void markInvalid ()
 Sets the ID as invalid. More...
 
std::string toString () const
 Human-readable representation of the cryostat ID. More...
 
 operator std::string () const
 

Static Public Member Functions

static constexpr PlaneID_t getInvalidID ()
 Return the value of the invalid plane ID as a r-value. More...
 
- Static Public Member Functions inherited from geo::TPCID
static constexpr TPCID_t getInvalidID ()
 Return the value of the invalid TPC ID as a r-value. More...
 
- Static Public Member Functions inherited from geo::CryostatID
static constexpr CryostatID_t getInvalidID ()
 Return the value of the invalid ID as a r-value. More...
 
template<typename T >
static constexpr int ThreeWayComparison (T a, T b)
 Returns < 0 if a < b, 0 if a == b, > 0 if a > b. More...
 

Public Attributes

PlaneID_t Plane = InvalidID
 Index of the plane within its TPC. More...
 
- Public Attributes inherited from geo::TPCID
TPCID_t TPC = InvalidID
 Index of the TPC within its cryostat. More...
 
- Public Attributes inherited from geo::CryostatID
bool isValid = false
 Whether this ID points to a valid element. More...
 
CryostatID_t Cryostat = InvalidID
 Index of cryostat. More...
 

Static Public Attributes

static constexpr PlaneID_t InvalidID = std::numeric_limits<PlaneID_t>::max()
 Special code for an invalid ID. More...
 
static constexpr auto Level = geo::ElementLevel::Plane
 Level of this element. More...
 
- Static Public Attributes inherited from geo::TPCID
static constexpr TPCID_t InvalidID = std::numeric_limits<TPCID_t>::max()
 Special code for an invalid ID. More...
 
static constexpr auto Level = geo::ElementLevel::TPC
 Level of this element. More...
 
- Static Public Attributes inherited from geo::CryostatID
static constexpr CryostatID_t InvalidID = std::numeric_limits<CryostatID_t>::max()
 Special code for an invalid ID. More...
 
static constexpr auto Level = geo::ElementLevel::Cryostat
 Level of this element. More...
 

Detailed Description

The data type to uniquely identify a Plane.

Definition at line 472 of file geo_types.h.

Member Typedef Documentation

template<std::size_t L>
using geo::PlaneID::ID_t = details::AbsIDtype<L, ThisID_t>

Type of the ID with the specified level L.

Definition at line 480 of file geo_types.h.

Type of the parent ID.

Definition at line 476 of file geo_types.h.

using geo::PlaneID::PlaneID_t = unsigned int

Type for the ID number.

Definition at line 473 of file geo_types.h.

Type of this ID.

Definition at line 475 of file geo_types.h.

template<std::size_t A>
using geo::PlaneID::UpperID_t = details::RelIDtype<A, ThisID_t>

Type of the ID A levels above this one.

Definition at line 484 of file geo_types.h.

Constructor & Destructor Documentation

constexpr geo::PlaneID::PlaneID ( )
default

Default constructor: an invalid plane ID.

constexpr geo::PlaneID::PlaneID ( TPCID const &  tpcid,
PlaneID_t  p 
)
inline

Constructor: plane with index p in the TPC identified by tpcid.

Definition at line 499 of file geo_types.h.

500  : TPCID(tpcid), Plane(p) {}
p
Definition: test.py:223
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
constexpr TPCID()=default
Default constructor: an invalid TPC ID.
constexpr geo::PlaneID::PlaneID ( CryostatID_t  c,
TPCID_t  t,
PlaneID_t  p 
)
inline

Constructor: plane with index p in the cryostat index c, TPC index t.

Definition at line 503 of file geo_types.h.

504  : TPCID(c, t), Plane(p) {}
p
Definition: test.py:223
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
constexpr TPCID()=default
Default constructor: an invalid TPC ID.

Member Function Documentation

constexpr PlaneID const& geo::PlaneID::asConstPlaneID ( )
inline

Conversion to PlaneID (for convenience of notation).

Definition at line 538 of file geo_types.h.

538 { return *this; }
constexpr PlaneID const& geo::PlaneID::asPlaneID ( ) const
inline

Conversion to PlaneID (for convenience of notation).

Definition at line 534 of file geo_types.h.

534 { return *this; }
PlaneID& geo::PlaneID::asPlaneID ( )
inline

Conversion to PlaneID (for convenience of notation).

Definition at line 536 of file geo_types.h.

536 { return *this; }
constexpr int geo::PlaneID::cmp ( PlaneID const &  other) const
inline

Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger.

Definition at line 541 of file geo_types.h.

542  {
543  int cmp_res = TPCID::cmp(other);
544  if (cmp_res == 0) // same TPC: compare plane
545  return ThreeWayComparison(deepestIndex(), other.deepestIndex());
546  else // return the order of planes
547  return cmp_res;
548  } // cmp()
constexpr int cmp(TPCID const &other) const
Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger.
Definition: geo_types.h:453
static constexpr int ThreeWayComparison(T a, T b)
Returns < 0 if a < b, 0 if a == b, > 0 if a > b.
Definition: geo_types.h:290
constexpr auto const & deepestIndex() const
Returns the value of the deepest ID available (plane&#39;s).
Definition: geo_types.h:516
constexpr auto const& geo::PlaneID::deepestIndex ( ) const
inline

Returns the value of the deepest ID available (plane's).

Definition at line 516 of file geo_types.h.

516 { return Plane; }
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
auto& geo::PlaneID::deepestIndex ( )
inline

Returns the deepest ID available (plane's).

Definition at line 518 of file geo_types.h.

518 { return Plane; }
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
template<std::size_t Index>
constexpr auto geo::PlaneID::getIndex ( ) const

Returns the index level Index of this type.

Definition at line 950 of file geo_types.h.

950  {
951  static_assert
952  (Index <= Level, "This ID type does not have the requested Index level.");
953  return details::getAbsIDindex<Index>(*this);
954 } // geo::PlaneID::getIndex() const
unsigned int Index
static constexpr auto Level
Level of this element.
Definition: geo_types.h:551
static constexpr PlaneID_t geo::PlaneID::getInvalidID ( )
inlinestatic

Return the value of the invalid plane ID as a r-value.

Definition at line 554 of file geo_types.h.

554 { return PlaneID::InvalidID; }
static constexpr PlaneID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:490
template<std::size_t Above>
constexpr auto geo::PlaneID::getRelIndex ( ) const

Returns the index Above levels higher than Level.

Definition at line 964 of file geo_types.h.

964  {
965  static_assert
966  (Above <= Level, "This ID type does not have the requested Index level.");
967  return getIndex<Level - Above>();
968 } // geo::PlaneID::getRelIndex()
constexpr auto getIndex() const
Returns the index level Index of this type.
Definition: geo_types.h:950
static constexpr auto Level
Level of this element.
Definition: geo_types.h:551
geo::PlaneID::operator std::string ( ) const
inlineexplicit

Definition at line 511 of file geo_types.h.

511 { return toString(); }
std::string toString() const
Human-readable representation of the plane ID.
Definition: geo_types.h:510
constexpr ParentID_t const& geo::PlaneID::parentID ( ) const
inline

Return the parent ID of this one (a TPC ID).

Definition at line 520 of file geo_types.h.

520 { return *this; }
ParentID_t& geo::PlaneID::parentID ( )
inline

Return the parent ID of this one (a TPC ID).

Definition at line 522 of file geo_types.h.

522 { return *this; }
std::string geo::PlaneID::toString ( ) const
inline

Human-readable representation of the plane ID.

Definition at line 510 of file geo_types.h.

510 { return details::writeToString(*this); }
std::string writeToString(T const &value)
Write the argument into a string.
Definition: geo_types.h:864
template<std::size_t Index>
auto & geo::PlaneID::writeIndex ( )

Returns the index level Index of this type.

Definition at line 957 of file geo_types.h.

957  {
958  static_assert
959  (Index <= Level, "This ID type does not have the requested Index level.");
960  return details::getAbsIDindex<Index>(*this);
961 } // geo::PlaneID::writeIndex()
unsigned int Index
static constexpr auto Level
Level of this element.
Definition: geo_types.h:551

Member Data Documentation

constexpr PlaneID_t geo::PlaneID::InvalidID = std::numeric_limits<PlaneID_t>::max()
static

Special code for an invalid ID.

Definition at line 490 of file geo_types.h.

constexpr auto geo::PlaneID::Level = geo::ElementLevel::Plane
static

Level of this element.

Definition at line 551 of file geo_types.h.

PlaneID_t geo::PlaneID::Plane = InvalidID

Index of the plane within its TPC.

Definition at line 493 of file geo_types.h.


The documentation for this struct was generated from the following file: