Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-15 08:12:42

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/Definitions/Common.hpp"
0013 #include "ActsExamples/EventData/MuonSpacePoint.hpp"
0014 
0015 #include <cmath>
0016 #include <vector>
0017 
0018 namespace ActsExamples {
0019 class MuonSegment {
0020  public:
0021   using MuonId = MuonSpacePoint::MuonId;
0022   /// @brief Empty default constructor
0023   MuonSegment() = default;
0024   /// @brief Standard copy constructor
0025   MuonSegment(const MuonSegment& other) = default;
0026   /// @brief Standard move constructor
0027   MuonSegment(MuonSegment&& other) = default;
0028   /// @brief Standard copy assignment
0029   MuonSegment& operator=(const MuonSegment& other) = default;
0030 
0031   /// @brief Returns the reconstructed segment position in global coordinates
0032   const Acts::Vector3& globalPosition() const { return m_globPos; }
0033   /// @brief Returns the reconstructed segment direction in global coordinates
0034   const Acts::Vector3& globalDirection() const { return m_globDir; }
0035   /// @brief Returns the reconstructed segment position expressed in the local space point frame
0036   const Acts::Vector3& localPosition() const { return m_localPos; }
0037   /// @brief Returns the reconstructed segment direction expressed in the local space point frame
0038   const Acts::Vector3& localDirection() const { return m_localDir; }
0039   /// @brief Returns the associated MS sector identifier
0040   const MuonId& id() const { return m_id; }
0041   /// @brief returns the fitted segment time & uncertainty
0042   double time() const { return m_time; }
0043   double timeUncert() const { return m_timeError; }
0044   /// @brief Returns the chiSquared & degreed of freedom
0045   double chiSquared() const { return m_chiSquared; }
0046   double nDoF() const { return m_nDoF; }
0047   /// @brief Returns the number of precision hits building the segment
0048   unsigned nPrecisionHits() const { return m_precisionHits; }
0049   /// @brief Returns the number of complementary trigger hits in the bending plane
0050   unsigned nTrigEtaLayers() const { return m_triEtaLayers; }
0051   /// @brief Returns the number of complementary trigger hits in the non-bending plane
0052   unsigned nTrigPhiLayers() const { return m_phiLayers; }
0053   /// @brief Set the global segment position & direction
0054   void setGlobalCoords(const Acts::Vector3& pos, const Acts::Vector3& dir) {
0055     m_globPos = pos;
0056     m_globDir = dir;
0057   }
0058   /// @brief Set the local segment position & direction
0059   /// @param pos: Position of the segment in the local frame
0060   /// @param dir: Direction of the segment in the local frame
0061   void setLocalCoords(const Acts::Vector3& pos, const Acts::Vector3& dir) {
0062     m_localPos = pos;
0063     m_localDir = dir;
0064   }
0065   /// @brief Set the Identifier
0066   void setId(const MuonId& id) { m_id = id; }
0067   /// @brief Set the time & unceratinty
0068   void setTime(const double time, const double timeError) {
0069     m_time = time;
0070     m_timeError = timeError;
0071   }
0072   /// @brief Set the chi2 & the number of degrees of freedom
0073   void setFitQuality(const double chi2, const unsigned nDoF) {
0074     m_chiSquared = chi2;
0075     m_nDoF = nDoF;
0076   }
0077   /// @brief Set the segment hit summary in terms of precision hits (Straw/ Mm /sTgc)
0078   ///        & trigger eta (Rpc /Tgc) & trigger phi (Rpc / Tgc) hits
0079   void setHitSummary(unsigned nPrec, unsigned nTrigEta, unsigned nTrigPhi) {
0080     m_precisionHits = nPrec;
0081     m_triEtaLayers = nTrigEta;
0082     m_phiLayers = nTrigPhi;
0083   }
0084 
0085  private:
0086   MuonId m_id{};
0087   Acts::Vector3 m_globPos{Acts::Vector3::Zero()};
0088   Acts::Vector3 m_globDir{Acts::Vector3::Zero()};
0089   Acts::Vector3 m_localPos{Acts::Vector3::Zero()};
0090   Acts::Vector3 m_localDir{Acts::Vector3::Zero()};
0091   /// @brief Fitted segment time of arrival
0092   double m_time{0.f};
0093   /// @brief Uncertainty on the time of arrival
0094   double m_timeError{0.f};
0095   /// @brief segment chi2 & number of degrees of freedom
0096   double m_chiSquared{0.f};
0097   unsigned m_nDoF{0u};
0098   /// @brief how many precision hits are on the segment (Straw tubes or Mm)
0099   unsigned m_precisionHits{0u};
0100   /// @brief  Complementary hits in the non-bending direction (Rpc / Tgc / sTgc)
0101   unsigned m_phiLayers{0u};
0102   /// @brief  Complementary hits in the bending direction (Rpc / Tgc)
0103   unsigned m_triEtaLayers{0u};
0104 };
0105 using MuonSegmentContainer = std::vector<MuonSegment>;
0106 
0107 }  // namespace ActsExamples