ATLAS Offline Software
Loading...
Searching...
No Matches
MuonLayerHashProviderTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUON_MUONLAYERHASHPROVIDERTOOL_H
6#define MUON_MUONLAYERHASHPROVIDERTOOL_H
7
9
13
14#include <mutex>
15#include <string>
16#include <vector>
17#include <array>
18
19
20namespace Muon {
21
23 public:
29 using HashVec = std::vector<IdentifierHash>;
30
33 static constexpr unsigned techMax = MuonStationIndex::toInt(TechnologyIndex::TechnologyIndexMax);
34 using TechnologyRegionHashVec = std::array< RegionHashVec, techMax>;
35
41
43 const HashVec& getHashes( int sector, TechnologyIndex technologyIndex, unsigned int sectorLayerHash ) const;
44
46 MuonLayerHashProviderTool(const std::string& type, const std::string& name, const IInterface* parent);
47 virtual ~MuonLayerHashProviderTool()=default;
48 StatusCode initialize() override;
49
51 static const InterfaceID& interfaceID() {
52 static const InterfaceID IID_MuonLayerHashProviderTool("Muon::MuonLayerHashProviderTool",1,0);
53 return IID_MuonLayerHashProviderTool;
54 }
55
56
57 private:
58
60 void insertTechnology( const MuonIdHelper& idHelper );
61
63 void insertTgcs() const;
64
66 void insertHash( const IdentifierHash& hash, const Identifier& id ) const;
67
69 void insertHash( int sector, const IdentifierHash& hash, const Identifier& id ) const;
70
73
75 mutable RegionHashesPerSectorVec m_regionHashesPerSector ATLAS_THREAD_SAFE{};
76 mutable std::atomic<bool> m_hashLoaded ATLAS_THREAD_SAFE{false};
77 mutable std::mutex m_tgcHash{};
78
79 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
80
82 "MuonManager ReadKey for IOV Range intersection"};
83
84
85 };
86
87
88 inline const std::vector<IdentifierHash>& MuonLayerHashProviderTool::getHashes( int sector, TechnologyIndex technologyIndex,
89 unsigned int sectorLayerHash ) const {
90 if (!m_hashLoaded){
91 insertTgcs();
92 }
93 using namespace MuonStationIndex;
94 return m_regionHashesPerSector[sector-1].technologyRegionHashVecs[toInt(technologyIndex)][sectorLayerHash];
95 }
96}
97
98
99
100#endif
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
This is a "hash" representation of an Identifier.
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
MuonStationIndex::TechnologyIndex TechnologyIndex
RegionHashesPerSectorVec m_regionHashesPerSector ATLAS_THREAD_SAFE
cachaed hash data structure
MuonLayerHashProviderTool(const std::string &type, const std::string &name, const IInterface *parent)
Default AlgTool functions.
const HashVec & getHashes(int sector, TechnologyIndex technologyIndex, unsigned int sectorLayerHash) const
access hashes for a given sector, technology and layer hash
std::array< HashVec, MuonStationIndex::sectorLayerHashMax()> RegionHashVec
void insertHash(const IdentifierHash &hash, const Identifier &id) const
insert a single hash for a given identifier
virtual ~MuonLayerHashProviderTool()=default
void insertTgcs() const
insert hashes for the tgcs
std::array< RegionHashesPerSector, MuonStationIndex::numberOfSectors()> RegionHashesPerSectorVec
std::vector< IdentifierHash > HashVec
define data structure
void insertTechnology(const MuonIdHelper &idHelper)
insert hashes of a given technology
bool initializeSectorMapping()
initialize the mapping structure
static const InterfaceID & interfaceID()
access to tool interface
std::array< RegionHashVec, techMax > TechnologyRegionHashVec
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
TechnologyIndex
enum to classify the different layers in the muon spectrometer
constexpr unsigned numberOfSectors()
return total number of sectors
constexpr int toInt(const EnumType enumVal)
constexpr unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.