Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:46

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 "Acts/EventData/SourceLink.hpp"
0014 #include "ActsExamples/EventData/Index.hpp"
0015 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0016 #include "ActsExamples/EventData/SimHit.hpp"
0017 
0018 #include <cmath>
0019 #include <vector>
0020 
0021 #include <boost/container/static_vector.hpp>
0022 
0023 namespace ActsExamples {
0024 using MuonSimHit = SimHit;
0025 /// Container of space points.
0026 using MuonSimHitContainer = std::vector<MuonSimHit>;
0027 constexpr int g_fieldShift = 8;
0028 // field translators
0029 enum class MuonIdentifierFieldMaps {
0030   stationName = 40,
0031   stationEta = 32,
0032   stationPhi = 24,
0033   multilayer = 16,
0034   tubeLayer = 8,
0035   tube = 0,
0036 };
0037 struct MuonMdtIdentifierFields {
0038   std::int8_t stationName = 0;
0039   std::int8_t stationEta = 0;
0040   std::int8_t stationPhi = 0;
0041   std::int8_t multilayer = 0;
0042   std::int8_t tubeLayer = 0;
0043   std::int8_t tube = 0;
0044 };
0045 MuonMdtIdentifierFields splitId(Acts::GeometryIdentifier::Value theID) {
0046   MuonMdtIdentifierFields f;
0047   f.tube = theID & 0xFF;
0048   theID = theID >> g_fieldShift;
0049   f.tubeLayer = theID & 0xFF;
0050   theID = theID >> g_fieldShift;
0051   f.multilayer = theID & 0xFF;
0052   theID = theID >> g_fieldShift;
0053   f.stationPhi = theID & 0xFF;
0054   theID = theID >> g_fieldShift;
0055   f.stationEta = theID & 0xFF;
0056   theID = theID >> g_fieldShift;
0057   f.stationName = theID & 0xFF;
0058   return f;
0059 }
0060 Acts::GeometryIdentifier::Value compressId(MuonMdtIdentifierFields f) {
0061   Acts::GeometryIdentifier::Value out{0};
0062   out = out << g_fieldShift | f.stationName;
0063   out = out << g_fieldShift | static_cast<std::uint8_t>(f.stationEta);
0064   out = out << g_fieldShift | static_cast<std::uint8_t>(f.stationPhi);
0065   out = out << g_fieldShift | f.multilayer;
0066   out = out << g_fieldShift | f.tubeLayer;
0067   out = out << g_fieldShift | f.tube;
0068   return out;
0069 }
0070 
0071 }  // namespace ActsExamples