test
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
PTDRElectronID Class Reference

#include <PTDRElectronID.h>

Inheritance diagram for PTDRElectronID:
ElectronIDAlgo

Public Member Functions

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

Private Attributes

std::vector< int > acceptCracks_
 
edm::ParameterSet cuts_
 
std::string quality_
 
std::vector< int > useBremFraction_
 
std::vector< int > useDeltaEtaIn_
 
std::vector< int > useDeltaPhiIn_
 
std::vector< int > useDeltaPhiOut_
 
std::vector< int > useE9overE25_
 
std::vector< int > useEoverPIn_
 
std::vector< int > useEoverPOut_
 
std::vector< int > useHoverE_
 
std::vector< int > useInvEMinusInvP_
 
std::vector< int > useSigmaEtaEta_
 
std::vector< int > useSigmaPhiPhi_
 
int variables_
 

Additional Inherited Members

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

Detailed Description

Definition at line 6 of file PTDRElectronID.h.

Constructor & Destructor Documentation

PTDRElectronID::PTDRElectronID ( )
inline

Definition at line 10 of file PTDRElectronID.h.

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

Definition at line 12 of file PTDRElectronID.h.

12 {};

Member Function Documentation

double PTDRElectronID::result ( const reco::GsfElectron electron,
const edm::Event e,
const edm::EventSetup es 
)
virtual

Reimplemented from ElectronIDAlgo.

Definition at line 37 of file PTDRElectronID.cc.

References acceptCracks_, reco::GsfElectron::BIGBREM, reco::GsfElectron::caloEnergy(), reco::GsfElectron::classification(), cuts_, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::e5x5(), reco::GsfElectron::eSeedClusterOverPout(), reco::GsfElectron::eSuperClusterOverP(), reco::GsfElectron::GAP, edm::ParameterSet::getParameter(), reco::GsfElectron::GOLDEN, reco::GsfElectron::hadronicOverEm(), reco::GsfElectron::isEB(), reco::GsfElectron::isEE(), reco::GsfElectron::r9(), reco::GsfElectron::SHOWERING, reco::GsfElectron::sigmaIetaIeta(), reco::GsfElectron::sigmaIphiIphi(), reco::GsfElectron::superCluster(), reco::GsfElectron::trackMomentumAtVtx(), reco::GsfElectron::trackMomentumOut(), reco::GsfElectron::UNKNOWN, useBremFraction_, useDeltaEtaIn_, useDeltaPhiIn_, useDeltaPhiOut_, useE9overE25_, useEoverPIn_, useEoverPOut_, useHoverE_, useInvEMinusInvP_, useSigmaEtaEta_, useSigmaPhiPhi_, relativeConstraints::value, and variables_.

