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

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

#include <geo_types.h>

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

Public Types

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 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 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

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 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 TPC.

Definition at line 386 of file geo_types.h.

Member Typedef Documentation

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

Type of the ID with the specified level L.

Definition at line 394 of file geo_types.h.

Type of the parent ID.

Definition at line 390 of file geo_types.h.

Type of this ID.

Definition at line 389 of file geo_types.h.

using geo::TPCID::TPCID_t = unsigned int

Type for the ID number.

Definition at line 387 of file geo_types.h.

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

Type of the ID A levels above this one.

Definition at line 398 of file geo_types.h.

Constructor & Destructor Documentation

constexpr geo::TPCID::TPCID ( )
default

Default constructor: an invalid TPC ID.

constexpr geo::TPCID::TPCID ( CryostatID const &  cryoid,
TPCID_t  t 
)
inline

Constructor: TPC with index t in the cryostat identified by cryoid.

Definition at line 412 of file geo_types.h.

413  : CryostatID(cryoid), TPC(t) {}
constexpr CryostatID()=default
Default constructor: an invalid cryostat.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
constexpr geo::TPCID::TPCID ( CryostatID_t  c,
TPCID_t  t 
)
inline

Constructor: TPC with index t in the cryostat index c.

Definition at line 416 of file geo_types.h.

416 : CryostatID(c), TPC(t) {}
constexpr CryostatID()=default
Default constructor: an invalid cryostat.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406

Member Function Documentation

constexpr TPCID const& geo::TPCID::asConstTPCID ( )
inline

Conversion to TPCID (for convenience of notation).

Definition at line 450 of file geo_types.h.

450 { return *this; }
constexpr TPCID const& geo::TPCID::asTPCID ( ) const
inline

Conversion to TPCID (for convenience of notation).

Definition at line 446 of file geo_types.h.

446 { return *this; }
TPCID& geo::TPCID::asTPCID ( )
inline

Conversion to TPCID (for convenience of notation).

Definition at line 448 of file geo_types.h.

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

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

Definition at line 453 of file geo_types.h.

454  {
455  int cmp_res = CryostatID::cmp(other);
456  if (cmp_res == 0) // same cryostat: compare TPC
457  return ThreeWayComparison(deepestIndex(), other.deepestIndex());
458  else // return the order of cryostats
459  return cmp_res;
460  } // cmp()
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 (TPC&#39;s).
Definition: geo_types.h:428
constexpr int cmp(CryostatID const &other) const
Returns < 0 if this is smaller than other, 0 if equal, > 0 if larger.
Definition: geo_types.h:271
constexpr auto const& geo::TPCID::deepestIndex ( ) const
inline

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

Definition at line 428 of file geo_types.h.

428 { return TPC; }
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
auto& geo::TPCID::deepestIndex ( )
inline

Returns the deepest ID available (TPC's).

Definition at line 430 of file geo_types.h.

430 { return TPC; }
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
template<std::size_t Index>
constexpr auto geo::TPCID::getIndex ( ) const

Returns the index level Index of this type.

Definition at line 927 of file geo_types.h.

927  {
928  static_assert
929  (Index <= Level, "This ID type does not have the requested Index level.");
930  return details::getAbsIDindex<Index>(*this);
931 } // geo::TPCID::getIndex() const
static constexpr auto Level
Level of this element.
Definition: geo_types.h:463
unsigned int Index
static constexpr TPCID_t geo::TPCID::getInvalidID ( )
inlinestatic

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

Definition at line 466 of file geo_types.h.

466 { return TPCID::InvalidID; }
static constexpr TPCID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:403
template<std::size_t Above>
constexpr auto geo::TPCID::getRelIndex ( ) const

Returns the index Above levels higher than Level.

Definition at line 941 of file geo_types.h.

941  {
942  static_assert
943  (Above <= Level, "This ID type does not have the requested Index level.");
944  return getIndex<Level - Above>();
945 } // geo::TPCID::getRelIndex()
static constexpr auto Level
Level of this element.
Definition: geo_types.h:463
constexpr auto getIndex() const
Returns the index level Index of this type.
Definition: geo_types.h:927
geo::TPCID::operator std::string ( ) const
inlineexplicit

Definition at line 423 of file geo_types.h.

423 { return toString(); }
std::string toString() const
Human-readable representation of the TPC ID.
Definition: geo_types.h:422
constexpr ParentID_t const& geo::TPCID::parentID ( ) const
inline

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

Definition at line 432 of file geo_types.h.

432 { return *this; }
ParentID_t& geo::TPCID::parentID ( )
inline

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

Definition at line 434 of file geo_types.h.

434 { return *this; }
std::string geo::TPCID::toString ( ) const
inline

Human-readable representation of the TPC ID.

Definition at line 422 of file geo_types.h.

422 { 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::TPCID::writeIndex ( )

Returns the index level Index of this type.

Definition at line 934 of file geo_types.h.

934  {
935  static_assert
936  (Index <= Level, "This ID type does not have the requested Index level.");
937  return details::getAbsIDindex<Index>(*this);
938 } // geo::TPCID::writeIndex()
static constexpr auto Level
Level of this element.
Definition: geo_types.h:463
unsigned int Index

Member Data Documentation

constexpr TPCID_t geo::TPCID::InvalidID = std::numeric_limits<TPCID_t>::max()
static

Special code for an invalid ID.

Definition at line 403 of file geo_types.h.

constexpr auto geo::TPCID::Level = geo::ElementLevel::TPC
static

Level of this element.

Definition at line 463 of file geo_types.h.

TPCID_t geo::TPCID::TPC = InvalidID

Index of the TPC within its cryostat.

Definition at line 406 of file geo_types.h.


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