Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Examples/Framework/include/ActsExamples/EventData/MuonSpacePoint.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
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 /// @brief Example implementation of a CompositeSpacePoint concept inspired by the ATLAS Muon::SpacePoint EDM.
0023 ///         The space points are expressed in a local frame such that the x-axis
0024 ///         is parallel to the ATLAS Monitored Drift Tubes (Mdt), the y-axis
0025 ///         points within the tube layer & the z-axis outside of the plane.
0026 class MuonSpacePoint {
0027  public:
0028   /// @brief Identifier helper class to distinguish different measurements
0029   class MuonId {
0030    public:
0031     /// @brief Technology encoding of the measurement
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     /// @brief ATLAS-MS station encoding
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     /// @brief Detector side encoding
0061     enum class DetSide : std::int8_t { UnDef = 0, A = 1, C = -1 };
0062     /// @brief Print the Identifier's stationName to a string
0063     static std::string toString(const StationName st);
0064     /// @brief Print the Identifier's technologyField to a string
0065     static std::string toString(const TechField tech);
0066     /// @brief Print the Identifier's detector side to a string
0067     static std::string toString(const DetSide side);
0068 
0069     /// @brief Constructor taking the encoded 32 bit integer
0070     explicit MuonId(std::uint32_t rawRep);
0071     /// @brief Returns the integer representation of the Identifier
0072     std::uint32_t toInt() const;
0073     /// @brief Empty default Identifier constructor
0074     explicit MuonId() = default;
0075     /// @brief Default copy constructor
0076     MuonId(const MuonId& other) = default;
0077     /// @brief Default move constructor
0078     MuonId(MuonId&& other) = default;
0079     /// @brief Default copy assignment
0080     MuonId& operator=(const MuonId& other) = default;
0081     /// @brief Default move assignment
0082     MuonId& operator=(MuonId&& other) = default;
0083     /// @brief Returns the technology of the measurement
0084     TechField technology() const { return m_tech; }
0085     /// @brief Returns the MS station in which the measurement was recorded
0086     StationName msStation() const { return m_stName; }
0087     /// @brief Returns the sector in which the measurement was recorded
0088     std::uint16_t sector() const { return m_sector; }
0089     /// @brief Returns the detector side
0090     DetSide side() const { return m_side; }
0091     /// @brief Returns the layer
0092     std::uint8_t detLayer() const { return m_layer; }
0093     /// @brief Returns the channel number
0094     std::uint16_t channel() const { return m_channel; }
0095     /// @brief Returns whether the id corresponds to a precision coordinate (eta) measurement
0096     bool measuresEta() const { return m_measEta; }
0097     /// @brief Returns whether the id corresponds to a non-precision coordinate (phi) measurement
0098     bool measuresPhi() const { return m_measPhi; }
0099     /// @brief Returns whether the id corresponds to a channel carrying time information
0100     bool measuresTime() const { return m_measTime; }
0101     /// @brief Returns whether two Identifiers belong to the same station, which
0102     ///        is characterized that both share the same msStation, sector &
0103     ///        side field.
0104     bool sameStation(const MuonId& other) const {
0105       return msStation() == other.msStation() && sector() == other.sector() &&
0106              side() == other.side();
0107     }
0108     /// @brief Set the fields needed to Identify the detector in the system
0109     /// @param stName: StationName where the muon station is located
0110     /// @param side: Positive or negative side
0111     /// @param sector: Phi sector in which the chamber is installed
0112     /// @param tech: Technology of the chamber within the chamber
0113     void setChamber(StationName stName, DetSide side, std::uint16_t sector,
0114                     TechField tech);
0115     /// @brief Set the measurement layer & channel */
0116     void setLayAndCh(std::uint8_t layer, std::uint16_t ch);
0117     /// @brief Define the measurement type of the space point
0118     /// @param measEta: Flag stating whether the space point measures the precision (eta) coordinate
0119     /// @param measPhi: Flag stating whether the space point measures the non-precsion (phi) coordinate
0120     /// @param measTime: Flag stating whether the space point carries time information
0121     void setCoordFlags(bool measEta, bool measPhi, bool measTime = false);
0122     /// @brief prints the Muon identifier to string
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   /// @brief Empty default constructor
0137   MuonSpacePoint() = default;
0138   /// @brief Copy constructor
0139   MuonSpacePoint(const MuonSpacePoint& other) = default;
0140   /// @brief Move constructor
0141   MuonSpacePoint(MuonSpacePoint&& other) = default;
0142   /// @brief Copy assignment
0143   MuonSpacePoint& operator=(const MuonSpacePoint& other) = default;
0144   /// @brief Move assignment
0145   MuonSpacePoint& operator=(MuonSpacePoint&& other) = default;
0146   /// @brief Returns the Identifier of the space point
0147   const MuonId& id() const { return m_id; }
0148   /// @brief Returnt the geometry Identifier of the space point
0149   const Acts::GeometryIdentifier& geometryId() const { return m_geoId; }
0150   /// @brief Returns the local measurement position
0151   const Acts::Vector3& localPosition() const { return m_pos; }
0152   /// @brief Returns the local sensor direction
0153   const Acts::Vector3& sensorDirection() const { return m_dir; }
0154   /// @brief Returns the normal vector to the plane
0155   const Acts::Vector3& planeNormal() const { return m_norm; }
0156   /// @brief Returns the vector pointing to the next wire / strip
0157   const Acts::Vector3& toNextSensor() const { return m_toNext; }
0158   /// @brief Returns the transformation from the local frame to the sector frame
0159   const Acts::Transform3& toSectorTransform() const { return m_toSectorTrf; }
0160   /// @brief Returns the space point covariance values
0161   const std::array<double, 3>& covariance() const { return m_cov; }
0162   /// @brief Returns the drift radius
0163   double driftRadius() const { return m_radius; }
0164   /// @brief Returns the measurement time *
0165   double time() const { return m_time; }
0166   /// @brief Returns whether the measurement is a straw measurement
0167   bool isStraw() const { return id().technology() == MuonId::TechField::Mdt; }
0168   /// @brief Returns whether the measurement provides time information
0169   bool hasTime() const { return id().measuresTime(); }
0170   /// @brief Returns whether the measurement constrains the bending plane
0171   bool measuresLoc1() const { return id().measuresEta(); }
0172   /// @brief Returns whether the measurement constrains the non-bending plane
0173   bool measuresLoc0() const { return id().measuresPhi(); }
0174   /// @brief Define the space point's identifier
0175   void setId(const MuonId& id);
0176   /// @brief Define the space point coordinates.
0177   /// @param pos: Space point position
0178   /// @param sensorDir: Direction of the sensor
0179   /// @param toNextSensor: Vector pointing to the next sensor
0180   void defineCoordinates(Acts::Vector3&& pos, Acts::Vector3&& sensorDir,
0181                          Acts::Vector3&& toNextSensor);
0182   /// @brief Define the transformation from the local frame to the sector frame
0183   void setToSectorTransform(const Acts::Vector3& translation,
0184                             const Acts::SquareMatrix<3>& rotation) {
0185     m_toSectorTrf.translation() = translation;
0186     m_toSectorTrf.linear() = rotation;
0187   }
0188   /// @brief Define the space point radius
0189   void setRadius(const double r);
0190   /// @brief Define the time of the space point measurement
0191   void setTime(const double t);
0192   /// @brief Define the spatial components of the covariance
0193   void setCovariance(const double covX, const double covY, const double covT);
0194   /// @brief Set the geometry identifier
0195   void setGeometryId(const Acts::GeometryIdentifier& geoId);
0196 
0197  private:
0198   MuonId m_id{};
0199   Acts::Transform3 m_toSectorTrf{Acts::Transform3::Identity()};
0200 
0201   Acts::Vector3 m_pos{Acts::Vector3::Zero()};
0202   Acts::Vector3 m_dir{Acts::Vector3::Zero()};
0203   Acts::Vector3 m_toNext{Acts::Vector3::Zero()};
0204   Acts::Vector3 m_norm{Acts::Vector3::Zero()};
0205 
0206   std::array<double, 3> m_cov{Acts::filledArray<double, 3>(0.)};
0207   double m_radius{0.};
0208   double m_time{0.};
0209   Acts::GeometryIdentifier m_geoId{};
0210 };
0211 
0212 static_assert(Acts::Experimental::CompositeSpacePoint<MuonSpacePoint>);
0213 /// @brief Abbrivation of the MuonSpacePoint container as a jagged vector of
0214 ///        space point objects. The inner vector represents a collection of
0215 ///        space points that are close-by together in space, a so-called bucket.
0216 using MuonSpacePointBucket = std::vector<MuonSpacePoint>;
0217 using MuonSpacePointContainer = std::vector<MuonSpacePointBucket>;
0218 
0219 /// @brief ostream operator of the Muon space point Identifier
0220 std::ostream& operator<<(std::ostream& ostr, const MuonSpacePoint::MuonId& id);
0221 /// @brief osteram operator of the space point
0222 std::ostream& operator<<(std::ostream& ostr, const MuonSpacePoint& sp);
0223 
0224 }  // namespace ActsExamples