89{
90
92
93 static const SG::ConstAccessor<char> aidCut(
m_idCut);
94
95
100 for (const auto* vertex : *vtxC) {
103 break;
104 }
105 }
106 }
107
108
109 SG::ReadHandle<xAOD::ElectronContainer> inputElectrons{
m_containerName,
110 ctx };
112
113 if (!eleC) {
116 return StatusCode::FAILURE;
117 }
118 if (!pvtx) {
119 ATH_MSG_DEBUG(
"No primary vertex found. Setting default values.");
121 dh.drv(*iele) = -1;
122 dh.dphiv(*iele) = -1;
123 dh.dmee(*iele) = -1;
124 dh.dmeeVtx(*iele) = -1;
125 dh.dsep(*iele) = -1;
126 dh.dambi(*iele) = -1;
127 dh.dtrv(*iele) = -1;
128 dh.dtpv(*iele) = -1;
129 dh.dtzv(*iele) = -1;
130 }
131 return StatusCode::SUCCESS;
132 }
133 ATH_MSG_DEBUG(
"Pvx z = " << pvtx->z() <<
", number of electrons "
134 << eleC->size());
135
136
137 SG::ReadHandle<xAOD::TrackParticleContainer> inputTrackParticles{
139 };
141
142 std::set<const xAOD::TrackParticle*> alreadyStored;
143 std::set<const xAOD::TrackParticle*> eleIDtpStored, eleGSFtpStored;
144 auto closeByTracks =
145 std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(
147
148 for (const auto* ele : *eleC) {
149
150 dh.dambi(*ele) = -1;
151
152
154 m_idCut.empty() || !aidCut.isAvailable(*ele) || !aidCut(*ele))
155 continue;
156
157
159 eleGSFtpStored.insert(eleGSFtp);
160
163 eleIDtpStored.insert(eleIDtp);
164
165
166 for (const auto* tp : *idtpC) {
167
168
169 if (tp == eleIDtp) {
170 closeByTracks->push_back(tp);
171 alreadyStored.insert(tp);
172 continue;
173 }
174
175
176 if (alreadyStored.find(tp) != alreadyStored.end())
177 continue;
178
180
181
182
183
184 double dR = eleIDtp->
p4().DeltaR(tp->p4());
185 double dz = std::abs(eleIDtp->
z0() - tp->z0()) * std::sin(eleIDtp->
theta());
186 if (dR >= 0.3 || dz >=
m_dzCut)
187 continue;
188
189
191 continue;
192
193 alreadyStored.insert(tp);
194
195 closeByTracks->push_back(tp);
196 }
197 }
198
199 if (closeByTracks->empty())
200 return StatusCode::SUCCESS;
201
202 if (msgLvl(MSG::DEBUG)) {
203 SG::ReadHandle<xAOD::TrackParticleContainer> tpCReadHandle{
m_tpCName,
204 ctx };
206
208 << idtpC->size() << " , number of selected close-by tracks "
209 << closeByTracks->size() << " , number of GSF tracks "
211 for (const auto* trk : eleIDtpStored)
213 << trk << " pt = " << trk->pt() * 1e-3
214 << " eta = " << trk->eta() << " phi = " << trk->phi()
216 for (const auto* trk : eleGSFtpStored)
218 << trk << " pt = " << trk->pt() * 1e-3
219 << " eta = " << trk->eta() << " phi = " << trk->phi()
223 << trk << " pt = " << trk->pt() * 1e-3
224 << " eta = " << trk->eta() << " phi = " << trk->phi()
226 }
227
228 for (const auto* ele : *eleC) {
229
230
232 m_idCut.empty() || !aidCut.isAvailable(*ele) || !aidCut(*ele))
233 continue;
234
235
237 ATH_MSG_ERROR(
"Cannot decorate the electron with the simple info");
238 return StatusCode::FAILURE;
239 }
240
241 }
242
243 return StatusCode::SUCCESS;
244}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
size_type size() const noexcept
Returns the number of elements in the collection.
const_pointer_type ptr()
Dereference the pointer.
float z0() const
Returns the parameter.
float theta() const
Returns the parameter, which has range 0 to .
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
std::size_t numberOfSiHits(const xAOD::TrackParticle *tp)
return the number of Si hits in the track particle
const xAOD::TrackParticle * getOriginalTrackParticle(const xAOD::Electron *el)
Helper function for getting the "Original" Track Particle (i.e before GSF) via the electron.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Electron_v1 Electron
Definition of the current "egamma version".