Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:01

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