CMS 3D CMS Logo

Functions
lowptgsfeleid Namespace Reference

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, const reco::Track *trk=nullptr)
 
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

◆ features_V0()

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

Definition at line 359 of file LowPtGsfElectronFeatures.cc.

References reco::GsfElectron::closestCtfTrackRef(), reco::GsfElectron::core(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::ecalEnergy(), hcalRecHitTable_cff::energy, reco::GsfElectron::eSuperClusterOverP(), reco::LeafCandidate::eta(), f, reco::GsfElectron::fbrem(), nano_mu_digi_cff::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(), SiStripOfflineCRack_cfg::p2, BaseParticlePropagator::particle(), reco::LeafCandidate::phi(), conifer::pow(), BaseParticlePropagator::propagateToEcalEntrance(), reco::LeafCandidate::pt(), reco::GsfElectron::shFracInnerHits(), mathSSE::sqrt(), trackClusterMatching(), lowPtElectrons_cff::unbiased, and RawParticle::vertex().

Referenced by LowPtGsfElectronIDProducer::eval().

359  {
360  float eid_rho = -999.;
361  float eid_sc_eta = -999.;
362  float eid_shape_full5x5_r9 = -999.;
363  float eid_sc_etaWidth = -999.;
364  float eid_sc_phiWidth = -999.;
365  float eid_shape_full5x5_HoverE = -999.;
366  float eid_trk_nhits = -999.;
367  float eid_trk_chi2red = -999.;
368  float eid_gsf_chi2red = -999.;
369  float eid_brem_frac = -999.;
370  float eid_gsf_nhits = -999.;
371  float eid_match_SC_EoverP = -999.;
372  float eid_match_eclu_EoverP = -999.;
373  float eid_match_SC_dEta = -999.;
374  float eid_match_SC_dPhi = -999.;
375  float eid_match_seed_dEta = -999.;
376  float eid_sc_E = -999.;
377  float eid_trk_p = -999.;
378  float gsf_mode_p = -999.;
379  float core_shFracHits = -999.;
380  float gsf_bdtout1 = -999.;
381  float gsf_dr = -999.;
382  float trk_dr = -999.;
383  float sc_Nclus = -999.;
384  float sc_clus1_nxtal = -999.;
385  float sc_clus1_dphi = -999.;
386  float sc_clus2_dphi = -999.;
387  float sc_clus1_deta = -999.;
388  float sc_clus2_deta = -999.;
389  float sc_clus1_E = -999.;
390  float sc_clus2_E = -999.;
391  float sc_clus1_E_ov_p = -999.;
392  float sc_clus2_E_ov_p = -999.;
393 
394  // KF tracks
395  if (ele.core().isNonnull()) {
396  const auto& trk = ele.closestCtfTrackRef(); // reco::TrackRef
397  if (trk.isNonnull()) {
398  eid_trk_p = (float)trk->p();
399  eid_trk_nhits = (float)trk->found();
400  eid_trk_chi2red = (float)trk->normalizedChi2();
401  TVector3 trkTV3(0, 0, 0);
402  trkTV3.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi());
403  TVector3 eleTV3(0, 0, 0);
404  eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi());
405  trk_dr = eleTV3.DeltaR(trkTV3);
406  }
407  }
408 
409  // GSF tracks
410  if (ele.core().isNonnull()) {
411  const auto& gsf = ele.core()->gsfTrack(); // reco::GsfTrackRef
412  if (gsf.isNonnull()) {
413  gsf_mode_p = gsf->pMode();
414  eid_gsf_nhits = (float)gsf->found();
415  eid_gsf_chi2red = gsf->normalizedChi2();
416  TVector3 gsfTV3(0, 0, 0);
417  gsfTV3.SetPtEtaPhi(gsf->ptMode(), gsf->etaMode(), gsf->phiMode());
418  TVector3 eleTV3(0, 0, 0);
419  eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi());
420  gsf_dr = eleTV3.DeltaR(gsfTV3);
421  }
422  }
423 
424  // Super clusters
425  if (ele.core().isNonnull()) {
426  const auto& sc = ele.core()->superCluster(); // reco::SuperClusterRef
427  if (sc.isNonnull()) {
428  eid_sc_E = sc->energy();
429  eid_sc_eta = sc->eta();
430  eid_sc_etaWidth = sc->etaWidth();
431  eid_sc_phiWidth = sc->phiWidth();
432  sc_Nclus = (float)sc->clustersSize();
433  }
434  }
435 
436  // Track-cluster matching
437  eid_match_seed_dEta = ele.deltaEtaSeedClusterTrackAtCalo();
438  eid_match_eclu_EoverP = (1. / ele.ecalEnergy()) - (1. / ele.p());
439  eid_match_SC_EoverP = ele.eSuperClusterOverP();
440  eid_match_SC_dEta = ele.deltaEtaSuperClusterTrackAtVtx();
441  eid_match_SC_dPhi = ele.deltaPhiSuperClusterTrackAtVtx();
442 
443  // Shower shape vars
444  eid_shape_full5x5_HoverE = ele.full5x5_hcalOverEcal();
445  eid_shape_full5x5_r9 = ele.full5x5_r9();
446 
447  // Misc
448  eid_rho = rho;
449 
450  eid_brem_frac = ele.fbrem();
451  core_shFracHits = (float)ele.shFracInnerHits();
452 
453  // Unbiased BDT from ElectronSeed
454  gsf_bdtout1 = unbiased;
455 
456  // Clusters
457  if (ele.core().isNonnull()) {
458  const auto& gsf = ele.core()->gsfTrack(); // reco::GsfTrackRef
459  if (gsf.isNonnull()) {
460  const auto& sc = ele.core()->superCluster(); // reco::SuperClusterRef
461  if (sc.isNonnull()) {
462  // Propagate electron track to ECAL surface
463  double mass2 = 0.000511 * 0.000511;
464  float p2 = pow(gsf->p(), 2);
465  float energy = sqrt(mass2 + p2);
466  math::XYZTLorentzVector mom = math::XYZTLorentzVector(gsf->px(), gsf->py(), gsf->pz(), energy);
467  math::XYZTLorentzVector pos = math::XYZTLorentzVector(gsf->vx(), gsf->vy(), gsf->vz(), 0.);
468  float field_z = 3.8;
469  BaseParticlePropagator mypart(RawParticle(mom, pos, gsf->charge()), 0, 0, field_z);
470  mypart.propagateToEcalEntrance(true); // true only first half loop , false more than one loop
471  bool reach_ECAL = mypart.getSuccess(); // 0 does not reach ECAL, 1 yes barrel, 2 yes endcaps
472 
473  // ECAL entry point for track
474  GlobalPoint ecal_pos(
475  mypart.particle().vertex().x(), mypart.particle().vertex().y(), mypart.particle().vertex().z());
476 
477  // Track-cluster matching for most energetic clusters
478  sc_clus1_nxtal = -999.;
479  sc_clus1_dphi = -999.;
480  sc_clus2_dphi = -999.;
481  sc_clus1_deta = -999.;
482  sc_clus2_deta = -999.;
483  sc_clus1_E = -999.;
484  sc_clus2_E = -999.;
485  sc_clus1_E_ov_p = -999.;
486  sc_clus2_E_ov_p = -999.;
488  *gsf,
489  reach_ECAL,
490  ecal_pos,
491  sc_clus1_nxtal,
492  sc_clus1_dphi,
493  sc_clus2_dphi,
494  sc_clus1_deta,
495  sc_clus2_deta,
496  sc_clus1_E,
497  sc_clus2_E,
498  sc_clus1_E_ov_p,
499  sc_clus2_E_ov_p);
500 
501  } // sc.isNonnull()
502  } // gsf.isNonnull()
503  } // clusters
504 
505  // Out-of-range
506  eid_sc_eta = std::clamp(eid_sc_eta, -5.f, 5.f);
507  eid_shape_full5x5_r9 = std::clamp(eid_shape_full5x5_r9, 0.f, 2.f);
508  eid_sc_etaWidth = std::clamp(eid_sc_etaWidth, 0.f, 3.14f);
509  eid_sc_phiWidth = std::clamp(eid_sc_phiWidth, 0.f, 3.14f);
510  eid_shape_full5x5_HoverE = std::clamp(eid_shape_full5x5_HoverE, 0.f, 50.f);
511  eid_trk_nhits = std::clamp(eid_trk_nhits, -1.f, 50.f);
512  eid_trk_chi2red = std::clamp(eid_trk_chi2red, -1.f, 50.f);
513  eid_gsf_chi2red = std::clamp(eid_gsf_chi2red, -1.f, 100.f);
514  if (eid_brem_frac < 0.)
515  eid_brem_frac = -1.; //
516  if (eid_brem_frac > 1.)
517  eid_brem_frac = 1.; //
518  eid_gsf_nhits = std::clamp(eid_gsf_nhits, -1.f, 50.f);
519  eid_match_SC_EoverP = std::clamp(eid_match_SC_EoverP, 0.f, 100.f);
520  eid_match_eclu_EoverP = std::clamp(eid_match_eclu_EoverP, -1.f, 1.f);
521  eid_match_SC_dEta = std::clamp(eid_match_SC_dEta, -10.f, 10.f);
522  eid_match_SC_dPhi = std::clamp(eid_match_SC_dPhi, -3.14f, 3.14f);
523  eid_match_seed_dEta = std::clamp(eid_match_seed_dEta, -10.f, 10.f);
524  eid_sc_E = std::clamp(eid_sc_E, 0.f, 1000.f);
525  eid_trk_p = std::clamp(eid_trk_p, -1.f, 1000.f);
526  gsf_mode_p = std::clamp(gsf_mode_p, 0.f, 1000.f);
527  core_shFracHits = std::clamp(core_shFracHits, 0.f, 1.f);
528  gsf_bdtout1 = std::clamp(gsf_bdtout1, -20.f, 20.f);
529  if (gsf_dr < 0.)
530  gsf_dr = 5.; //
531  if (gsf_dr > 5.)
532  gsf_dr = 5.; //
533  if (trk_dr < 0.)
534  trk_dr = 5.; //
535  if (trk_dr > 5.)
536  trk_dr = 5.; //
537  sc_Nclus = std::clamp(sc_Nclus, 0.f, 20.f);
538  sc_clus1_nxtal = std::clamp(sc_clus1_nxtal, 0.f, 100.f);
539  if (sc_clus1_dphi < -3.14)
540  sc_clus1_dphi = -5.; //
541  if (sc_clus1_dphi > 3.14)
542  sc_clus1_dphi = 5.; //
543  if (sc_clus2_dphi < -3.14)
544  sc_clus2_dphi = -5.; //
545  if (sc_clus2_dphi > 3.14)
546  sc_clus2_dphi = 5.; //
547  sc_clus1_deta = std::clamp(sc_clus1_deta, -5.f, 5.f);
548  sc_clus2_deta = std::clamp(sc_clus2_deta, -5.f, 5.f);
549  sc_clus1_E = std::clamp(sc_clus1_E, 0.f, 1000.f);
550  sc_clus2_E = std::clamp(sc_clus2_E, 0.f, 1000.f);
551  if (sc_clus1_E_ov_p < 0.)
552  sc_clus1_E_ov_p = -1.; //
553  if (sc_clus2_E_ov_p < 0.)
554  sc_clus2_E_ov_p = -1.; //
555 
556  // Set contents of vector
557  std::vector<float> output = {eid_rho,
558  eid_sc_eta,
559  eid_shape_full5x5_r9,
560  eid_sc_etaWidth,
561  eid_sc_phiWidth,
562  eid_shape_full5x5_HoverE,
563  eid_trk_nhits,
564  eid_trk_chi2red,
565  eid_gsf_chi2red,
566  eid_brem_frac,
567  eid_gsf_nhits,
568  eid_match_SC_EoverP,
569  eid_match_eclu_EoverP,
570  eid_match_SC_dEta,
571  eid_match_SC_dPhi,
572  eid_match_seed_dEta,
573  eid_sc_E,
574  eid_trk_p,
575  gsf_mode_p,
576  core_shFracHits,
577  gsf_bdtout1,
578  gsf_dr,
579  trk_dr,
580  sc_Nclus,
581  sc_clus1_nxtal,
582  sc_clus1_dphi,
583  sc_clus2_dphi,
584  sc_clus1_deta,
585  sc_clus2_deta,
586  sc_clus1_E,
587  sc_clus2_E,
588  sc_clus1_E_ov_p,
589  sc_clus2_E_ov_p};
590  return output;
591  }
constexpr int pow(int x)
Definition: conifer.h:24
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:19
double f[11][100]

