ATLAS Offline Software
MuonLayerHashProviderTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUON_MUONLAYERHASHPROVIDERTOOL_H
6 #define MUON_MUONLAYERHASHPROVIDERTOOL_H
7 
9 #include "GaudiKernel/ServiceHandle.h"
10 
12 
13 #include <string>
14 #include <vector>
15 
16 static const InterfaceID IID_MuonLayerHashProviderTool("Muon::MuonLayerHashProviderTool",1,0);
17 
18 namespace Muon {
19 
21  public:
27  typedef std::vector<IdentifierHash> HashVec;
28  typedef std::vector< HashVec > RegionHashVec;
29  typedef std::vector< RegionHashVec > TechnologyRegionHashVec;
30  typedef RegionHashVec::const_iterator RegionHashVecCit;
31 
33  int sector;
35  };
36  typedef std::vector<RegionHashesPerSector> RegionHashesPerSectorVec;
37  typedef RegionHashesPerSectorVec::const_iterator RegionHashesPerSectorCit;
38 
40  const HashVec& getHashes( int sector, MuonStationIndex::TechnologyIndex technologyIndex, unsigned int sectorLayerHash ) const;
41 
43  const HashVec& getHashes( const Identifier& id ) const;
44 
46  bool hashInSector( IdentifierHash hash, int sector, MuonStationIndex::TechnologyIndex technologyIndex, unsigned int sectorLayerHash ) const;
47 
49  MuonLayerHashProviderTool(const std::string& type, const std::string& name, const IInterface* parent);
50  virtual ~MuonLayerHashProviderTool()=default;
52 
54  static const InterfaceID& interfaceID() { return IID_MuonLayerHashProviderTool; }
55 
56 
57  private:
58 
60  void insertTechnology( const MuonIdHelper& idHelper );
61 
63  bool insertTgcs();
64 
66  void insertHash( const IdentifierHash& hash, const Identifier& id );
67 
69  void insertHash( int sector, const IdentifierHash& hash, const Identifier& id );
70 
73 
75  unsigned int m_ntechnologies;
76 
79 
80  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
81 
82  };
83 
85  MuonStationIndex::TechnologyIndex technologyIndex, unsigned int sectorLayerHash ) const {
86  const std::vector<IdentifierHash>& hashes = getHashes(sector,technologyIndex,sectorLayerHash);
87  return std::binary_search(hashes.begin(),hashes.end(),hash);
88  }
89 
90  inline const std::vector<IdentifierHash>& MuonLayerHashProviderTool::getHashes( const Identifier& id ) const {
91  MuonStationIndex::DetectorRegionIndex regionIndex = m_idHelperSvc->regionIndex(id);
92  MuonStationIndex::LayerIndex layerIndex = m_idHelperSvc->layerIndex(id);
93  unsigned int sectorLayerHash = MuonStationIndex::sectorLayerHash(regionIndex,layerIndex);
94  return getHashes(m_idHelperSvc->sector(id),m_idHelperSvc->technologyIndex(id),sectorLayerHash);
95  }
96 
97 
98  inline const std::vector<IdentifierHash>& MuonLayerHashProviderTool::getHashes( int sector, MuonStationIndex::TechnologyIndex technologyIndex,
99  unsigned int sectorLayerHash ) const {
100  return m_regionHashesPerSector[sector-1].technologyRegionHashVecs[technologyIndex][sectorLayerHash];
101  }
102 }
103 
104 
105 
106 #endif
python.root_lsr_rank.hashes
hashes
Definition: root_lsr_rank.py:34
Muon::MuonLayerHashProviderTool::MuonLayerHashProviderTool
MuonLayerHashProviderTool(const std::string &type, const std::string &name, const IInterface *parent)
Default AlgTool functions.
Definition: MuonLayerHashProviderTool.cxx:15
Muon::MuonLayerHashProviderTool
Definition: MuonLayerHashProviderTool.h:20
Muon::MuonLayerHashProviderTool::m_ntechnologies
unsigned int m_ntechnologies
number of technologies
Definition: MuonLayerHashProviderTool.h:75
Muon::MuonLayerHashProviderTool::hashInSector
bool hashInSector(IdentifierHash hash, int sector, MuonStationIndex::TechnologyIndex technologyIndex, unsigned int sectorLayerHash) const
check whether a collection hash is part of given sector, technology and sector layer hash
Definition: MuonLayerHashProviderTool.h:84
Muon::MuonLayerHashProviderTool::m_regionHashesPerSector
RegionHashesPerSectorVec m_regionHashesPerSector
cachaed hash data structure
Definition: MuonLayerHashProviderTool.h:78
Muon::MuonLayerHashProviderTool::insertTgcs
bool insertTgcs()
insert hashes for the tgcs
Definition: MuonLayerHashProviderTool.cxx:59
Muon::MuonStationIndex::LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:38
Muon::MuonStationIndex::sectorLayerHash
static unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
Definition: MuonStationIndex.cxx:226
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:98
Muon::MuonLayerHashProviderTool::insertTechnology
void insertTechnology(const MuonIdHelper &idHelper)
insert hashes of a given technology
Definition: MuonLayerHashProviderTool.cxx:46
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::MuonLayerHashProviderTool::RegionHashesPerSector
Definition: MuonLayerHashProviderTool.h:32
Muon::MuonLayerHashProviderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonLayerHashProviderTool.h:80
MuonIdHelper
Definition: MuonIdHelper.h:80
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:108
Muon::MuonStationIndex::DetectorRegionIndex
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:47
Muon::MuonLayerHashProviderTool::RegionHashesPerSectorVec
std::vector< RegionHashesPerSector > RegionHashesPerSectorVec
Definition: MuonLayerHashProviderTool.h:36
Muon::MuonLayerHashProviderTool::RegionHashVec
std::vector< HashVec > RegionHashVec
Definition: MuonLayerHashProviderTool.h:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Muon::MuonLayerHashProviderTool::RegionHashesPerSectorCit
RegionHashesPerSectorVec::const_iterator RegionHashesPerSectorCit
Definition: MuonLayerHashProviderTool.h:37
Muon::MuonLayerHashProviderTool::~MuonLayerHashProviderTool
virtual ~MuonLayerHashProviderTool()=default
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
Muon::MuonLayerHashProviderTool::HashVec
std::vector< IdentifierHash > HashVec
define data structure
Definition: MuonLayerHashProviderTool.h:27
Muon::MuonLayerHashProviderTool::interfaceID
static const InterfaceID & interfaceID()
access to tool interface
Definition: MuonLayerHashProviderTool.h:54
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::MuonLayerHashProviderTool::TechnologyRegionHashVec
std::vector< RegionHashVec > TechnologyRegionHashVec
Definition: MuonLayerHashProviderTool.h:29
Muon::MuonLayerHashProviderTool::RegionHashesPerSector::technologyRegionHashVecs
TechnologyRegionHashVec technologyRegionHashVecs
Definition: MuonLayerHashProviderTool.h:34
Muon::MuonLayerHashProviderTool::initialize
StatusCode initialize()
Definition: MuonLayerHashProviderTool.cxx:23
AthAlgTool
Definition: AthAlgTool.h:26
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
Muon::MuonLayerHashProviderTool::insertHash
void insertHash(const IdentifierHash &hash, const Identifier &id)
insert a single hash for a given identifier
Definition: MuonLayerHashProviderTool.cxx:36
IMuonIdHelperSvc.h
ServiceHandle< Muon::IMuonIdHelperSvc >
Muon::MuonLayerHashProviderTool::RegionHashVecCit
RegionHashVec::const_iterator RegionHashVecCit
Definition: MuonLayerHashProviderTool.h:30
Identifier
Definition: IdentifierFieldParser.cxx:14