84{
85
87
88 static const SG::AuxElement::ConstAccessor<char> aidCut(
m_idCut);
89
90
95 for (const auto* vertex : *vtxC) {
98 break;
99 }
100 }
101 }
102
103
104 SG::ReadHandle<xAOD::ElectronContainer> inputElectrons{
m_containerName,
105 ctx };
107
108 if (!eleC) {
111 return StatusCode::FAILURE;
112 }
113 if (!pvtx) {
114 ATH_MSG_DEBUG(
"No primary vertex found. Setting default values.");
116 dh.drv(*iele) = -1;
117 dh.dphiv(*iele) = -1;
118 dh.dmee(*iele) = -1;
119 dh.dmeeVtx(*iele) = -1;
120 dh.dsep(*iele) = -1;
121 dh.dambi(*iele) = -1;
122 dh.dtrv(*iele) = -1;
123 dh.dtpv(*iele) = -1;
124 dh.dtzv(*iele) = -1;
125 }
126 return StatusCode::SUCCESS;
127 }
128 ATH_MSG_DEBUG(
"Pvx z = " << pvtx->z() <<
", number of electrons "
129 << eleC->size());
130
131
132 SG::ReadHandle<xAOD::TrackParticleContainer> inputTrackParticles{
134 };
136
137 std::set<const xAOD::TrackParticle*> alreadyStored;
138 std::set<const xAOD::TrackParticle*> eleIDtpStored, eleGSFtpStored;
139 auto closeByTracks =
140 std::make_unique<ConstDataVector<xAOD::TrackParticleContainer>>(
142
143 for (const auto* ele : *eleC) {
144
145 dh.dambi(*ele) = -1;
146
147
149 m_idCut.empty() || !aidCut.isAvailable(*ele) || !aidCut(*ele))
150 continue;
151
152
154 eleGSFtpStored.insert(eleGSFtp);
155
158 eleIDtpStored.insert(eleIDtp);
159
160
161 for (const auto* tp : *idtpC) {
162
163
164 if (tp == eleIDtp) {
165 closeByTracks->push_back(tp);
166 alreadyStored.insert(tp);
167 continue;
168 }
169
170
171 if (alreadyStored.find(tp) != alreadyStored.end())
172 continue;
173
175
176
177
178
179 double dR = eleIDtp->
p4().DeltaR(tp->p4());
180 double dz = std::abs(eleIDtp->
z0() - tp->z0()) *
sin(eleIDtp->
theta());
181 if (dR >= 0.3 || dz >=
m_dzCut)
182 continue;
183
184
186 continue;
187
188 alreadyStored.insert(tp);
189
190 closeByTracks->push_back(tp);
191 }
192 }
193
194 if (closeByTracks->empty())
195 return StatusCode::SUCCESS;
196
197 if (msgLvl(MSG::DEBUG)) {
198 SG::ReadHandle<xAOD::TrackParticleContainer> tpCReadHandle{
m_tpCName,
199 ctx };
201
203 << idtpC->size() << " , number of selected close-by tracks "
204 << closeByTracks->size() << " , number of GSF tracks "
206 for (const auto* trk : eleIDtpStored)
208 << trk << " pt = " << trk->pt() * 1e-3
209 << " eta = " << trk->eta() << " phi = " << trk->phi()
211 for (const auto* trk : eleGSFtpStored)
213 << trk << " pt = " << trk->pt() * 1e-3
214 << " eta = " << trk->eta() << " phi = " << trk->phi()
218 << trk << " pt = " << trk->pt() * 1e-3
219 << " eta = " << trk->eta() << " phi = " << trk->phi()
221 }
222
223 for (const auto* ele : *eleC) {
224
225
227 m_idCut.empty() || !aidCut.isAvailable(*ele) || !aidCut(*ele))
228 continue;
229
230
232 ATH_MSG_ERROR(
"Cannot decorate the electron with the simple info");
233 return StatusCode::FAILURE;
234 }
235
236 }
237
238 return StatusCode::SUCCESS;
239}
#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".