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 8 of file CutBasedElectronID.cc.

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

9 {
10  verticesCollection_ = iC.consumes<std::vector<reco::Vertex> >(conf.getParameter<edm::InputTag>("verticesCollection"));
11 
12 }
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 126 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_, extraflags_cff::vtx, and wantBinning_.

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

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

Definition at line 56 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().

56  {
57 
58  double eta = fabs(electron->superCluster()->eta());
59  double eOverP = electron->eSuperClusterOverP();
60  double fBrem = electron->fbrem();
61 
62  int cat = -1;
63  if (version_ == "V00" || version_ == "V01") {
64  if((electron->isEB() && fBrem<0.06) || (electron->isEE() && fBrem<0.1))
65  cat=1;
66  else if (eOverP < 1.2 && eOverP > 0.8)
67  cat=0;
68  else
69  cat=2;
70 
71  return cat;
72 
73  } else if (version_ == "V02") {
74  if (electron->isEB()) { // BARREL
75  if(fBrem < 0.12)
76  cat=1;
77  else if (eOverP < 1.2 && eOverP > 0.9)
78  cat=0;
79  else
80  cat=2;
81  } else { // ENDCAP
82  if(fBrem < 0.2)
83  cat=1;
84  else if (eOverP < 1.22 && eOverP > 0.82)
85  cat=0;
86  else
87  cat=2;
88  }
89 
90  return cat;
91 
92  } else {
93  if (electron->isEB()) {
94  if ((fBrem >= 0.12) and (eOverP > 0.9) and (eOverP < 1.2))
95  cat = 0;
96  else if (((eta > .445 and eta < .45 ) or
97  (eta > .79 and eta < .81 ) or
98  (eta > 1.137 and eta < 1.157 ) or
99  (eta > 1.47285 and eta < 1.4744)) and newCategories_)
100  cat = 6;
101  else if (electron->trackerDrivenSeed() and !electron->ecalDrivenSeed() and newCategories_)
102  cat = 8;
103  else if (fBrem < 0.12)
104  cat = 1;
105  else
106  cat = 2;
107  } else {
108  if ((fBrem >= 0.2) and (eOverP > 0.82) and (eOverP < 1.22))
109  cat = 3;
110  else if (eta > 1.5 and eta < 1.58 and newCategories_)
111  cat = 7;
112  else if (electron->trackerDrivenSeed() and !electron->ecalDrivenSeed() and newCategories_)
113  cat = 8;
114  else if (fBrem < 0.2)
115  cat = 4;
116  else
117  cat = 5;
118  }
119 
120  return cat;
121  }
122 
123  return -1;
124 }
float eSuperClusterOverP() const
Definition: GsfElectron.h:249
float fbrem() const
Definition: GsfElectron.h:772
bool isEE() const
Definition: GsfElectron.h:357
bool isEB() const
Definition: GsfElectron.h:356
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:185
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 428 of file CutBasedElectronID.cc.

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

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

428  {
429 
430  float et_min = 10;
431  float et_max = 40;
432 
433  bool accept = false;
434  float cut = cut_max; // the cut at et=40 GeV
435 
436  if(et < et_max) {
437  cut = cut_min + (1/et_min - 1/et)*(cut_max - cut_min)/(1/et_min - 1/et_max);
438  }
439 
440  if(et < et_min) {
441  cut = cut_min;
442  }
443 
444  if(gtn) { // useful for e/p cut which is gt
445  accept = (x >= cut);
446  }
447  else {
448  accept = (x <= cut);
449  }
450 
451  //std::cout << x << " " << cut_min << " " << cut << " " << cut_max << " " << et << " " << accept << std::endl;
452  return accept;
453 }
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 43 of file CutBasedElectronID.cc.

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

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

45  {
46 
47  if (type_ == "classbased")
48  return cicSelection(electron, e, es);
49  else if (type_ == "robust")
50  return robustSelection(electron, e, es);
51 
52  return 0;
53 
54 }
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 455 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 extraflags_cff::vtx.

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

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

Reimplemented from ElectronIDAlgo.

Definition at line 14 of file CutBasedElectronID.cc.

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

Referenced by ~CutBasedElectronID().

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