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.;
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.;
54 eid_trk_nhits = tk->
found();
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());
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);
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();
92 eid_match_eclu_EoverP = (1. / ele.
ecalEnergy()) - (1. / ele.
p());
104 eid_brem_frac = ele.
fbrem();
117 double mass2 = 0.000511 * 0.000511;
118 float p2 =
pow(gsf->p(), 2);
119 float energy =
sqrt(mass2 + p2);
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.;
137 sc_clus1_E_ov_p = -999.;
138 sc_clus2_E_ov_p = -999.;
152 sc_clus1_nxtal = (
int)sc_clus1_nxtal;
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.14
f);
163 eid_sc_phiWidth = std::clamp(eid_sc_phiWidth, 0.
f, 3.14
f);
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.)
170 if (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.14
f, 3.14
f);
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);
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.14
f, 3.14
f);
194 sc_clus2_dphi = std::clamp(sc_clus2_dphi, -3.14
f, 3.14
f);
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.;
205 std::vector<float>
output = {eid_rho,
207 eid_shape_full5x5_r9,
210 eid_shape_full5x5_HoverE,
217 eid_match_eclu_EoverP,
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.;
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);
295 const auto&
gsf = ele.
core()->gsfTrack();
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);
310 const auto&
sc = ele.
core()->superCluster();
311 if (
sc.isNonnull()) {
313 eid_sc_eta =
sc->
eta();
314 eid_sc_etaWidth =
sc->etaWidth();
315 eid_sc_phiWidth =
sc->phiWidth();
316 sc_Nclus = (
float)
sc->clustersSize();
322 eid_match_eclu_EoverP = (1. / ele.
ecalEnergy()) - (1. / ele.
p());
334 eid_brem_frac = ele.
fbrem();
342 const auto&
gsf = ele.
core()->gsfTrack();
343 if (
gsf.isNonnull()) {
344 const auto&
sc = ele.
core()->superCluster();
345 if (
sc.isNonnull()) {
347 double mass2 = 0.000511 * 0.000511;
349 float energy =
sqrt(mass2 + p2);
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.;
369 sc_clus1_E_ov_p = -999.;
370 sc_clus2_E_ov_p = -999.;
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.14
f);
393 eid_sc_phiWidth = std::clamp(eid_sc_phiWidth, 0.
f, 3.14
f);
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.)
400 if (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.14
f, 3.14
f);
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);
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)
425 if (sc_clus1_dphi > 3.14)
427 if (sc_clus2_dphi < -3.14)
429 if (sc_clus2_dphi > 3.14)
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.;
441 std::vector<float>
output = {eid_rho,
443 eid_shape_full5x5_r9,
446 eid_shape_full5x5_HoverE,
453 eid_match_eclu_EoverP,
482 for (
auto const& cluster : sc.
clusters()) {
483 if (cluster->energy() > maxEne1) {
484 maxEne1 = cluster->energy();
491 for (
auto const& cluster : sc.
clusters()) {
493 if (cluster->energy() > maxEne2) {
494 maxEne2 = cluster->energy();
508 bool const& reach_ECAL,
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,
517 float& sc_clus1_E_ov_p,
518 float& sc_clus2_E_ov_p) {
530 for (
auto const& cluster : sc.
clusters()) {
531 float deta = ecal_pos.
eta() - cluster->eta();
534 sc_clus1_E = cluster->energy();
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;
542 }
else if (clusNum == i2) {
543 sc_clus2_E = cluster->energy();
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;
constexpr double deltaPhi(double phi1, double phi2)
double p() const
momentum vector magnitude
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 normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
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 phi() const
azimuthal angle of momentum vector
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 &)
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
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
float deltaEtaSuperClusterTrackAtVtx() const
double eta() const
pseudorapidity of momentum vector
double pt() const
track transverse momentum
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)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
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
unsigned short found() const
Number of valid hits on track.
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)
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.