CMS 3D CMS Logo

LowPtGsfElectronFeatures.cc
Go to the documentation of this file.
9 #include "TVector3.h"
10 #include <algorithm>
11 
12 namespace lowptgsfeleid {
13 
14  std::vector<float> features_V1(
15  reco::GsfElectron const& ele, float rho, float unbiased, float field_z, const reco::Track* trk) {
16  float eid_rho = -999.;
17  float eid_sc_eta = -999.;
18  float eid_shape_full5x5_r9 = -999.;
19  float eid_sc_etaWidth = -999.;
20  float eid_sc_phiWidth = -999.;
21  float eid_shape_full5x5_HoverE = -999.;
22  float eid_trk_nhits = -999.;
23  float eid_trk_chi2red = -999.;
24  float eid_gsf_chi2red = -999.;
25  float eid_brem_frac = -999.;
26  float eid_gsf_nhits = -999.;
27  float eid_match_SC_EoverP = -999.;
28  float eid_match_eclu_EoverP = -999.;
29  float eid_match_SC_dEta = -999.;
30  float eid_match_SC_dPhi = -999.;
31  float eid_match_seed_dEta = -999.;
32  float eid_sc_E = -999.;
33  float eid_trk_p = -999.;
34  float gsf_mode_p = -999.;
35  float core_shFracHits = -999.;
36  float gsf_bdtout1 = -999.;
37  float gsf_dr = -999.;
38  float trk_dr = -999.;
39  float sc_Nclus = -999.;
40  float sc_clus1_nxtal = -999.;
41  float sc_clus1_dphi = -999.;
42  float sc_clus2_dphi = -999.;
43  float sc_clus1_deta = -999.;
44  float sc_clus2_deta = -999.;
45  float sc_clus1_E = -999.;
46  float sc_clus2_E = -999.;
47  float sc_clus1_E_ov_p = -999.;
48  float sc_clus2_E_ov_p = -999.;
49 
50  // KF tracks
51  if (trk != nullptr || (ele.core().isNonnull() && ele.closestCtfTrackRef().isNonnull())) {
52  const reco::Track* tk = trk ? trk : &*ele.closestCtfTrackRef();
53  eid_trk_p = tk->p();
54  eid_trk_nhits = tk->found();
55  eid_trk_chi2red = tk->normalizedChi2();
56  TVector3 trkTV3(0, 0, 0);
57  trkTV3.SetPtEtaPhi(tk->pt(), tk->eta(), tk->phi());
58  TVector3 eleTV3(0, 0, 0);
59  eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi());
60  trk_dr = reco::deltaR(*tk, ele);
61  }
62 
63  // GSF tracks
64  if (ele.core().isNonnull()) {
66  if (gsf.isNonnull()) {
67  gsf_mode_p = gsf->pMode();
68  eid_gsf_nhits = (float)gsf->found();
69  eid_gsf_chi2red = gsf->normalizedChi2();
70  TVector3 gsfTV3(0, 0, 0);
71  gsfTV3.SetPtEtaPhi(gsf->ptMode(), gsf->etaMode(), gsf->phiMode());
72  TVector3 eleTV3(0, 0, 0);
73  eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi());
74  gsf_dr = eleTV3.DeltaR(gsfTV3);
75  }
76  }
77 
78  // Super clusters
79  if (ele.core().isNonnull()) {
81  if (sc.isNonnull()) {
82  eid_sc_E = sc->energy();
83  eid_sc_eta = sc->eta();
84  eid_sc_etaWidth = sc->etaWidth();
85  eid_sc_phiWidth = sc->phiWidth();
86  sc_Nclus = sc->clustersSize();
87  }
88  }
89 
90  // Track-cluster matching
91  eid_match_seed_dEta = ele.deltaEtaSeedClusterTrackAtCalo();
92  eid_match_eclu_EoverP = (1. / ele.ecalEnergy()) - (1. / ele.p());
93  eid_match_SC_EoverP = ele.eSuperClusterOverP();
94  eid_match_SC_dEta = ele.deltaEtaSuperClusterTrackAtVtx();
95  eid_match_SC_dPhi = ele.deltaPhiSuperClusterTrackAtVtx();
96 
97  // Shower shape vars
98  eid_shape_full5x5_HoverE = ele.full5x5_hcalOverEcal();
99  eid_shape_full5x5_r9 = ele.full5x5_r9();
100 
101  // Misc
102  eid_rho = rho;
103 
104  eid_brem_frac = ele.fbrem();
105  core_shFracHits = ele.shFracInnerHits();
106 
107  // Unbiased BDT from ElectronSeed
108  gsf_bdtout1 = unbiased;
109 
110  // Clusters
111  if (ele.core().isNonnull()) {
113  if (gsf.isNonnull()) {
115  if (sc.isNonnull()) {
116  // Propagate electron track to ECAL surface
117  double mass2 = 0.000511 * 0.000511;
118  float p2 = pow(gsf->p(), 2);
119  float energy = sqrt(mass2 + p2);
120  XYZTLorentzVector mom = XYZTLorentzVector(gsf->px(), gsf->py(), gsf->pz(), energy);
121  XYZTLorentzVector pos = XYZTLorentzVector(gsf->vx(), gsf->vy(), gsf->vz(), 0.);
122  BaseParticlePropagator propagator(RawParticle(mom, pos, gsf->charge()), 0, 0, field_z);
123 
124  propagator.propagateToEcalEntrance(true); // true only first half loop , false more than one loop
125  bool reach_ECAL = propagator.getSuccess(); // 0 does not reach ECAL, 1 yes barrel, 2 yes endcaps
126  // ECAL entry point for track
127  GlobalPoint ecal_pos(propagator.particle().x(), propagator.particle().y(), propagator.particle().z());
128 
129  // Track-cluster matching for most energetic clusters
130  sc_clus1_nxtal = -999;
131  sc_clus1_dphi = -999.;
132  sc_clus2_dphi = -999.;
133  sc_clus1_deta = -999.;
134  sc_clus2_deta = -999.;
135  sc_clus1_E = -999.;
136  sc_clus2_E = -999.;
137  sc_clus1_E_ov_p = -999.;
138  sc_clus2_E_ov_p = -999.;
140  *gsf,
141  reach_ECAL,
142  ecal_pos,
143  sc_clus1_nxtal,
144  sc_clus1_dphi,
145  sc_clus2_dphi,
146  sc_clus1_deta,
147  sc_clus2_deta,
148  sc_clus1_E,
149  sc_clus2_E,
150  sc_clus1_E_ov_p,
151  sc_clus2_E_ov_p);
152  sc_clus1_nxtal = (int)sc_clus1_nxtal;
153 
154  } // sc.isNonnull()
155  } // gsf.isNonnull()
156  } // clusters
157 
158  // Out-of-range
159  eid_rho = std::clamp(eid_rho, 0.f, 100.f);
160  eid_sc_eta = std::clamp(eid_sc_eta, -5.f, 5.f);
161  eid_shape_full5x5_r9 = std::clamp(eid_shape_full5x5_r9, 0.f, 2.f);
162  eid_sc_etaWidth = std::clamp(eid_sc_etaWidth, 0.f, 3.14f);
163  eid_sc_phiWidth = std::clamp(eid_sc_phiWidth, 0.f, 3.14f);
164  eid_shape_full5x5_HoverE = std::clamp(eid_shape_full5x5_HoverE, 0.f, 50.f);
165  eid_trk_nhits = std::clamp(eid_trk_nhits, -1.f, 50.f);
166  eid_trk_chi2red = std::clamp(eid_trk_chi2red, -1.f, 50.f);
167  eid_gsf_chi2red = std::clamp(eid_gsf_chi2red, -1.f, 100.f);
168  if (eid_brem_frac < 0.)
169  eid_brem_frac = -1.; //
170  if (eid_brem_frac > 1.)
171  eid_brem_frac = 1.; //
172  eid_gsf_nhits = std::clamp(eid_gsf_nhits, -1.f, 50.f);
173  eid_match_SC_EoverP = std::clamp(eid_match_SC_EoverP, 0.f, 100.f);
174  eid_match_eclu_EoverP = std::clamp(eid_match_eclu_EoverP, -1.f, 1.f);
175  eid_match_SC_dEta = std::clamp(eid_match_SC_dEta, -10.f, 10.f);
176  eid_match_SC_dPhi = std::clamp(eid_match_SC_dPhi, -3.14f, 3.14f);
177  eid_match_seed_dEta = std::clamp(eid_match_seed_dEta, -10.f, 10.f);
178  eid_sc_E = std::clamp(eid_sc_E, 0.f, 1000.f);
179  eid_trk_p = std::clamp(eid_trk_p, -1.f, 1000.f);
180  gsf_mode_p = std::clamp(gsf_mode_p, 0.f, 1000.f);
181  core_shFracHits = std::clamp(core_shFracHits, 0.f, 1.f);
182  gsf_bdtout1 = std::clamp(gsf_bdtout1, -20.f, 20.f);
183  if (gsf_dr < 0.)
184  gsf_dr = 5.; //
185  if (gsf_dr > 5.)
186  gsf_dr = 5.; //
187  if (trk_dr < 0.)
188  trk_dr = 5.; //
189  if (trk_dr > 5.)
190  trk_dr = 5.; //
191  sc_Nclus = std::clamp(sc_Nclus, 0.f, 20.f);
192  sc_clus1_nxtal = std::clamp(sc_clus1_nxtal, 0.f, 100.f);
193  sc_clus1_dphi = std::clamp(sc_clus1_dphi, -3.14f, 3.14f);
194  sc_clus2_dphi = std::clamp(sc_clus2_dphi, -3.14f, 3.14f);
195  sc_clus1_deta = std::clamp(sc_clus1_deta, -5.f, 5.f);
196  sc_clus2_deta = std::clamp(sc_clus2_deta, -5.f, 5.f);
197  sc_clus1_E = std::clamp(sc_clus1_E, 0.f, 1000.f);
198  sc_clus2_E = std::clamp(sc_clus2_E, 0.f, 1000.f);
199  if (sc_clus1_E_ov_p < 0.)
200  sc_clus1_E_ov_p = -1.; //
201  if (sc_clus2_E_ov_p < 0.)
202  sc_clus2_E_ov_p = -1.; //
203 
204  // Set contents of vector
205  std::vector<float> output = {eid_rho,
206  eid_sc_eta,
207  eid_shape_full5x5_r9,
208  eid_sc_etaWidth,
209  eid_sc_phiWidth,
210  eid_shape_full5x5_HoverE,
211  eid_trk_nhits,
212  eid_trk_chi2red,
213  eid_gsf_chi2red,
214  eid_brem_frac,
215  eid_gsf_nhits,
216  eid_match_SC_EoverP,
217  eid_match_eclu_EoverP,
218  eid_match_SC_dEta,
219  eid_match_SC_dPhi,
220  eid_match_seed_dEta,
221  eid_sc_E,
222  eid_trk_p,
223  gsf_mode_p,
224  core_shFracHits,
225  gsf_bdtout1,
226  gsf_dr,
227  trk_dr,
228  sc_Nclus,
229  sc_clus1_nxtal,
230  sc_clus1_dphi,
231  sc_clus2_dphi,
232  sc_clus1_deta,
233  sc_clus2_deta,
234  sc_clus1_E,
235  sc_clus2_E,
236  sc_clus1_E_ov_p,
237  sc_clus2_E_ov_p};
238  return output;
239  }
240 
242  // feature list for original models (2019Aug07 and earlier)
243  std::vector<float> features_V0(reco::GsfElectron const& ele, float rho, float unbiased) {
244  float eid_rho = -999.;
245  float eid_sc_eta = -999.;
246  float eid_shape_full5x5_r9 = -999.;
247  float eid_sc_etaWidth = -999.;
248  float eid_sc_phiWidth = -999.;
249  float eid_shape_full5x5_HoverE = -999.;
250  float eid_trk_nhits = -999.;
251  float eid_trk_chi2red = -999.;
252  float eid_gsf_chi2red = -999.;
253  float eid_brem_frac = -999.;
254  float eid_gsf_nhits = -999.;
255  float eid_match_SC_EoverP = -999.;
256  float eid_match_eclu_EoverP = -999.;
257  float eid_match_SC_dEta = -999.;
258  float eid_match_SC_dPhi = -999.;
259  float eid_match_seed_dEta = -999.;
260  float eid_sc_E = -999.;
261  float eid_trk_p = -999.;
262  float gsf_mode_p = -999.;
263  float core_shFracHits = -999.;
264  float gsf_bdtout1 = -999.;
265  float gsf_dr = -999.;
266  float trk_dr = -999.;
267  float sc_Nclus = -999.;
268  float sc_clus1_nxtal = -999.;
269  float sc_clus1_dphi = -999.;
270  float sc_clus2_dphi = -999.;
271  float sc_clus1_deta = -999.;
272  float sc_clus2_deta = -999.;
273  float sc_clus1_E = -999.;
274  float sc_clus2_E = -999.;
275  float sc_clus1_E_ov_p = -999.;
276  float sc_clus2_E_ov_p = -999.;
277 
278  // KF tracks
279  if (ele.core().isNonnull()) {
280  const auto& trk = ele.closestCtfTrackRef(); // reco::TrackRef
281  if (trk.isNonnull()) {
282  eid_trk_p = (float)trk->p();
283  eid_trk_nhits = (float)trk->found();
284  eid_trk_chi2red = (float)trk->normalizedChi2();
285  TVector3 trkTV3(0, 0, 0);
286  trkTV3.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi());
287  TVector3 eleTV3(0, 0, 0);
288  eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi());
289  trk_dr = eleTV3.DeltaR(trkTV3);
290  }
291  }
292 
293  // GSF tracks
294  if (ele.core().isNonnull()) {
295  const auto& gsf = ele.core()->gsfTrack(); // reco::GsfTrackRef
296  if (gsf.isNonnull()) {
297  gsf_mode_p = gsf->pMode();
298  eid_gsf_nhits = (float)gsf->found();
299  eid_gsf_chi2red = gsf->normalizedChi2();
300  TVector3 gsfTV3(0, 0, 0);
301  gsfTV3.SetPtEtaPhi(gsf->ptMode(), gsf->etaMode(), gsf->phiMode());
302  TVector3 eleTV3(0, 0, 0);
303  eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi());
304  gsf_dr = eleTV3.DeltaR(gsfTV3);
305  }
306  }
307 
308  // Super clusters
309  if (ele.core().isNonnull()) {
310  const auto& sc = ele.core()->superCluster(); // reco::SuperClusterRef
311  if (sc.isNonnull()) {
312  eid_sc_E = sc->energy();
313  eid_sc_eta = sc->eta();
314  eid_sc_etaWidth = sc->etaWidth();
315  eid_sc_phiWidth = sc->phiWidth();
316  sc_Nclus = (float)sc->clustersSize();
317  }
318  }
319 
320  // Track-cluster matching
321  eid_match_seed_dEta = ele.deltaEtaSeedClusterTrackAtCalo();
322  eid_match_eclu_EoverP = (1. / ele.ecalEnergy()) - (1. / ele.p());
323  eid_match_SC_EoverP = ele.eSuperClusterOverP();
324  eid_match_SC_dEta = ele.deltaEtaSuperClusterTrackAtVtx();
325  eid_match_SC_dPhi = ele.deltaPhiSuperClusterTrackAtVtx();
326 
327  // Shower shape vars
328  eid_shape_full5x5_HoverE = ele.full5x5_hcalOverEcal();
329  eid_shape_full5x5_r9 = ele.full5x5_r9();
330 
331  // Misc
332  eid_rho = rho;
333 
334  eid_brem_frac = ele.fbrem();
335  core_shFracHits = (float)ele.shFracInnerHits();
336 
337  // Unbiased BDT from ElectronSeed
338  gsf_bdtout1 = unbiased;
339 
340  // Clusters
341  if (ele.core().isNonnull()) {
342  const auto& gsf = ele.core()->gsfTrack(); // reco::GsfTrackRef
343  if (gsf.isNonnull()) {
344  const auto& sc = ele.core()->superCluster(); // reco::SuperClusterRef
345  if (sc.isNonnull()) {
346  // Propagate electron track to ECAL surface
347  double mass2 = 0.000511 * 0.000511;
348  float p2 = pow(gsf->p(), 2);
349  float energy = sqrt(mass2 + p2);
350  math::XYZTLorentzVector mom = math::XYZTLorentzVector(gsf->px(), gsf->py(), gsf->pz(), energy);
351  math::XYZTLorentzVector pos = math::XYZTLorentzVector(gsf->vx(), gsf->vy(), gsf->vz(), 0.);
352  float field_z = 3.8;
353  BaseParticlePropagator mypart(RawParticle(mom, pos, gsf->charge()), 0, 0, field_z);
354  mypart.propagateToEcalEntrance(true); // true only first half loop , false more than one loop
355  bool reach_ECAL = mypart.getSuccess(); // 0 does not reach ECAL, 1 yes barrel, 2 yes endcaps
356 
357  // ECAL entry point for track
358  GlobalPoint ecal_pos(
359  mypart.particle().vertex().x(), mypart.particle().vertex().y(), mypart.particle().vertex().z());
360 
361  // Track-cluster matching for most energetic clusters
362  sc_clus1_nxtal = -999.;
363  sc_clus1_dphi = -999.;
364  sc_clus2_dphi = -999.;
365  sc_clus1_deta = -999.;
366  sc_clus2_deta = -999.;
367  sc_clus1_E = -999.;
368  sc_clus2_E = -999.;
369  sc_clus1_E_ov_p = -999.;
370  sc_clus2_E_ov_p = -999.;
372  *gsf,
373  reach_ECAL,
374  ecal_pos,
375  sc_clus1_nxtal,
376  sc_clus1_dphi,
377  sc_clus2_dphi,
378  sc_clus1_deta,
379  sc_clus2_deta,
380  sc_clus1_E,
381  sc_clus2_E,
382  sc_clus1_E_ov_p,
383  sc_clus2_E_ov_p);
384 
385  } // sc.isNonnull()
386  } // gsf.isNonnull()
387  } // clusters
388 
389  // Out-of-range
390  eid_sc_eta = std::clamp(eid_sc_eta, -5.f, 5.f);
391  eid_shape_full5x5_r9 = std::clamp(eid_shape_full5x5_r9, 0.f, 2.f);
392  eid_sc_etaWidth = std::clamp(eid_sc_etaWidth, 0.f, 3.14f);
393  eid_sc_phiWidth = std::clamp(eid_sc_phiWidth, 0.f, 3.14f);
394  eid_shape_full5x5_HoverE = std::clamp(eid_shape_full5x5_HoverE, 0.f, 50.f);
395  eid_trk_nhits = std::clamp(eid_trk_nhits, -1.f, 50.f);
396  eid_trk_chi2red = std::clamp(eid_trk_chi2red, -1.f, 50.f);
397  eid_gsf_chi2red = std::clamp(eid_gsf_chi2red, -1.f, 100.f);
398  if (eid_brem_frac < 0.)
399  eid_brem_frac = -1.; //
400  if (eid_brem_frac > 1.)
401  eid_brem_frac = 1.; //
402  eid_gsf_nhits = std::clamp(eid_gsf_nhits, -1.f, 50.f);
403  eid_match_SC_EoverP = std::clamp(eid_match_SC_EoverP, 0.f, 100.f);
404  eid_match_eclu_EoverP = std::clamp(eid_match_eclu_EoverP, -1.f, 1.f);
405  eid_match_SC_dEta = std::clamp(eid_match_SC_dEta, -10.f, 10.f);
406  eid_match_SC_dPhi = std::clamp(eid_match_SC_dPhi, -3.14f, 3.14f);
407  eid_match_seed_dEta = std::clamp(eid_match_seed_dEta, -10.f, 10.f);
408  eid_sc_E = std::clamp(eid_sc_E, 0.f, 1000.f);
409  eid_trk_p = std::clamp(eid_trk_p, -1.f, 1000.f);
410  gsf_mode_p = std::clamp(gsf_mode_p, 0.f, 1000.f);
411  core_shFracHits = std::clamp(core_shFracHits, 0.f, 1.f);
412  gsf_bdtout1 = std::clamp(gsf_bdtout1, -20.f, 20.f);
413  if (gsf_dr < 0.)
414  gsf_dr = 5.; //
415  if (gsf_dr > 5.)
416  gsf_dr = 5.; //
417  if (trk_dr < 0.)
418  trk_dr = 5.; //
419  if (trk_dr > 5.)
420  trk_dr = 5.; //
421  sc_Nclus = std::clamp(sc_Nclus, 0.f, 20.f);
422  sc_clus1_nxtal = std::clamp(sc_clus1_nxtal, 0.f, 100.f);
423  if (sc_clus1_dphi < -3.14)
424  sc_clus1_dphi = -5.; //
425  if (sc_clus1_dphi > 3.14)
426  sc_clus1_dphi = 5.; //
427  if (sc_clus2_dphi < -3.14)
428  sc_clus2_dphi = -5.; //
429  if (sc_clus2_dphi > 3.14)
430  sc_clus2_dphi = 5.; //
431  sc_clus1_deta = std::clamp(sc_clus1_deta, -5.f, 5.f);
432  sc_clus2_deta = std::clamp(sc_clus2_deta, -5.f, 5.f);
433  sc_clus1_E = std::clamp(sc_clus1_E, 0.f, 1000.f);
434  sc_clus2_E = std::clamp(sc_clus2_E, 0.f, 1000.f);
435  if (sc_clus1_E_ov_p < 0.)
436  sc_clus1_E_ov_p = -1.; //
437  if (sc_clus2_E_ov_p < 0.)
438  sc_clus2_E_ov_p = -1.; //
439 
440  // Set contents of vector
441  std::vector<float> output = {eid_rho,
442  eid_sc_eta,
443  eid_shape_full5x5_r9,
444  eid_sc_etaWidth,
445  eid_sc_phiWidth,
446  eid_shape_full5x5_HoverE,
447  eid_trk_nhits,
448  eid_trk_chi2red,
449  eid_gsf_chi2red,
450  eid_brem_frac,
451  eid_gsf_nhits,
452  eid_match_SC_EoverP,
453  eid_match_eclu_EoverP,
454  eid_match_SC_dEta,
455  eid_match_SC_dPhi,
456  eid_match_seed_dEta,
457  eid_sc_E,
458  eid_trk_p,
459  gsf_mode_p,
460  core_shFracHits,
461  gsf_bdtout1,
462  gsf_dr,
463  trk_dr,
464  sc_Nclus,
465  sc_clus1_nxtal,
466  sc_clus1_dphi,
467  sc_clus2_dphi,
468  sc_clus1_deta,
469  sc_clus2_deta,
470  sc_clus1_E,
471  sc_clus2_E,
472  sc_clus1_E_ov_p,
473  sc_clus2_E_ov_p};
474  return output;
475  }
476 
478  // Find most energetic clusters
480  reco::SuperCluster const& sc, int& clusNum, float& maxEne1, float& maxEne2, int& i1, int& i2) {
481  if (sc.clustersSize() > 0 && sc.clustersBegin() != sc.clustersEnd()) {
482  for (auto const& cluster : sc.clusters()) {
483  if (cluster->energy() > maxEne1) {
484  maxEne1 = cluster->energy();
485  i1 = clusNum;
486  }
487  clusNum++;
488  }
489  if (sc.clustersSize() > 1) {
490  clusNum = 0;
491  for (auto const& cluster : sc.clusters()) {
492  if (clusNum != i1) {
493  if (cluster->energy() > maxEne2) {
494  maxEne2 = cluster->energy();
495  i2 = clusNum;
496  }
497  }
498  clusNum++;
499  }
500  }
501  } // loop over clusters
502  }
503 
505  // Track-cluster matching for most energetic clusters
507  reco::GsfTrack const& gsf,
508  bool const& reach_ECAL,
509  GlobalPoint const& ecal_pos,
510  float& sc_clus1_nxtal,
511  float& sc_clus1_dphi,
512  float& sc_clus2_dphi,
513  float& sc_clus1_deta,
514  float& sc_clus2_deta,
515  float& sc_clus1_E,
516  float& sc_clus2_E,
517  float& sc_clus1_E_ov_p,
518  float& sc_clus2_E_ov_p) {
519  // Iterate through ECAL clusters and sort in energy
520  int clusNum = 0;
521  float maxEne1 = -1;
522  float maxEne2 = -1;
523  int i1 = -1;
524  int i2 = -1;
525  findEnergeticClusters(sc, clusNum, maxEne1, maxEne2, i1, i2);
526 
527  // track-clusters match
528  clusNum = 0;
529  if (sc.clustersSize() > 0 && sc.clustersBegin() != sc.clustersEnd()) {
530  for (auto const& cluster : sc.clusters()) {
531  float deta = ecal_pos.eta() - cluster->eta();
532  float dphi = reco::deltaPhi(ecal_pos.phi(), cluster->phi());
533  if (clusNum == i1) {
534  sc_clus1_E = cluster->energy();
535  if (gsf.pMode() > 0)
536  sc_clus1_E_ov_p = cluster->energy() / gsf.pMode();
537  sc_clus1_nxtal = (float)cluster->size();
538  if (reach_ECAL > 0) {
539  sc_clus1_deta = deta;
540  sc_clus1_dphi = dphi;
541  }
542  } else if (clusNum == i2) {
543  sc_clus2_E = cluster->energy();
544  if (gsf.pMode() > 0)
545  sc_clus2_E_ov_p = cluster->energy() / gsf.pMode();
546  if (reach_ECAL > 0) {
547  sc_clus2_deta = deta;
548  sc_clus2_dphi = dphi;
549  }
550  }
551  clusNum++;
552  }
553  }
554  }
555 
556 } // namespace lowptgsfeleid
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
double p() const
momentum vector magnitude
Definition: TrackBase.h:654
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:186
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:205
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
void findEnergeticClusters(reco::SuperCluster const &, int &, float &, float &, int &, int &)
double eta() const final
momentum pseudorapidity
double pMode() const
momentum vector magnitude from mode
Definition: GsfTrack.h:47
float eSuperClusterOverP() const
Definition: GsfElectron.h:249
double y() const
y of vertex
Definition: RawParticle.h:302
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:600
double z() const
z of vertex
Definition: RawParticle.h:303
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:684
double pt() const final
transverse momentum
float fbrem() const
Definition: GsfElectron.h:772
RawParticle const & particle() const
The particle being propagated.
const CaloClusterPtrVector & clusters() const
const access to the cluster list itself
Definition: SuperCluster.h:69
void trackClusterMatching(reco::SuperCluster const &, reco::GsfTrack const &, bool const &, GlobalPoint const &, float &, float &, float &, float &, float &, float &, float &, float &, float &)
std::vector< float > features_V1(reco::GsfElectron const &ele, float rho, float unbiased, float field_z, const reco::Track *trk=0)
double x() const
x of vertex
Definition: RawParticle.h:301
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:253
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:690
T sqrt(T t)
Definition: SSEVec.h:18
double pt() const
track transverse momentum
Definition: TrackBase.h:660
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:256
float energy() const
Energy. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:104
double f[11][100]
std::vector< float > features_V0(reco::GsfElectron const &ele, float rho, float unbiased)
double p2[4]
Definition: TauolaWrapper.h:90
bool propagateToEcalEntrance(bool first=true)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:339
float shFracInnerHits() const
Definition: GsfElectron.h:204
double p() const final
magnitude of momentum vector
size_t clustersSize() const
number of BasicCluster constituents
Definition: SuperCluster.h:87
float full5x5_hcalOverEcal() const
Definition: GsfElectron.h:470
float ecalEnergy() const
Definition: GsfElectron.h:860
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
float full5x5_r9() const
Definition: GsfElectron.h:467
T eta() const
Definition: PV3DBase.h:76
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:254
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:199
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
double phi() const final
momentum azimuthal angle
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:27
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.
Definition: SimCluster.h:148