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