CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ClassBasedElectronID Class Reference

#include <ClassBasedElectronID.h>

Inheritance diagram for ClassBasedElectronID:
ElectronIDAlgo

Public Member Functions

 ClassBasedElectronID ()
 
double result (const reco::GsfElectron *, const edm::Event &, const edm::EventSetup &) override
 
void setup (const edm::ParameterSet &conf) override
 
 ~ClassBasedElectronID () override
 
- Public Member Functions inherited from ElectronIDAlgo
 ElectronIDAlgo ()
 
virtual ~ElectronIDAlgo ()
 

Private Attributes

edm::ParameterSet cuts_
 
std::string quality_
 

Additional Inherited Members

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

Detailed Description

Definition at line 6 of file ClassBasedElectronID.h.

Constructor & Destructor Documentation

◆ ClassBasedElectronID()

ClassBasedElectronID::ClassBasedElectronID ( )
inline

Definition at line 8 of file ClassBasedElectronID.h.

8 {}

◆ ~ClassBasedElectronID()

ClassBasedElectronID::~ClassBasedElectronID ( )
inlineoverride

Definition at line 10 of file ClassBasedElectronID.h.

10 {}

Member Function Documentation

◆ result()

double ClassBasedElectronID::result ( const reco::GsfElectron electron,
const edm::Event e,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from ElectronIDAlgo.

Definition at line 27 of file ClassBasedElectronID.cc.

References reco::GsfElectron::BIGBREM, cuts_, HPSPFTauProducerPuppi_cfi::electron, reco::GsfElectron::GAP, edm::ParameterSet::getParameter(), reco::GsfElectron::GOLDEN, reco::GsfElectron::SHOWERING, reco::GsfElectron::UNKNOWN, HLT_2024v14_cff::value1, and HLT_2024v14_cff::value2.

27  {
28  //determine which element of the cut arrays in cfi file to read
29  //depending on the electron classification
30  int icut = 0;
31  int elClass = electron->classification();
32  if (electron->isEB()) //barrel
33  {
34  if (elClass == reco::GsfElectron::GOLDEN)
35  icut = 0;
36  if (elClass == reco::GsfElectron::BIGBREM)
37  icut = 1;
38  if (elClass == reco::GsfElectron::SHOWERING)
39  icut = 2;
40  if (elClass == reco::GsfElectron::GAP)
41  icut = 6;
42  }
43  if (electron->isEE()) //endcap
44  {
45  if (elClass == reco::GsfElectron::GOLDEN)
46  icut = 3;
47  if (elClass == reco::GsfElectron::BIGBREM)
48  icut = 4;
49  if (elClass == reco::GsfElectron::SHOWERING)
50  icut = 5;
51  if (elClass == reco::GsfElectron::GAP)
52  icut = 7;
53  }
54  if (elClass == reco::GsfElectron::UNKNOWN) {
55  edm::LogError("ClassBasedElectronID") << "Error: unrecognized electron classification ";
56  return 1.;
57  }
58 
59  bool useDeltaEtaIn = true;
60  bool useSigmaIetaIeta = true;
61  bool useHoverE = true;
62  bool useEoverPOut = true;
63  bool useDeltaPhiInCharge = true;
64 
65  // DeltaEtaIn
66  if (useDeltaEtaIn) {
67  double value = electron->deltaEtaSuperClusterTrackAtVtx();
68  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("deltaEtaIn");
69  if (fabs(value) > maxcut[icut])
70  return 0.;
71  }
72 
73  // SigmaIetaIeta
74  if (useSigmaIetaIeta) {
75  double value = electron->sigmaIetaIeta();
76  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("sigmaIetaIetaMax");
77  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("sigmaIetaIetaMin");
78  if (value < mincut[icut] || value > maxcut[icut])
79  return 0.;
80  }
81 
82  // H/E
83  if (useHoverE) { //_[variables_]) {
84  double value = electron->hadronicOverEm();
85  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("HoverE");
86  if (value > maxcut[icut])
87  return 0.;
88  } // if use
89 
90  // Eseed/Pout
91  if (useEoverPOut) {
92  double value = electron->eSeedClusterOverPout();
93  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("EoverPOutMax");
94  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("EoverPOutMin");
95  if (value < mincut[icut] || value > maxcut[icut])
96  return 0.;
97  }
98 
99  // DeltaPhiIn*Charge
100  if (useDeltaPhiInCharge) {
101  double value1 = electron->deltaPhiSuperClusterTrackAtVtx();
102  double value2 = electron->charge();
103  double value = value1 * value2;
104  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("deltaPhiInChargeMax");
105  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("deltaPhiInChargeMin");
106  if (value < mincut[icut] || value > maxcut[icut])
107  return 0.;
108  }
109 
110  return 1.;
111 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Log< level::Error, false > LogError
Definition: value.py:1
edm::ParameterSet cuts_

◆ setup()

void ClassBasedElectronID::setup ( const edm::ParameterSet conf)
overridevirtual

Reimplemented from ElectronIDAlgo.

Definition at line 4 of file ClassBasedElectronID.cc.

References cuts_, beamvalidation::exit(), edm::ParameterSet::getParameter(), quality_, and AlCaHLTBitMon_QueryRunRegistry::string.

6 {
7  // Get all the parameters
8  //baseSetup(conf);
9 
10  quality_ = conf.getParameter<std::string>("electronQuality");
11 
12  if (quality_ == "Eff95Cuts") {
13  cuts_ = conf.getParameter<edm::ParameterSet>("Eff95Cuts");
14  }
15 
16  else if (quality_ == "Eff90Cuts") {
17  cuts_ = conf.getParameter<edm::ParameterSet>("Eff90Cuts");
18  }
19 
20  else {
21  edm::LogError("ClassBasedElectronID") << "Invalid electronQuality parameter: must be tight, medium or loose.";
22  exit(1);
23  }
24 
25 } // end of setup
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Log< level::Error, false > LogError
edm::ParameterSet cuts_
def exit(msg="")

Member Data Documentation

◆ cuts_

edm::ParameterSet ClassBasedElectronID::cuts_
private

Definition at line 17 of file ClassBasedElectronID.h.

Referenced by result(), and setup().

◆ quality_

std::string ClassBasedElectronID::quality_
private

Definition at line 16 of file ClassBasedElectronID.h.

Referenced by setup().