ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArRawConditions
src
LArMCSym.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArRawConditions/LArMCSym.h
"
6
#include <algorithm>
7
#include <cstdlib>
8
9
18
LArMCSym::LArMCSym
(
const
LArOnlineID_Base
* onlId,
19
const
CaloCell_Base_ID
* caloId,
20
std::vector<HWIdentifier>&& oflHashtoSymOnl,
21
std::vector<HWIdentifier>&& onlHashtoSymOnl,
22
std::vector<HWIdentifier>&&
symIds
) :
23
m_onlineID
(onlId),
24
m_caloCellID
(caloId),
25
m_oflHashtoSymOnl
(
initIndices
(oflHashtoSymOnl,
symIds
)),
26
m_onlHashtoSymOnl
(
initIndices
(onlHashtoSymOnl,
symIds
)),
27
m_symIds
(
std
::move(
symIds
))
28
{
29
}
30
31
32
std::vector<LArMCSym::IdPair_t>
33
LArMCSym::initIndices
(
const
std::vector<HWIdentifier>& ids,
34
const
std::vector<HWIdentifier>&
symIds
)
const
35
{
36
std::vector<IdPair_t> out;
37
out.reserve (ids.size());
38
HWIdentifier
last_id;
39
size_t
idx =
NO_INDEX
;
40
for
(
const
HWIdentifier
&
id
: ids) {
41
if
(!
id
.is_valid()) {
42
idx =
NO_INDEX
;
43
}
44
else
if
(
id
!= last_id) {
45
if
(idx <
symIds
.size()-1 &&
symIds
[idx+1] ==
id
) {
46
++idx;
47
}
48
else
{
49
auto
it = std::lower_bound (
symIds
.begin(),
symIds
.end(),
id
);
50
if
(it ==
symIds
.end() || *it !=
id
) std::abort();
51
idx = it -
symIds
.begin();
52
}
53
}
54
out.emplace_back (
id
.get_identifier32().get_compact(), idx);
55
last_id = id;
56
}
57
58
return
out;
59
}
60
LArMCSym.h
CaloCell_Base_ID
Helper base class for offline cell identifiers.
Definition
CaloCell_Base_ID.h:40
HWIdentifier
Definition
HWIdentifier.h:13
LArMCSym::symIds
const std::vector< HWIdentifier > & symIds() const
Return the list of symmetric hashes.
Definition
LArMCSym.h:132
LArMCSym::m_onlineID
const LArOnlineID_Base * m_onlineID
Definition
LArMCSym.h:152
LArMCSym::m_oflHashtoSymOnl
const std::vector< IdPair_t > m_oflHashtoSymOnl
Definition
LArMCSym.h:154
LArMCSym::m_symIds
const std::vector< HWIdentifier > m_symIds
Definition
LArMCSym.h:156
LArMCSym::LArMCSym
LArMCSym()=delete
LArMCSym::initIndices
std::vector< IdPair_t > initIndices(const std::vector< HWIdentifier > &ids, const std::vector< HWIdentifier > &symIds) const
Definition
LArMCSym.cxx:33
LArMCSym::NO_INDEX
static constexpr size_t NO_INDEX
Return for an index if there's no valid symmetric identifier.
Definition
LArMCSym.h:41
LArMCSym::m_onlHashtoSymOnl
const std::vector< IdPair_t > m_onlHashtoSymOnl
Definition
LArMCSym.h:155
LArMCSym::m_caloCellID
const CaloCell_Base_ID * m_caloCellID
Definition
LArMCSym.h:153
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition
LArOnlineID_Base.h:97
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0