CMS 3D CMS Logo

Classes | Functions
lowptgsfeleid Namespace Reference

Classes

class  Features
 
class  HeavyObjectCache
 

Functions

std::vector< float > features_V0 (reco::GsfElectron const &ele, float rho, float unbiased)
 
std::vector< float > features_V1 (reco::GsfElectron const &ele, float rho, float unbiased, float field_z)
 
void findEnergeticClusters (reco::SuperCluster const &, int &, float &, float &, int &, int &)
 
void trackClusterMatching (reco::SuperCluster const &, reco::GsfTrack const &, bool const &, GlobalPoint const &, float &, float &, float &, float &, float &, float &, float &, float &, float &)
 

Function Documentation

std::vector< float > lowptgsfeleid::features_V0 ( reco::GsfElectron const &  ele,
float  rho,
float  unbiased 
)

Definition at line 243 of file LowPtGsfElectronFeatures.cc.

References reco::GsfElectron::closestCtfTrackRef(), reco::GsfElectron::core(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::ecalEnergy(), SimCluster::energy(), reco::GsfElectron::eSuperClusterOverP(), reco::LeafCandidate::eta(), SimCluster::eta(), f, reco::GsfElectron::fbrem(), objects.autophobj::float, reco::GsfElectron::full5x5_hcalOverEcal(), reco::GsfElectron::full5x5_r9(), BaseParticlePropagator::getSuccess(), ntupleEnum::gsf, edm::Ref< C, T, F >::isNonnull(), convertSQLitetoXML_cfg::output, reco::LeafCandidate::p(), p2, BaseParticlePropagator::particle(), reco::LeafCandidate::phi(), funct::pow(), BaseParticlePropagator::propagateToEcalEntrance(), reco::LeafCandidate::pt(), SimDataFormats::CaloAnalysis::sc, reco::GsfElectron::shFracInnerHits(), mathSSE::sqrt(), trackClusterMatching(), lowPtElectronProducer_cff::unbiased, and RawParticle::vertex().

Referenced by LowPtGsfElectronIDProducer::eval().

243  {
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  }
void trackClusterMatching(reco::SuperCluster const &, reco::GsfTrack const &, bool const &, GlobalPoint const &, float &, float &, float &, float &, float &, float &, float &, float &, float &)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
T sqrt(T t)
Definition: SSEVec.h:18
float energy() const
Energy. Note this is taken from the first SimTrack only.
Definition: SimCluster.h:104
double f[11][100]
double p2[4]
Definition: TauolaWrapper.h:90
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.
Definition: SimCluster.h:148
std::vector< float > lowptgsfeleid::features_V1 ( reco::GsfElectron const &  ele,
float  rho,
float  unbiased,
float  field_z 
)

Definition at line 13 of file LowPtGsfElectronFeatures.cc.

References reco::GsfElectron::closestCtfTrackRef(), reco::GsfElectron::core(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::ecalEnergy(), reco::GsfElectron::eSuperClusterOverP(), reco::LeafCandidate::eta(), f, reco::GsfElectron::fbrem(), objects.autophobj::float, reco::GsfElectron::full5x5_hcalOverEcal(), reco::GsfElectron::full5x5_r9(), BaseParticlePropagator::getSuccess(), ntupleEnum::gsf, createfilelist::int, edm::Ref< C, T, F >::isNonnull(), convertSQLitetoXML_cfg::output, reco::LeafCandidate::p(), p2, BaseParticlePropagator::particle(), reco::LeafCandidate::phi(), funct::pow(), BaseParticlePropagator::propagateToEcalEntrance(), PhotonConversionTrajectorySeedProducerFromQuadruplets_cfi::propagator, reco::LeafCandidate::pt(), SimDataFormats::CaloAnalysis::sc, reco::GsfElectron::shFracInnerHits(), mathSSE::sqrt(), trackClusterMatching(), lowPtElectronProducer_cff::unbiased, RawParticle::x(), RawParticle::y(), and RawParticle::z().

Referenced by LowPtGsfElectronIDProducer::eval().

13  {
14  float eid_rho = -999.;
15  float eid_sc_eta = -999.;
16  float eid_shape_full5x5_r9 = -999.;
17  float eid_sc_etaWidth = -999.;
18  float eid_sc_phiWidth = -999.;
19  float eid_shape_full5x5_HoverE = -999.;
20  float eid_trk_nhits = -999.;
21  float eid_trk_chi2red = -999.;
22  float eid_gsf_chi2red = -999.;
23  float eid_brem_frac = -999.;
24  float eid_gsf_nhits = -999.;
25  float eid_match_SC_EoverP = -999.;
26  float eid_match_eclu_EoverP = -999.;
27  float eid_match_SC_dEta = -999.;
28  float eid_match_SC_dPhi = -999.;
29  float eid_match_seed_dEta = -999.;
30  float eid_sc_E = -999.;
31  float eid_trk_p = -999.;
32  float gsf_mode_p = -999.;
33  float core_shFracHits = -999.;
34  float gsf_bdtout1 = -999.;
35  float gsf_dr = -999.;
36  float trk_dr = -999.;
37  float sc_Nclus = -999.;
38  float sc_clus1_nxtal = -999.;
39  float sc_clus1_dphi = -999.;
40  float sc_clus2_dphi = -999.;
41  float sc_clus1_deta = -999.;
42  float sc_clus2_deta = -999.;
43  float sc_clus1_E = -999.;
44  float sc_clus2_E = -999.;
45  float sc_clus1_E_ov_p = -999.;
46  float sc_clus2_E_ov_p = -999.;
47 
48  // KF tracks
49  if (ele.core().isNonnull()) {
50  reco::TrackRef trk = ele.closestCtfTrackRef();
51  if (trk.isNonnull()) {
52  eid_trk_p = (float)trk->p();
53  eid_trk_nhits = (float)trk->found();
54  eid_trk_chi2red = (float)trk->normalizedChi2();
55  TVector3 trkTV3(0, 0, 0);
56  trkTV3.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi());
57  TVector3 eleTV3(0, 0, 0);
58  eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi());
59  trk_dr = eleTV3.DeltaR(trkTV3);
60  }
61  }
62 
63  // GSF tracks
64  if (ele.core().isNonnull()) {
65  reco::GsfTrackRef gsf = ele.core()->gsfTrack();
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()) {
80  reco::SuperClusterRef sc = ele.core()->superCluster();
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()) {
112  reco::GsfTrackRef gsf = ele.core()->gsfTrack();
113  if (gsf.isNonnull()) {
114  reco::SuperClusterRef sc = ele.core()->superCluster();
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  }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
void trackClusterMatching(reco::SuperCluster const &, reco::GsfTrack const &, bool const &, GlobalPoint const &, float &, float &, float &, float &, float &, float &, float &, float &, float &)
T sqrt(T t)
Definition: SSEVec.h:18
double f[11][100]
double p2[4]
Definition: TauolaWrapper.h:90
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:27
void lowptgsfeleid::findEnergeticClusters ( reco::SuperCluster const &  sc,
int &  clusNum,
float &  maxEne1,
float &  maxEne2,
int &  i1,
int &  i2 
)

Definition at line 479 of file LowPtGsfElectronFeatures.cc.

References reco::SuperCluster::clusters(), reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), and reco::SuperCluster::clustersSize().

Referenced by trackClusterMatching().

480  {
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  }
void lowptgsfeleid::trackClusterMatching ( reco::SuperCluster const &  sc,
reco::GsfTrack const &  gsf,
bool const &  reach_ECAL,
GlobalPoint const &  ecal_pos,
float &  sc_clus1_nxtal,
float &  sc_clus1_dphi,
float &  sc_clus2_dphi,
float &  sc_clus1_deta,
float &  sc_clus2_deta,
float &  sc_clus1_E,
float &  sc_clus2_E,
float &  sc_clus1_E_ov_p,
float &  sc_clus2_E_ov_p 
)

Definition at line 506 of file LowPtGsfElectronFeatures.cc.

References reco::SuperCluster::clusters(), reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), reco::SuperCluster::clustersSize(), reco::deltaPhi(), PV3DBase< T, PVType, FrameType >::eta(), findEnergeticClusters(), objects.autophobj::float, PV3DBase< T, PVType, FrameType >::phi(), and reco::GsfTrack::pMode().

Referenced by features_V0(), and features_V1().

518  {
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  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
void findEnergeticClusters(reco::SuperCluster const &, int &, float &, float &, int &, int &)