15 float eid_rho = -999.;
16 float eid_sc_eta = -999.;
17 float eid_shape_full5x5_r9 = -999.;
18 float eid_sc_etaWidth = -999.;
19 float eid_sc_phiWidth = -999.;
20 float eid_shape_full5x5_HoverE = -999.;
21 float eid_trk_nhits = -999.;
22 float eid_trk_chi2red = -999.;
23 float eid_gsf_chi2red = -999.;
24 float eid_brem_frac = -999.;
25 float eid_gsf_nhits = -999.;
26 float eid_match_SC_EoverP = -999.;
27 float eid_match_eclu_EoverP = -999.;
28 float eid_match_SC_dEta = -999.;
29 float eid_match_SC_dPhi = -999.;
30 float eid_match_seed_dEta = -999.;
31 float eid_sc_E = -999.;
32 float eid_trk_p = -999.;
33 float gsf_mode_p = -999.;
34 float core_shFracHits = -999.;
35 float gsf_bdtout1 = -999.;
38 float sc_Nclus = -999.;
39 float sc_clus1_nxtal = -999.;
40 float sc_clus1_dphi = -999.;
41 float sc_clus2_dphi = -999.;
42 float sc_clus1_deta = -999.;
43 float sc_clus2_deta = -999.;
44 float sc_clus1_E = -999.;
45 float sc_clus2_E = -999.;
46 float sc_clus1_E_ov_p = -999.;
47 float sc_clus2_E_ov_p = -999.;
53 eid_trk_p = (
float)trk->p();
54 eid_trk_nhits = (
float)trk->found();
55 eid_trk_chi2red = (
float)trk->normalizedChi2();
56 TVector3 trkTV3(0, 0, 0);
57 trkTV3.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi());
58 TVector3 eleTV3(0, 0, 0);
59 eleTV3.SetPtEtaPhi(ele.
pt(), ele.
eta(), ele.
phi());
60 trk_dr = eleTV3.DeltaR(trkTV3);
68 gsf_mode_p = gsf->pMode();
69 eid_gsf_nhits = (
float)gsf->found();
70 eid_gsf_chi2red = gsf->normalizedChi2();
71 TVector3 gsfTV3(0, 0, 0);
72 gsfTV3.SetPtEtaPhi(gsf->ptMode(), gsf->etaMode(), gsf->phiMode());
73 TVector3 eleTV3(0, 0, 0);
74 eleTV3.SetPtEtaPhi(ele.
pt(), ele.
eta(), ele.
phi());
75 gsf_dr = eleTV3.DeltaR(gsfTV3);
83 eid_sc_E = sc->energy();
84 eid_sc_eta = sc->eta();
85 eid_sc_etaWidth = sc->etaWidth();
86 eid_sc_phiWidth = sc->phiWidth();
87 sc_Nclus = sc->clustersSize();
93 eid_match_eclu_EoverP = (1. / ele.
ecalEnergy()) - (1. / ele.
p());
105 eid_brem_frac = ele.
fbrem();
118 double mass2 = 0.000511 * 0.000511;
119 float p2 =
pow(gsf->p(), 2);
120 float energy =
sqrt(mass2 + p2);
131 sc_clus1_nxtal = -999;
132 sc_clus1_dphi = -999.;
133 sc_clus2_dphi = -999.;
134 sc_clus1_deta = -999.;
135 sc_clus2_deta = -999.;
138 sc_clus1_E_ov_p = -999.;
139 sc_clus2_E_ov_p = -999.;
153 sc_clus1_nxtal = (
int)sc_clus1_nxtal;
160 eid_rho = std::clamp(eid_rho, 0.
f, 100.
f);
161 eid_sc_eta = std::clamp(eid_sc_eta, -5.
f, 5.
f);
162 eid_shape_full5x5_r9 = std::clamp(eid_shape_full5x5_r9, 0.
f, 2.
f);
163 eid_sc_etaWidth = std::clamp(eid_sc_etaWidth, 0.
f, 3.14
f);
164 eid_sc_phiWidth = std::clamp(eid_sc_phiWidth, 0.
f, 3.14
f);
165 eid_shape_full5x5_HoverE = std::clamp(eid_shape_full5x5_HoverE, 0.
f, 50.
f);
166 eid_trk_nhits = std::clamp(eid_trk_nhits, -1.
f, 50.
f);
167 eid_trk_chi2red = std::clamp(eid_trk_chi2red, -1.
f, 50.
f);
168 eid_gsf_chi2red = std::clamp(eid_gsf_chi2red, -1.
f, 100.
f);
169 if (eid_brem_frac < 0.)
171 if (eid_brem_frac > 1.)
173 eid_gsf_nhits = std::clamp(eid_gsf_nhits, -1.
f, 50.
f);
174 eid_match_SC_EoverP = std::clamp(eid_match_SC_EoverP, 0.
f, 100.
f);
175 eid_match_eclu_EoverP = std::clamp(eid_match_eclu_EoverP, -1.
f, 1.
f);
176 eid_match_SC_dEta = std::clamp(eid_match_SC_dEta, -10.
f, 10.
f);
177 eid_match_SC_dPhi = std::clamp(eid_match_SC_dPhi, -3.14
f, 3.14
f);
178 eid_match_seed_dEta = std::clamp(eid_match_seed_dEta, -10.
f, 10.
f);
179 eid_sc_E = std::clamp(eid_sc_E, 0.
f, 1000.
f);
180 eid_trk_p = std::clamp(eid_trk_p, -1.
f, 1000.
f);
181 gsf_mode_p = std::clamp(gsf_mode_p, 0.
f, 1000.
f);
182 core_shFracHits = std::clamp(core_shFracHits, 0.
f, 1.
f);
183 gsf_bdtout1 = std::clamp(gsf_bdtout1, -20.
f, 20.
f);
192 sc_Nclus = std::clamp(sc_Nclus, 0.
f, 20.
f);
193 sc_clus1_nxtal = std::clamp(sc_clus1_nxtal, 0.
f, 100.
f);
194 sc_clus1_dphi = std::clamp(sc_clus1_dphi, -3.14
f, 3.14
f);
195 sc_clus2_dphi = std::clamp(sc_clus2_dphi, -3.14
f, 3.14
f);
196 sc_clus1_deta = std::clamp(sc_clus1_deta, -5.
f, 5.
f);
197 sc_clus2_deta = std::clamp(sc_clus2_deta, -5.
f, 5.
f);
198 sc_clus1_E = std::clamp(sc_clus1_E, 0.
f, 1000.
f);
199 sc_clus2_E = std::clamp(sc_clus2_E, 0.
f, 1000.
f);
200 if (sc_clus1_E_ov_p < 0.)
201 sc_clus1_E_ov_p = -1.;
202 if (sc_clus2_E_ov_p < 0.)
203 sc_clus2_E_ov_p = -1.;
206 std::vector<float>
output = {eid_rho,
208 eid_shape_full5x5_r9,
211 eid_shape_full5x5_HoverE,
218 eid_match_eclu_EoverP,
245 float eid_rho = -999.;
246 float eid_sc_eta = -999.;
247 float eid_shape_full5x5_r9 = -999.;
248 float eid_sc_etaWidth = -999.;
249 float eid_sc_phiWidth = -999.;
250 float eid_shape_full5x5_HoverE = -999.;
251 float eid_trk_nhits = -999.;
252 float eid_trk_chi2red = -999.;
253 float eid_gsf_chi2red = -999.;
254 float eid_brem_frac = -999.;
255 float eid_gsf_nhits = -999.;
256 float eid_match_SC_EoverP = -999.;
257 float eid_match_eclu_EoverP = -999.;
258 float eid_match_SC_dEta = -999.;
259 float eid_match_SC_dPhi = -999.;
260 float eid_match_seed_dEta = -999.;
261 float eid_sc_E = -999.;
262 float eid_trk_p = -999.;
263 float gsf_mode_p = -999.;
264 float core_shFracHits = -999.;
265 float gsf_bdtout1 = -999.;
266 float gsf_dr = -999.;
267 float trk_dr = -999.;
268 float sc_Nclus = -999.;
269 float sc_clus1_nxtal = -999.;
270 float sc_clus1_dphi = -999.;
271 float sc_clus2_dphi = -999.;
272 float sc_clus1_deta = -999.;
273 float sc_clus2_deta = -999.;
274 float sc_clus1_E = -999.;
275 float sc_clus2_E = -999.;
276 float sc_clus1_E_ov_p = -999.;
277 float sc_clus2_E_ov_p = -999.;
282 if (trk.isNonnull()) {
283 eid_trk_p = (
float)trk->p();
284 eid_trk_nhits = (
float)trk->found();
285 eid_trk_chi2red = (
float)trk->normalizedChi2();
286 TVector3 trkTV3(0, 0, 0);
287 trkTV3.SetPtEtaPhi(trk->pt(), trk->eta(), trk->phi());
288 TVector3 eleTV3(0, 0, 0);
289 eleTV3.SetPtEtaPhi(ele.
pt(), ele.
eta(), ele.
phi());
290 trk_dr = eleTV3.DeltaR(trkTV3);
296 const auto&
gsf = ele.
core()->gsfTrack();
297 if (
gsf.isNonnull()) {
298 gsf_mode_p =
gsf->pMode();
299 eid_gsf_nhits = (
float)
gsf->found();
300 eid_gsf_chi2red =
gsf->normalizedChi2();
301 TVector3 gsfTV3(0, 0, 0);
302 gsfTV3.SetPtEtaPhi(
gsf->ptMode(),
gsf->etaMode(),
gsf->phiMode());
303 TVector3 eleTV3(0, 0, 0);
304 eleTV3.SetPtEtaPhi(ele.
pt(), ele.
eta(), ele.
phi());
305 gsf_dr = eleTV3.DeltaR(gsfTV3);
311 const auto&
sc = ele.
core()->superCluster();
312 if (
sc.isNonnull()) {
314 eid_sc_eta =
sc->
eta();
315 eid_sc_etaWidth =
sc->etaWidth();
316 eid_sc_phiWidth =
sc->phiWidth();
317 sc_Nclus = (
float)
sc->clustersSize();
323 eid_match_eclu_EoverP = (1. / ele.
ecalEnergy()) - (1. / ele.
p());
335 eid_brem_frac = ele.
fbrem();
343 const auto&
gsf = ele.
core()->gsfTrack();
344 if (
gsf.isNonnull()) {
345 const auto&
sc = ele.
core()->superCluster();
346 if (
sc.isNonnull()) {
348 double mass2 = 0.000511 * 0.000511;
350 float energy =
sqrt(mass2 + p2);
363 sc_clus1_nxtal = -999.;
364 sc_clus1_dphi = -999.;
365 sc_clus2_dphi = -999.;
366 sc_clus1_deta = -999.;
367 sc_clus2_deta = -999.;
370 sc_clus1_E_ov_p = -999.;
371 sc_clus2_E_ov_p = -999.;
391 eid_sc_eta = std::clamp(eid_sc_eta, -5.
f, 5.
f);
392 eid_shape_full5x5_r9 = std::clamp(eid_shape_full5x5_r9, 0.
f, 2.
f);
393 eid_sc_etaWidth = std::clamp(eid_sc_etaWidth, 0.
f, 3.14
f);
394 eid_sc_phiWidth = std::clamp(eid_sc_phiWidth, 0.
f, 3.14
f);
395 eid_shape_full5x5_HoverE = std::clamp(eid_shape_full5x5_HoverE, 0.
f, 50.
f);
396 eid_trk_nhits = std::clamp(eid_trk_nhits, -1.
f, 50.
f);
397 eid_trk_chi2red = std::clamp(eid_trk_chi2red, -1.
f, 50.
f);
398 eid_gsf_chi2red = std::clamp(eid_gsf_chi2red, -1.
f, 100.
f);
399 if (eid_brem_frac < 0.)
401 if (eid_brem_frac > 1.)
403 eid_gsf_nhits = std::clamp(eid_gsf_nhits, -1.
f, 50.
f);
404 eid_match_SC_EoverP = std::clamp(eid_match_SC_EoverP, 0.
f, 100.
f);
405 eid_match_eclu_EoverP = std::clamp(eid_match_eclu_EoverP, -1.
f, 1.
f);
406 eid_match_SC_dEta = std::clamp(eid_match_SC_dEta, -10.
f, 10.
f);
407 eid_match_SC_dPhi = std::clamp(eid_match_SC_dPhi, -3.14
f, 3.14
f);
408 eid_match_seed_dEta = std::clamp(eid_match_seed_dEta, -10.
f, 10.
f);
409 eid_sc_E = std::clamp(eid_sc_E, 0.
f, 1000.
f);
410 eid_trk_p = std::clamp(eid_trk_p, -1.
f, 1000.
f);
411 gsf_mode_p = std::clamp(gsf_mode_p, 0.
f, 1000.
f);
412 core_shFracHits = std::clamp(core_shFracHits, 0.
f, 1.
f);
413 gsf_bdtout1 = std::clamp(gsf_bdtout1, -20.
f, 20.
f);
422 sc_Nclus = std::clamp(sc_Nclus, 0.
f, 20.
f);
423 sc_clus1_nxtal = std::clamp(sc_clus1_nxtal, 0.
f, 100.
f);
424 if (sc_clus1_dphi < -3.14)
426 if (sc_clus1_dphi > 3.14)
428 if (sc_clus2_dphi < -3.14)
430 if (sc_clus2_dphi > 3.14)
432 sc_clus1_deta = std::clamp(sc_clus1_deta, -5.
f, 5.
f);
433 sc_clus2_deta = std::clamp(sc_clus2_deta, -5.
f, 5.
f);
434 sc_clus1_E = std::clamp(sc_clus1_E, 0.
f, 1000.
f);
435 sc_clus2_E = std::clamp(sc_clus2_E, 0.
f, 1000.
f);
436 if (sc_clus1_E_ov_p < 0.)
437 sc_clus1_E_ov_p = -1.;
438 if (sc_clus2_E_ov_p < 0.)
439 sc_clus2_E_ov_p = -1.;
442 std::vector<float>
output = {eid_rho,
444 eid_shape_full5x5_r9,
447 eid_shape_full5x5_HoverE,
454 eid_match_eclu_EoverP,
483 for (
auto const& cluster : sc.
clusters()) {
484 if (cluster->energy() > maxEne1) {
485 maxEne1 = cluster->energy();
492 for (
auto const& cluster : sc.
clusters()) {
494 if (cluster->energy() > maxEne2) {
495 maxEne2 = cluster->energy();
509 bool const& reach_ECAL,
511 float& sc_clus1_nxtal,
512 float& sc_clus1_dphi,
513 float& sc_clus2_dphi,
514 float& sc_clus1_deta,
515 float& sc_clus2_deta,
518 float& sc_clus1_E_ov_p,
519 float& sc_clus2_E_ov_p) {
531 for (
auto const& cluster : sc.
clusters()) {
532 float deta = ecal_pos.
eta() - cluster->eta();
535 sc_clus1_E = cluster->energy();
537 sc_clus1_E_ov_p = cluster->energy() / gsf.
pMode();
538 sc_clus1_nxtal = (
float)cluster->size();
539 if (reach_ECAL > 0) {
540 sc_clus1_deta = deta;
541 sc_clus1_dphi = dphi;
543 }
else if (clusNum == i2) {
544 sc_clus2_E = cluster->energy();
546 sc_clus2_E_ov_p = cluster->energy() / gsf.
pMode();
547 if (reach_ECAL > 0) {
548 sc_clus2_deta = deta;
549 sc_clus2_dphi = dphi;
constexpr double deltaPhi(double phi1, double phi2)
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
virtual TrackRef closestCtfTrackRef() const
bool isNonnull() const
Checks for non-null.
void findEnergeticClusters(reco::SuperCluster const &, int &, float &, float &, int &, int &)
double eta() const final
momentum pseudorapidity
double pMode() const
momentum vector magnitude from mode
float eSuperClusterOverP() const
double y() const
y of vertex
double z() const
z of vertex
Geom::Phi< T > phi() const
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
double pt() const final
transverse momentum
RawParticle const & particle() const
The particle being propagated.
const CaloClusterPtrVector & clusters() const
const access to the cluster list itself
void trackClusterMatching(reco::SuperCluster const &, reco::GsfTrack const &, bool const &, GlobalPoint const &, float &, float &, float &, float &, float &, float &, float &, float &, float &)
double x() const
x of vertex
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
float deltaEtaSuperClusterTrackAtVtx() const
float deltaPhiSuperClusterTrackAtVtx() const
float energy() const
Energy. Note this is taken from the first SimTrack only.
std::vector< float > features_V0(reco::GsfElectron const &ele, float rho, float unbiased)
bool propagateToEcalEntrance(bool first=true)
const XYZTLorentzVector & vertex() const
the vertex fourvector
float shFracInnerHits() const
double p() const final
magnitude of momentum vector
size_t clustersSize() const
number of BasicCluster constituents
float full5x5_hcalOverEcal() const
virtual GsfElectronCoreRef core() const
float deltaEtaSeedClusterTrackAtCalo() const
SuperClusterRef superCluster() const override
reference to a SuperCluster
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
double phi() const final
momentum azimuthal angle
Power< A, B >::type pow(const A &a, const B &b)
std::vector< float > features_V1(reco::GsfElectron const &ele, float rho, float unbiased, float field_z)
math::XYZTLorentzVector XYZTLorentzVector
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.