File indexing completed on 2026-04-20 07:47:04
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/EventData/CompositeSpacePoint.hpp"
0013 #include "Acts/Geometry/GeometryIdentifier.hpp"
0014 #include "Acts/Utilities/ArrayHelpers.hpp"
0015
0016 #include <cstdint>
0017 #include <iostream>
0018 #include <vector>
0019
0020 namespace ActsExamples {
0021
0022
0023
0024
0025
0026 class MuonSpacePoint {
0027 public:
0028
0029 class MuonId {
0030 public:
0031
0032 enum class TechField : std::int8_t {
0033 UnDef = -1,
0034 Mdt = 0,
0035 Rpc = 2,
0036 Tgc = 3,
0037 sTgc = 4,
0038 Mm = 5
0039 };
0040
0041 enum class StationName : std::int8_t {
0042 UnDef = -1,
0043 BIS,
0044 BIL,
0045 BMS,
0046 BML,
0047 BOS,
0048 BOL,
0049 BEE,
0050 EIS,
0051 EIL,
0052 EMS,
0053 EML,
0054 EOS,
0055 EOL,
0056 EES,
0057 EEL,
0058 MaxVal
0059 };
0060
0061 enum class DetSide : std::int8_t { UnDef = 0, A = 1, C = -1 };
0062
0063 static std::string toString(const StationName st);
0064
0065 static std::string toString(const TechField tech);
0066
0067 static std::string toString(const DetSide side);
0068
0069
0070 explicit MuonId(std::uint32_t rawRep);
0071
0072 std::uint32_t toInt() const;
0073
0074 explicit MuonId() = default;
0075
0076 MuonId(const MuonId& other) = default;
0077
0078 MuonId(MuonId&& other) = default;
0079
0080 MuonId& operator=(const MuonId& other) = default;
0081
0082 MuonId& operator=(MuonId&& other) = default;
0083
0084 TechField technology() const { return m_tech; }
0085
0086 StationName msStation() const { return m_stName; }
0087
0088 std::uint16_t sector() const { return m_sector; }
0089
0090 DetSide side() const { return m_side; }
0091
0092 std::uint8_t detLayer() const { return m_layer; }
0093
0094 std::uint16_t channel() const { return m_channel; }
0095
0096 bool measuresEta() const { return m_measEta; }
0097
0098 bool measuresPhi() const { return m_measPhi; }
0099
0100 bool measuresTime() const { return m_measTime; }
0101
0102
0103
0104 bool sameStation(const MuonId& other) const {
0105 return msStation() == other.msStation() && sector() == other.sector() &&
0106 side() == other.side();
0107 }
0108
0109
0110
0111
0112
0113 void setChamber(StationName stName, DetSide side, std::uint16_t sector,
0114 TechField tech);
0115
0116 void setLayAndCh(std::uint8_t layer, std::uint16_t ch);
0117
0118
0119
0120
0121 void setCoordFlags(bool measEta, bool measPhi, bool measTime = false);
0122
0123 std::string toString() const;
0124
0125 private:
0126 TechField m_tech{TechField::UnDef};
0127 StationName m_stName{StationName::UnDef};
0128 DetSide m_side{DetSide::UnDef};
0129 std::uint16_t m_sector{1};
0130 std::uint8_t m_layer{1};
0131 std::uint16_t m_channel{1};
0132 bool m_measEta{false};
0133 bool m_measPhi{false};
0134 bool m_measTime{false};
0135 };
0136
0137 MuonSpacePoint() = default;
0138
0139 MuonSpacePoint(const MuonSpacePoint& other) = default;
0140
0141 MuonSpacePoint(MuonSpacePoint&& other) = default;
0142
0143 MuonSpacePoint& operator=(const MuonSpacePoint& other) = default;
0144
0145 MuonSpacePoint& operator=(MuonSpacePoint&& other) = default;
0146
0147 const MuonId& id() const { return m_id; }
0148
0149 const Acts::GeometryIdentifier& geometryId() const { return m_geoId; }
0150
0151 const Acts::Vector3& localPosition() const { return m_pos; }
0152
0153 const Acts::Vector3& sensorDirection() const { return m_dir; }
0154
0155 const Acts::Vector3& planeNormal() const { return m_norm; }
0156
0157 const Acts::Vector3& toNextSensor() const { return m_toNext; }
0158
0159 const std::array<double, 3>& covariance() const { return m_cov; }
0160
0161 double driftRadius() const { return m_radius; }
0162
0163 double time() const { return m_time; }
0164
0165 bool isStraw() const { return id().technology() == MuonId::TechField::Mdt; }
0166
0167 bool hasTime() const { return id().measuresTime(); }
0168
0169 bool measuresLoc1() const { return id().measuresEta(); }
0170
0171 bool measuresLoc0() const { return id().measuresPhi(); }
0172
0173 void setId(const MuonId& id);
0174
0175
0176
0177
0178 void defineCoordinates(Acts::Vector3&& pos, Acts::Vector3&& sensorDir,
0179 Acts::Vector3&& toNextSensor);
0180
0181 void setRadius(const double r);
0182
0183 void setTime(const double t);
0184
0185 void setCovariance(const double covX, const double covY, const double covT);
0186
0187 void setGeometryId(const Acts::GeometryIdentifier& geoId);
0188
0189 private:
0190 MuonId m_id{};
0191 Acts::Vector3 m_pos{Acts::Vector3::Zero()};
0192 Acts::Vector3 m_dir{Acts::Vector3::Zero()};
0193 Acts::Vector3 m_toNext{Acts::Vector3::Zero()};
0194 Acts::Vector3 m_norm{Acts::Vector3::Zero()};
0195
0196 std::array<double, 3> m_cov{Acts::filledArray<double, 3>(0.)};
0197 double m_radius{0.};
0198 double m_time{0.};
0199 Acts::GeometryIdentifier m_geoId{};
0200 };
0201
0202 static_assert(Acts::Experimental::CompositeSpacePoint<MuonSpacePoint>);
0203
0204
0205
0206 using MuonSpacePointBucket = std::vector<MuonSpacePoint>;
0207 using MuonSpacePointContainer = std::vector<MuonSpacePointBucket>;
0208
0209
0210 std::ostream& operator<<(std::ostream& ostr, const MuonSpacePoint::MuonId& id);
0211
0212 std::ostream& operator<<(std::ostream& ostr, const MuonSpacePoint& sp);
0213
0214 }