CMS 3D CMS Logo

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 (const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
 
double result (const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &) override
 
double robustSelection (const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &)
 
void setup (const edm::ParameterSet &conf) override
 
 ~CutBasedElectronID () override
 
- Public Member Functions inherited from ElectronIDAlgo
 ElectronIDAlgo ()
 
virtual ~ElectronIDAlgo ()
 

Private Attributes

edm::ParameterSet cuts_
 
bool newCategories_
 
std::string quality_
 
std::string type_
 
std::string version_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > verticesCollection_
 
bool wantBinning_
 

Additional Inherited Members

- Protected Attributes inherited from ElectronIDAlgo
edm::InputTag reducedBarrelRecHitCollection_
 
edm::InputTag reducedEndcapRecHitCollection_
 

Detailed Description

Definition at line 10 of file CutBasedElectronID.h.

Constructor & Destructor Documentation

CutBasedElectronID::CutBasedElectronID ( const edm::ParameterSet conf,
edm::ConsumesCollector iC 
)

Definition at line 9 of file CutBasedElectronID.cc.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), and verticesCollection_.

10 {
11  verticesCollection_ = iC.consumes<std::vector<reco::Vertex> >(conf.getParameter<edm::InputTag>("verticesCollection"));
12 
13 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< reco::Vertex > > verticesCollection_
CutBasedElectronID::~CutBasedElectronID ( )
inlineoverride

Member Function Documentation

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

Definition at line 127 of file CutBasedElectronID.cc.

References stringResolutionProvider_cfi::bin, eostools::cat(), classify(), compute_cut(), reco::GsfElectron::convDcot(), reco::GsfElectron::convDist(), TkAlMuonSelectors_cfi::cut, cutsInCategoriesElectronIdentification_cfi::cutdcotdist, electronIdCutBased_cfi::cutdeta, electronIdCutBased_cfi::cutdphi, electronIdCutBased_cfi::cuteopin, cutsInCategoriesElectronIdentification_cfi::cutet, cutsInCategoriesElectronIdentification_cfi::cuthoe, cutsInCategoriesElectronIdentificationV06_cfi::cuthoel, electronIdCutBased_cfi::cutip, electronIdCutBased_cfi::cutmishits, cuts_, cutsInCategoriesElectronIdentification_cfi::cutsee, cutsInCategoriesElectronIdentificationV06_cfi::cutseel, electronIdCutBased_cfi::deltaEtaIn, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), electronIdCutBased_cfi::deltaPhiIn, reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::dr03TkSumPt(), reco::GsfElectron::dr04EcalRecHitSumEt(), reco::GsfElectron::dr04HcalTowerSumEt(), reco::GsfElectron::eSeedClusterOverP(), electronIdCutBased_cfi::eSeedOverPin, reco::GsfElectron::eSuperClusterOverP(), PVValHelper::eta, JetChargeProducer_cfi::exp, reco::GsfElectron::fbrem(), edm::Event::getByToken(), edm::ParameterSet::getParameter(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::hadronicOverEm(), electronIdCutBased_cfi::hOverE, reco::GsfElectron::isEB(), reco::GsfElectron::isEE(), SiStripPI::max, reco::HitPattern::MISSING_INNER_HITS, or, funct::pow(), quality_, result(), reco::GsfElectron::sigmaEtaEta(), reco::GsfElectron::sigmaIetaIeta(), funct::sin(), reco::GsfElectron::superCluster(), type_, version_, verticesCollection_, badGlobalMuonTaggersAOD_cff::vtx, and wantBinning_.

Referenced by result(), and ~CutBasedElectronID().

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

Definition at line 57 of file CutBasedElectronID.cc.

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

Referenced by cicSelection(), and ~CutBasedElectronID().

57  {
58 
59  double eta = fabs(electron->superCluster()->eta());
60  double eOverP = electron->eSuperClusterOverP();
61  double fBrem = electron->fbrem();
62 
63  int cat = -1;
64  if (version_ == "V00" || version_ == "V01") {
65  if((electron->isEB() && fBrem<0.06) || (electron->isEE() && fBrem<0.1))
66  cat=1;
67  else if (eOverP < 1.2 && eOverP > 0.8)
68  cat=0;
69  else
70  cat=2;
71 
72  return cat;
73 
74  } else if (version_ == "V02") {
75  if (electron->isEB()) { // BARREL
76  if(fBrem < 0.12)
77  cat=1;
78  else if (eOverP < 1.2 && eOverP > 0.9)
79  cat=0;
80  else
81  cat=2;
82  } else { // ENDCAP
83  if(fBrem < 0.2)
84  cat=1;
85  else if (eOverP < 1.22 && eOverP > 0.82)
86  cat=0;
87  else
88  cat=2;
89  }
90 
91  return cat;
92 
93  } else {
94  if (electron->isEB()) {
95  if ((fBrem >= 0.12) and (eOverP > 0.9) and (eOverP < 1.2))
96  cat = 0;
97  else if (((eta > .445 and eta < .45 ) or
98  (eta > .79 and eta < .81 ) or
99  (eta > 1.137 and eta < 1.157 ) or
100  (eta > 1.47285 and eta < 1.4744)) and newCategories_)
101  cat = 6;
102  else if (electron->trackerDrivenSeed() and !electron->ecalDrivenSeed() and newCategories_)
103  cat = 8;
104  else if (fBrem < 0.12)
105  cat = 1;
106  else
107  cat = 2;
108  } else {
109  if ((fBrem >= 0.2) and (eOverP > 0.82) and (eOverP < 1.22))
110  cat = 3;
111  else if (eta > 1.5 and eta < 1.58 and newCategories_)
112  cat = 7;
113  else if (electron->trackerDrivenSeed() and !electron->ecalDrivenSeed() and newCategories_)
114  cat = 8;
115  else if (fBrem < 0.2)
116  cat = 4;
117  else
118  cat = 5;
119  }
120 
121  return cat;
122  }
123 
124  return -1;
125 }
float eSuperClusterOverP() const
Definition: GsfElectron.h:245
float fbrem() const
Definition: GsfElectron.h:761
bool isEE() const
Definition: GsfElectron.h:353
bool isEB() const
Definition: GsfElectron.h:352
def cat(path)
Definition: eostools.py:401
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
bool trackerDrivenSeed() const
Definition: GsfElectron.h:189
bool ecalDrivenSeed() const
Definition: GsfElectron.h:188
bool CutBasedElectronID::compute_cut ( double  x,
double  et,
double  cut_min,
double  cut_max,
bool  gtn = false 
)

Definition at line 429 of file CutBasedElectronID.cc.

References accept(), TkAlMuonSelectors_cfi::cut, and stringResolutionProvider_cfi::et.

Referenced by cicSelection(), and ~CutBasedElectronID().

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

Reimplemented from ElectronIDAlgo.

Definition at line 44 of file CutBasedElectronID.cc.

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

Referenced by cicSelection(), robustSelection(), and ~CutBasedElectronID().

46  {
47 
48  if (type_ == "classbased")
49  return cicSelection(electron, e, es);
50  else if (type_ == "robust")
51  return robustSelection(electron, e, es);
52 
53  return 0;
54 
55 }
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 456 of file CutBasedElectronID.cc.

References reco::GsfElectron::convDcot(), reco::GsfElectron::convDist(), TkAlMuonSelectors_cfi::cut, cuts_, electronIdCutBased_cfi::deltaEtaIn, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), electronIdCutBased_cfi::deltaPhiIn, 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(), PVValHelper::eta, JetChargeProducer_cfi::exp, edm::Event::getByToken(), edm::ParameterSet::getParameter(), reco::GsfElectron::gsfTrack(), reco::GsfElectron::hadronicOverEm(), electronIdCutBased_cfi::hOverE, reco::GsfElectron::isEB(), reco::GsfElectron::isEE(), edm::HandleBase::isValid(), SiStripPI::max, reco::HitPattern::MISSING_INNER_HITS, or, reco::GsfElectron::p4(), GeomDetEnumerators::PixelBarrel, reco::BeamSpot::position(), edm::Handle< T >::product(), quality_, result(), reco::GsfElectron::sigmaEtaEta(), reco::GsfElectron::sigmaIetaIeta(), funct::sin(), reco::GsfElectron::superCluster(), type_, version_, verticesCollection_, and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by result(), and ~CutBasedElectronID().