◆ features_V1()

std::vector< float > lowptgsfeleid::features_V1 ( reco::GsfElectron const &  ele,
float  rho,
float  unbiased,
float  field_z,
const reco::Track trk = nullptr 
)

Definition at line 135 of file LowPtGsfElectronFeatures.cc.

References reco::GsfElectron::closestCtfTrackRef(), reco::GsfElectron::core(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::deltaR(), reco::GsfElectron::ecalEnergy(), hcalRecHitTable_cff::energy, reco::GsfElectron::eSuperClusterOverP(), reco::LeafCandidate::eta(), f, reco::GsfElectron::fbrem(), nano_mu_digi_cff::float, reco::Track::found(), reco::GsfElectron::full5x5_hcalOverEcal(), reco::GsfElectron::full5x5_r9(), ntupleEnum::gsf, reco::GsfElectron::gsfTrack(), createfilelist::int, edm::Ref< C, T, F >::isNonnull(), reco::TrackBase::normalizedChi2(), convertSQLitetoXML_cfg::output, reco::LeafCandidate::p(), reco::TrackBase::p(), SiStripOfflineCRack_cfg::p2, reco::LeafCandidate::phi(), conifer::pow(), TrackCandidateProducer_cfi::propagator, reco::LeafCandidate::pt(), reco::GsfElectron::shFracInnerHits(), mathSSE::sqrt(), reco::GsfElectron::superCluster(), trackClusterMatching(), and lowPtElectrons_cff::unbiased.

Referenced by LowPtGsfElectronIDProducer::eval().

136  {
137  float eid_rho = -999.;
138  float eid_sc_eta = -999.;
139  float eid_shape_full5x5_r9 = -999.;
140  float eid_sc_etaWidth = -999.;
141  float eid_sc_phiWidth = -999.;
142  float eid_shape_full5x5_HoverE = -999.;
143  float eid_trk_nhits = -999.;
144  float eid_trk_chi2red = -999.;
145  float eid_gsf_chi2red = -999.;
146  float eid_brem_frac = -999.;
147  float eid_gsf_nhits = -999.;
148  float eid_match_SC_EoverP = -999.;
149  float eid_match_eclu_EoverP = -999.;
150  float eid_match_SC_dEta = -999.;
151  float eid_match_SC_dPhi = -999.;
152  float eid_match_seed_dEta = -999.;
153  float eid_sc_E = -999.;
154  float eid_trk_p = -999.;
155  float gsf_mode_p = -999.;
156  float core_shFracHits = -999.;
157  float gsf_bdtout1 = -999.;
158  float gsf_dr = -999.;
159  float trk_dr = -999.;
160  float sc_Nclus = -999.;
161  float sc_clus1_nxtal = -999.;
162  float sc_clus1_dphi = -999.;
163  float sc_clus2_dphi = -999.;
164  float sc_clus1_deta = -999.;
165  float sc_clus2_deta = -999.;
166  float sc_clus1_E = -999.;
167  float sc_clus2_E = -999.;
168  float sc_clus1_E_ov_p = -999.;
169  float sc_clus2_E_ov_p = -999.;
170 
171  // KF tracks
172  if (trk != nullptr || (ele.core().isNonnull() && ele.closestCtfTrackRef().isNonnull())) {
173  const reco::Track* tk = trk ? trk : &*ele.closestCtfTrackRef();
174  eid_trk_p = tk->p();
175  eid_trk_nhits = tk->found();
176  eid_trk_chi2red = tk->normalizedChi2();
177  trk_dr = reco::deltaR(*tk, ele);
178  }
179 
180  // GSF tracks
181  if (ele.core().isNonnull()) {
182  reco::GsfTrackRef gsf = ele.gsfTrack();
183  if (gsf.isNonnull()) {
184  gsf_mode_p = gsf->pMode();
185  eid_gsf_nhits = (float)gsf->found();
186  eid_gsf_chi2red = gsf->normalizedChi2();
187  TVector3 gsfTV3(0, 0, 0);
188  gsfTV3.SetPtEtaPhi(gsf->ptMode(), gsf->etaMode(), gsf->phiMode());
189  TVector3 eleTV3(0, 0, 0);
190  eleTV3.SetPtEtaPhi(ele.pt(), ele.eta(), ele.phi());
191  gsf_dr = eleTV3.DeltaR(gsfTV3);
192  }
193  }
194 
195  // Super clusters
196  if (ele.core().isNonnull()) {
197  reco::SuperClusterRef sc = ele.superCluster();
198  if (sc.isNonnull()) {
199  eid_sc_E = sc->energy();
200  eid_sc_eta = sc->eta();
201  eid_sc_etaWidth = sc->etaWidth();
202  eid_sc_phiWidth = sc->phiWidth();
203  sc_Nclus = sc->clustersSize();
204  }
205  }
206 
207  // Track-cluster matching
208  eid_match_seed_dEta = ele.deltaEtaSeedClusterTrackAtCalo();
209  eid_match_eclu_EoverP = (1. / ele.ecalEnergy()) - (1. / ele.p());
210  eid_match_SC_EoverP = ele.eSuperClusterOverP();
211  eid_match_SC_dEta = ele.deltaEtaSuperClusterTrackAtVtx();
212  eid_match_SC_dPhi = ele.deltaPhiSuperClusterTrackAtVtx();
213 
214  // Shower shape vars
215  eid_shape_full5x5_HoverE = ele.full5x5_hcalOverEcal();
216  eid_shape_full5x5_r9 = ele.full5x5_r9();
217 
218  // Misc
219  eid_rho = rho;
220 
221  eid_brem_frac = ele.fbrem();
222  core_shFracHits = ele.shFracInnerHits();
223 
224  // Unbiased BDT from ElectronSeed
225  gsf_bdtout1 = unbiased;
226 
227  // Clusters
228  if (ele.core().isNonnull()) {
229  reco::GsfTrackRef gsf = ele.gsfTrack();
230  if (gsf.isNonnull()) {
231  reco::SuperClusterRef sc = ele.superCluster();
232  if (sc.isNonnull()) {
233  // Propagate electron track to ECAL surface
234  double mass2 = 0.000511 * 0.000511;
235  float p2 = pow(gsf->p(), 2);
236  float energy = sqrt(mass2 + p2);
237  XYZTLorentzVector mom = XYZTLorentzVector(gsf->px(), gsf->py(), gsf->pz(), energy);
238  XYZTLorentzVector pos = XYZTLorentzVector(gsf->vx(), gsf->vy(), gsf->vz(), 0.);
239  BaseParticlePropagator propagator(RawParticle(mom, pos, gsf->charge()), 0, 0, field_z);
240  propagator.propagateToEcalEntrance(true); // true only first half loop , false more than one loop
241  bool reach_ECAL = propagator.getSuccess(); // 0 does not reach ECAL, 1 yes barrel, 2 yes endcaps
242  // ECAL entry point for track
243  GlobalPoint ecal_pos(propagator.particle().x(), propagator.particle().y(), propagator.particle().z());
244 
245  // Track-cluster matching for most energetic clusters
246  sc_clus1_nxtal = -999;
247  sc_clus1_dphi = -999.;
248  sc_clus2_dphi = -999.;
249  sc_clus1_deta = -999.;
250  sc_clus2_deta = -999.;
251  sc_clus1_E = -999.;
252  sc_clus2_E = -999.;
253  sc_clus1_E_ov_p = -999.;
254  sc_clus2_E_ov_p = -999.;
256  *gsf,
257  reach_ECAL,
258  ecal_pos,
259  sc_clus1_nxtal,
260  sc_clus1_dphi,
261  sc_clus2_dphi,
262  sc_clus1_deta,
263  sc_clus2_deta,
264  sc_clus1_E,
265  sc_clus2_E,
266  sc_clus1_E_ov_p,
267  sc_clus2_E_ov_p);
268  sc_clus1_nxtal = (int)sc_clus1_nxtal;
269 
270  } // sc.isNonnull()
271  } // gsf.isNonnull()
272  } // clusters
273 
274  // Out-of-range
275  eid_rho = std::clamp(eid_rho, 0.f, 100.f);
276  eid_sc_eta = std::clamp(eid_sc_eta, -5.f, 5.f);
277  eid_shape_full5x5_r9 = std::clamp(eid_shape_full5x5_r9, 0.f, 2.f);
278  eid_sc_etaWidth = std::clamp(eid_sc_etaWidth, 0.f, 3.14f);
279  eid_sc_phiWidth = std::clamp(eid_sc_phiWidth, 0.f, 3.14f);
280  eid_shape_full5x5_HoverE = std::clamp(eid_shape_full5x5_HoverE, 0.f, 50.f);
281  eid_trk_nhits = std::clamp(eid_trk_nhits, -1.f, 50.f);
282  eid_trk_chi2red = std::clamp(eid_trk_chi2red, -1.f, 50.f);
283  eid_gsf_chi2red = std::clamp(eid_gsf_chi2red, -1.f, 100.f);
284  if (eid_brem_frac < 0.)
285  eid_brem_frac = -1.; //
286  if (eid_brem_frac > 1.)
287  eid_brem_frac = 1.; //
288  eid_gsf_nhits = std::clamp(eid_gsf_nhits, -1.f, 50.f);
289  eid_match_SC_EoverP = std::clamp(eid_match_SC_EoverP, 0.f, 100.f);
290  eid_match_eclu_EoverP = std::clamp(eid_match_eclu_EoverP, -1.f, 1.f);
291  eid_match_SC_dEta = std::clamp(eid_match_SC_dEta, -10.f, 10.f);
292  eid_match_SC_dPhi = std::clamp(eid_match_SC_dPhi, -3.14f, 3.14f);
293  eid_match_seed_dEta = std::clamp(eid_match_seed_dEta, -10.f, 10.f);
294  eid_sc_E = std::clamp(eid_sc_E, 0.f, 1000.f);
295  eid_trk_p = std::clamp(eid_trk_p, -1.f, 1000.f);
296  gsf_mode_p = std::clamp(gsf_mode_p, 0.f, 1000.f);
297  core_shFracHits = std::clamp(core_shFracHits, 0.f, 1.f);
298  gsf_bdtout1 = std::clamp(gsf_bdtout1, -20.f, 20.f);
299  if (gsf_dr < 0.)
300  gsf_dr = 5.; //
301  if (gsf_dr > 5.)
302  gsf_dr = 5.; //
303  if (trk_dr < 0.)
304  trk_dr = 5.; //
305  if (trk_dr > 5.)
306  trk_dr = 5.; //
307  sc_Nclus = std::clamp(sc_Nclus, 0.f, 20.f);
308  sc_clus1_nxtal = std::clamp(sc_clus1_nxtal, 0.f, 100.f);
309  sc_clus1_dphi = std::clamp(sc_clus1_dphi, -3.14f, 3.14f);
310  sc_clus2_dphi = std::clamp(sc_clus2_dphi, -3.14f, 3.14f);
311  sc_clus1_deta = std::clamp(sc_clus1_deta, -5.f, 5.f);
312  sc_clus2_deta = std::clamp(sc_clus2_deta, -5.f, 5.f);
313  sc_clus1_E = std::clamp(sc_clus1_E, 0.f, 1000.f);
314  sc_clus2_E = std::clamp(sc_clus2_E, 0.f, 1000.f);
315  if (sc_clus1_E_ov_p < 0.)
316  sc_clus1_E_ov_p = -1.; //
317  if (sc_clus2_E_ov_p < 0.)
318  sc_clus2_E_ov_p = -1.; //
319 
320  // Set contents of vector
321  std::vector<float> output = {eid_rho,
322  eid_sc_eta,
323  eid_shape_full5x5_r9,
324  eid_sc_etaWidth,
325  eid_sc_phiWidth,
326  eid_shape_full5x5_HoverE,
327  eid_trk_nhits,
328  eid_trk_chi2red,
329  eid_gsf_chi2red,
330  eid_brem_frac,
331  eid_gsf_nhits,
332  eid_match_SC_EoverP,
333  eid_match_eclu_EoverP,
334  eid_match_SC_dEta,
335  eid_match_SC_dPhi,
336  eid_match_seed_dEta,
337  eid_sc_E,
338  eid_trk_p,
339  gsf_mode_p,
340  core_shFracHits,
341  gsf_bdtout1,
342  gsf_dr,
343  trk_dr,
344  sc_Nclus,
345  sc_clus1_nxtal,
346  sc_clus1_dphi,
347  sc_clus2_dphi,
348  sc_clus1_deta,
349  sc_clus2_deta,
350  sc_clus1_E,
351  sc_clus2_E,
352  sc_clus1_E_ov_p,
353  sc_clus2_E_ov_p};
354  return output;
355  }
double p() const
momentum vector magnitude
Definition: TrackBase.h:631
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
constexpr int pow(int x)
Definition: conifer.h:24
void trackClusterMatching(reco::SuperCluster const &, reco::GsfTrack const &, bool const &, GlobalPoint const &, float &, float &, float &, float &, float &, float &, float &, float &, float &)
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:142
T sqrt(T t)
Definition: SSEVec.h:19
double f[11][100]
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
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:593
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25

