ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAlgorithms
TrigT2CaloCommon
src
LArRodIdHash.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT2CaloCommon/LArRodIdHash.h
"
6
7
#include "eformat/SourceIdentifier.h"
8
#include "
LArIdentifier/LArReadoutModuleService.h
"
9
10
#include <stdexcept>
11
12
using
eformat::helper::SourceIdentifier;
13
14
15
void
LArRodIdHash::initialize
(
int
offset
,
const
std::vector<HWIdentifier>& roms ) {
16
17
m_offset
=
offset
;
18
19
LArReadoutModuleService
larROMService;
20
std::vector<ID> rmod;
21
rmod.reserve(roms.size());
22
23
for
(
const
HWIdentifier
& mId : roms) {
24
SourceIdentifier sid{
static_cast<
eformat::SubDetector
>
(larROMService.
subDet
(mId)),
25
static_cast<
uint8_t
>
(larROMService.
rodFragId
(mId))};
26
const
uint32_t rod_id = sid.code();
27
rmod.push_back(rod_id);
28
}
29
30
size_t
n = 0;
31
for
(
ID
id
: rmod) {
32
m_lookup
[id] = n;
33
m_int2id
.push_back(
id
);
34
++n;
35
}
36
}
37
38
39
size_t
LArRodIdHash::operator()
(
ID
id
)
const
{
40
41
const
auto
it =
m_lookup
.find(
id
);
42
if
(it!=
m_lookup
.end())
return
it->second;
43
44
throw
std::out_of_range(
"LArRodIdHash: invalid Rod number"
+ std::to_string(
id
));
45
46
}
LArReadoutModuleService.h
LArRodIdHash.h
HWIdentifier
Definition
HWIdentifier.h:13
LArReadoutModuleService
Service for creating and interpreting LAr readout modules identifiers.
Definition
LArReadoutModuleService.h:20
LArReadoutModuleService::subDet
static int subDet(const HWIdentifier &id)
return sub-detector identifier
Definition
LArReadoutModuleService.cxx:163
LArReadoutModuleService::rodFragId
static int rodFragId(const HWIdentifier &id)
return ROD fragment identifier ( == ROL == ROB identifier )
Definition
LArReadoutModuleService.cxx:212
LArRodIdHash::m_offset
int m_offset
Definition
LArRodIdHash.h:56
LArRodIdHash::ID
unsigned int ID
definition of ID type
Definition
LArRodIdHash.h:30
LArRodIdHash::m_lookup
std::unordered_map< ID, size_t > m_lookup
lookup map
Definition
LArRodIdHash.h:51
LArRodIdHash::m_int2id
std::vector< ID > m_int2id
reverse lookup
Definition
LArRodIdHash.h:54
LArRodIdHash::operator()
size_t operator()(ID id) const
convert ID to index throws std::out_of_range if not found
Definition
LArRodIdHash.cxx:39
LArRodIdHash::initialize
void initialize(int offset, const std::vector< HWIdentifier > &roms)
Initialize.
Definition
LArRodIdHash.cxx:15
LArRodIdHash::offset
int offset() const
return offset
Definition
LArRodIdHash.h:46
Generated on
for ATLAS Offline Software by
1.17.0