Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
18 
19 namespace Muon {
20 
22  public:
28  using HashVec = std::vector<IdentifierHash>;
29  using RegionHashVec = std::vector<HashVec>;
30  using TechnologyRegionHashVec = std::vector< RegionHashVec >;
31 
33  int sector{-1};
35  };
36  using RegionHashesPerSectorVec = std::vector<RegionHashesPerSector>;
37 
39  const HashVec& getHashes( int sector, MuonStationIndex::TechnologyIndex technologyIndex, unsigned int sectorLayerHash ) const;
40 
42  MuonLayerHashProviderTool(const std::string& type, const std::string& name, const IInterface* parent);
43  virtual ~MuonLayerHashProviderTool()=default;
44  StatusCode initialize() override;
45 
47  static const InterfaceID& interfaceID() {
48  static const InterfaceID IID_MuonLayerHashProviderTool("Muon::MuonLayerHashProviderTool",1,0);
49  return IID_MuonLayerHashProviderTool;
50  }
51 
52 
53  private:
54 
56  void insertTechnology( const MuonIdHelper& idHelper );
57 
59  void insertTgcs() const;
60 
62  void insertHash( const IdentifierHash& hash, const Identifier& id ) const;
63 
65  void insertHash( int sector, const IdentifierHash& hash, const Identifier& id ) const;
66 
69 
71  mutable RegionHashesPerSectorVec m_regionHashesPerSector ATLAS_THREAD_SAFE{};
72  mutable std::atomic<bool> m_hashLoaded ATLAS_THREAD_SAFE{false};
73  mutable std::mutex m_tgcHash{};
74 
75  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
76 
77  SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> m_detMgrKey{this, "DetMgr", "MuonDetectorManager",
78  "MuonManager ReadKey for IOV Range intersection"};
79 
80 
81  };
82 
83 
84  inline const std::vector<IdentifierHash>& MuonLayerHashProviderTool::getHashes( int sector, MuonStationIndex::TechnologyIndex technologyIndex,
85  unsigned int sectorLayerHash ) const {
86  if (!m_hashLoaded){
87  insertTgcs();
88  }
89  return m_regionHashesPerSector[sector-1].technologyRegionHashVecs[technologyIndex][sectorLayerHash];
90  }
91 }
92 
93 
94 
95 #endif
Muon::MuonLayerHashProviderTool::MuonLayerHashProviderTool
MuonLayerHashProviderTool(const std::string &type, const std::string &name, const IInterface *parent)
Default AlgTool functions.
Definition: MuonLayerHashProviderTool.cxx:15
Muon::MuonLayerHashProviderTool::insertTgcs
void insertTgcs() const
insert hashes for the tgcs
Definition: MuonLayerHashProviderTool.cxx:58
Muon::MuonLayerHashProviderTool::HashVec
std::vector< IdentifierHash > HashVec
define data structure
Definition: MuonLayerHashProviderTool.h:28
Muon::MuonLayerHashProviderTool::m_tgcHash
std::mutex m_tgcHash
Definition: MuonLayerHashProviderTool.h:73
Muon::MuonLayerHashProviderTool
Definition: MuonLayerHashProviderTool.h:21
Muon::MuonLayerHashProviderTool::TechnologyRegionHashVec
std::vector< RegionHashVec > TechnologyRegionHashVec
Definition: MuonLayerHashProviderTool.h:30
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
Muon::MuonLayerHashProviderTool::getHashes
const HashVec & getHashes(int sector, MuonStationIndex::TechnologyIndex technologyIndex, unsigned int sectorLayerHash) const
access hashes for a given sector, technology and layer hash
Definition: MuonLayerHashProviderTool.h:84
Muon::MuonLayerHashProviderTool::insertTechnology
void insertTechnology(const MuonIdHelper &idHelper)
insert hashes of a given technology
Definition: MuonLayerHashProviderTool.cxx:45
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Muon::MuonLayerHashProviderTool::RegionHashesPerSector
Definition: MuonLayerHashProviderTool.h:32
Muon::MuonLayerHashProviderTool::insertHash
void insertHash(const IdentifierHash &hash, const Identifier &id) const
insert a single hash for a given identifier
Definition: MuonLayerHashProviderTool.cxx:35
Muon::MuonLayerHashProviderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonLayerHashProviderTool.h:75
MuonIdHelper
Definition: MuonIdHelper.h:80
Muon::MuonLayerHashProviderTool::initialize
StatusCode initialize() override
Definition: MuonLayerHashProviderTool.cxx:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::MuonLayerHashProviderTool::RegionHashesPerSector::sector
int sector
Definition: MuonLayerHashProviderTool.h:33
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Muon::MuonLayerHashProviderTool::initializeSectorMapping
bool initializeSectorMapping()
initialize the mapping structure
Definition: MuonLayerHashProviderTool.cxx:103
Muon::MuonLayerHashProviderTool::RegionHashesPerSectorVec
std::vector< RegionHashesPerSector > RegionHashesPerSectorVec
Definition: MuonLayerHashProviderTool.h:36
ReadCondHandleKey.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
Muon::MuonLayerHashProviderTool::RegionHashVec
std::vector< HashVec > RegionHashVec
Definition: MuonLayerHashProviderTool.h:29
MuonDetectorManager.h
Muon::MuonLayerHashProviderTool::~MuonLayerHashProviderTool
virtual ~MuonLayerHashProviderTool()=default
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager >
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
Muon::MuonLayerHashProviderTool::interfaceID
static const InterfaceID & interfaceID()
access to tool interface
Definition: MuonLayerHashProviderTool.h:47
Muon::MuonLayerHashProviderTool::RegionHashesPerSector::technologyRegionHashVecs
TechnologyRegionHashVec technologyRegionHashVecs
Definition: MuonLayerHashProviderTool.h:34
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MuonLayerHashProviderTool::ATLAS_THREAD_SAFE
RegionHashesPerSectorVec m_regionHashesPerSector ATLAS_THREAD_SAFE
cachaed hash data structure
Definition: MuonLayerHashProviderTool.h:71
Muon::MuonLayerHashProviderTool::m_detMgrKey
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
Definition: MuonLayerHashProviderTool.h:77
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
IMuonIdHelperSvc.h
ServiceHandle< Muon::IMuonIdHelperSvc >
Identifier
Definition: IdentifierFieldParser.cxx:14