CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CutBasedElectronID Class Reference

#include <CutBasedElectronID.h>

Inheritance diagram for CutBasedElectronID:
ElectronIDAlgo

Public Member Functions

double cicSelection (const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &)
 
int classify (const reco::GsfElectron *)
 
bool compute_cut (double x, double et, double cut_min, double cut_max, bool gtn=false)
 
 CutBasedElectronID ()
 
double result (const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &)
 
double robustSelection (const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &)
 
void setup (const edm::ParameterSet &conf)
 
virtual ~CutBasedElectronID ()
 
- Public Member Functions inherited from ElectronIDAlgo
void baseSetup (const edm::ParameterSet &conf)
 
 ElectronIDAlgo ()
 
virtual ~ElectronIDAlgo ()
 

Private Attributes

edm::ParameterSet cuts_
 
bool newCategories_
 
std::string quality_
 
std::string type_
 
std::string version_
 
edm::InputTag verticesCollection_
 
bool wantBinning_
 

Additional Inherited Members

- Protected Member Functions inherited from ElectronIDAlgo
EcalClusterLazyTools getClusterShape (const edm::Event &, const edm::EventSetup &)
 
- Protected Attributes inherited from ElectronIDAlgo
edm::InputTag reducedBarrelRecHitCollection_
 
edm::InputTag reducedEndcapRecHitCollection_
 

Detailed Description

Definition at line 6 of file CutBasedElectronID.h.

Constructor & Destructor Documentation

CutBasedElectronID::CutBasedElectronID ( )
inline

Definition at line 10 of file CutBasedElectronID.h.

10 {};
virtual CutBasedElectronID::~CutBasedElectronID ( )
inlinevirtual

Definition at line 12 of file CutBasedElectronID.h.

12 {};

Member Function Documentation

double CutBasedElectronID::cicSelection ( const reco::GsfElectron electron,
const edm::Event e,
const edm::EventSetup es 
)

Definition at line 123 of file CutBasedElectronID.cc.

