Warning, file /include/Acts/EventData/TrackStateType.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <bitset>
0012 #include <cassert>
0013 #include <cstddef>
0014 #include <cstdint>
0015 #include <limits>
0016 #include <ostream>
0017 #include <type_traits>
0018
0019 namespace Acts {
0020
0021
0022
0023
0024 enum TrackStateFlag {
0025 MeasurementFlag = 0,
0026 ParameterFlag = 1,
0027 OutlierFlag = 2,
0028 HoleFlag = 3,
0029 MaterialFlag = 4,
0030 SharedHitFlag = 5,
0031 SplitHitFlag = 6,
0032 NoExpectedHitFlag = 7,
0033 NumTrackStateFlags = 8,
0034 };
0035
0036 class ConstTrackStateType;
0037
0038
0039
0040 class TrackStateType {
0041 public:
0042
0043 using raw_type = std::uint64_t;
0044
0045 static constexpr std::size_t kRawBits =
0046 std::numeric_limits<std::make_unsigned_t<raw_type>>::digits;
0047
0048
0049 TrackStateType() = delete;
0050
0051
0052
0053 explicit TrackStateType(raw_type& raw) : m_raw{&raw} {
0054 assert(m_raw != nullptr);
0055 }
0056
0057
0058 TrackStateType(const TrackStateType&) = delete;
0059
0060
0061 TrackStateType(TrackStateType&&) = delete;
0062
0063
0064 TrackStateType& operator=(const TrackStateType&) = delete;
0065
0066
0067 TrackStateType& operator=(TrackStateType&&) = delete;
0068
0069
0070
0071
0072 TrackStateType& operator=(const ConstTrackStateType& other);
0073
0074
0075
0076
0077 bool test(std::size_t pos) const {
0078 std::bitset<kRawBits> bs{*m_raw};
0079 return bs.test(pos);
0080 }
0081
0082
0083
0084
0085 void set(std::size_t pos, bool value = true) {
0086 std::bitset<kRawBits> bs{*m_raw};
0087 bs.set(pos, value);
0088 *m_raw = bs.to_ullong();
0089 }
0090
0091
0092
0093 void reset(std::size_t pos) { set(pos, false); }
0094
0095 friend std::ostream& operator<<(std::ostream& os, const TrackStateType& t) {
0096 std::bitset<kRawBits> bs{*t.m_raw};
0097 std::bitset<TrackStateFlag::NumTrackStateFlags> trunc;
0098 for (std::size_t i = 0; i < TrackStateFlag::NumTrackStateFlags; i++) {
0099 trunc[i] = bs[i];
0100 }
0101
0102 os << "SMHOPM=" << trunc;
0103 return os;
0104 }
0105
0106 private:
0107 raw_type* m_raw{nullptr};
0108 };
0109
0110
0111
0112 class ConstTrackStateType {
0113 public:
0114
0115 using raw_type = std::uint64_t;
0116
0117 static constexpr std::size_t kRawBits =
0118 std::numeric_limits<std::make_unsigned_t<raw_type>>::digits;
0119
0120
0121 ConstTrackStateType() = delete;
0122
0123
0124
0125 explicit ConstTrackStateType(const raw_type& raw) : m_raw{&raw} {
0126 assert(m_raw != nullptr);
0127 }
0128
0129
0130 ConstTrackStateType(const ConstTrackStateType& other) = delete;
0131
0132
0133 ConstTrackStateType(ConstTrackStateType&& other) = delete;
0134
0135
0136 ConstTrackStateType& operator=(const ConstTrackStateType&) = delete;
0137
0138
0139 ConstTrackStateType& operator=(ConstTrackStateType&&) = delete;
0140
0141
0142
0143
0144 bool test(std::size_t pos) const {
0145 std::bitset<kRawBits> bs{*m_raw};
0146 return bs.test(pos);
0147 }
0148
0149 friend std::ostream& operator<<(std::ostream& os,
0150 const ConstTrackStateType& t) {
0151 std::bitset<kRawBits> bs{*t.m_raw};
0152 std::bitset<TrackStateFlag::NumTrackStateFlags> trunc;
0153 for (std::size_t i = 0; i < TrackStateFlag::NumTrackStateFlags; i++) {
0154 trunc[i] = bs[i];
0155 }
0156
0157 os << "SMHOPM=" << trunc;
0158 return os;
0159 }
0160
0161 private:
0162 friend class TrackStateType;
0163 const raw_type* m_raw{nullptr};
0164 };
0165
0166 inline TrackStateType& TrackStateType::operator=(
0167 const ConstTrackStateType& other) {
0168 *m_raw = *other.m_raw;
0169 return *this;
0170 }
0171
0172 }