70 {
71
72
74 if (!
jets.isValid()) {
76 return StatusCode::FAILURE;
77 }
78
79
80 std::vector<const xAOD::Jet*> selectedJets;
81
83
84 std::vector<int>
entries = m_parser->evaluateAsVector();
87 return StatusCode::FAILURE;
88 }
89
90 for (
size_t i = 0;
i <
jets->size(); ++
i) {
92 selectedJets.push_back((*jets)[i]);
93 }
94 }
95 } else {
96
97 for (const auto* jet : *jets) {
98 selectedJets.push_back(jet);
99 }
100 }
101
102 ATH_MSG_DEBUG(
"Number of selected jets: " << selectedJets.size()
103 <<
" out of " <<
jets->size());
104
105
107
108 if (!ghostContainer.isValid()) {
110 return StatusCode::SUCCESS;
111 }
112
113 size_t nObjects = ghostContainer->size();
114 std::vector<bool>
mask(nObjects,
false);
116
117
118 SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::IParticleContainer>>> ghostAcc(
m_ghostName);
119
120 size_t nGhostLinks = 0;
121
122
123 for (const auto* jet : selectedJets) {
124 if (!jet) continue;
125
126
127 if (!ghostAcc.isAvailable(*jet)) {
129 continue;
130 }
131
132
133 const std::vector<ElementLink<xAOD::IParticleContainer>>& ghostLinks = ghostAcc(*jet);
134
136
137
138 for (const auto& link : ghostLinks) {
139 if (!
link.isValid())
continue;
140
142 if (index < 0) {
144 continue;
145 }
146
147 if (index < maskSize) {
149 nGhostLinks++;
150 const xAOD::IParticle* ghostObj = *
link;
151 if (ghostObj) {
153 <<
", eta=" << ghostObj->
eta());
154 }
155 }
156 }
157 }
158
159 size_t nKept = std::count(
mask.begin(),
mask.end(),
true);
160 ATH_MSG_DEBUG(
"Found " << nGhostLinks <<
" ghost links from selected jets");
162 << nKept << " out of " << nObjects << " objects");
163
164 ghostContainer.keep(mask);
165
166 return StatusCode::SUCCESS;
167}
#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
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
virtual double pt() const =0
The transverse momentum ( ) of the particle.
pointer & link(pointer p) const
Return a reference to the link for an element.