70 {
71 const EventContext &ctx = Gaudi::Hive::currentContext();
72
73
75 if (!
jets.isValid()) {
77 return StatusCode::FAILURE;
78 }
79
80
81 std::vector<const xAOD::Jet*> selectedJets;
82
84
85 std::vector<int>
entries = m_parser->evaluateAsVector();
88 return StatusCode::FAILURE;
89 }
90
91 for (
size_t i = 0;
i <
jets->size(); ++
i) {
93 selectedJets.push_back((*jets)[i]);
94 }
95 }
96 } else {
97
98 for (const auto* jet : *jets) {
99 selectedJets.push_back(jet);
100 }
101 }
102
103 ATH_MSG_DEBUG(
"Number of selected jets: " << selectedJets.size()
104 <<
" out of " <<
jets->size());
105
106
108
109 if (!ghostContainer.isValid()) {
111 return StatusCode::SUCCESS;
112 }
113
114 size_t nObjects = ghostContainer->size();
115 std::vector<bool>
mask(nObjects,
false);
117
118
120
121 size_t nGhostLinks = 0;
122
123
124 for (const auto* jet : selectedJets) {
125 if (!jet) continue;
126
127
128 if (!ghostAcc.isAvailable(*jet)) {
130 continue;
131 }
132
133
134 const std::vector<ElementLink<xAOD::IParticleContainer>>& ghostLinks = ghostAcc(*jet);
135
137
138
139 for (const auto& link : ghostLinks) {
140 if (!link.isValid()) continue;
141
142 int index = link.index();
143 if (index < 0) {
145 continue;
146 }
147
148 if (index < maskSize) {
150 nGhostLinks++;
151 const xAOD::IParticle* ghostObj = *link;
152 if (ghostObj) {
154 <<
", eta=" << ghostObj->
eta());
155 }
156 }
157 }
158 }
159
160 size_t nKept = std::count(
mask.begin(),
mask.end(),
true);
161 ATH_MSG_DEBUG(
"Found " << nGhostLinks <<
" ghost links from selected jets");
163 << nKept << " out of " << nObjects << " objects");
164
165 ghostContainer.keep(mask);
166
167 return StatusCode::SUCCESS;
168}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
StringProperty m_selectionString
SG::ThinningHandleKey< xAOD::IParticleContainer > m_ghostContainerKey
StringProperty m_ghostName
SG::ReadHandleKey< xAOD::JetContainer > m_jetSGKey
SG::ConstAccessor< T, ALLOC > ConstAccessor
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
virtual double pt() const =0
The transverse momentum ( ) of the particle.