248{
249
251
252
255
256
257
258 bool useGSF = false;
259
261
263 <<
" phi = " << ele->
phi() <<
" GSF trk ptr = "
264 << eleGSFtrkP << " ID trk ptr " << eleIDtrkP);
265
269 double tpvr = -1, tpvp = 9e9, tpvz = 9e9;
271 truthEl->
prodVtx() !=
nullptr) {
275 }
276 dh.dtrv(*ele) = tpvr;
277 dh.dtpv(*ele) = tpvp;
278 dh.dtzv(*ele) = tpvz;
279 }
280
281
282
284 double detaMin = 9e9;
286
287 if (
tp->charge() * eletrkP->
charge() > 0)
288 continue;
289
290
291 double dR = eletrkP->
p4().DeltaR(
tp->p4());
292 double dz = std::abs(eletrkP->
z0() -
tp->z0()) *
sin(eletrkP->
theta());
293 if (dR >= 0.3 || dz >=
m_dzCut)
294 continue;
295
296 double deta = std::abs(eletrkP->
eta() -
tp->eta());
297 if (deta < detaMin) {
299 detaMin = deta;
300 }
301 }
302
305 double mee = -1.;
306 double meeAtVtx = -1.;
308 bool goodConv = false;
309
310 if (otrkP) {
311
312
313 TLorentzVector ep4;
315
316
317 TLorentzVector op4;
319
320
321 mee = (ep4 + op4).M();
322 op4.SetPhi(eletrkP->
phi());
323 meeAtVtx = (ep4 + op4).M();
324
325
326 std::vector<double> helix1, helix2;
327 helix1.resize(5);
328 helix2.resize(5);
329 helix(eletrkP, pvtx, helix1);
330 helix(otrkP, pvtx, helix2);
331
333 if (helix1[4] < helix2[4])
334 beta = TMath::PiOver2() - helix1[4];
335 else
336 beta = TMath::PiOver2() - helix2[4];
337
338 double phi1(helix1[4] + beta);
339 if (phi1 > TMath::TwoPi())
340 phi1 -= TMath::TwoPi();
341 if (phi1 < 0.)
342 phi1 += TMath::TwoPi();
343
344 double phi2(helix2[4] + beta);
345 if (phi2 > TMath::TwoPi())
346 phi2 -= TMath::TwoPi();
347 if (phi2 < 0.)
348 phi2 += TMath::TwoPi();
349
351 double r1 = 1 / (2. * std::abs(helix1[1]));
352
353 double charge1(1.);
354 if (helix1[1] < 0.)
355 charge1 = -1.;
356 double rcenter1(helix1[3] / charge1 + r1);
357 double phicenter1(phi1 + TMath::PiOver2() * charge1);
358
359 double x1 = rcenter1 *
cos(phicenter1);
360 double y1 = rcenter1 *
sin(phicenter1);
361
363 double r2 = 1 / (2. * std::abs(helix2[1]));
364
365 double charge2(1.);
366 if (helix2[1] < 0.)
367 charge2 = -1.;
368 double rcenter2(helix2[3] / charge2 + r2);
369 double phicenter2(phi2 + TMath::PiOver2() * charge2);
370
371 double x2 = rcenter2 *
cos(phicenter2);
372 double y2 = rcenter2 *
sin(phicenter2);
374
376 if (dx < 1e-9 && dx > 0.)
378 if (dx > -1e-9 && dx < 0.)
380 double slope((y1 - y2) / dx);
381 double b(y1 - slope * x1);
383 double d(sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
384
385 double separation =
d -
r1 -
r2;
386 double cpx1, cpx2;
387 if (x1 > x2) {
390 } else {
393 }
394
395 double temp1 = (cpx1 + cpx2) / 2;
396 double temp2 = slope * temp1 +
b;
397 double convX =
cos(beta) * temp1 +
sin(beta) * temp2;
398 double convY = -
sin(beta) * temp1 +
cos(beta) * temp2;
399
400 double dct(helix1[0] - helix2[0]);
401
404 goodConv = true;
406 pv = std::atan2(convY, convX);
407 rv = sqrt(convX * convX + convY * convY);
408 if (convX *
cos(eletrkP->
phi()) + convY *
sin(eletrkP->
phi()) < 0)
410 }
411 } else {
413 }
417 dh.dmeeVtx(*ele) = meeAtVtx;
421 else if (otrkP) {
424 else
426 }
427 return StatusCode::SUCCESS;
428}
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float phi() const
Vertex azimuthal angle.
float perp() const
Vertex transverse distance from the beam line.
bool isElectron(const T &p)
constexpr double electronMassInMeV
the mass of the electron (in MeV)
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any)
TruthParticle_v1 TruthParticle
Typedef to implementation.