Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:10:43

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   using longIdType = Acts::GeometryIdentifier::Value;
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 = (int)(theID & 0xFF);
0056   theID = theID >> g_fieldShift;
0057   f.stationName = theID & 0xFF;
0058   return f;
0059 }
0060 Acts::GeometryIdentifier::Value compressId(muonMdtIdentifierFields f) {
0061   using longIdType = Acts::GeometryIdentifier::Value;
0062   longIdType out{0};
0063   out = out << g_fieldShift | f.stationName;
0064   out = out << g_fieldShift | (u_int8_t)f.stationEta;
0065   out = out << g_fieldShift | f.stationPhi;
0066   out = out << g_fieldShift | f.multilayer;
0067   out = out << g_fieldShift | f.tubeLayer;
0068   out = out << g_fieldShift | f.tube;
0069   return out;
0070 }
0071 
0072 }  // namespace ActsExamples