CMS 3D CMS Logo

Classes | Functions
lowptgsfeleseed Namespace Reference

Classes

class  HeavyObjectCache
 

Functions

std::vector< float > features (const reco::PreId &ecal, const reco::PreId &hcal, double rho, const reco::BeamSpot &spot, noZS::EcalClusterLazyTools &ecalTools)
 

Function Documentation

◆ features()

std::vector< float > lowptgsfeleseed::features ( const reco::PreId ecal,
const reco::PreId hcal,
double  rho,
const reco::BeamSpot spot,
noZS::EcalClusterLazyTools ecalTools 
)

Definition at line 14 of file LowPtGsfElectronFeatures.cc.

18  {
19  float trk_pt_ = -1.;
20  float trk_eta_ = -1.;
21  float trk_phi_ = -1.;
22  float trk_p_ = -1.;
23  float trk_nhits_ = -1.;
24  float trk_high_quality_ = -1.;
25  float trk_chi2red_ = -1.;
26  float rho_ = -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.; // must be last (not used by unbiased model)
44 
45  // Tracks
46  const auto& trk = ecal.trackRef(); // reco::TrackRef
47  if (trk.isNonnull()) {
48  trk_pt_ = trk->pt();
49  trk_eta_ = trk->eta();
50  trk_phi_ = trk->phi();
51  trk_p_ = trk->p();
52  trk_nhits_ = static_cast<float>(trk->found());
53  trk_high_quality_ = static_cast<float>(trk->quality(reco::TrackBase::qualityByName("highPurity")));
54  trk_chi2red_ = trk->normalizedChi2();
55  if (trk->dxy(spot) > 0.) {
56  trk_dxy_sig_ = trk->dxyError() / trk->dxy(spot); //@@ to be consistent with the training based on 94X MC
57  }
58  ktf_ecal_cluster_dphi_ *= trk->charge(); //@@ to be consistent with the training based on 94X MC
59  }
60 
61  // Rho
62  rho_ = static_cast<float>(rho);
63 
64  // ECAL clusters
65  const auto& ecal_clu = ecal.clusterRef(); // reco::PFClusterRef
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_;
78  }
79  if (ktf_ecal_cluster_e5x5_ > 0.) {
80  ktf_ecal_cluster_circularity_ = 1. - tools.e1x5(*ecal_clu) / ktf_ecal_cluster_e5x5_;
81  } else {
82  ktf_ecal_cluster_circularity_ = -0.1;
83  }
84  }
85 
86  // HCAL clusters
87  const auto& hcal_clu = hcal.clusterRef(); // reco::PFClusterRef
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];
92  }
93 
94  // PreId
95  preid_gsf_dpt_ = ecal.dpt();
96  preid_trk_gsf_chiratio_ = ecal.chi2Ratio();
97  preid_gsf_chi2red_ = ecal.gsfChi2();
98 
99  // Set contents of vector
100  std::vector<float> output = {trk_pt_,
101  trk_eta_,
102  trk_phi_,
103  trk_p_,
104  trk_nhits_,
105  trk_high_quality_,
106  trk_chi2red_,
107  rho_,
108  ktf_ecal_cluster_e_,
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_,
118  ktf_hcal_cluster_e_,
119  ktf_hcal_cluster_deta_,
120  ktf_hcal_cluster_dphi_,
121  preid_gsf_dpt_,
122  preid_trk_gsf_chiratio_,
123  preid_gsf_chi2red_,
124  trk_dxy_sig_};
125  return output;
126  };

References bsc_activity_cfg::ecal, convertSQLitetoXML_cfg::output, and reco::TrackBase::qualityByName().

Referenced by lowptgsfeleseed::HeavyObjectCache::eval().

convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
hcal
Definition: ConfigurationDatabase.cc:13
ZElectronSkim_cff.rho
rho
Definition: ZElectronSkim_cff.py:38
tools
Definition: tools.py:1
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
bsc_activity_cfg.ecal
ecal
Definition: bsc_activity_cfg.py:25