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 16 of file LowPtGsfElectronFeatures.cc.

20  {
21  float trk_pt_ = -1.;
22  float trk_eta_ = -1.;
23  float trk_phi_ = -1.;
24  float trk_p_ = -1.;
25  float trk_nhits_ = -1.;
26  float trk_high_quality_ = -1.;
27  float trk_chi2red_ = -1.;
28  float rho_ = -1.;
29  float ktf_ecal_cluster_e_ = -1.;
30  float ktf_ecal_cluster_deta_ = -42.;
31  float ktf_ecal_cluster_dphi_ = -42.;
32  float ktf_ecal_cluster_e3x3_ = -1.;
33  float ktf_ecal_cluster_e5x5_ = -1.;
34  float ktf_ecal_cluster_covEtaEta_ = -42.;
35  float ktf_ecal_cluster_covEtaPhi_ = -42.;
36  float ktf_ecal_cluster_covPhiPhi_ = -42.;
37  float ktf_ecal_cluster_r9_ = -0.1;
38  float ktf_ecal_cluster_circularity_ = -0.1;
39  float ktf_hcal_cluster_e_ = -1.;
40  float ktf_hcal_cluster_deta_ = -42.;
41  float ktf_hcal_cluster_dphi_ = -42.;
42  float preid_gsf_dpt_ = -1.;
43  float preid_trk_gsf_chiratio_ = -1.;
44  float preid_gsf_chi2red_ = -1.;
45  float trk_dxy_sig_ = -1.; // must be last (not used by unbiased model)
46 
47  // Tracks
48  const auto& trk = ecal.trackRef(); // reco::TrackRef
49  if (trk.isNonnull()) {
50  trk_pt_ = trk->pt();
51  trk_eta_ = trk->eta();
52  trk_phi_ = trk->phi();
53  trk_p_ = trk->p();
54  trk_nhits_ = static_cast<float>(trk->found());
55  trk_high_quality_ = static_cast<float>(trk->quality(reco::TrackBase::qualityByName("highPurity")));
56  trk_chi2red_ = trk->normalizedChi2();
57  if (trk->dxy(spot) > 0.) {
58  trk_dxy_sig_ = trk->dxyError() / trk->dxy(spot); //@@ to be consistent with the training based on 94X MC
59  }
60  ktf_ecal_cluster_dphi_ *= trk->charge(); //@@ to be consistent with the training based on 94X MC
61  }
62 
63  // Rho
64  rho_ = static_cast<float>(rho);
65 
66  // ECAL clusters
67  const auto& ecal_clu = ecal.clusterRef(); // reco::PFClusterRef
68  if (ecal_clu.isNonnull()) {
69  ktf_ecal_cluster_e_ = ecal_clu->energy();
70  ktf_ecal_cluster_deta_ = ecal.geomMatching()[0];
71  ktf_ecal_cluster_dphi_ = ecal.geomMatching()[1];
72  ktf_ecal_cluster_e3x3_ = tools.e3x3(*ecal_clu);
73  ktf_ecal_cluster_e5x5_ = tools.e5x5(*ecal_clu);
74  const auto& covs = tools.localCovariances(*ecal_clu);
75  ktf_ecal_cluster_covEtaEta_ = covs[0];
76  ktf_ecal_cluster_covEtaPhi_ = covs[1];
77  ktf_ecal_cluster_covPhiPhi_ = covs[2];
78  if (ktf_ecal_cluster_e_ > 0.) {
79  ktf_ecal_cluster_r9_ = ktf_ecal_cluster_e3x3_ / ktf_ecal_cluster_e_;
80  }
81  if (ktf_ecal_cluster_e5x5_ > 0.) {
82  ktf_ecal_cluster_circularity_ = 1. - tools.e1x5(*ecal_clu) / ktf_ecal_cluster_e5x5_;
83  } else {
84  ktf_ecal_cluster_circularity_ = -0.1;
85  }
86  }
87 
88  // HCAL clusters
89  const auto& hcal_clu = hcal.clusterRef(); // reco::PFClusterRef
90  if (hcal_clu.isNonnull()) {
91  ktf_hcal_cluster_e_ = hcal_clu->energy();
92  ktf_hcal_cluster_deta_ = hcal.geomMatching()[0];
93  ktf_hcal_cluster_dphi_ = hcal.geomMatching()[1];
94  }
95 
96  // PreId
97  preid_gsf_dpt_ = ecal.dpt();
98  preid_trk_gsf_chiratio_ = ecal.chi2Ratio();
99  preid_gsf_chi2red_ = ecal.gsfChi2();
100 
101  // Set contents of vector
102  std::vector<float> output = {trk_pt_,
103  trk_eta_,
104  trk_phi_,
105  trk_p_,
106  trk_nhits_,
107  trk_high_quality_,
108  trk_chi2red_,
109  rho_,
110  ktf_ecal_cluster_e_,
111  ktf_ecal_cluster_deta_,
112  ktf_ecal_cluster_dphi_,
113  ktf_ecal_cluster_e3x3_,
114  ktf_ecal_cluster_e5x5_,
115  ktf_ecal_cluster_covEtaEta_,
116  ktf_ecal_cluster_covEtaPhi_,
117  ktf_ecal_cluster_covPhiPhi_,
118  ktf_ecal_cluster_r9_,
119  ktf_ecal_cluster_circularity_,
120  ktf_hcal_cluster_e_,
121  ktf_hcal_cluster_deta_,
122  ktf_hcal_cluster_dphi_,
123  preid_gsf_dpt_,
124  preid_trk_gsf_chiratio_,
125  preid_gsf_chi2red_,
126  trk_dxy_sig_};
127  return output;
128  };

References 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
ecal
Definition: ElectronicsMappingGPU.h:13
tools
Definition: tools.py:1
reco::TrackBase::qualityByName
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126