Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-21 08:09:21

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 // This file is part of the ACTS project.
0010 //
0011 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0012 //
0013 // This Source Code Form is subject to the terms of the Mozilla Public
0014 // License, v. 2.0. If a copy of the MPL was not distributed with this
0015 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0016 #include "ActsExamples/EventData/MuonSpacePoint.hpp"
0017 
0018 #include "Acts/Utilities/StringHelpers.hpp"
0019 
0020 #include "TString.h"
0021 
0022 std::ostream& operator<<(std::ostream& ostr,
0023                          const ActsExamples::MuonSpacePoint::MuonId& id) {
0024   ostr << Form("%s in %2d on %s",
0025                ActsExamples::to_string(id.msStation()).c_str(), id.sector(),
0026                ActsExamples::to_string(id.side()).c_str());
0027   return ostr;
0028 }
0029 std::ostream& operator<<(std::ostream& ostr,
0030                          const ActsExamples::MuonSpacePoint& sp) {
0031   ostr << "Id: " << sp.id() << ", pos: " << Acts::toString(sp.localPosition())
0032        << ", dir: " << Acts::toString(sp.sensorDirection())
0033        << ", covariance: " << Acts::toString(sp.covariance());
0034   return ostr;
0035 }
0036 
0037 namespace ActsExamples {
0038 using TechField = MuonSpacePoint::MuonId::TechField;
0039 using StationName = MuonSpacePoint::MuonId::StationName;
0040 using DetSide = MuonSpacePoint::MuonId::DetSide;
0041 
0042 std::string to_string(const StationName st) {
0043   switch (st) {
0044     case StationName::BIS:
0045       return "BIS";
0046     case StationName::BIL:
0047       return "BIL";
0048     case StationName::BMS:
0049       return "BMS";
0050     case StationName::BML:
0051       return "BML";
0052     case StationName::BOS:
0053       return "BOS";
0054     case StationName::BOL:
0055       return "BOL";
0056     case StationName::BEE:
0057       return "BEE";
0058     case StationName::EIL:
0059       return "EIL";
0060     case StationName::EIS:
0061       return "EIS";
0062     case StationName::EMS:
0063       return "EMS";
0064     case StationName::EML:
0065       return "EML";
0066     case StationName::EOS:
0067       return "EOS";
0068     case StationName::EOL:
0069       return "EOL";
0070     case StationName::EES:
0071       return "EES";
0072     case StationName::EEL:
0073       return "EEL";
0074     default:
0075       return "Unknown";
0076   }
0077 }
0078 std::string to_string(const TechField tech) {
0079   switch (tech) {
0080     case TechField::Mdt:
0081       return "Mdt";
0082     case TechField::Tgc:
0083       return "Tgc";
0084     case TechField::Rpc:
0085       return "Rpc";
0086     case TechField::sTgc:
0087       return "sTgc";
0088     case TechField::Mm:
0089       return "Mm";
0090     default:
0091       return "Unknown";
0092   }
0093 }
0094 std::string to_string(const DetSide side) {
0095   switch (side) {
0096     case DetSide::A:
0097       return "A-side";
0098     case DetSide::C:
0099       return "C-side";
0100     default:
0101       return "Unknown";
0102   }
0103 }
0104 void MuonSpacePoint::MuonId::setChamber(StationName stName, DetSide side,
0105                                         int sector, TechField tech) {
0106   m_stName = stName;
0107   m_side = side;
0108   m_sector = sector;
0109   m_tech = tech;
0110 }
0111 void MuonSpacePoint::MuonId::setLayAndCh(std::uint8_t layer, std::uint16_t ch) {
0112   m_layer = layer;
0113   m_channel = ch;
0114 }
0115 void MuonSpacePoint::MuonId::setCoordFlags(bool measEta, bool measPhi) {
0116   m_measEta = measEta;
0117   m_measPhi = measPhi;
0118 }
0119 void MuonSpacePoint::defineCoordinates(Acts::Vector3&& pos,
0120                                        Acts::Vector3&& sensorDir) {
0121   m_pos = std::move(pos);
0122   m_dir = std::move(sensorDir);
0123 }
0124 void MuonSpacePoint::defineNormal(Acts::Vector3&& norm) {
0125   m_norm = std::move(norm);
0126 }
0127 void MuonSpacePoint::setRadius(const double r) {
0128   m_radius = r;
0129 }
0130 void MuonSpacePoint::setTime(const double t) {
0131   m_time = t;
0132 }
0133 void MuonSpacePoint::setSpatialCov(const double xx, const double xy,
0134                                    const double yx, const double yy) {
0135   m_cov(Acts::eX, Acts::eX) = xx;
0136   m_cov(Acts::eX, Acts::eY) = xy;
0137   m_cov(Acts::eY, Acts::eX) = yx;
0138   m_cov(Acts::eY, Acts::eY) = yy;
0139 }
0140 void MuonSpacePoint::setId(const MuonId& id) {
0141   m_id = id;
0142 }
0143 }  // namespace ActsExamples