ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Muon
L0MuonS1TGC
src
TgcL0MdtCandidateSelector.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 "
TgcL0MdtCandidateSelector.h
"
6
7
#include <algorithm>
8
#include <cstdint>
9
#include <memory>
10
#include <utility>
11
#include <vector>
12
13
#include "
AthContainers/OwnershipPolicy.h
"
14
#include "
xAODL0MuonCand/TGCCandData.h
"
15
16
namespace
{
17
18
using
CandidateGroup = std::pair<std::uint16_t, std::uint16_t>;
19
20
CandidateGroup candidateGroup(
const
xAOD::TGCCandData
&candidate) {
21
return
{candidate.
subdetectorId
(), candidate.
sectorId
()};
22
}
23
24
}
// namespace
25
26
namespace
L0Muon
{
27
28
std::unique_ptr<xAOD::TGCCandDataContainer>
TgcL0MdtCandidateSelector::select
(
29
xAOD::TGCCandDataContainer
&candidates)
const
{
30
auto
output = std::make_unique<xAOD::TGCCandDataContainer>(
SG::VIEW_ELEMENTS
);
31
std::vector<xAOD::TGCCandData *> orderedCandidates;
32
orderedCandidates.reserve(candidates.size());
33
for
(
xAOD::TGCCandData
*candidate : candidates) {
34
if
(candidate->
tcId
() == 0U)
35
continue
;
36
orderedCandidates.emplace_back(candidate);
37
}
38
39
std::stable_sort
(
40
orderedCandidates.begin(), orderedCandidates.end(),
41
[](
const
xAOD::TGCCandData
*left,
const
xAOD::TGCCandData
*right) {
42
const CandidateGroup leftGroup = candidateGroup(*left);
43
const CandidateGroup rightGroup = candidateGroup(*right);
44
if (leftGroup != rightGroup)
45
return leftGroup < rightGroup;
46
return left->pt() > right->pt();
47
});
48
49
CandidateGroup currentGroup{};
50
bool
haveCurrentGroup{
false
};
51
std::size_t groupCandidate{0U};
52
for
(
xAOD::TGCCandData
*candidate : orderedCandidates) {
53
const
CandidateGroup group = candidateGroup(*candidate);
54
if
(!haveCurrentGroup || group != currentGroup) {
55
currentGroup = group;
56
haveCurrentGroup =
true
;
57
groupCandidate = 0U;
58
}
59
if
(groupCandidate >=
s_maxCandidatesPerSector
)
60
continue
;
61
62
++groupCandidate;
63
output->push_back(candidate);
64
}
65
return
output;
66
}
67
68
}
// namespace L0Muon
TGCCandData.h
OwnershipPolicy.h
TgcL0MdtCandidateSelector.h
L0Muon::TgcL0MdtCandidateSelector::select
std::unique_ptr< xAOD::TGCCandDataContainer > select(xAOD::TGCCandDataContainer &candidates) const
Create a non-owning view of the three candidates with the highest encoded pT per sector for one BC pr...
Definition
TgcL0MdtCandidateSelector.cxx:28
L0Muon::TgcL0MdtCandidateSelector::s_maxCandidatesPerSector
static constexpr std::size_t s_maxCandidatesPerSector
Definition
TgcL0MdtCandidateSelector.h:30
xAOD::ICandData_v1::sectorId
uint16_t sectorId() const
Retrieve the sector id.
xAOD::ICandData_v1::subdetectorId
uint16_t subdetectorId() const
Retrieve the sub detector id.
xAOD::TGCCandData_v1::tcId
uint8_t tcId() const
Retrieve the trigger-candidate identifier.
Definition
TGCCandData_v1.cxx:34
L0Muon
Definition
NSWTPBits.h:7
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
std::stable_sort
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
Definition
DVL_algorithms.h:644
xAOD::TGCCandDataContainer
TGCCandDataContainer_v1 TGCCandDataContainer
Definition
MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODL0MuonCand/xAODL0MuonCand/TGCCandDataContainer.h:13
xAOD::TGCCandData
TGCCandData_v1 TGCCandData
Definition
MuonSpectrometer/MuonPhaseII/Event/xAOD/xAODL0MuonCand/xAODL0MuonCand/TGCCandData.h:12
Generated on
for ATLAS Offline Software by
1.17.0