39  {
40 
41  //determine which element of the cut arrays in cfi file to read
42  //depending on the electron classification
43  int icut=0;
44  int elClass = electron->classification() ;
45  if (electron->isEB()) //barrel
46  {
47  if (elClass == reco::GsfElectron::GOLDEN) icut=0;
48  if (elClass == reco::GsfElectron::BIGBREM) icut=1;
49  //if (elClass == reco::GsfElectron::NARROW) icut=2;
50  if (elClass == reco::GsfElectron::SHOWERING) icut=3;
51  if (elClass == reco::GsfElectron::GAP) icut=8;
52  }
53  if (electron->isEE()) //endcap
54  {
55  if (elClass == reco::GsfElectron::GOLDEN) icut=4;
56  if (elClass == reco::GsfElectron::BIGBREM) icut=5;
57  //if (elClass == reco::GsfElectron::NARROW) icut=6;
58  if (elClass == reco::GsfElectron::SHOWERING) icut=7;
59  if (elClass == reco::GsfElectron::GAP) icut=8;
60  }
61  if (elClass == reco::GsfElectron::UNKNOWN)
62  {
63  edm::LogError("PTDRElectronID") << "Error: unrecognized electron classification ";
64  return 1.;
65  }
66 
68  if (elClass == reco::GsfElectron::GAP) return 1.;
69 
70  if (useEoverPIn_[variables_]) {
71  double value = electron->eSuperClusterOverP();
72  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("EoverPInMax");
73  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("EoverPInMin");
74  if (value<mincut[icut] || value>maxcut[icut]) return 0.;
75  }
76 
77  if (useDeltaEtaIn_[variables_]) {
78  double value = electron->deltaEtaSuperClusterTrackAtVtx();
79  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("deltaEtaIn");
80  if (fabs(value)>maxcut[icut]) return 0.;
81  }
82 
83  if (useDeltaPhiIn_[variables_]) {
84  double value = electron->deltaPhiSuperClusterTrackAtVtx();
85  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("deltaPhiIn");
86  if (fabs(value)>maxcut[icut]) return 0.;
87  }
88 
89  if (useHoverE_[variables_]) {
90  double value = electron->hadronicOverEm();
91  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("HoverE");
92  if (value>maxcut[icut]) return 0.;
93  }
94 
95  if (useEoverPOut_[variables_]) {
96  double value = electron->eSeedClusterOverPout();
97  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("EoverPOutMax");
98  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("EoverPOutMin");
99  if (value<mincut[icut] || value>maxcut[icut]) return 0.;
100  }
101 
102  if (useDeltaPhiOut_[variables_]) {
103  double value = electron->deltaPhiSeedClusterTrackAtCalo();
104  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("deltaPhiOut");
105  if (fabs(value)>maxcut[icut]) return 0.;
106  }
107 
108  if (useInvEMinusInvP_[variables_]) {
109  double value = (1./electron->caloEnergy())-(1./electron->trackMomentumAtVtx().R());
110  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("invEMinusInvP");
111  if (value>maxcut[icut]) return 0.;
112  }
113 
114  if (useBremFraction_[variables_]) {
115  double value = electron->trackMomentumAtVtx().R()-electron->trackMomentumOut().R();
116  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("bremFraction");
117  if (value<mincut[icut]) return 0.;
118  }
119 
120  //EcalClusterLazyTools lazyTools = getClusterShape(e,es);
121  //std::vector<float> vCov = lazyTools.localCovariances(*(electron->superCluster()->seed())) ;
122  //std::vector<float> vCov = lazyTools.covariances(*(electron->superCluster()->seed())) ;
123 
124  if (useE9overE25_[variables_]) {
125  double value = electron->r9()*electron->superCluster()->energy()/electron->e5x5();
126  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("E9overE25");
127  if (fabs(value)<mincut[icut]) return 0.;
128  }
129 
130  if (useSigmaEtaEta_[variables_]) {
131  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("sigmaEtaEtaMax");
132  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("sigmaEtaEtaMin");
133  if (electron->sigmaIetaIeta()<mincut[icut] || electron->sigmaIetaIeta()>maxcut[icut]) return 0.;
134  }
135 
136  if (useSigmaPhiPhi_[variables_]) {
137  std::vector<double> mincut = cuts_.getParameter<std::vector<double> >("sigmaPhiPhiMin");
138  std::vector<double> maxcut = cuts_.getParameter<std::vector<double> >("sigmaPhiPhiMax");
139  if (electron->sigmaIphiIphi()<mincut[icut] || electron->sigmaIphiIphi()>maxcut[icut]) return 0.;
140  }
141 
142  return 1.;
143 
144 }
float sigmaIphiIphi() const
Definition: GsfElectron.h:400
T getParameter(std::string const &) const
float eSuperClusterOverP() const
Definition: GsfElectron.h:243
edm::ParameterSet cuts_
std::vector< int > useHoverE_
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:286
std::vector< int > useInvEMinusInvP_
std::vector< int > useDeltaPhiOut_
bool isEE() const
Definition: GsfElectron.h:348
bool isEB() const
Definition: GsfElectron.h:347
std::vector< int > useSigmaPhiPhi_
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:247
float sigmaIetaIeta() const
Definition: GsfElectron.h:399
float hadronicOverEm() const
Definition: GsfElectron.h:440
std::vector< int > useEoverPIn_
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:251
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:288
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:250
float eSeedClusterOverPout() const
Definition: GsfElectron.h:245
std::vector< int > useDeltaEtaIn_
std::vector< int > useEoverPOut_
std::vector< int > useSigmaEtaEta_
Classification classification() const
Definition: GsfElectron.h:680
float e5x5() const
Definition: GsfElectron.h:403
float r9() const
Definition: GsfElectron.h:404
std::vector< int > useBremFraction_
std::vector< int > useDeltaPhiIn_
float caloEnergy() const
Definition: GsfElectron.h:775
std::vector< int > useE9overE25_
std::vector< int > acceptCracks_
void PTDRElectronID::setup ( const edm::ParameterSet conf)
virtual

Reimplemented from ElectronIDAlgo.

Definition at line 3 of file PTDRElectronID.cc.

