ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Muon
L1MuonS1TGC
src
MdtCandSelector.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 "
MdtCandSelector.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 "
xAODTrigL1Muon/L1TGCCandData.h
"
15
16
namespace
{
17
18
using
CandidateGroup = std::pair<std::uint16_t, std::uint16_t>;
19
20
CandidateGroup candidateGroup(
const
xAOD::L1TGCCandData
&candidate) {
21
return
{candidate.
l1SubdetectorId
(), candidate.
l1SectorId
()};
22
}
23
24
}
// namespace
25
26
namespace
L1Muon::L1TGC
{
27
28
std::unique_ptr<xAOD::L1TGCCandDataContainer>
MdtCandSelector::select
(
29
xAOD::L1TGCCandDataContainer
&candidates)
const
{
30
auto
output = std::make_unique<xAOD::L1TGCCandDataContainer>(
SG::VIEW_ELEMENTS
);
31
std::vector<xAOD::L1TGCCandData *> orderedCandidates;
32
orderedCandidates.reserve(candidates.size());
33
for
(
xAOD::L1TGCCandData
*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::L1TGCCandData
*left,
const
xAOD::L1TGCCandData
*right) {
42
const CandidateGroup leftGroup = candidateGroup(*left);
43
const CandidateGroup rightGroup = candidateGroup(*right);
44
if (leftGroup != rightGroup)
45
return leftGroup < rightGroup;
46
return left->l1Pt() > right->l1Pt();
47
});
48
49
CandidateGroup currentGroup{};
50
bool
haveCurrentGroup{
false
};
51
std::size_t groupCandidate{0U};
52
for
(
xAOD::L1TGCCandData
*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 L1Muon::L1TGC
L1TGCCandData.h
MdtCandSelector.h
OwnershipPolicy.h
L1Muon::L1TGC::MdtCandSelector::select
std::unique_ptr< xAOD::L1TGCCandDataContainer > select(xAOD::L1TGCCandDataContainer &candidates) const
Create a non-owning view of the three candidates with the highest encoded pT per sector for one BC pr...
Definition
MdtCandSelector.cxx:28
L1Muon::L1TGC::MdtCandSelector::s_maxCandidatesPerSector
static constexpr std::size_t s_maxCandidatesPerSector
Definition
MdtCandSelector.h:30
xAOD::IL1CandData_v1::l1SectorId
uint16_t l1SectorId() const
Retrieve the sector id.
xAOD::IL1CandData_v1::tcId
uint8_t tcId() const
Retrieve the trigger-candidate identifier.
Definition
IL1CandData_v1.cxx:70
xAOD::IL1CandData_v1::l1SubdetectorId
uint16_t l1SubdetectorId() const
Retrieve the sub detector id.
L1Muon::L1TGC
Definition
SectorLogicWordEncoder.cxx:21
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::L1TGCCandData
L1TGCCandData_v1 L1TGCCandData
Definition
L1TGCCandData.h:11
xAOD::L1TGCCandDataContainer
L1TGCCandDataContainer_v1 L1TGCCandDataContainer
Definition
L1TGCCandDataContainer.h:13
Generated on
for ATLAS Offline Software by
1.17.0