File indexing completed on 2025-12-17 09:12:29
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <cstdint>
0012 #include <iosfwd>
0013
0014 namespace Acts {
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 class GeometryIdentifier {
0028 public:
0029 using Value = uint64_t;
0030
0031
0032 constexpr GeometryIdentifier(Value encoded) : m_value(encoded) {}
0033
0034 GeometryIdentifier() = default;
0035 GeometryIdentifier(GeometryIdentifier&&) = default;
0036 GeometryIdentifier(const GeometryIdentifier&) = default;
0037 ~GeometryIdentifier() = default;
0038 GeometryIdentifier& operator=(GeometryIdentifier&&) = default;
0039 GeometryIdentifier& operator=(const GeometryIdentifier&) = default;
0040
0041
0042 constexpr Value value() const { return m_value; }
0043
0044
0045 constexpr Value volume() const { return getBits(volume_mask); }
0046
0047 constexpr Value boundary() const { return getBits(boundary_mask); }
0048
0049 constexpr Value layer() const { return getBits(layer_mask); }
0050
0051 constexpr Value approach() const { return getBits(approach_mask); }
0052
0053 constexpr Value sensitive() const { return getBits(sensitive_mask); }
0054
0055 private:
0056
0057 static constexpr Value volume_mask = 0xff00000000000000;
0058 static constexpr Value boundary_mask = 0x00ff000000000000;
0059 static constexpr Value layer_mask = 0x0000fff000000000;
0060 static constexpr Value approach_mask = 0x0000000ff0000000;
0061 static constexpr Value sensitive_mask = 0x000000000fffffff;
0062
0063
0064 Value m_value = 0;
0065
0066
0067 static constexpr int extractShift(Value mask) {
0068
0069
0070
0071
0072 return __builtin_ctzll(mask);
0073 }
0074
0075 constexpr Value getBits(Value mask) const {
0076 return (m_value & mask) >> extractShift(mask);
0077 }
0078
0079 friend constexpr bool operator==(GeometryIdentifier lhs,
0080 GeometryIdentifier rhs) {
0081 return lhs.m_value == rhs.m_value;
0082 }
0083 friend constexpr bool operator<(GeometryIdentifier lhs,
0084 GeometryIdentifier rhs) {
0085 return lhs.m_value < rhs.m_value;
0086 }
0087 };
0088
0089 std::ostream& operator<<(std::ostream& os, GeometryIdentifier id);
0090
0091 }