References acceptCracks_, cuts_, edm::hlt::Exception, edm::ParameterSet::getParameter(), quality_, AlCaHLTBitMon_QueryRunRegistry::string, useBremFraction_, useDeltaEtaIn_, useDeltaPhiIn_, useDeltaPhiOut_, useE9overE25_, useEoverPIn_, useEoverPOut_, useHoverE_, useInvEMinusInvP_, useSigmaEtaEta_, useSigmaPhiPhi_, and variables_.

3  {
4 
5  // Get all the parameters
6  //baseSetup(conf);
7 
8  quality_ = conf.getParameter<std::string>("electronQuality");
9 
10  useEoverPIn_ = conf.getParameter<std::vector<int> >("useEoverPIn");
11  useDeltaEtaIn_ = conf.getParameter<std::vector<int> >("useDeltaEtaIn");
12  useDeltaPhiIn_ = conf.getParameter<std::vector<int> >("useDeltaPhiIn");
13  useHoverE_ = conf.getParameter<std::vector<int> >("useHoverE");
14  useE9overE25_ = conf.getParameter<std::vector<int> >("useE9overE25");
15  useEoverPOut_ = conf.getParameter<std::vector<int> >("useEoverPOut");
16  useDeltaPhiOut_ = conf.getParameter<std::vector<int> >("useDeltaPhiOut");
17  useInvEMinusInvP_ = conf.getParameter<std::vector<int> >("useInvEMinusInvP");
18  useBremFraction_ = conf.getParameter<std::vector<int> >("useBremFraction");
19  useSigmaEtaEta_ = conf.getParameter<std::vector<int> >("useSigmaEtaEta");
20  useSigmaPhiPhi_ = conf.getParameter<std::vector<int> >("useSigmaPhiPhi");
21  acceptCracks_ = conf.getParameter<std::vector<int> >("acceptCracks");
22 
23  if (quality_=="tight") {
24  cuts_ = conf.getParameter<edm::ParameterSet>("tightEleIDCuts");
25  variables_ = 2 ;
26  } else if (quality_=="medium") {
27  cuts_ = conf.getParameter<edm::ParameterSet>("mediumEleIDCuts");
28  variables_ = 1 ;
29  } else if (quality_=="loose") {
30  cuts_ = conf.getParameter<edm::ParameterSet>("looseEleIDCuts");
31  variables_ = 0 ;
32  } else {
33  throw cms::Exception("Configuration") << "Invalid electronQuality parameter in PTDElectronID: must be tight, medium or loose." ;
34  }
35 }
T getParameter(std::string const &) const
edm::ParameterSet cuts_
std::vector< int > useHoverE_
std::vector< int > useInvEMinusInvP_
std::vector< int > useDeltaPhiOut_
std::vector< int > useSigmaPhiPhi_
std::vector< int > useEoverPIn_
std::vector< int > useDeltaEtaIn_
std::vector< int > useEoverPOut_
std::vector< int > useSigmaEtaEta_
std::vector< int > useBremFraction_
std::vector< int > useDeltaPhiIn_
std::string quality_
std::vector< int > useE9overE25_
std::vector< int > acceptCracks_

Member Data Documentation

std::vector<int> PTDRElectronID::acceptCracks_
private

Definition at line 32 of file PTDRElectronID.h.

Referenced by result(), and setup().

edm::ParameterSet PTDRElectronID::cuts_
private

Definition at line 34 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::string PTDRElectronID::quality_
private

Definition at line 19 of file PTDRElectronID.h.

Referenced by setup().

std::vector<int> PTDRElectronID::useBremFraction_
private

Definition at line 29 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useDeltaEtaIn_
private

Definition at line 22 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useDeltaPhiIn_
private

Definition at line 23 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useDeltaPhiOut_
private

Definition at line 27 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useE9overE25_
private

Definition at line 25 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useEoverPIn_
private

Definition at line 21 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useEoverPOut_
private

Definition at line 26 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useHoverE_
private

Definition at line 24 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useInvEMinusInvP_
private

Definition at line 28 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useSigmaEtaEta_
private

Definition at line 30 of file PTDRElectronID.h.

Referenced by result(), and setup().

std::vector<int> PTDRElectronID::useSigmaPhiPhi_
private

Definition at line 31 of file PTDRElectronID.h.

Referenced by result(), and setup().

int PTDRElectronID::variables_
private

Definition at line 36 of file PTDRElectronID.h.

Referenced by result(), and setup().