23 float trk_nhits_ = -1.;
24 float trk_high_quality_ = -1.;
25 float trk_chi2red_ = -1.;
27 float ktf_ecal_cluster_e_ = -1.;
28 float ktf_ecal_cluster_deta_ = -42.;
29 float ktf_ecal_cluster_dphi_ = -42.;
30 float ktf_ecal_cluster_e3x3_ = -1.;
31 float ktf_ecal_cluster_e5x5_ = -1.;
32 float ktf_ecal_cluster_covEtaEta_ = -42.;
33 float ktf_ecal_cluster_covEtaPhi_ = -42.;
34 float ktf_ecal_cluster_covPhiPhi_ = -42.;
35 float ktf_ecal_cluster_r9_ = -0.1;
36 float ktf_ecal_cluster_circularity_ = -0.1;
37 float ktf_hcal_cluster_e_ = -1.;
38 float ktf_hcal_cluster_deta_ = -42.;
39 float ktf_hcal_cluster_dphi_ = -42.;
40 float preid_gsf_dpt_ = -1.;
41 float preid_trk_gsf_chiratio_ = -1.;
42 float preid_gsf_chi2red_ = -1.;
43 float trk_dxy_sig_ = -1.;
46 const auto& trk =
ecal.trackRef();
47 if (trk.isNonnull()) {
49 trk_eta_ = trk->eta();
50 trk_phi_ = trk->phi();
52 trk_nhits_ = static_cast<float>(trk->found());
54 trk_chi2red_ = trk->normalizedChi2();
55 if (trk->dxy(spot) > 0.) {
56 trk_dxy_sig_ = trk->dxyError() / trk->dxy(spot);
58 ktf_ecal_cluster_dphi_ *= trk->charge();
62 rho_ = static_cast<float>(rho);
65 const auto& ecal_clu =
ecal.clusterRef();
66 if (ecal_clu.isNonnull()) {
67 ktf_ecal_cluster_e_ = ecal_clu->energy();
68 ktf_ecal_cluster_deta_ =
ecal.geomMatching()[0];
69 ktf_ecal_cluster_dphi_ =
ecal.geomMatching()[1];
70 ktf_ecal_cluster_e3x3_ =
tools.e3x3(*ecal_clu);
71 ktf_ecal_cluster_e5x5_ =
tools.e5x5(*ecal_clu);
72 const auto& covs =
tools.localCovariances(*ecal_clu);
73 ktf_ecal_cluster_covEtaEta_ = covs[0];
74 ktf_ecal_cluster_covEtaPhi_ = covs[1];
75 ktf_ecal_cluster_covPhiPhi_ = covs[2];
76 if (ktf_ecal_cluster_e_ > 0.) {
77 ktf_ecal_cluster_r9_ = ktf_ecal_cluster_e3x3_ / ktf_ecal_cluster_e_;
79 if (ktf_ecal_cluster_e5x5_ > 0.) {
80 ktf_ecal_cluster_circularity_ = 1. -
tools.e1x5(*ecal_clu) / ktf_ecal_cluster_e5x5_;
82 ktf_ecal_cluster_circularity_ = -0.1;
87 const auto& hcal_clu =
hcal.clusterRef();
88 if (hcal_clu.isNonnull()) {
89 ktf_hcal_cluster_e_ = hcal_clu->energy();
90 ktf_hcal_cluster_deta_ =
hcal.geomMatching()[0];
91 ktf_hcal_cluster_dphi_ =
hcal.geomMatching()[1];
95 preid_gsf_dpt_ =
ecal.dpt();
96 preid_trk_gsf_chiratio_ =
ecal.chi2Ratio();
97 preid_gsf_chi2red_ =
ecal.gsfChi2();
100 std::vector<float>
output = {trk_pt_,
109 ktf_ecal_cluster_deta_,
110 ktf_ecal_cluster_dphi_,
111 ktf_ecal_cluster_e3x3_,
112 ktf_ecal_cluster_e5x5_,
113 ktf_ecal_cluster_covEtaEta_,
114 ktf_ecal_cluster_covEtaPhi_,
115 ktf_ecal_cluster_covPhiPhi_,
116 ktf_ecal_cluster_r9_,
117 ktf_ecal_cluster_circularity_,
119 ktf_hcal_cluster_deta_,
120 ktf_hcal_cluster_dphi_,
122 preid_trk_gsf_chiratio_,
133 float eid_rho = -999.;
134 float eid_sc_eta = -999.;
135 float eid_shape_full5x5_r9 = -999.;
136 float eid_sc_etaWidth = -999.;
137 float eid_sc_phiWidth = -999.;
138 float eid_shape_full5x5_HoverE = -999.;
139 float eid_trk_nhits = -999.;
140 float eid_trk_chi2red = -999.;
141 float eid_gsf_chi2red = -999.;
142 float eid_brem_frac = -999.;
143 float eid_gsf_nhits = -999.;
144 float eid_match_SC_EoverP = -999.;
145 float eid_match_eclu_EoverP = -999.;
146 float eid_match_SC_dEta = -999.;
147 float eid_match_SC_dPhi = -999.;
148 float eid_match_seed_dEta = -999.;
149 float eid_sc_E = -999.;
150 float eid_trk_p = -999.;
151 float gsf_mode_p = -999.;
152 float core_shFracHits = -999.;
153 float gsf_bdtout1 = -999.;
154 float gsf_dr = -999.;
155 float trk_dr = -999.;
156 float sc_Nclus = -999.;
157 float sc_clus1_nxtal = -999.;
158 float sc_clus1_dphi = -999.;
159 float sc_clus2_dphi = -999.;
160 float sc_clus1_deta = -999.;
161 float sc_clus2_deta = -999.;
162 float sc_clus1_E = -999.;
163 float sc_clus2_E = -999.;
164 float sc_clus1_E_ov_p = -999.;
165 float sc_clus2_E_ov_p = -999.;
170 if (trk.isNonnull()) {
171 eid_trk_p = (
float)trk->p();
172 eid_trk_nhits = (
float)trk->found();
173 eid_trk_chi2red = (
float)trk->normalizedChi2();
174 TVector3 trkTV3(0, 0, 0);
175 trkTV3.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi());
176 TVector3 eleTV3(0, 0, 0);
177 eleTV3.SetPtEtaPhi(ele->
pt(), ele->
eta(), ele->
phi());
178 trk_dr = eleTV3.DeltaR(trkTV3);
184 const auto&
gsf = ele->
core()->gsfTrack();
185 if (
gsf.isNonnull()) {
186 gsf_mode_p =
gsf->pMode();
187 eid_gsf_nhits = (
float)
gsf->found();
188 eid_gsf_chi2red =
gsf->normalizedChi2();
189 TVector3 gsfTV3(0, 0, 0);
190 gsfTV3.SetPtEtaPhi(
gsf->ptMode(),
gsf->etaMode(),
gsf->phiMode());
191 TVector3 eleTV3(0, 0, 0);
192 eleTV3.SetPtEtaPhi(ele->
pt(), ele->
eta(), ele->
phi());
193 gsf_dr = eleTV3.DeltaR(gsfTV3);
199 const auto& sc = ele->
core()->superCluster();
200 if (sc.isNonnull()) {
201 eid_sc_E = sc->energy();
202 eid_sc_eta = sc->eta();
203 eid_sc_etaWidth = sc->etaWidth();
204 eid_sc_phiWidth = sc->phiWidth();
205 sc_Nclus = (
float)sc->clustersSize();
212 eid_match_eclu_EoverP = (1. / ele->
ecalEnergy()) - (1. / ele->
p());
228 eid_brem_frac = ele->
fbrem();
233 gsf_bdtout1 = unbiased;
237 const auto&
gsf = ele->
core()->gsfTrack();
238 if (
gsf.isNonnull()) {
239 const auto& sc = ele->
core()->superCluster();
240 if (sc.isNonnull()) {
242 double mass_ = 0.000511 * 0.000511;
263 if (sc->clustersSize() > 0 && sc->clustersBegin() != sc->clustersEnd()) {
264 for (
const auto& cluster : sc->clusters()) {
265 if (cluster->energy() > maxEne1) {
266 maxEne1 = cluster->energy();
271 if (sc->clustersSize() > 1) {
273 for (
const auto& cluster : sc->clusters()) {
275 if (cluster->energy() > maxEne2) {
276 maxEne2 = cluster->energy();
285 edm::LogError(
"SuperClusters") <<
"Problem accessing SC constituent clusters:"
286 <<
" clusNum=" << clusNum <<
" clustersSize=" << sc->clustersSize()
287 <<
" energy=" << sc->energy() << std::endl;
291 sc_clus1_nxtal = -999.;
292 sc_clus1_dphi = -999.;
293 sc_clus2_dphi = -999.;
294 sc_clus1_deta = -999.;
295 sc_clus2_deta = -999.;
298 sc_clus1_E_ov_p = -999.;
299 sc_clus2_E_ov_p = -999.;
304 if (sc->clustersSize() > 0 && sc->clustersBegin() != sc->clustersEnd()) {
305 for (
const auto& cluster : sc->clusters()) {
306 float deta = std::fabs(ecal_pos.eta() - cluster->eta());
307 float dphi = std::fabs(ecal_pos.phi() - cluster->phi());
310 if (ecal_pos.phi() - cluster->phi() < 0)
312 if (ecal_pos.eta() - cluster->eta() < 0)
316 sc_clus1_E = cluster->energy();
317 if (
gsf->pMode() > 0)
318 sc_clus1_E_ov_p = cluster->energy() /
gsf->pMode();
319 sc_clus1_nxtal = (
float)cluster->size();
320 if (reach_ECAL > 0) {
321 sc_clus1_deta = deta;
322 sc_clus1_dphi = dphi;
324 }
else if (clusNum ==
i2) {
325 sc_clus2_E = cluster->energy();
326 if (
gsf->pMode() > 0)
327 sc_clus2_E_ov_p = cluster->energy() /
gsf->pMode();
328 if (reach_ECAL > 0) {
329 sc_clus2_deta = deta;
330 sc_clus2_dphi = dphi;
337 edm::LogError(
"SuperClusters") <<
"Problem with track-cluster matching" << std::endl;
352 if (eid_shape_full5x5_r9 < 0)
353 eid_shape_full5x5_r9 = 0;
354 if (eid_shape_full5x5_r9 > 2)
355 eid_shape_full5x5_r9 = 2;
356 if (eid_sc_etaWidth < 0)
358 if (eid_sc_etaWidth > 3.14)
359 eid_sc_etaWidth = 3.14;
360 if (eid_sc_phiWidth < 0)
362 if (eid_sc_phiWidth > 3.14)
363 eid_sc_phiWidth = 3.14;
364 if (eid_shape_full5x5_HoverE < 0)
365 eid_shape_full5x5_HoverE = 0;
366 if (eid_shape_full5x5_HoverE > 50)
367 eid_shape_full5x5_HoverE = 50;
368 if (eid_trk_nhits < -1)
370 if (eid_trk_nhits > 50)
372 if (eid_trk_chi2red < -1)
373 eid_trk_chi2red = -1;
374 if (eid_trk_chi2red > 50)
375 eid_trk_chi2red = 50;
376 if (eid_gsf_chi2red < -1)
377 eid_gsf_chi2red = -1;
378 if (eid_gsf_chi2red > 100)
379 eid_gsf_chi2red = 100;
380 if (eid_brem_frac < 0)
382 if (eid_brem_frac > 1)
384 if (eid_gsf_nhits < -1)
386 if (eid_gsf_nhits > 50)
388 if (eid_match_SC_EoverP < 0)
389 eid_match_SC_EoverP = 0;
390 if (eid_match_SC_EoverP > 100)
391 eid_match_SC_EoverP = 100;
392 if (eid_match_eclu_EoverP < -1.)
393 eid_match_eclu_EoverP = -1.;
394 if (eid_match_eclu_EoverP > 1.)
395 eid_match_eclu_EoverP = 1.;
396 if (eid_match_SC_dEta < -10)
397 eid_match_SC_dEta = -10;
398 if (eid_match_SC_dEta > 10)
399 eid_match_SC_dEta = 10;
400 if (eid_match_SC_dPhi < -3.14)
401 eid_match_SC_dPhi = -3.14;
402 if (eid_match_SC_dPhi > 3.14)
403 eid_match_SC_dPhi = 3.14;
404 if (eid_match_seed_dEta < -10)
405 eid_match_seed_dEta = -10;
406 if (eid_match_seed_dEta > 10)
407 eid_match_seed_dEta = 10;
414 if (eid_trk_p > 1000)
418 if (gsf_mode_p > 1000)
420 if (core_shFracHits < 0)
422 if (core_shFracHits > 1)
424 if (gsf_bdtout1 < -20)
426 if (gsf_bdtout1 > 20)
440 if (sc_clus1_nxtal < 0)
442 if (sc_clus1_nxtal > 100)
443 sc_clus1_nxtal = 100;
444 if (sc_clus1_dphi < -3.14)
446 if (sc_clus1_dphi > 3.14)
448 if (sc_clus2_dphi < -3.14)
450 if (sc_clus2_dphi > 3.14)
452 if (sc_clus1_deta < -5)
454 if (sc_clus1_deta > 5)
456 if (sc_clus2_deta < -5)
458 if (sc_clus2_deta > 5)
462 if (sc_clus1_E > 1000)
466 if (sc_clus2_E > 1000)
468 if (sc_clus1_E_ov_p < 0)
469 sc_clus1_E_ov_p = -1;
470 if (sc_clus2_E_ov_p < 0)
471 sc_clus2_E_ov_p = -1;
474 std::vector<float>
output = {eid_rho,
476 eid_shape_full5x5_r9,
479 eid_shape_full5x5_HoverE,
486 eid_match_eclu_EoverP,
512 std::vector<float>
features(
edm::Ref<std::vector<reco::GsfElectron> >
const& ele,
float rho,
float unbiased) {