References newFWLiteAna::bin, classify(), compute_cut(), reco::GsfElectron::convDcot(), reco::GsfElectron::convDist(), GOODCOLL_filter_cfg::cut, cutsInCategoriesElectronIdentification_cfi::cutdcotdist, cutsInCategoriesElectronIdentification_cfi::cutet, cutsInCategoriesElectronIdentification_cfi::cuthoe, cutsInCategoriesElectronIdentificationV06_cfi::cuthoel, cuts_, cutsInCategoriesElectronIdentification_cfi::cutsee, cutsInCategoriesElectronIdentificationV06_cfi::cutseel, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::dr03TkSumPt(), reco::GsfElectron::dr04EcalRecHitSumEt(), reco::GsfElectron::dr04HcalTowerSumEt(), reco::GsfElectron::eSeedClusterOverP(), reco::GsfElectron::eSuperClusterOverP(), eta(), create_public_lumi_plots::exp, reco::GsfElectron::fbrem(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::hadronicOverEm(), reco::GsfElectron::isEB(), reco::GsfElectron::isEE(), max(), or, funct::pow(), quality_, result(), reco::GsfElectron::sigmaEtaEta(), reco::GsfElectron::sigmaIetaIeta(), funct::sin(), reco::GsfElectron::superCluster(), type_, version_, verticesCollection_, and wantBinning_.

Referenced by result().

125  {
126 
127  double scTheta = (2*atan(exp(-electron->superCluster()->eta())));
128  double scEt = electron->superCluster()->energy()*sin(scTheta);
129 
130  double eta = fabs(electron->superCluster()->eta());
131 
132  double eOverP = electron->eSuperClusterOverP();
133  double eSeedOverPin = electron->eSeedClusterOverP();
134  double fBrem = electron->fbrem();
135  double hOverE = electron->hadronicOverEm();
136  double sigmaee = electron->sigmaIetaIeta(); //sqrt(vLocCov[0]);
137  double deltaPhiIn = electron->deltaPhiSuperClusterTrackAtVtx();
138  double deltaEtaIn = electron->deltaEtaSuperClusterTrackAtVtx();
139 
140  double ip = 0;
141  int mishits = electron->gsfTrack()->trackerExpectedHitsInner().numberOfHits();
142  double tkIso = electron->dr03TkSumPt();
143  double ecalIso = electron->dr04EcalRecHitSumEt();
144  double hcalIso = electron->dr04HcalTowerSumEt();
145 
146  if (version_ == "V00") {
147  sigmaee = electron->sigmaEtaEta();//sqrt(vCov[0]);
148  if (electron->isEE())
149  sigmaee = sigmaee - 0.02*(fabs(eta) - 2.3); //correct sigmaetaeta dependence on eta in endcap
150  }
151 
152  if (version_ != "V01" or version_ != "V00") {
155  if (vtxH->size() != 0) {
156  reco::VertexRef vtx(vtxH, 0);
157  ip = fabs(electron->gsfTrack()->dxy(math::XYZPoint(vtx->x(),vtx->y(),vtx->z())));
158  } else
159  ip = fabs(electron->gsfTrack()->dxy());
160 
161  if (electron->isEB()) {
162  sigmaee = electron->sigmaIetaIeta(); //sqrt(vCov[0]);
163  }
164  }
165 
166  std::vector<double> cut;
167 
168  int cat = classify(electron);
169  int eb;
170 
171  if (electron->isEB())
172  eb = 0;
173  else
174  eb = 1;
175 
176  // LOOSE and TIGHT Selections
177  if (type_ == "classbased" && (version_ == "V01" || version_ == "V00")) {
178 
179  if ((eOverP < 0.8) && (fBrem < 0.2))
180  return 0.;
181 
182  cut = cuts_.getParameter<std::vector<double> >("hOverE");
183  if (hOverE > cut[cat+4*eb])
184  return 0.;
185 
186  cut = cuts_.getParameter<std::vector<double> >("sigmaEtaEta");
187  if (sigmaee > cut[cat+4*eb])
188  return 0.;
189 
190  cut = cuts_.getParameter<std::vector<double> >("deltaPhiIn");
191  if (eOverP < 1.5) {
192  if (fabs(deltaPhiIn) > cut[cat+4*eb])
193  return 0.;
194  } else {
195  if (fabs(deltaPhiIn) > cut[3+4*eb])
196  return 0.;
197  }
198 
199  cut = cuts_.getParameter<std::vector<double> >("deltaEtaIn");
200  if (fabs(deltaEtaIn) > cut[cat+4*eb])
201  return 0.;
202 
203  cut = cuts_.getParameter<std::vector<double> >("eSeedOverPin");
204  if (eSeedOverPin < cut[cat+4*eb])
205  return 0.;
206 
207  if (quality_ == "tight")
208  if (eOverP < 0.9*(1-fBrem))
209  return 0.;
210 
211  return 1.;
212  }
213 
214  if (type_ == "classbased" and version_ == "V02") {
215  double result = 0.;
216 
217  int bin = 0;
218 
219  if (scEt < 20.)
220  bin = 2;
221  else if (scEt > 30.)
222  bin = 0;
223  else
224  bin = 1;
225 
226  if (fBrem > 0)
227  eSeedOverPin = eSeedOverPin + fBrem;
228 
229  if (bin != 2) {
230  tkIso = tkIso*pow(40./scEt, 2);
231  ecalIso = ecalIso*pow(40./scEt, 2);
232  hcalIso = hcalIso*pow(40./scEt, 2);
233  }
234 
235  std::vector<double> cutTk = cuts_.getParameter<std::vector<double> >("cutisotk");
236  std::vector<double> cutEcal = cuts_.getParameter<std::vector<double> >("cutisoecal");
237  std::vector<double> cutHcal = cuts_.getParameter<std::vector<double> >("cutisohcal");
238  if ((tkIso > cutTk[cat+3*eb+bin*6]) ||
239  (ecalIso > cutEcal[cat+3*eb+bin*6]) ||
240  (hcalIso > cutHcal[cat+3*eb+bin*6]))
241  result = 0.;
242  else
243  result = 2.;
244 
245  if (fBrem > -2) {
246  std::vector<double> cuthoe = cuts_.getParameter<std::vector<double> >("cuthoe");
247  std::vector<double> cutsee = cuts_.getParameter<std::vector<double> >("cutsee");
248  std::vector<double> cutdphi = cuts_.getParameter<std::vector<double> >("cutdphiin");
249  std::vector<double> cutdeta = cuts_.getParameter<std::vector<double> >("cutdetain");
250  std::vector<double> cuteopin = cuts_.getParameter<std::vector<double> >("cuteseedopcor");
251  std::vector<double> cutet = cuts_.getParameter<std::vector<double> >("cutet");
252  std::vector<double> cutip = cuts_.getParameter<std::vector<double> >("cutip");
253  std::vector<double> cutmishits = cuts_.getParameter<std::vector<double> >("cutmishits");
254  if ((hOverE < cuthoe[cat+3*eb+bin*6]) and
255  (sigmaee < cutsee[cat+3*eb+bin*6]) and
256  (fabs(deltaPhiIn) < cutdphi[cat+3*eb+bin*6]) and
257  (fabs(deltaEtaIn) < cutdeta[cat+3*eb+bin*6]) and
258  (eSeedOverPin > cuteopin[cat+3*eb+bin*6]) and
259  (ip < cutip[cat+3*eb+bin*6]) and
260  (mishits < cutmishits[cat+3*eb+bin*6]))
261  result = result + 1.;
262  }
263  return result;
264  }
265 
266  if (version_ == "V03" or version_ == "V04" or version_ == "V05") {
267  double result = 0.;
268 
269  int bin = 0;
270 
271  if (wantBinning_) {
272  if (scEt < 20.)
273  bin = 2;
274  else if (scEt > 30.)
275  bin = 0;
276  else
277  bin = 1;
278  }
279 
280  if (fBrem > 0)
281  eSeedOverPin = eSeedOverPin + fBrem;
282 
283  float iso_sum = tkIso + ecalIso + hcalIso;
284  float iso_sum_corrected = iso_sum*pow(40./scEt, 2);
285 
286  std::vector<double> cutIsoSum = cuts_.getParameter<std::vector<double> >("cutiso_sum");
287  std::vector<double> cutIsoSumCorr = cuts_.getParameter<std::vector<double> >("cutiso_sumoet");
288  if ((iso_sum < cutIsoSum[cat+bin*9]) and
289  (iso_sum_corrected < cutIsoSumCorr[cat+bin*9]))
290  result += 2.;
291 
292  if (fBrem > -2) {
293  std::vector<double> cuthoe = cuts_.getParameter<std::vector<double> >("cuthoe");
294  std::vector<double> cutsee = cuts_.getParameter<std::vector<double> >("cutsee");
295  std::vector<double> cutdphi = cuts_.getParameter<std::vector<double> >("cutdphiin");
296  std::vector<double> cutdeta = cuts_.getParameter<std::vector<double> >("cutdetain");
297  std::vector<double> cuteopin = cuts_.getParameter<std::vector<double> >("cuteseedopcor");
298  std::vector<double> cutet = cuts_.getParameter<std::vector<double> >("cutet");
299 
300  if ((hOverE < cuthoe[cat+bin*9]) and
301  (sigmaee < cutsee[cat+bin*9]) and
302  (fabs(deltaPhiIn) < cutdphi[cat+bin*9]) and
303  (fabs(deltaEtaIn) < cutdeta[cat+bin*9]) and
304  (eSeedOverPin > cuteopin[cat+bin*9]) and
305  (scEt > cutet[cat+bin*9]))
306  result += 1.;
307  }
308 
309  std::vector<double> cutip = cuts_.getParameter<std::vector<double> >("cutip_gsf");
310  if (ip < cutip[cat+bin*9])
311  result += 8;
312 
313  std::vector<double> cutmishits = cuts_.getParameter<std::vector<double> >("cutfmishits");
314  std::vector<double> cutdcotdist = cuts_.getParameter<std::vector<double> >("cutdcotdist");
315 
316  float dist = (electron->convDist() == -9999.? 9999:electron->convDist());
317  float dcot = (electron->convDcot() == -9999.? 9999:electron->convDcot());
318 
319  float dcotdistcomb = ((0.04 - std::max(fabs(dist), fabs(dcot))) > 0?(0.04 - std::max(fabs(dist), fabs(dcot))):0);
320 
321  if ((mishits < cutmishits[cat+bin*9]) and
322  (dcotdistcomb < cutdcotdist[cat+bin*9]))
323  result += 4;
324 
325  return result;
326  }
327 
328  if (type_ == "classbased" && (version_ == "V06" || version_ == "")) {
329  std::vector<double> cutIsoSum = cuts_.getParameter<std::vector<double> >("cutiso_sum");
330  std::vector<double> cutIsoSumCorr = cuts_.getParameter<std::vector<double> >("cutiso_sumoet");
331  std::vector<double> cuthoe = cuts_.getParameter<std::vector<double> >("cuthoe");
332  std::vector<double> cutsee = cuts_.getParameter<std::vector<double> >("cutsee");
333  std::vector<double> cutdphi = cuts_.getParameter<std::vector<double> >("cutdphiin");
334  std::vector<double> cutdeta = cuts_.getParameter<std::vector<double> >("cutdetain");
335  std::vector<double> cuteopin = cuts_.getParameter<std::vector<double> >("cuteseedopcor");
336  std::vector<double> cutmishits = cuts_.getParameter<std::vector<double> >("cutfmishits");
337  std::vector<double> cutdcotdist = cuts_.getParameter<std::vector<double> >("cutdcotdist");
338  std::vector<double> cutip = cuts_.getParameter<std::vector<double> >("cutip_gsf");
339  std::vector<double> cutIsoSumCorrl = cuts_.getParameter<std::vector<double> >("cutiso_sumoetl");
340  std::vector<double> cuthoel = cuts_.getParameter<std::vector<double> >("cuthoel");
341  std::vector<double> cutseel = cuts_.getParameter<std::vector<double> >("cutseel");
342  std::vector<double> cutdphil = cuts_.getParameter<std::vector<double> >("cutdphiinl");
343  std::vector<double> cutdetal = cuts_.getParameter<std::vector<double> >("cutdetainl");
344  std::vector<double> cutipl = cuts_.getParameter<std::vector<double> >("cutip_gsfl");
345 
346  int result = 0;
347 
348  const int ncuts = 10;
349  std::vector<bool> cut_results(ncuts, false);
350 
351  float iso_sum = tkIso + ecalIso + hcalIso;
352  float scEta = electron->superCluster()->eta();
353  if(fabs(scEta)>1.5)
354  iso_sum += (fabs(scEta)-1.5)*1.09;
355 
356  float iso_sumoet = iso_sum*(40./scEt);
357 
358  float eseedopincor = eSeedOverPin + fBrem;
359  if(fBrem < 0)
360  eseedopincor = eSeedOverPin;
361 
362  float dist = (electron->convDist() == -9999.? 9999:electron->convDist());
363  float dcot = (electron->convDcot() == -9999.? 9999:electron->convDcot());
364 
365  float dcotdistcomb = ((0.04 - std::max(fabs(dist), fabs(dcot))) > 0?(0.04 - std::max(fabs(dist), fabs(dcot))):0);
366 
367  for (int cut=0; cut<ncuts; cut++) {
368  switch (cut) {
369  case 0:
370  cut_results[cut] = compute_cut(fabs(deltaEtaIn), scEt, cutdetal[cat], cutdeta[cat]);
371  break;
372  case 1:
373  cut_results[cut] = compute_cut(fabs(deltaPhiIn), scEt, cutdphil[cat], cutdphi[cat]);
374  break;
375  case 2:
376  cut_results[cut] = (eseedopincor > cuteopin[cat]);
377  break;
378  case 3:
379  cut_results[cut] = compute_cut(hOverE, scEt, cuthoel[cat], cuthoe[cat]);
380  break;
381  case 4:
382  cut_results[cut] = compute_cut(sigmaee, scEt, cutseel[cat], cutsee[cat]);
383  break;
384  case 5:
385  cut_results[cut] = compute_cut(iso_sumoet, scEt, cutIsoSumCorrl[cat], cutIsoSumCorr[cat]);
386  break;
387  case 6:
388  cut_results[cut] = (iso_sum < cutIsoSum[cat]);
389  break;
390  case 7:
391  cut_results[cut] = compute_cut(fabs(ip), scEt, cutipl[cat], cutip[cat]);
392  break;
393  case 8:
394  cut_results[cut] = (mishits < cutmishits[cat]);
395  break;
396  case 9:
397  cut_results[cut] = (dcotdistcomb < cutdcotdist[cat]);
398  break;
399  }
400  }
401 
402  // ID part
403  if (cut_results[0] & cut_results[1] & cut_results[2] & cut_results[3] & cut_results[4])
404  result = result + 1;
405 
406  // ISO part
407  if (cut_results[5] & cut_results[6])
408  result = result + 2;
409 
410  // IP part
411  if (cut_results[7])
412  result = result + 8;
413 
414  // Conversion part
415  if (cut_results[8] & cut_results[9])
416  result = result + 4;
417 
418  return result;
419  }
420 
421  return -1.;
422 }
T getParameter(std::string const &) const
float dr04HcalTowerSumEt() const
Definition: GsfElectron.h:451
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ParameterSet cuts_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float fbrem() const
Definition: GsfElectron.h:639
T eta() const
float convDist() const
Definition: GsfElectron.h:498
double result(const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &)
bool isEE() const
Definition: GsfElectron.h:331
bool isEB() const
Definition: GsfElectron.h:330
float convDcot() const
Definition: GsfElectron.h:499
int classify(const reco::GsfElectron *)
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
float sigmaIetaIeta() const
Definition: GsfElectron.h:382
float hadronicOverEm() const
Definition: GsfElectron.h:403
float eSeedClusterOverP() const
Definition: GsfElectron.h:230
float dr04EcalRecHitSumEt() const
Definition: GsfElectron.h:448
const T & max(const T &a, const T &b)
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
edm::InputTag verticesCollection_
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
float dr03TkSumPt() const
Definition: GsfElectron.h:436
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
bool compute_cut(double x, double et, double cut_min, double cut_max, bool gtn=false)
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
float sigmaEtaEta() const
Definition: GsfElectron.h:381
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
int CutBasedElectronID::classify ( const reco::GsfElectron electron)

Definition at line 53 of file CutBasedElectronID.cc.

References reco::GsfElectron::ecalDrivenSeed(), reco::GsfElectron::eSuperClusterOverP(), eta(), reco::GsfElectron::fbrem(), reco::GsfElectron::isEB(), reco::GsfElectron::isEE(), newCategories_, or, reco::GsfElectron::superCluster(), reco::GsfElectron::trackerDrivenSeed(), and version_.

Referenced by cicSelection().

53  {
54 
55  double eta = fabs(electron->superCluster()->eta());
56  double eOverP = electron->eSuperClusterOverP();
57  double fBrem = electron->fbrem();
58 
59  int cat = -1;
60  if (version_ == "V00" || version_ == "V01") {
61  if((electron->isEB() && fBrem<0.06) || (electron->isEE() && fBrem<0.1))
62  cat=1;
63  else if (eOverP < 1.2 && eOverP > 0.8)
64  cat=0;
65  else
66  cat=2;
67 
68  return cat;
69 
70  } else if (version_ == "V02") {
71  if (electron->isEB()) { // BARREL
72  if(fBrem < 0.12)
73  cat=1;
74  else if (eOverP < 1.2 && eOverP > 0.9)
75  cat=0;
76  else
77  cat=2;
78  } else { // ENDCAP
79  if(fBrem < 0.2)
80  cat=1;
81  else if (eOverP < 1.22 && eOverP > 0.82)
82  cat=0;
83  else
84  cat=2;
85  }
86 
87  return cat;
88 
89  } else {
90  if (electron->isEB()) {
91  if ((fBrem >= 0.12) and (eOverP > 0.9) and (eOverP < 1.2))
92  cat = 0;
93  else if (((eta > .445 and eta < .45 ) or
94  (eta > .79 and eta < .81 ) or
95  (eta > 1.137 and eta < 1.157 ) or
96  (eta > 1.47285 and eta < 1.4744)) and newCategories_)
97  cat = 6;
98  else if (electron->trackerDrivenSeed() and !electron->ecalDrivenSeed() and newCategories_)
99  cat = 8;
100  else if (fBrem < 0.12)
101  cat = 1;
102  else
103  cat = 2;
104  } else {
105  if ((fBrem >= 0.2) and (eOverP > 0.82) and (eOverP < 1.22))
106  cat = 3;
107  else if (eta > 1.5 and eta < 1.58 and newCategories_)
108  cat = 7;
109  else if (electron->trackerDrivenSeed() and !electron->ecalDrivenSeed() and newCategories_)
110  cat = 8;
111  else if (fBrem < 0.2)
112  cat = 4;
113  else
114  cat = 5;
115  }
116 
117  return cat;
118  }
119 
120  return -1;
121 }
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
float fbrem() const
Definition: GsfElectron.h:639
T eta() const
bool isEE() const
Definition: GsfElectron.h:331
bool isEB() const
Definition: GsfElectron.h:330
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
bool trackerDrivenSeed() const
Definition: GsfElectron.h:173
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
bool ecalDrivenSeed() const
Definition: GsfElectron.h:172
bool CutBasedElectronID::compute_cut ( double  x,
double  et,
double  cut_min,
double  cut_max,
bool  gtn = false 
)

Definition at line 425 of file CutBasedElectronID.cc.

References accept(), and GOODCOLL_filter_cfg::cut.

Referenced by cicSelection().

425  {
426 
427  float et_min = 10;
428  float et_max = 40;
429 
430  bool accept = false;
431  float cut = cut_max; // the cut at et=40 GeV
432 
433  if(et < et_max) {
434  cut = cut_min + (1/et_min - 1/et)*(cut_max - cut_min)/(1/et_min - 1/et_max);
435  }
436 
437  if(et < et_min) {
438  cut = cut_min;
439  }
440 
441  if(gtn) { // useful for e/p cut which is gt
442  accept = (x >= cut);
443  }
444  else {
445  accept = (x <= cut);
446  }
447 
448  //std::cout << x << " " << cut_min << " " << cut << " " << cut_max << " " << et << " " << accept << std::endl;
449  return accept;
450 }
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
x
Definition: VDTMath.h:216
double CutBasedElectronID::result ( const reco::GsfElectron electron,
const edm::Event e,
const edm::EventSetup es 
)
virtual

Reimplemented from ElectronIDAlgo.

Definition at line 40 of file CutBasedElectronID.cc.

References cicSelection(), robustSelection(), and type_.

Referenced by cicSelection(), and robustSelection().

42  {
43 
44  if (type_ == "classbased")
45  return cicSelection(electron, e, es);
46  else if (type_ == "robust")
47  return robustSelection(electron, e, es);
48 
49  return 0;
50 
51 }
double robustSelection(const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &)
double cicSelection(const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &)
double CutBasedElectronID::robustSelection ( const reco::GsfElectron electron,
const edm::Event e,
const edm::EventSetup es 
)

Definition at line 452 of file CutBasedElectronID.cc.

References reco::GsfElectron::convDcot(), reco::GsfElectron::convDist(), GOODCOLL_filter_cfg::cut, cuts_, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::dr03EcalRecHitSumEt(), reco::GsfElectron::dr03HcalDepth1TowerSumEt(), reco::GsfElectron::dr03HcalDepth2TowerSumEt(), reco::GsfElectron::dr03HcalTowerSumEt(), reco::GsfElectron::dr03TkSumPt(), reco::GsfElectron::dr04EcalRecHitSumEt(), reco::GsfElectron::dr04HcalDepth1TowerSumEt(), reco::GsfElectron::dr04HcalDepth2TowerSumEt(), reco::GsfElectron::dr04HcalTowerSumEt(), reco::GsfElectron::e1x5(), reco::GsfElectron::e2x5Max(), reco::GsfElectron::e5x5(), reco::GsfElectron::eSuperClusterOverP(), eta(), create_public_lumi_plots::exp, edm::Event::getByLabel(), edm::ParameterSet::getParameter(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::hadronicOverEm(), reco::GsfElectron::isEB(), reco::GsfElectron::isEE(), edm::HandleBase::isValid(), max(), or, reco::GsfElectron::p4(), reco::BeamSpot::position(), edm::Handle< T >::product(), quality_, result(), reco::GsfElectron::sigmaEtaEta(), reco::GsfElectron::sigmaIetaIeta(), funct::sin(), reco::GsfElectron::superCluster(), type_, version_, and verticesCollection_.

Referenced by result().

454  {
455 
456  double scTheta = (2*atan(exp(-electron->superCluster()->eta())));
457  double scEt = electron->superCluster()->energy()*sin(scTheta);
458  double eta = electron->p4().Eta();
459  double eOverP = electron->eSuperClusterOverP();
460  double hOverE = electron->hadronicOverEm();
461  double sigmaee = electron->sigmaIetaIeta();
462  double e25Max = electron->e2x5Max();
463  double e15 = electron->e1x5();
464  double e55 = electron->e5x5();
465  double e25Maxoe55 = e25Max/e55;
466  double e15oe55 = e15/e55 ;
467  double deltaPhiIn = electron->deltaPhiSuperClusterTrackAtVtx();
468  double deltaEtaIn = electron->deltaEtaSuperClusterTrackAtVtx();
469 
470  double ip = 0;
471  int mishits = electron->gsfTrack()->trackerExpectedHitsInner().numberOfHits();
472  double tkIso = electron->dr03TkSumPt();
473  double ecalIso = electron->dr04EcalRecHitSumEt();
474  double ecalIsoPed = (electron->isEB())?std::max(0.,ecalIso-1.):ecalIso;
475  double hcalIso = electron->dr04HcalTowerSumEt();
476  double hcalIso1 = electron->dr04HcalDepth1TowerSumEt();
477  double hcalIso2 = electron->dr04HcalDepth2TowerSumEt();
478 
479  if (version_ == "V00") {
480  sigmaee = electron->sigmaEtaEta();
481  if (electron->isEE())
482  sigmaee = sigmaee - 0.02*(fabs(eta) - 2.3); //correct sigmaetaeta dependence on eta in endcap
483  }
484 
485  if (version_ == "V03" or version_ == "V04") {
486  edm::Handle<reco::BeamSpot> pBeamSpot;
487  // uses the same name for the vertex collection to avoid adding more new names
488  e.getByLabel(verticesCollection_, pBeamSpot);
489  if (pBeamSpot.isValid()) {
490  const reco::BeamSpot *bspot = pBeamSpot.product();
491  const math::XYZPoint bspotPosition = bspot->position();
492  ip = fabs(electron->gsfTrack()->dxy(bspotPosition));
493  } else
494  ip = fabs(electron->gsfTrack()->dxy());
495  }
496 
497  if (version_ == "V04" or version_ == "V05") {
498  ecalIso = electron->dr03EcalRecHitSumEt();
499  ecalIsoPed = (electron->isEB())?std::max(0.,ecalIso-1.):ecalIso;
500  hcalIso = electron->dr03HcalTowerSumEt();
501  hcalIso1 = electron->dr03HcalDepth1TowerSumEt();
502  hcalIso2 = electron->dr03HcalDepth2TowerSumEt();
503  }
504 
505  if (version_ == "V05") {
508  if (vtxH->size() != 0) {
509  reco::VertexRef vtx(vtxH, 0);
510  ip = fabs(electron->gsfTrack()->dxy(math::XYZPoint(vtx->x(),vtx->y(),vtx->z())));
511  } else
512  ip = fabs(electron->gsfTrack()->dxy());
513  }
514 
515  // .....................................................................................
516  std::vector<double> cut;
517  // ROBUST Selection
518  if (type_ == "robust") {
519 
520  double result = 0;
521 
522  // hoe, sigmaEtaEta, dPhiIn, dEtaIn
523  if (electron->isEB())
524  cut = cuts_.getParameter<std::vector<double> >("barrel");
525  else
526  cut = cuts_.getParameter<std::vector<double> >("endcap");
527  // check isolations: if only isolation passes result = 2
528  if (quality_ == "highenergy") {
529  if ((tkIso > cut[6] || hcalIso2 > cut[11]) ||
530  (electron->isEB() && ((ecalIso + hcalIso1) > cut[7]+cut[8]*scEt)) ||
531  (electron->isEE() && (scEt >= 50.) && ((ecalIso + hcalIso1) > cut[7]+cut[8]*(scEt-50))) ||
532  (electron->isEE() && (scEt < 50.) && ((ecalIso + hcalIso1) > cut[9]+cut[10]*(scEt-50))))
533  result = 0;
534  else
535  result = 2;
536  } else {
537  if ((tkIso > cut[6]) || (ecalIso > cut[7]) || (hcalIso > cut[8]) || (hcalIso1 > cut[9]) || (hcalIso2 > cut[10]) ||
538  (tkIso/electron->p4().Pt() > cut[11]) || (ecalIso/electron->p4().Pt() > cut[12]) || (hcalIso/electron->p4().Pt() > cut[13]) ||
539  ((tkIso+ecalIso+hcalIso)>cut[14]) || (((tkIso+ecalIso+hcalIso)/ electron->p4().Pt()) > cut[15]) ||
540  ((tkIso+ecalIsoPed+hcalIso)>cut[16]) || (((tkIso+ecalIsoPed+hcalIso)/ electron->p4().Pt()) > cut[17]) )
541  result = 0.;
542  else
543  result = 2.;
544  }
545 
546  if ((hOverE < cut[0]) && (sigmaee < cut[1]) && (fabs(deltaPhiIn) < cut[2]) &&
547  (fabs(deltaEtaIn) < cut[3]) && (e25Maxoe55 > cut[4] && e15oe55 > cut[5]) &&
548  (sigmaee >= cut[18]) && (eOverP > cut[19] && eOverP < cut[20]) )
549  { result = result + 1 ; }
550 
551  if (ip > cut[21])
552  return result;
553  if (mishits > cut[22]) // expected missing hits
554  return result;
555  // positive cut[23] means to demand a valid hit in 1st layer PXB
556  if (cut[23] >0 && not (electron->gsfTrack()->hitPattern().hasValidHitInFirstPixelBarrel()))
557  return result;
558 
559  // cut[24]: Dist cut[25]: dcot
560  float dist = fabs(electron->convDist());
561  float dcot = fabs(electron->convDcot());
562  bool isConversion = (cut[24]>99. || cut[25]>99.)?false:(dist < cut[24] && dcot < cut[25]);
563  if (isConversion)
564  return result ;
565 
566  result += 4 ;
567 
568  return result ;
569  }
570 
571  return -1. ;
572  }
T getParameter(std::string const &) const
float dr04HcalTowerSumEt() const
Definition: GsfElectron.h:451
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:204
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
float dr04HcalDepth1TowerSumEt() const
Definition: GsfElectron.h:449
edm::ParameterSet cuts_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float dr03HcalDepth2TowerSumEt() const
Definition: GsfElectron.h:439
T eta() const
float e2x5Max() const
Definition: GsfElectron.h:385
float convDist() const
Definition: GsfElectron.h:498
double result(const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &)
bool isEE() const
Definition: GsfElectron.h:331
bool isEB() const
Definition: GsfElectron.h:330
float convDcot() const
Definition: GsfElectron.h:499
float dr04HcalDepth2TowerSumEt() const
Definition: GsfElectron.h:450
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
float sigmaIetaIeta() const
Definition: GsfElectron.h:382
float hadronicOverEm() const
Definition: GsfElectron.h:403
float dr04EcalRecHitSumEt() const
Definition: GsfElectron.h:448
const T & max(const T &a, const T &b)
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
edm::InputTag verticesCollection_
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
float dr03TkSumPt() const
Definition: GsfElectron.h:436
float dr03HcalDepth1TowerSumEt() const
Definition: GsfElectron.h:438
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
float e1x5() const
Definition: GsfElectron.h:384
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
T const * product() const
Definition: Handle.h:74
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:437
float e5x5() const
Definition: GsfElectron.h:386
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:440
const Point & position() const
position
Definition: BeamSpot.h:63
float sigmaEtaEta() const
Definition: GsfElectron.h:381
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
void CutBasedElectronID::setup ( const edm::ParameterSet conf)
virtual

Reimplemented from ElectronIDAlgo.

Definition at line 11 of file CutBasedElectronID.cc.

References ElectronIDAlgo::baseSetup(), cuts_, edm::hlt::Exception, edm::ParameterSet::getParameter(), newCategories_, or, quality_, type_, version_, verticesCollection_, and wantBinning_.

11  {
12 
13  // Get all the parameters
14  baseSetup(conf);
15 
16  type_ = conf.getParameter<std::string>("electronIDType");
17  quality_ = conf.getParameter<std::string>("electronQuality");
18  version_ = conf.getParameter<std::string>("electronVersion");
19  verticesCollection_ = conf.getParameter<edm::InputTag>("verticesCollection");
20 
21  if (type_ == "classbased" and (version_ == "V06")) {
22  newCategories_ = conf.getParameter<bool>("additionalCategories");
23  }
24 
25  if (type_ == "classbased" and (version_ == "V03" or version_ == "V04" or version_ == "V05" or version_ == "")) {
26  wantBinning_ = conf.getParameter<bool>("etBinning");
27  newCategories_ = conf.getParameter<bool>("additionalCategories");
28  }
29 
30  if (type_ == "robust" || type_ == "classbased") {
31  std::string stringCut = type_+quality_+"EleIDCuts"+version_;
32  cuts_ = conf.getParameter<edm::ParameterSet>(stringCut);
33  }
34  else {
35  throw cms::Exception("Configuration")
36  << "Invalid electronType parameter in CutBasedElectronID: must be robust or classbased\n";
37  }
38 }
T getParameter(std::string const &) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ParameterSet cuts_
void baseSetup(const edm::ParameterSet &conf)
edm::InputTag verticesCollection_

Member Data Documentation

edm::ParameterSet CutBasedElectronID::cuts_
private

Definition at line 28 of file CutBasedElectronID.h.

Referenced by cicSelection(), robustSelection(), and setup().

bool CutBasedElectronID::newCategories_
private

Definition at line 23 of file CutBasedElectronID.h.

Referenced by classify(), and setup().

std::string CutBasedElectronID::quality_
private

Definition at line 25 of file CutBasedElectronID.h.

Referenced by cicSelection(), robustSelection(), and setup().

std::string CutBasedElectronID::type_
private
std::string CutBasedElectronID::version_
private

Definition at line 26 of file CutBasedElectronID.h.

Referenced by cicSelection(), classify(), robustSelection(), and setup().

edm::InputTag CutBasedElectronID::verticesCollection_
private

Definition at line 27 of file CutBasedElectronID.h.

Referenced by cicSelection(), robustSelection(), and setup().

bool CutBasedElectronID::wantBinning_
private

Definition at line 22 of file CutBasedElectronID.h.

Referenced by cicSelection(), and setup().