ATLAS Offline Software
Loading...
Searching...
No Matches
LArRodIdHash.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7 NAME: LArRodIdHash.h
8 PACKAGE: Trigger/TrigAlgorithms/TrigT2CaloCommon
9
10 AUTHOR: Denis Oliveira Damazio
11
12 PURPOSE: LArReadoutModuleID to integer (hash ID) mapping.
13 *******************************************************************/
14
15#ifndef TRIGT2CALOCOMMON_LARRODIDHASH_H
16#define TRIGT2CALOCOMMON_LARRODIDHASH_H
17
18#include <vector>
19#include <unordered_map>
20
21class HWIdentifier;
22
26
27 public:
28
30 using ID = unsigned int;
31
33 void initialize(int offset, const std::vector<HWIdentifier>& roms );
34
37 size_t operator() (ID id) const ;
38
40 size_t max() const { return m_int2id.size(); }
41
43 ID identifier(size_t i) const { return m_int2id[i]; }
44
46 int offset() const { return m_offset; }
47
48 private:
49
51 std::unordered_map<ID, size_t> m_lookup ;
52
54 std::vector<ID> m_int2id;
55
56 int m_offset{0};
57
58};
59
60#endif
61
class that provides LArReadoutModuleID to integer hash ID mapping.
unsigned int ID
definition of ID type
std::unordered_map< ID, size_t > m_lookup
lookup map
std::vector< ID > m_int2id
reverse lookup
ID identifier(size_t i) const
reverse conversion
size_t operator()(ID id) const
convert ID to index throws std::out_of_range if not found
size_t max() const
return maximum number of IDs
int offset() const
return offset
void initialize()