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 
40 using namespace std;
41 using namespace reco;
42 namespace edm { class EventSetup; }
43 
45 
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 
72 };
73 
74 
76 
77 
78  printf(" eta_min eta_max effective area\n");
79  uint nEtaBins = absEtaMin_.size();
80  for(uint iEta = 0; iEta<nEtaBins; iEta++){
81  printf(" %8.4f %8.4f %8.5f\n",
82  absEtaMin_[iEta], absEtaMax_[iEta],
83  effectiveAreaValues_[iEta]);
84  }
85 
86 }
87 const float ZElectronsSelector::getEffectiveArea(float eta) const{
88 
89  float effArea = 0;
90  uint nEtaBins = absEtaMin_.size();
91  for(uint iEta = 0; iEta<nEtaBins; iEta++){
92  if( std::abs(eta) >= absEtaMin_[iEta]
93  && std::abs(eta) < absEtaMax_[iEta] ){
94  effArea = effectiveAreaValues_[iEta];
95  break;
96  }
97  }
98 
99  return effArea;
100 }
101 
102 
104  theRhoToken(iC.consumes <double> (cfg.getParameter<edm::InputTag>("rho")))
105 {
106  absEtaMin_ = cfg.getParameter<std::vector<double> >("absEtaMin");
107  absEtaMax_ = cfg.getParameter<std::vector<double> >("absEtaMax");
108  effectiveAreaValues_= cfg.getParameter<std::vector<double> >("effectiveAreaValues");
109  //printEffectiveAreas();
110  eleIDWP = cfg.getParameter<edm::ParameterSet>("eleID");
111 
112  missHits = eleIDWP.getParameter<std::vector<int> >("missingHitsCut");
113  sigmaIEtaIEtaCut= eleIDWP.getParameter<std::vector<double> >("full5x5_sigmaIEtaIEtaCut");
114  dEtaInSeedCut = eleIDWP.getParameter<std::vector<double> >("dEtaInSeedCut");
115  dPhiInCut = eleIDWP.getParameter<std::vector<double> >("dPhiInCut");
116  hOverECut = eleIDWP.getParameter<std::vector<double> >("hOverECut");
117  relCombIso = eleIDWP.getParameter<std::vector<double> >("relCombIsolationWithEACut");
118  EInvMinusPInv = eleIDWP.getParameter<std::vector<double> >("EInverseMinusPInverseCut");
119 }
120 
121 
122 
124 
126 
127 }
128 
130 
131  float pt_e = el.pt();
132  unsigned int ind=0;
133  auto etrack = el.gsfTrack();
134  float abseta = fabs((el.superCluster().get())->position().eta());
135 
136  if (el.isEB()){
137  if (abseta> 1.479) return false; // check if it is really needed
138  }
139  if (el.isEE()){
140  ind=1;
141  if (abseta< 1.479) return false; // check if it is really needed
142  if (abseta>=2.5 ) return false; // check if it is really needed
143  }
144 
145  if (etrack->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS)>missHits[ind]) return false;
146  if (el.full5x5_sigmaIetaIeta() > sigmaIEtaIEtaCut[ind]) return false;
147  if (fabs(el.deltaPhiSuperClusterTrackAtVtx())> dPhiInCut[ind]) return false;
148  if (fabs(el.deltaEtaSeedClusterTrackAtVtx())> dEtaInSeedCut[ind]) return false;
149  if (el.hadronicOverEm()>hOverECut[ind]) return false;
150  const float eA = getEffectiveArea( abseta );
151  const float rho = _rhoHandle.isValid() ? (float)(*_rhoHandle.product()) : 0;
155  ) > relCombIso[ind]*pt_e) return false;
156  const float ecal_energy_inverse = 1.0/el.ecalEnergy();
157  const float eSCoverP = el.eSuperClusterOverP();
158  if ( std::abs(1.0 - eSCoverP)*ecal_energy_inverse > EInvMinusPInv[ind]) return false;
159 
160  return true;
161 }
162 
164 
165 typedef SingleObjectSelector<
169 
const PflowIsolationVariables & pfIsolationVariables() const
Definition: GsfElectron.h:687
T getParameter(std::string const &) const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:186
float eSuperClusterOverP() const
Definition: GsfElectron.h:249
vector< double > EInvMinusPInv
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< double > absEtaMax_
#define EVENTSETUP_STD_INIT(SELECTOR)
vector< double > dEtaInSeedCut
std::vector< double > effectiveAreaValues_
double pt() const final
transverse momentum
bool ev
bool operator()(const reco::GsfElectron &) const
bool isEE() const
Definition: GsfElectron.h:357
bool isEB() const
Definition: GsfElectron.h:356
float full5x5_sigmaIetaIeta() const
Definition: GsfElectron.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SingleObjectSelector< edm::View< reco::GsfElectron >, ZElectronsSelector > ZElectronsSelectorAndSkim
float hadronicOverEm() const
Definition: GsfElectron.h:495
edm::EDGetTokenT< double > theRhoToken
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:641
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:256
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:640
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:243
bool isValid() const
Definition: HandleBase.h:74
float deltaEtaSeedClusterTrackAtVtx() const
Definition: GsfElectron.h:259
vector< double > relCombIso
T const * product() const
Definition: Handle.h:74
edm::Handle< double > _rhoHandle
void newEvent(const edm::Event &, const edm::EventSetup &)
def uint(string)
float ecalEnergy() const
Definition: GsfElectron.h:860
void printEffectiveAreas() const
edm::ParameterSet eleIDWP
fixed size matrix
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:509
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
vector< double > dPhiInCut
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:639
std::vector< double > absEtaMin_
edm::EDGetTokenT< reco::GsfElectronCollection > theGsfEToken
const float getEffectiveArea(float eta) const
vector< double > hOverECut
ZElectronsSelector(const edm::ParameterSet &, edm::ConsumesCollector &iC)
vector< double > sigmaIEtaIEtaCut