◆ findEnergeticClusters()

void lowptgsfeleid::findEnergeticClusters ( reco::SuperCluster const &  sc,
int &  clusNum,
float &  maxEne1,
float &  maxEne2,
int &  i1,
int &  i2 
)

Definition at line 595 of file LowPtGsfElectronFeatures.cc.

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

Referenced by trackClusterMatching().

596  {
597  if (sc.clustersSize() > 0 && sc.clustersBegin() != sc.clustersEnd()) {
598  for (auto const& cluster : sc.clusters()) {
599  if (cluster->energy() > maxEne1) {
600  maxEne1 = cluster->energy();
601  i1 = clusNum;
602  }
603  clusNum++;
604  }
605  if (sc.clustersSize() > 1) {
606  clusNum = 0;
607  for (auto const& cluster : sc.clusters()) {
608  if (clusNum != i1) {
609  if (cluster->energy() > maxEne2) {
610  maxEne2 = cluster->energy();
611  i2 = clusNum;
612  }
613  }
614  clusNum++;
615  }
616  }
617  } // loop over clusters
618  }

◆ trackClusterMatching()

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 622 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(), nano_mu_digi_cff::float, ntupleEnum::gsf, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, PV3DBase< T, PVType, FrameType >::phi(), and Geom::Phi< T1, Range >::phi().