458  {
459 
460  double scTheta = (2*atan(exp(-electron->superCluster()->eta())));
461  double scEt = electron->superCluster()->energy()*sin(scTheta);
462  double eta = electron->p4().Eta();
463  double eOverP = electron->eSuperClusterOverP();
464  double hOverE = electron->hadronicOverEm();
465  double sigmaee = electron->sigmaIetaIeta();
466  double e25Max = electron->e2x5Max();
467  double e15 = electron->e1x5();
468  double e55 = electron->e5x5();
469  double e25Maxoe55 = e25Max/e55;
470  double e15oe55 = e15/e55 ;
471  double deltaPhiIn = electron->deltaPhiSuperClusterTrackAtVtx();
472  double deltaEtaIn = electron->deltaEtaSuperClusterTrackAtVtx();
473 
474  double ip = 0;
475  int mishits = electron->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
476  double tkIso = electron->dr03TkSumPt();
477  double ecalIso = electron->dr04EcalRecHitSumEt();
478  double ecalIsoPed = (electron->isEB())?std::max(0.,ecalIso-1.):ecalIso;
479  double hcalIso = electron->dr04HcalTowerSumEt();
480  double hcalIso1 = electron->dr04HcalDepth1TowerSumEt();
481  double hcalIso2 = electron->dr04HcalDepth2TowerSumEt();
482 
483  if (version_ == "V00") {
484  sigmaee = electron->sigmaEtaEta();
485  if (electron->isEE())
486  sigmaee = sigmaee - 0.02*(fabs(eta) - 2.3); //correct sigmaetaeta dependence on eta in endcap
487  }
488 
489  if (version_ == "V03" or version_ == "V04") {
490  edm::Handle<reco::BeamSpot> pBeamSpot;
491  // uses the same name for the vertex collection to avoid adding more new names
492  e.getByToken(verticesCollection_, pBeamSpot);
493  if (pBeamSpot.isValid()) {
494  const reco::BeamSpot *bspot = pBeamSpot.product();
495  const math::XYZPoint& bspotPosition = bspot->position();
496  ip = fabs(electron->gsfTrack()->dxy(bspotPosition));
497  } else
498  ip = fabs(electron->gsfTrack()->dxy());
499  }
500 
501  if (version_ == "V04" or version_ == "V05") {
502  ecalIso = electron->dr03EcalRecHitSumEt();
503  ecalIsoPed = (electron->isEB())?std::max(0.,ecalIso-1.):ecalIso;
504  hcalIso = electron->dr03HcalTowerSumEt();
505  hcalIso1 = electron->dr03HcalDepth1TowerSumEt();
506  hcalIso2 = electron->dr03HcalDepth2TowerSumEt();
507  }
508 
509  if (version_ == "V05") {
512  if (!vtxH->empty()) {
513  reco::VertexRef vtx(vtxH, 0);
514  ip = fabs(electron->gsfTrack()->dxy(math::XYZPoint(vtx->x(),vtx->y(),vtx->z())));
515  } else
516  ip = fabs(electron->gsfTrack()->dxy());
517  }
518 
519  // .....................................................................................
520  std::vector<double> cut;
521  // ROBUST Selection
522  if (type_ == "robust") {
523 
524  double result = 0;
525 
526  // hoe, sigmaEtaEta, dPhiIn, dEtaIn
527  if (electron->isEB())
528  cut = cuts_.getParameter<std::vector<double> >("barrel");
529  else
530  cut = cuts_.getParameter<std::vector<double> >("endcap");
531  // check isolations: if only isolation passes result = 2
532  if (quality_ == "highenergy") {
533  if ((tkIso > cut[6] || hcalIso2 > cut[11]) ||
534  (electron->isEB() && ((ecalIso + hcalIso1) > cut[7]+cut[8]*scEt)) ||
535  (electron->isEE() && (scEt >= 50.) && ((ecalIso + hcalIso1) > cut[7]+cut[8]*(scEt-50))) ||
536  (electron->isEE() && (scEt < 50.) && ((ecalIso + hcalIso1) > cut[9]+cut[10]*(scEt-50))))
537  result = 0;
538  else
539  result = 2;
540  } else {
541  if ((tkIso > cut[6]) || (ecalIso > cut[7]) || (hcalIso > cut[8]) || (hcalIso1 > cut[9]) || (hcalIso2 > cut[10]) ||
542  (tkIso/electron->p4().Pt() > cut[11]) || (ecalIso/electron->p4().Pt() > cut[12]) || (hcalIso/electron->p4().Pt() > cut[13]) ||
543  ((tkIso+ecalIso+hcalIso)>cut[14]) || (((tkIso+ecalIso+hcalIso)/ electron->p4().Pt()) > cut[15]) ||
544  ((tkIso+ecalIsoPed+hcalIso)>cut[16]) || (((tkIso+ecalIsoPed+hcalIso)/ electron->p4().Pt()) > cut[17]) )
545  result = 0.;
546  else
547  result = 2.;
548  }
549 
550  if ((hOverE < cut[0]) && (sigmaee < cut[1]) && (fabs(deltaPhiIn) < cut[2]) &&
551  (fabs(deltaEtaIn) < cut[3]) && (e25Maxoe55 > cut[4] && e15oe55 > cut[5]) &&
552  (sigmaee >= cut[18]) && (eOverP > cut[19] && eOverP < cut[20]) )
553  { result = result + 1 ; }
554 
555  if (ip > cut[21])
556  return result;
557  if (mishits > cut[22]) // expected missing hits
558  return result;
559  // positive cut[23] means to demand a valid hit in 1st layer PXB
560  if (cut[23] > 0 && !electron->gsfTrack()->hitPattern().hasValidHitInPixelLayer(PixelSubdetector::SubDetector::PixelBarrel, 1))
561  return result;
562 
563  // cut[24]: Dist cut[25]: dcot
564  float dist = fabs(electron->convDist());
565  float dcot = fabs(electron->convDcot());
566  bool isConversion = (cut[24]>99. || cut[25]>99.)?false:(dist < cut[24] && dcot < cut[25]);
567  if (isConversion)
568  return result ;
569 
570  result += 4 ;
571 
572  return result ;
573  }
574 
575  return -1. ;
576  }
T getParameter(std::string const &) const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
float dr04HcalTowerSumEt() const
Definition: GsfElectron.h:562
const LorentzVector & p4(P4Kind kind) const
Definition: GsfElectron.cc:225
float eSuperClusterOverP() const
Definition: GsfElectron.h:245
float dr04HcalDepth1TowerSumEt() const
Definition: GsfElectron.h:560
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
double result(const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &) override
edm::ParameterSet cuts_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float dr03HcalDepth2TowerSumEt() const
Definition: GsfElectron.h:550
float e2x5Max() const
Definition: GsfElectron.h:439
float convDist() const
Definition: GsfElectron.h:609
bool isEE() const
Definition: GsfElectron.h:353
bool isEB() const
Definition: GsfElectron.h:352
float convDcot() const
Definition: GsfElectron.h:610
edm::EDGetTokenT< std::vector< reco::Vertex > > verticesCollection_
float dr04HcalDepth2TowerSumEt() const
Definition: GsfElectron.h:561
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:249
float sigmaIetaIeta() const
Definition: GsfElectron.h:436
float hadronicOverEm() const
Definition: GsfElectron.h:491
float dr04EcalRecHitSumEt() const
Definition: GsfElectron.h:559
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:252
float dr03TkSumPt() const
Definition: GsfElectron.h:547
float dr03HcalDepth1TowerSumEt() const
Definition: GsfElectron.h:549
bool isValid() const
Definition: HandleBase.h:74
T const * product() const
Definition: Handle.h:81
float e1x5() const
Definition: GsfElectron.h:438
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:548
float e5x5() const
Definition: GsfElectron.h:440
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:551
const Point & position() const
position
Definition: BeamSpot.h:62
float sigmaEtaEta() const
Definition: GsfElectron.h:435
void CutBasedElectronID::setup ( const edm::ParameterSet conf)
overridevirtual

