All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
geo::OpDetID Struct Reference

The data type to uniquely identify a optical detector. More...

#include <geo_types.h>

Inheritance diagram for geo::OpDetID:
geo::CryostatID

Public Types

using OpDetID_t = unsigned int
 Type for the ID number. More...
 
using ThisID_t = OpDetID
 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 OpDetID ()=default
 Default constructor: an invalid optical detector ID. More...
 
constexpr OpDetID (CryostatID const &cryoid, OpDetID_t o)
 
constexpr OpDetID (CryostatID_t c, OpDetID_t o)
 Constructor: opdtical detector with index o in the cryostat index c More...
 
constexpr auto const & deepestIndex () const
 Returns the value of the deepest ID available (OpDet's). More...
 
auto & deepestIndex ()
 Returns the deepest ID available (OpDet'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 OpDetID const & asOpDetID () const
 Conversion to OpDetID (for convenience of notation). More...
 
OpDetIDasOpDetID ()
 Conversion to OpDetID (for convenience of notation). More...
 
constexpr OpDetID const & asConstOpDetID ()
 Conversion to OpDetID (for convenience of notation). More...
 
constexpr int cmp (OpDetID 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 optical detector 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 OpDetID_t getInvalidID ()
 Return the value of the invalid optical detector 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

OpDetID_t OpDet = InvalidID
 Index of the optical detector 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 OpDetID_t InvalidID = std::numeric_limits<OpDetID_t>::max()
 Special code for an invalid ID. More...
 
static constexpr auto Level = geo::ElementLevel::OpDet
 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 optical detector.

Definition at line 297 of file geo_types.h.

Member Typedef Documentation

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

Type of the ID with the specified level L.

Definition at line 305 of file geo_types.h.

using geo::OpDetID::OpDetID_t = unsigned int

Type for the ID number.

Definition at line 298 of file geo_types.h.

Type of the parent ID.

Definition at line 301 of file geo_types.h.

Type of this ID.

Definition at line 300 of file geo_types.h.

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

Type of the ID A levels above this one.

Definition at line 309 of file geo_types.h.

Constructor & Destructor Documentation

constexpr geo::OpDetID::OpDetID ( )
default

Default constructor: an invalid optical detector ID.

constexpr geo::OpDetID::OpDetID ( CryostatID const &  cryoid,
OpDetID_t  o 
)
inline

Constructor: optical detector with index o in the cryostat identified by cryoid

Definition at line 326 of file geo_types.h.

327  : CryostatID(cryoid), OpDet(o) {}
OpDetID_t OpDet
Index of the optical detector within its cryostat.
Definition: geo_types.h:319
constexpr CryostatID()=default
Default constructor: an invalid cryostat.
constexpr geo::OpDetID::OpDetID ( CryostatID_t  c,
OpDetID_t  o 
)
inline

Constructor: opdtical detector with index o in the cryostat index c

Definition at line 330 of file geo_types.h.

330 : CryostatID(c), OpDet(o) {}
OpDetID_t OpDet
Index of the optical detector within its cryostat.
Definition: geo_types.h:319
constexpr CryostatID()=default
Default constructor: an invalid cryostat.

Member Function Documentation

constexpr OpDetID const& geo::OpDetID::asConstOpDetID ( )
inline

Conversion to OpDetID (for convenience of notation).

Definition at line 364 of file geo_types.h.

364 { return *this; }
constexpr OpDetID const& geo::OpDetID::asOpDetID ( ) const
inline

Conversion to OpDetID (for convenience of notation).

Definition at line 360 of file geo_types.h.

360 { return *this; }
OpDetID& geo::OpDetID::asOpDetID ( )
inline

Conversion to OpDetID (for convenience of notation).

Definition at line 362 of file geo_types.h.

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

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

Definition at line 367 of file geo_types.h.

368  {
369  int cmp_res = CryostatID::cmp(other);
370  if (cmp_res == 0) // same cryostat: compare optical detectors
371  return ThreeWayComparison(deepestIndex(), other.deepestIndex());
372  else // return the order of cryostats
373  return cmp_res;
374  } // cmp()
static constexpr int ThreeWayComparison(T a, T b)
Returns &lt; 0 if a &lt; b, 0 if a == b, &gt; 0 if a &gt; b.
Definition: geo_types.h:290
constexpr auto const & deepestIndex() const
Returns the value of the deepest ID available (OpDet&#39;s).
Definition: geo_types.h:342
constexpr int cmp(CryostatID const &other) const
Returns &lt; 0 if this is smaller than other, 0 if equal, &gt; 0 if larger.
Definition: geo_types.h:271
constexpr auto const& geo::OpDetID::deepestIndex ( ) const
inline

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

Definition at line 342 of file geo_types.h.

342 { return OpDet; }
OpDetID_t OpDet
Index of the optical detector within its cryostat.
Definition: geo_types.h:319
auto& geo::OpDetID::deepestIndex ( )
inline

Returns the deepest ID available (OpDet's).

Definition at line 344 of file geo_types.h.

344 { return OpDet; }
OpDetID_t OpDet
Index of the optical detector within its cryostat.
Definition: geo_types.h:319
template<std::size_t Index>
constexpr auto geo::OpDetID::getIndex ( ) const

Returns the index level Index of this type.

Definition at line 904 of file geo_types.h.

904  {
905  static_assert
906  (Index <= Level, "This ID type does not have the requested Index level.");
907  return details::getAbsIDindex<Index>(*this);
908 } // geo::OpDetID::getIndex() const
static constexpr auto Level
Level of this element.
Definition: geo_types.h:377
static constexpr OpDetID_t geo::OpDetID::getInvalidID ( )
inlinestatic

Return the value of the invalid optical detector ID as a r-value.

Definition at line 380 of file geo_types.h.

380 { return OpDetID::InvalidID; }
static constexpr OpDetID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:315
template<std::size_t Above>
constexpr auto geo::OpDetID::getRelIndex ( ) const

Returns the index Above levels higher than Level.

Definition at line 918 of file geo_types.h.

918  {
919  static_assert
920  (Above <= Level, "This ID type does not have the requested Index level.");
921  return getIndex<Level - Above>();
922 } // geo::OpDetID::getRelIndex()
constexpr auto getIndex() const
Returns the index level Index of this type.
Definition: geo_types.h:904
static constexpr auto Level
Level of this element.
Definition: geo_types.h:377
geo::OpDetID::operator std::string ( ) const
inlineexplicit

Definition at line 337 of file geo_types.h.

337 { return toString(); }
std::string toString() const
Human-readable representation of the optical detector ID.
Definition: geo_types.h:336
constexpr ParentID_t const& geo::OpDetID::parentID ( ) const
inline

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

Definition at line 346 of file geo_types.h.

346 { return *this; }
ParentID_t& geo::OpDetID::parentID ( )
inline

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

Definition at line 348 of file geo_types.h.

348 { return *this; }
std::string geo::OpDetID::toString ( ) const
inline

Human-readable representation of the optical detector ID.

Definition at line 336 of file geo_types.h.

336 { 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::OpDetID::writeIndex ( )

Returns the index level Index of this type.

Definition at line 911 of file geo_types.h.

911  {
912  static_assert
913  (Index <= Level, "This ID type does not have the requested Index level.");
914  return details::getAbsIDindex<Index>(*this);
915 } // geo::OpDetID::writeIndex()
static constexpr auto Level
Level of this element.
Definition: geo_types.h:377

Member Data Documentation

constexpr OpDetID_t geo::OpDetID::InvalidID = std::numeric_limits<OpDetID_t>::max()
static

Special code for an invalid ID.

Definition at line 315 of file geo_types.h.

constexpr auto geo::OpDetID::Level = geo::ElementLevel::OpDet
static

Level of this element.

Definition at line 377 of file geo_types.h.

OpDetID_t geo::OpDetID::OpDet = InvalidID

Index of the optical detector within its cryostat.

Definition at line 319 of file geo_types.h.


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