Referenced by features_V0(), and features_V1().

634  {
635  // Iterate through ECAL clusters and sort in energy
636  int clusNum = 0;
637  float maxEne1 = -1;
638  float maxEne2 = -1;
639  int i1 = -1;
640  int i2 = -1;
641  findEnergeticClusters(sc, clusNum, maxEne1, maxEne2, i1, i2);
642 
643  // track-clusters match
644  clusNum = 0;
645  if (sc.clustersSize() > 0 && sc.clustersBegin() != sc.clustersEnd()) {
646  for (auto const& cluster : sc.clusters()) {
647  float deta = ecal_pos.eta() - cluster->eta();
648  float dphi = reco::deltaPhi(ecal_pos.phi(), cluster->phi());
649  if (clusNum == i1) {
650  sc_clus1_E = cluster->energy();
651  if (gsf.pMode() > 0)
652  sc_clus1_E_ov_p = cluster->energy() / gsf.pMode();
653  sc_clus1_nxtal = (float)cluster->size();
654  if (reach_ECAL > 0) {
655  sc_clus1_deta = deta;
656  sc_clus1_dphi = dphi;
657  }
658  } else if (clusNum == i2) {
659  sc_clus2_E = cluster->energy();
660  if (gsf.pMode() > 0)
661  sc_clus2_E_ov_p = cluster->energy() / gsf.pMode();
662  if (reach_ECAL > 0) {
663  sc_clus2_deta = deta;
664  sc_clus2_dphi = dphi;
665  }
666  }
667  clusNum++;
668  }
669  }
670  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
void findEnergeticClusters(reco::SuperCluster const &, int &, float &, float &, int &, int &)