File indexing completed on 2025-10-21 08:03:09
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 MaxVal
0060 };
0061
0062 enum class DetSide : std::int8_t { UnDef = 0, A = 1, C = -1 };
0063
0064 static std::string toString(const StationName st);
0065
0066 static std::string toString(const TechField tech);
0067
0068 static std::string toString(const DetSide side);
0069
0070
0071 explicit MuonId(std::uint32_t rawRep);
0072
0073 std::uint32_t toInt() const;
0074
0075 explicit MuonId() = default;
0076
0077 MuonId(const MuonId& other) = default;
0078
0079 MuonId(MuonId&& other) = default;
0080
0081 MuonId& operator=(const MuonId& other) = default;
0082
0083 MuonId& operator=(MuonId&& other) = default;
0084
0085 TechField technology() const { return m_tech; }
0086
0087 StationName msStation() const { return m_stName; }
0088
0089 std::uint16_t sector() const { return m_sector; }
0090
0091 DetSide side() const { return m_side; }
0092
0093 std::uint8_t detLayer() const { return m_layer; }
0094
0095 std::uint16_t channel() const { return m_channel; }
0096
0097 bool measuresEta() const { return m_measEta; }
0098
0099 bool measuresPhi() const { return m_measPhi; }
0100
0101 bool measuresTime() const { return m_measTime; }
0102
0103
0104
0105 bool sameStation(const MuonId& other) const {
0106 return msStation() == other.msStation() && sector() == other.sector() &&
0107 side() == other.side();
0108 }
0109
0110
0111
0112
0113
0114 void setChamber(StationName stName, DetSide side, std::uint16_t sector,
0115 TechField tech);
0116
0117 void setLayAndCh(std::uint8_t layer, std::uint16_t ch);
0118
0119
0120
0121
0122 void setCoordFlags(bool measEta, bool measPhi, bool measTime = false);
0123
0124 std::string toString() const;
0125
0126 private:
0127 TechField m_tech{TechField::UnDef};
0128 StationName m_stName{StationName::UnDef};
0129 DetSide m_side{DetSide::UnDef};
0130 std::uint16_t m_sector{1};
0131 std::uint8_t m_layer{1};
0132 std::uint16_t m_channel{1};
0133 bool m_measEta{false};
0134 bool m_measPhi{false};
0135 bool m_measTime{false};
0136 };
0137
0138 MuonSpacePoint() = default;
0139
0140 MuonSpacePoint(const MuonSpacePoint& other) = default;
0141
0142 MuonSpacePoint(MuonSpacePoint&& other) = default;
0143
0144 MuonSpacePoint& operator=(const MuonSpacePoint& other) = default;
0145
0146 MuonSpacePoint& operator=(MuonSpacePoint&& other) = default;
0147
0148 const MuonId& id() const { return m_id; }
0149
0150 const Acts::GeometryIdentifier& geometryId() const { return m_geoId; }
0151
0152 const Acts::Vector3& localPosition() const { return m_pos; }
0153
0154 const Acts::Vector3& sensorDirection() const { return m_dir; }
0155
0156 const Acts::Vector3& planeNormal() const { return m_norm; }
0157
0158 const Acts::Vector3& toNextSensor() const { return m_toNext; }
0159
0160 const std::array<double, 3>& covariance() const { return m_cov; }
0161
0162 double driftRadius() const { return m_radius; }
0163
0164 double time() const { return m_time; }
0165
0166 bool isStraw() const { return id().technology() == MuonId::TechField::Mdt; }
0167
0168 bool hasTime() const { return id().measuresTime(); }
0169
0170 bool measuresLoc1() const { return id().measuresEta(); }
0171
0172 bool measuresLoc0() const { return id().measuresPhi(); }
0173
0174 void setId(const MuonId& id);
0175
0176
0177
0178
0179 void defineCoordinates(Acts::Vector3&& pos, Acts::Vector3&& sensorDir,
0180 Acts::Vector3&& toNextSensor);
0181
0182 void setRadius(const double r);
0183
0184 void setTime(const double t);
0185
0186 void setCovariance(const double covX, const double covY, const double covT);
0187
0188 void setGeometryId(const Acts::GeometryIdentifier& geoId);
0189
0190 private:
0191 MuonId m_id{};
0192 Acts::Vector3 m_pos{Acts::Vector3::Zero()};
0193 Acts::Vector3 m_dir{Acts::Vector3::Zero()};
0194 Acts::Vector3 m_toNext{Acts::Vector3::Zero()};
0195 Acts::Vector3 m_norm{Acts::Vector3::Zero()};
0196
0197 std::array<double, 3> m_cov{Acts::filledArray<double, 3>(0.)};
0198 double m_radius{0.};
0199 double m_time{0.};
0200 Acts::GeometryIdentifier m_geoId{};
0201 };
0202
0203 static_assert(Acts::Experimental::CompositeSpacePoint<MuonSpacePoint>);
0204
0205
0206
0207 using MuonSpacePointBucket = std::vector<MuonSpacePoint>;
0208 using MuonSpacePointContainer = std::vector<MuonSpacePointBucket>;
0209
0210
0211 std::ostream& operator<<(std::ostream& ostr,
0212 const ActsExamples::MuonSpacePoint::MuonId& id);
0213
0214 std::ostream& operator<<(std::ostream& ostr,
0215 const ActsExamples::MuonSpacePoint& sp);
0216 }