Reimplemented from ElectronIDAlgo.

Definition at line 15 of file CutBasedElectronID.cc.

References cuts_, Exception, edm::ParameterSet::getParameter(), newCategories_, or, quality_, AlCaHLTBitMon_QueryRunRegistry::string, type_, version_, and wantBinning_.

Referenced by ~CutBasedElectronID().

15  {
16 
17  // Get all the parameters
18  //baseSetup(conf);
19 
20  type_ = conf.getParameter<std::string>("electronIDType");
21  quality_ = conf.getParameter<std::string>("electronQuality");
22  version_ = conf.getParameter<std::string>("electronVersion");
23  //verticesCollection_ = conf.getParameter<edm::InputTag>("verticesCollection");
24 
25  if (type_ == "classbased" and (version_ == "V06")) {
26  newCategories_ = conf.getParameter<bool>("additionalCategories");
27  }
28 
29  if (type_ == "classbased" and (version_ == "V03" or version_ == "V04" or version_ == "V05" or version_ == "")) {
30  wantBinning_ = conf.getParameter<bool>("etBinning");
31  newCategories_ = conf.getParameter<bool>("additionalCategories");
32  }
33 
34  if (type_ == "robust" || type_ == "classbased") {
35  std::string stringCut = type_+quality_+"EleIDCuts"+version_;
36  cuts_ = conf.getParameter<edm::ParameterSet>(stringCut);
37  }
38  else {
39  throw cms::Exception("Configuration")
40  << "Invalid electronType parameter in CutBasedElectronID: must be robust or classbased\n";
41  }
42 }
T getParameter(std::string const &) const
edm::ParameterSet cuts_
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12

Member Data Documentation

edm::ParameterSet CutBasedElectronID::cuts_
private

Definition at line 32 of file CutBasedElectronID.h.

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

bool CutBasedElectronID::newCategories_
private

Definition at line 27 of file CutBasedElectronID.h.

Referenced by classify(), and setup().

std::string CutBasedElectronID::quality_
private

Definition at line 29 of file CutBasedElectronID.h.

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

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

Definition at line 30 of file CutBasedElectronID.h.

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

edm::EDGetTokenT<std::vector<reco::Vertex> > CutBasedElectronID::verticesCollection_
private

Definition at line 31 of file CutBasedElectronID.h.

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

bool CutBasedElectronID::wantBinning_
private

Definition at line 26 of file CutBasedElectronID.h.

Referenced by cicSelection(), and setup().