CMS 3D CMS Logo

ZElectronsSelector.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Class: ZElectronsSelector
3 //
4 // Original Author: Silvia Taroni
5 // Created: Wed, 29 Nov 2017 18:23:54 GMT
6 //
7 //
8 
10 
11 // system include files
12 
13 #include <algorithm>
14 #include <iostream>
15 #include <memory>
16 #include <string>
17 #include <vector>
18 
19 // user include files
22 
25 
27 
33 //
38 
39 using namespace std;
40 using namespace reco;
41 namespace edm {
42  class EventSetup;
43 }
44 
46 public:
48  bool operator()(const reco::GsfElectron&) const;
49  void newEvent(const edm::Event&, const edm::EventSetup&);
50  const float getEffectiveArea(float eta) const;
51  void printEffectiveAreas() const;
52 
56 
57  std::vector<double> absEtaMin_; // low limit of the eta range
58  std::vector<double> absEtaMax_; // upper limit of the eta range
59  std::vector<double> effectiveAreaValues_; // effective area for this eta range
60 
62 
63  vector<int> missHits;
64  vector<double> sigmaIEtaIEtaCut;
65  vector<double> dEtaInSeedCut;
66  vector<double> dPhiInCut;
67  vector<double> hOverECut;
68  vector<double> relCombIso;
69  vector<double> EInvMinusPInv;
70 };
71 
73  printf(" eta_min eta_max effective area\n");
74  uint nEtaBins = absEtaMin_.size();
75  for (uint iEta = 0; iEta < nEtaBins; iEta++) {
76  printf(" %8.4f %8.4f %8.5f\n", absEtaMin_[iEta], absEtaMax_[iEta], effectiveAreaValues_[iEta]);
77  }
78 }
79 const float ZElectronsSelector::getEffectiveArea(float eta) const {
80  float effArea = 0;
81  uint nEtaBins = absEtaMin_.size();
82  for (uint iEta = 0; iEta < nEtaBins; iEta++) {
83  if (std::abs(eta) >= absEtaMin_[iEta] && std::abs(eta) < absEtaMax_[iEta]) {
84  effArea = effectiveAreaValues_[iEta];
85  break;
86  }
87  }
88 
89  return effArea;
90 }
91 
93  : theRhoToken(iC.consumes<double>(cfg.getParameter<edm::InputTag>("rho"))) {
94  absEtaMin_ = cfg.getParameter<std::vector<double> >("absEtaMin");
95  absEtaMax_ = cfg.getParameter<std::vector<double> >("absEtaMax");
96  effectiveAreaValues_ = cfg.getParameter<std::vector<double> >("effectiveAreaValues");
97  //printEffectiveAreas();
98  eleIDWP = cfg.getParameter<edm::ParameterSet>("eleID");
99 
100  missHits = eleIDWP.getParameter<std::vector<int> >("missingHitsCut");
101  sigmaIEtaIEtaCut = eleIDWP.getParameter<std::vector<double> >("full5x5_sigmaIEtaIEtaCut");
102  dEtaInSeedCut = eleIDWP.getParameter<std::vector<double> >("dEtaInSeedCut");
103  dPhiInCut = eleIDWP.getParameter<std::vector<double> >("dPhiInCut");
104  hOverECut = eleIDWP.getParameter<std::vector<double> >("hOverECut");
105  relCombIso = eleIDWP.getParameter<std::vector<double> >("relCombIsolationWithEACut");
106  EInvMinusPInv = eleIDWP.getParameter<std::vector<double> >("EInverseMinusPInverseCut");
107 }
108 
110  ev.getByToken(theRhoToken, _rhoHandle);
111 }
112 
114  float pt_e = el.pt();
115  unsigned int ind = 0;
116  auto etrack = el.gsfTrack();
117  float abseta = fabs((el.superCluster().get())->position().eta());
118 
119  if (el.isEB()) {
120  if (abseta > 1.479)
121  return false; // check if it is really needed
122  }
123  if (el.isEE()) {
124  ind = 1;
125  if (abseta < 1.479)
126  return false; // check if it is really needed
127  if (abseta >= 2.5)
128  return false; // check if it is really needed
129  }
130 
131  if (etrack->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) > missHits[ind])
132  return false;
133  if (el.full5x5_sigmaIetaIeta() > sigmaIEtaIEtaCut[ind])
134  return false;
135  if (fabs(el.deltaPhiSuperClusterTrackAtVtx()) > dPhiInCut[ind])
136  return false;
137  if (fabs(el.deltaEtaSeedClusterTrackAtVtx()) > dEtaInSeedCut[ind])
138  return false;
139  if (el.hadronicOverEm() > hOverECut[ind])
140  return false;
141  const float eA = getEffectiveArea(abseta);
142  const float rho = _rhoHandle.isValid() ? (float)(*_rhoHandle.product()) : 0;
144  std::max(float(0.0),
146  relCombIso[ind] * pt_e)
147  return false;
148  const float ecal_energy_inverse = 1.0 / el.ecalEnergy();
149  const float eSCoverP = el.eSuperClusterOverP();
150  if (std::abs(1.0 - eSCoverP) * ecal_energy_inverse > EInvMinusPInv[ind])
151  return false;
152 
153  return true;
154 }
155 
157 
159 
EVENTSETUP_STD_INIT
#define EVENTSETUP_STD_INIT(SELECTOR)
Definition: EventSetupInitTrait.h:103
reco::GsfElectron::isEE
bool isEE() const
Definition: GsfElectron.h:337
reco::GsfElectron::isEB
bool isEB() const
Definition: GsfElectron.h:336
ZElectronsSelector::getEffectiveArea
const float getEffectiveArea(float eta) const
Definition: ZElectronsSelector.cc:79
reco::GsfElectron::gsfTrack
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:164
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ZElectronsSelector
Definition: ZElectronsSelector.cc:45
reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
reco::GsfElectron::deltaEtaSeedClusterTrackAtVtx
float deltaEtaSeedClusterTrackAtVtx() const
Definition: GsfElectron.h:239
ZElectronsSelector::relCombIso
vector< double > relCombIso
Definition: ZElectronsSelector.cc:68
edm::EDGetTokenT< double >
edm
HLT enums.
Definition: AlignableModifier.h:19
ZElectronsSelector::missHits
vector< int > missHits
Definition: ZElectronsSelector.cc:63
SingleObjectSelector.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
PFJetCollection.h
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
ZElectronsSelector::newEvent
void newEvent(const edm::Event &, const edm::EventSetup &)
Definition: ZElectronsSelector.cc:109
ZElectronsSelector::eleIDWP
edm::ParameterSet eleIDWP
Definition: ZElectronsSelector.cc:61
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
reco::GsfElectron::hadronicOverEm
float hadronicOverEm() const
Definition: GsfElectron.h:508
edm::Handle< double >
parallelization.uint
uint
Definition: parallelization.py:124
ZElectronsSelector::operator()
bool operator()(const reco::GsfElectron &) const
Definition: ZElectronsSelector.cc:113
MakerMacros.h
ZElectronsSelector::hOverECut
vector< double > hOverECut
Definition: ZElectronsSelector.cc:67
reco::GsfElectron::PflowIsolationVariables::sumPhotonEt
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:673
ZElectronsSelector::sigmaIEtaIEtaCut
vector< double > sigmaIEtaIEtaCut
Definition: ZElectronsSelector.cc:64
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ZElectronsSelector::effectiveAreaValues_
std::vector< double > effectiveAreaValues_
Definition: ZElectronsSelector.cc:59
PVValHelper::eta
Definition: PVValidationHelpers.h:70
ZElectronsSelector::ZElectronsSelector
ZElectronsSelector(const edm::ParameterSet &, edm::ConsumesCollector &iC)
Definition: ZElectronsSelector.cc:92
reco::GsfElectron
Definition: GsfElectron.h:35
GsfElectron.h
DDAxes::rho
GsfElectronFwd.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
reco::GsfElectron::full5x5_sigmaIetaIeta
float full5x5_sigmaIetaIeta() const
Definition: GsfElectron.h:479
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
ModuleDef.h
ZElectronsSelector::_rhoHandle
edm::Handle< double > _rhoHandle
Definition: ZElectronsSelector.cc:55
GsfTrack.h
edm::EventSetup
Definition: EventSetup.h:58
ZElectronsSelector::absEtaMin_
std::vector< double > absEtaMin_
Definition: ZElectronsSelector.cc:57
reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:672
ZElectronsSelector::absEtaMax_
std::vector< double > absEtaMax_
Definition: ZElectronsSelector.cc:58
SingleObjectSelectorBase
Definition: SingleObjectSelector.h:26
InputTag.h
ZElectronsSelector::printEffectiveAreas
void printEffectiveAreas() const
Definition: ZElectronsSelector.cc:72
looper.cfg
cfg
Definition: looper.py:296
ZElectronsSelectorAndSkim
SingleObjectSelector< edm::View< reco::GsfElectron >, ZElectronsSelector > ZElectronsSelectorAndSkim
Definition: ZElectronsSelector.cc:156
std
Definition: JetResolutionObject.h:76
ZElectronsSelector::dPhiInCut
vector< double > dPhiInCut
Definition: ZElectronsSelector.cc:66
ZElectronsSelector::dEtaInSeedCut
vector< double > dEtaInSeedCut
Definition: ZElectronsSelector.cc:65
Frameworkfwd.h
L1TMuonDQMOffline_cfi.nEtaBins
nEtaBins
Definition: L1TMuonDQMOffline_cfi.py:21
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
reco::HitPattern::MISSING_INNER_HITS
Definition: HitPattern.h:155
reco::GsfElectron::eSuperClusterOverP
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
reco::GsfElectron::superCluster
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:163
ZElectronsSelector::theGsfEToken
edm::EDGetTokenT< reco::GsfElectronCollection > theGsfEToken
Definition: ZElectronsSelector.cc:54
ZElectronsSelector::EInvMinusPInv
vector< double > EInvMinusPInv
Definition: ZElectronsSelector.cc:69
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
ConsumesCollector.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::GsfElectron::pfIsolationVariables
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:721
EventSetup
View.h
ParameterSet.h
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
EDFilter.h
ZElectronsSelector::theRhoToken
edm::EDGetTokenT< double > theRhoToken
Definition: ZElectronsSelector.cc:53
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:671
reco::GsfElectron::ecalEnergy
float ecalEnergy() const
Definition: GsfElectron.h:883