ATLAS Offline Software
Loading...
Searching...
No Matches
L0Muon::TgcL0MdtCandidateSelector Class Reference

Select the TGC candidates sent to MDTTP. More...

#include <TgcL0MdtCandidateSelector.h>

Collaboration diagram for L0Muon::TgcL0MdtCandidateSelector:

Public Member Functions

std::unique_ptr< xAOD::TGCCandDataContainerselect (xAOD::TGCCandDataContainer &candidates) const
 Create a non-owning view of the three candidates with the highest encoded pT per sector for one BC processing chain.

Static Private Attributes

static constexpr std::size_t s_maxCandidatesPerSector {3U}

Detailed Description

Select the TGC candidates sent to MDTTP.

Definition at line 15 of file TgcL0MdtCandidateSelector.h.

Member Function Documentation

◆ select()

std::unique_ptr< xAOD::TGCCandDataContainer > L0Muon::TgcL0MdtCandidateSelector::select ( xAOD::TGCCandDataContainer & candidates) const

Create a non-owning view of the three candidates with the highest encoded pT per sector for one BC processing chain.

Parameters
candidatesCandidate collection retained by the Sector Logic for one already-selected BC chain. The container is non-const because DataVector views store non-const pointers; its elements are not modified.
Returns
Non-owning MDTTP candidate view.

Definition at line 28 of file TgcL0MdtCandidateSelector.cxx.

29 {
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
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}
static constexpr std::size_t s_maxCandidatesPerSector
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
output
Definition merge.py:16
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.

Member Data Documentation

◆ s_maxCandidatesPerSector

std::size_t L0Muon::TgcL0MdtCandidateSelector::s_maxCandidatesPerSector {3U}
staticconstexprprivate

Definition at line 30 of file TgcL0MdtCandidateSelector.h.

30{3U};

The documentation for this class was generated from the following files: