CMS 3D CMS Logo

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

#include <PFEGammaFilters.h>

Public Member Functions

bool isElectron (const reco::GsfElectron &) const
 
bool isElectronSafeForJetMET (const reco::GsfElectron &, const reco::PFCandidate &, const reco::Vertex &, bool &lockTracks) const
 
bool isPhotonSafeForJetMET (const reco::Photon &, const reco::PFCandidate &) const
 
bool passElectronSelection (const reco::GsfElectron &, const reco::PFCandidate &, const int &) const
 
bool passPhotonSelection (const reco::Photon &) const
 
 PFEGammaFilters (const edm::ParameterSet &iConfig)
 

Private Member Functions

bool passGsfElePreSelWithOnlyConeHadem (const reco::GsfElectron &) const
 

Private Attributes

std::array< float, 2 > badHcal_dEta_
 
std::array< float, 2 > badHcal_dPhi_
 
std::array< float, 2 > badHcal_eInvPInv_
 
bool badHcal_eleEnable_
 
std::array< float, 2 > badHcal_full5x5_sigmaIetaIeta_
 
bool badHcal_phoEnable_
 
float badHcal_phoTrkSolidConeIso_offs_
 
float badHcal_phoTrkSolidConeIso_slope_
 
const bool debug_ = false
 
const float ele_ecalDrivenHademPreselCut_
 
const float ele_iso_combIso_eb_
 
const float ele_iso_combIso_ee_
 
const float ele_iso_mva_eb_
 
const float ele_iso_mva_ee_
 
const float ele_iso_pt_
 
float ele_maxDPhiIN_
 
float ele_maxE_
 
float ele_maxEcalEOverP_1_
 
float ele_maxEcalEOverP_2_
 
float ele_maxEcalEOverPRes_
 
float ele_maxEeleOverPout_
 
float ele_maxEeleOverPoutRes_
 
float ele_maxEleHcalEOverEcalE_
 
const float ele_maxElePtForOnlyMVAPresel_
 
float ele_maxHcalE_
 
float ele_maxHcalEOverEcalE_
 
float ele_maxHcalEOverP_
 
float ele_maxNtracks_
 
float ele_maxTrackPOverEele_
 
const unsigned int ele_missinghits_
 
const float ele_noniso_mva_
 
const float ph_combIso_
 
const float ph_Et_
 
const float ph_loose_hoe_
 
const float ph_sietaieta_eb_
 
const float ph_sietaieta_ee_
 
float pho_sumPtTrackIso_
 
float pho_sumPtTrackIsoSlope_
 

Detailed Description

Definition at line 16 of file PFEGammaFilters.h.

Constructor & Destructor Documentation

PFEGammaFilters::PFEGammaFilters ( const edm::ParameterSet iConfig)

Definition at line 29 of file PFEGammaFilters.cc.

References badHcal_dEta_, badHcal_dPhi_, badHcal_eInvPInv_, badHcal_eleEnable_, badHcal_full5x5_sigmaIetaIeta_, badHcal_phoEnable_, badHcal_phoTrkSolidConeIso_offs_, badHcal_phoTrkSolidConeIso_slope_, ele_maxDPhiIN_, ele_maxE_, ele_maxEcalEOverP_1_, ele_maxEcalEOverP_2_, ele_maxEcalEOverPRes_, ele_maxEeleOverPout_, ele_maxEeleOverPoutRes_, ele_maxEleHcalEOverEcalE_, ele_maxHcalE_, ele_maxHcalEOverEcalE_, ele_maxHcalEOverP_, ele_maxNtracks_, ele_maxTrackPOverEele_, edm::ParameterSet::getParameter(), pho_sumPtTrackIso_, and pho_sumPtTrackIsoSlope_.

29  :
30  ph_Et_(cfg.getParameter<double>("photon_MinEt")),
31  ph_combIso_(cfg.getParameter<double>("photon_combIso")),
32  ph_loose_hoe_(cfg.getParameter<double>("photon_HoE")),
33  ph_sietaieta_eb_(cfg.getParameter<double>("photon_SigmaiEtaiEta_barrel")),
34  ph_sietaieta_ee_(cfg.getParameter<double>("photon_SigmaiEtaiEta_endcap")),
35  ele_iso_pt_(cfg.getParameter<double>("electron_iso_pt")),
36  ele_iso_mva_eb_(cfg.getParameter<double>("electron_iso_mva_barrel")),
37  ele_iso_mva_ee_(cfg.getParameter<double>("electron_iso_mva_endcap")),
38  ele_iso_combIso_eb_(cfg.getParameter<double>("electron_iso_combIso_barrel")),
39  ele_iso_combIso_ee_(cfg.getParameter<double>("electron_iso_combIso_endcap")),
40  ele_noniso_mva_(cfg.getParameter<double>("electron_noniso_mvaCut")),
41  ele_missinghits_(cfg.getParameter<unsigned int>("electron_missinghits")),
42  ele_ecalDrivenHademPreselCut_(cfg.getParameter<double>("electron_ecalDrivenHademPreselCut")),
43  ele_maxElePtForOnlyMVAPresel_(cfg.getParameter<double>("electron_maxElePtForOnlyMVAPresel"))
44 {
45  auto const& eleProtectionsForBadHcal = cfg.getParameter<edm::ParameterSet>("electron_protectionsForBadHcal");
46  auto const& eleProtectionsForJetMET = cfg.getParameter<edm::ParameterSet>("electron_protectionsForJetMET");
47  auto const& phoProtectionsForBadHcal = cfg.getParameter<edm::ParameterSet>("photon_protectionsForBadHcal");
48  auto const& phoProtectionsForJetMET = cfg.getParameter<edm::ParameterSet>("photon_protectionsForJetMET");
49 
50  pho_sumPtTrackIso_ = phoProtectionsForJetMET.getParameter<double>("sumPtTrackIso");
51  pho_sumPtTrackIsoSlope_ = phoProtectionsForJetMET.getParameter<double>("sumPtTrackIsoSlope");
52 
53  ele_maxNtracks_ = eleProtectionsForJetMET.getParameter<double>("maxNtracks");
54  ele_maxHcalE_ = eleProtectionsForJetMET.getParameter<double>("maxHcalE");
55  ele_maxTrackPOverEele_ = eleProtectionsForJetMET.getParameter<double>("maxTrackPOverEele");
56  ele_maxE_ = eleProtectionsForJetMET.getParameter<double>("maxE");
57  ele_maxEleHcalEOverEcalE_ = eleProtectionsForJetMET.getParameter<double>("maxEleHcalEOverEcalE");
58  ele_maxEcalEOverPRes_ = eleProtectionsForJetMET.getParameter<double>("maxEcalEOverPRes");
59  ele_maxEeleOverPoutRes_ = eleProtectionsForJetMET.getParameter<double>("maxEeleOverPoutRes");
60  ele_maxHcalEOverP_ = eleProtectionsForJetMET.getParameter<double>("maxHcalEOverP");
61  ele_maxHcalEOverEcalE_ = eleProtectionsForJetMET.getParameter<double>("maxHcalEOverEcalE");
62  ele_maxEcalEOverP_1_ = eleProtectionsForJetMET.getParameter<double>("maxEcalEOverP_1");
63  ele_maxEcalEOverP_2_ = eleProtectionsForJetMET.getParameter<double>("maxEcalEOverP_2");
64  ele_maxEeleOverPout_ = eleProtectionsForJetMET.getParameter<double>("maxEeleOverPout");
65  ele_maxDPhiIN_ = eleProtectionsForJetMET.getParameter<double>("maxDPhiIN");
66 
67  readEBEEParams_(eleProtectionsForBadHcal, "full5x5_sigmaIetaIeta", badHcal_full5x5_sigmaIetaIeta_);
68  readEBEEParams_(eleProtectionsForBadHcal, "eInvPInv", badHcal_eInvPInv_);
69  readEBEEParams_(eleProtectionsForBadHcal, "dEta", badHcal_dEta_);
70  readEBEEParams_(eleProtectionsForBadHcal, "dPhi", badHcal_dPhi_);
71 
72  badHcal_eleEnable_ = eleProtectionsForBadHcal.getParameter<bool>("enableProtections");
73  badHcal_phoTrkSolidConeIso_offs_ = phoProtectionsForBadHcal.getParameter<double>("solidConeTrkIsoOffset");
74  badHcal_phoTrkSolidConeIso_slope_ = phoProtectionsForBadHcal.getParameter<double>("solidConeTrkIsoSlope");
75  badHcal_phoEnable_ = phoProtectionsForBadHcal.getParameter<bool>("enableProtections");
76 }
T getParameter(std::string const &) const
float ele_maxHcalEOverEcalE_
const float ele_iso_mva_eb_
const float ph_Et_
const float ele_iso_mva_ee_
const float ele_ecalDrivenHademPreselCut_
float badHcal_phoTrkSolidConeIso_offs_
const float ele_iso_pt_
const unsigned int ele_missinghits_
std::array< float, 2 > badHcal_full5x5_sigmaIetaIeta_
std::array< float, 2 > badHcal_dPhi_
const float ph_loose_hoe_
float badHcal_phoTrkSolidConeIso_slope_
const float ele_iso_combIso_ee_
const float ele_iso_combIso_eb_
std::array< float, 2 > badHcal_dEta_
float ele_maxEeleOverPout_
const float ele_noniso_mva_
float ele_maxEcalEOverP_2_
float ele_maxEeleOverPoutRes_
const float ph_sietaieta_ee_
float ele_maxEcalEOverPRes_
const float ph_sietaieta_eb_
float ele_maxEcalEOverP_1_
const float ele_maxElePtForOnlyMVAPresel_
float ele_maxEleHcalEOverEcalE_
float ele_maxTrackPOverEele_
float pho_sumPtTrackIsoSlope_
const float ph_combIso_
std::array< float, 2 > badHcal_eInvPInv_

Member Function Documentation

bool PFEGammaFilters::isElectron ( const reco::GsfElectron electron) const

Definition at line 179 of file PFEGammaFilters.cc.

References ele_missinghits_, reco::GsfElectron::gsfTrack(), and reco::HitPattern::MISSING_INNER_HITS.

Referenced by PFAlgo::processBlock().

179  {
180 
181  unsigned int nmisshits = electron.gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
182  if(nmisshits > ele_missinghits_)
183  return false;
184 
185  return true;
186 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:186
const unsigned int ele_missinghits_
bool PFEGammaFilters::isElectronSafeForJetMET ( const reco::GsfElectron electron,
const reco::PFCandidate pfcand,
const reco::Vertex primaryVertex,
bool &  lockTracks 
) const

Definition at line 189 of file PFEGammaFilters.cc.

References reco::PFBlock::associatedElements(), groupFilesInBlocks::block, gather_cfg::cout, reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::ecalEnergy(), reco::GsfElectron::eEleClusterOverPout(), reco::PFCandidate::egammaExtraRef(), ele_maxDPhiIN_, ele_maxE_, ele_maxEcalEOverP_1_, ele_maxEcalEOverP_2_, ele_maxEcalEOverPRes_, ele_maxEeleOverPout_, ele_maxEeleOverPoutRes_, ele_maxEleHcalEOverEcalE_, ele_maxHcalE_, ele_maxHcalEOverEcalE_, ele_maxHcalEOverP_, ele_maxNtracks_, ele_maxTrackPOverEele_, reco::GsfElectron::electronCluster(), reco::PFBlock::elements(), reco::CaloCluster::energy(), reco::GsfElectron::eSuperClusterOverP(), reco::LeafCandidate::eta(), spr::goodTrack(), reco::GsfElectron::gsfTrack(), reco::PFBlockElement::HCAL, PFTrackAlgoTools::isGoodForEGM(), reco::PFBlock::linkData(), reco::PFBlock::LINKTEST_ALL, reco::HitPattern::MISSING_INNER_HITS, reco::PFBlockElement::TRACK, reco::PFBlockElement::trackRef(), reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and reco::PFBlockElement::type().

Referenced by PFAlgo::processBlock().

192  {
193 
194  bool debugSafeForJetMET = false;
195  bool isSafeForJetMET = true;
196 
197 // cout << " ele_maxNtracks_ " << ele_maxNtracks_ << endl
198 // << " ele_maxHcalE_ " << ele_maxHcalE_ << endl
199 // << " ele_maxTrackPOverEele_ " << ele_maxTrackPOverEele_ << endl
200 // << " ele_maxE_ " << ele_maxE_ << endl
201 // << " ele_maxEleHcalEOverEcalE_ "<< ele_maxEleHcalEOverEcalE_ << endl
202 // << " ele_maxEcalEOverPRes_ " << ele_maxEcalEOverPRes_ << endl
203 // << " ele_maxEeleOverPoutRes_ " << ele_maxEeleOverPoutRes_ << endl
204 // << " ele_maxHcalEOverP_ " << ele_maxHcalEOverP_ << endl
205 // << " ele_maxHcalEOverEcalE_ " << ele_maxHcalEOverEcalE_ << endl
206 // << " ele_maxEcalEOverP_1_ " << ele_maxEcalEOverP_1_ << endl
207 // << " ele_maxEcalEOverP_2_ " << ele_maxEcalEOverP_2_ << endl
208 // << " ele_maxEeleOverPout_ " << ele_maxEeleOverPout_ << endl
209 // << " ele_maxDPhiIN_ " << ele_maxDPhiIN_ << endl;
210 
211  // loop on the extra-tracks associated to the electron
212  PFCandidateEGammaExtraRef pfcandextra = pfcand.egammaExtraRef();
213 
214  unsigned int iextratrack = 0;
215  unsigned int itrackHcalLinked = 0;
216  float SumExtraKfP = 0.;
217  //float Ene_ecalgsf = 0.;
218 
219 
220  // problems here: for now get the electron cluster from the gsf electron
221  // const PFCandidate::ElementsInBlocks& eleCluster = pfcandextra->gsfElectronClusterRef();
222  // PFCandidate::ElementsInBlocks::const_iterator iegfirst = eleCluster.begin();
223  // float Ene_hcalgsf = pfcandextra->
224 
225 
226  float ETtotal = electron.ecalEnergy();
227 
228  //NOTE take this from EGammaExtra
229  float Ene_ecalgsf = electron.electronCluster()->energy();
230  float Ene_hcalgsf = pfcandextra->hadEnergy();
231  float HOverHE = Ene_hcalgsf/(Ene_hcalgsf + Ene_ecalgsf);
232  float EtotPinMode = electron.eSuperClusterOverP();
233 
234  //NOTE take this from EGammaExtra
235  float EGsfPoutMode = electron.eEleClusterOverPout();
236  float HOverPin = Ene_hcalgsf / electron.gsfTrack()->pMode();
237  float dphi_normalsc = electron.deltaPhiSuperClusterTrackAtVtx();
238 
239 
240  const PFCandidate::ElementsInBlocks& extraTracks = pfcandextra->extraNonConvTracks();
241  for (PFCandidate::ElementsInBlocks::const_iterator itrk = extraTracks.begin();
242  itrk<extraTracks.end(); ++itrk) {
243  const PFBlock& block = *(itrk->first);
244  const PFBlock::LinkData& linkData = block.linkData();
245  const PFBlockElement& pfele = block.elements()[itrk->second];
246 
247  if(debugSafeForJetMET)
248  cout << " My track element number " << itrk->second << endl;
249  if(pfele.type()==reco::PFBlockElement::TRACK) {
250  const reco::TrackRef& trackref = pfele.trackRef();
251 
252  bool goodTrack = PFTrackAlgoTools::isGoodForEGM(trackref->algo());
253  // iter0, iter1, iter2, iter3 = Algo < 3
254  // algo 4,5,6,7
255  int nexhits = trackref->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS);
256 
257  bool trackIsFromPrimaryVertex = false;
258  for (Vertex::trackRef_iterator trackIt = primaryVertex.tracks_begin(); trackIt != primaryVertex.tracks_end(); ++trackIt) {
259  if ( (*trackIt).castTo<TrackRef>() == trackref ) {
260  trackIsFromPrimaryVertex = true;
261  break;
262  }
263  }
264 
265  // probably we could now remove the algo request??
266  if(goodTrack && nexhits == 0 && trackIsFromPrimaryVertex) {
267  float p_trk = trackref->p();
268  SumExtraKfP += p_trk;
269  iextratrack++;
270  // Check if these extra tracks are HCAL linked
271  std::multimap<double, unsigned int> hcalKfElems;
272  block.associatedElements( itrk->second,
273  linkData,
274  hcalKfElems,
277  if(!hcalKfElems.empty()) {
278  itrackHcalLinked++;
279  }
280  if(debugSafeForJetMET)
281  cout << " The ecalGsf cluster is not isolated: >0 KF extra with algo < 3"
282  << " Algo " << trackref->algo()
283  << " nexhits " << nexhits
284  << " trackIsFromPrimaryVertex " << trackIsFromPrimaryVertex << endl;
285  if(debugSafeForJetMET)
286  cout << " My track PT " << trackref->pt() << endl;
287 
288  }
289  else {
290  if(debugSafeForJetMET)
291  cout << " Tracks from PU "
292  << " Algo " << trackref->algo()
293  << " nexhits " << nexhits
294  << " trackIsFromPrimaryVertex " << trackIsFromPrimaryVertex << endl;
295  if(debugSafeForJetMET)
296  cout << " My track PT " << trackref->pt() << endl;
297  }
298  }
299  }
300  if( iextratrack > 0) {
301  if(iextratrack > ele_maxNtracks_ || Ene_hcalgsf > ele_maxHcalE_ || (SumExtraKfP/Ene_ecalgsf) > ele_maxTrackPOverEele_
302  || (ETtotal > ele_maxE_ && iextratrack > 1 && (Ene_hcalgsf/Ene_ecalgsf) > ele_maxEleHcalEOverEcalE_) ) {
303  if(debugSafeForJetMET)
304  cout << " *****This electron candidate is discarded: Non isolated # tracks "
305  << iextratrack << " HOverHE " << HOverHE
306  << " SumExtraKfP/Ene_ecalgsf " << SumExtraKfP/Ene_ecalgsf
307  << " SumExtraKfP " << SumExtraKfP
308  << " Ene_ecalgsf " << Ene_ecalgsf
309  << " ETtotal " << ETtotal
310  << " Ene_hcalgsf/Ene_ecalgsf " << Ene_hcalgsf/Ene_ecalgsf
311  << endl;
312 
313  isSafeForJetMET = false;
314  }
315  // the electron is retained and the kf tracks are not locked
316  if( (fabs(1.-EtotPinMode) < ele_maxEcalEOverPRes_ && (fabs(electron.eta()) < 1.0 || fabs(electron.eta()) > 2.0)) ||
317  ((EtotPinMode < 1.1 && EtotPinMode > 0.6) && (fabs(electron.eta()) >= 1.0 && fabs(electron.eta()) <= 2.0))) {
318  if( fabs(1.-EGsfPoutMode) < ele_maxEeleOverPoutRes_ &&
319  (itrackHcalLinked == iextratrack)) {
320 
321  lockTracks = false;
322  // lockExtraKf = false;
323  if(debugSafeForJetMET)
324  cout << " *****This electron is reactivated # tracks "
325  << iextratrack << " #tracks hcal linked " << itrackHcalLinked
326  << " SumExtraKfP/Ene_ecalgsf " << SumExtraKfP/Ene_ecalgsf
327  << " EtotPinMode " << EtotPinMode << " EGsfPoutMode " << EGsfPoutMode
328  << " eta gsf " << electron.eta() <<endl;
329  }
330  }
331  }
332 
333  if (HOverPin > ele_maxHcalEOverP_ && HOverHE > ele_maxHcalEOverEcalE_ && EtotPinMode < ele_maxEcalEOverP_1_) {
334  if(debugSafeForJetMET)
335  cout << " *****This electron candidate is discarded HCAL ENERGY "
336  << " HOverPin " << HOverPin << " HOverHE " << HOverHE << " EtotPinMode" << EtotPinMode << endl;
337  isSafeForJetMET = false;
338  }
339 
340  // Reject Crazy E/p values... to be understood in the future how to train a
341  // BDT in order to avoid to select this bad electron candidates.
342 
343  if( EtotPinMode < ele_maxEcalEOverP_2_ && EGsfPoutMode < ele_maxEeleOverPout_ ) {
344  if(debugSafeForJetMET)
345  cout << " *****This electron candidate is discarded Low ETOTPIN "
346  << " EtotPinMode " << EtotPinMode << " EGsfPoutMode " << EGsfPoutMode << endl;
347  isSafeForJetMET = false;
348  }
349 
350  // For not-preselected Gsf Tracks ET > 50 GeV, apply dphi preselection
351  if(ETtotal > ele_maxE_ && fabs(dphi_normalsc) > ele_maxDPhiIN_ ) {
352  if(debugSafeForJetMET)
353  cout << " *****This electron candidate is discarded Large ANGLE "
354  << " ETtotal " << ETtotal << " EGsfPoutMode " << dphi_normalsc << endl;
355  isSafeForJetMET = false;
356  }
357 
358 
359 
360  return isSafeForJetMET;
361 }
CaloClusterPtr electronCluster() const
Definition: GsfElectron.h:248
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:186
Abstract base class for a PFBlock element (track, cluster...)
float ele_maxHcalEOverEcalE_
double eta() const final
momentum pseudorapidity
float eSuperClusterOverP() const
Definition: GsfElectron.h:249
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:81
Type type() const
std::map< unsigned int, Link > LinkData
Definition: PFBlock.h:46
const edm::OwnVector< reco::PFBlockElement > & elements() const
Definition: PFBlock.h:107
const LinkData & linkData() const
Definition: PFBlock.h:112
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:387
bool isGoodForEGM(const reco::TrackBase::TrackAlgorithm &)
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:256
double energy() const
cluster energy
Definition: CaloCluster.h:126
float eEleClusterOverPout() const
Definition: GsfElectron.h:252
float ele_maxEeleOverPout_
float ele_maxEcalEOverP_2_
void associatedElements(unsigned i, const LinkData &linkData, std::multimap< double, unsigned > &sortedAssociates, reco::PFBlockElement::Type type=PFBlockElement::NONE, LinkTest test=LINKTEST_RECHIT) const
Definition: PFBlock.cc:75
float ele_maxEeleOverPoutRes_
float ele_maxEcalEOverPRes_
float ecalEnergy() const
Definition: GsfElectron.h:860
float ele_maxEcalEOverP_1_
reco::PFCandidateEGammaExtraRef egammaExtraRef() const
return a reference to the EGamma extra
Definition: PFCandidate.cc:605
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:37
float ele_maxEleHcalEOverEcalE_
float ele_maxTrackPOverEele_
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:76
virtual const reco::TrackRef & trackRef() const
Block of elements.
Definition: PFBlock.h:30
bool PFEGammaFilters::isPhotonSafeForJetMET ( const reco::Photon photon,
const reco::PFCandidate pfcand 
) const

Definition at line 362 of file PFEGammaFilters.cc.

References groupFilesInBlocks::block, gather_cfg::cout, reco::PFCandidate::egammaExtraRef(), reco::PFBlock::elements(), pho_sumPtTrackIso_, pho_sumPtTrackIsoSlope_, EnergyCorrector::pt, reco::LeafCandidate::pt(), reco::PFBlockElement::TRACK, reco::PFBlockElement::trackRef(), and reco::PFBlockElement::type().

Referenced by PFAlgo::processBlock().

362  {
363 
364  bool isSafeForJetMET = true;
365  bool debugSafeForJetMET = false;
366 
367 // cout << " pho_sumPtTrackIso_ForPhoton " << pho_sumPtTrackIso_
368 // << " pho_sumPtTrackIsoSlope_ForPhoton " << pho_sumPtTrackIsoSlope_ << endl;
369 
370  float sum_track_pt = 0.;
371 
372  PFCandidateEGammaExtraRef pfcandextra = pfcand.egammaExtraRef();
373  const PFCandidate::ElementsInBlocks& extraTracks = pfcandextra->extraNonConvTracks();
374  for (PFCandidate::ElementsInBlocks::const_iterator itrk = extraTracks.begin();
375  itrk<extraTracks.end(); ++itrk) {
376  const PFBlock& block = *(itrk->first);
377  const PFBlockElement& pfele = block.elements()[itrk->second];
378 
379 
380  if(pfele.type()==reco::PFBlockElement::TRACK) {
381 
382 
383  const reco::TrackRef& trackref = pfele.trackRef();
384 
385  if(debugSafeForJetMET)
386  cout << "PFEGammaFilters::isPhotonSafeForJetMET photon track:pt " << trackref->pt() << " SingleLegSize " << pfcandextra->singleLegConvTrackRefMva().size() << endl;
387 
388 
389  //const std::vector<reco::TrackRef>& mySingleLeg =
390  bool singleLegConv = false;
391  for(unsigned int iconv =0; iconv<pfcandextra->singleLegConvTrackRefMva().size(); iconv++) {
392  if(debugSafeForJetMET)
393  cout << "PFEGammaFilters::SingleLeg track:pt " << (pfcandextra->singleLegConvTrackRefMva()[iconv].first)->pt() << endl;
394 
395  if(pfcandextra->singleLegConvTrackRefMva()[iconv].first == trackref) {
396  singleLegConv = true;
397  if(debugSafeForJetMET)
398  cout << "PFEGammaFilters::isPhotonSafeForJetMET: SingleLeg conv track " << endl;
399  break;
400 
401  }
402  }
403  if(singleLegConv)
404  continue;
405 
406  sum_track_pt += trackref->pt();
407 
408  }
409 
410  }
411 
412  if(debugSafeForJetMET)
413  cout << " PFEGammaFilters::isPhotonSafeForJetMET: SumPt " << sum_track_pt << endl;
414 
415  if(sum_track_pt>(pho_sumPtTrackIso_ + pho_sumPtTrackIsoSlope_ * photon.pt())) {
416  isSafeForJetMET = false;
417  if(debugSafeForJetMET)
418  cout << "************************************!!!! PFEGammaFilters::isPhotonSafeForJetMET: Photon Discaded !!! " << endl;
419  }
420 
421  return isSafeForJetMET;
422 }
Abstract base class for a PFBlock element (track, cluster...)
Type type() const
double pt() const final
transverse momentum
const edm::OwnVector< reco::PFBlockElement > & elements() const
Definition: PFBlock.h:107
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:387
reco::PFCandidateEGammaExtraRef egammaExtraRef() const
return a reference to the EGamma extra
Definition: PFCandidate.cc:605
float pho_sumPtTrackIsoSlope_
virtual const reco::TrackRef & trackRef() const
Block of elements.
Definition: PFBlock.h:30
bool PFEGammaFilters::passElectronSelection ( const reco::GsfElectron electron,
const reco::PFCandidate pfcand,
const int &  nVtx 
) const

Definition at line 120 of file PFEGammaFilters.cc.

References funct::abs(), badHcal_dEta_, badHcal_dPhi_, badHcal_eInvPInv_, badHcal_eleEnable_, badHcal_full5x5_sigmaIetaIeta_, reco::LeafCandidate::charge(), gather_cfg::cout, debug_, reco::GsfElectron::deltaEtaSeedClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::dr03EcalRecHitSumEt(), reco::GsfElectron::dr03HcalTowerSumEt(), reco::GsfElectron::dr03TkSumPt(), reco::GsfElectron::ecalEnergy(), EE, ele_iso_combIso_eb_, ele_iso_combIso_ee_, ele_iso_mva_eb_, ele_iso_mva_ee_, ele_iso_pt_, ele_noniso_mva_, reco::GsfElectron::eSuperClusterOverP(), reco::LeafCandidate::eta(), reco::GsfElectron::full5x5_sigmaIetaIeta(), reco::GsfElectron::hcalOverEcal(), reco::GsfElectron::hcalOverEcalValid(), reco::GsfElectron::mva_e_pi(), reco::GsfElectron::mva_Isolated(), passGsfElePreSelWithOnlyConeHadem(), reco::LeafCandidate::phi(), and reco::LeafCandidate::pt().

Referenced by PFAlgo::processBlock().

122  {
123  // First simple selection, same as the Run1 to be improved in CMSSW_710
124 
125  bool validHoverE = electron.hcalOverEcalValid();
126  if (debug_) std::cout << "PFEGammaFilters:: Electron pt " << electron.pt()
127  << " eta, phi " << electron.eta() << ", " << electron.phi()
128  << " charge " << electron.charge()
129  << " isoDr03 " << (electron.dr03TkSumPt() + electron.dr03EcalRecHitSumEt() + electron.dr03HcalTowerSumEt())
130  << " mva_isolated " << electron.mva_Isolated()
131  << " mva_e_pi " << electron.mva_e_pi()
132  << " H/E_valid " << validHoverE
133  << " s(ieie) " << electron.full5x5_sigmaIetaIeta()
134  << " H/E " << electron.hcalOverEcal()
135  << " 1/e-1/p " << (1.0-electron.eSuperClusterOverP())/electron.ecalEnergy()
136  << " deta " << std::abs(electron.deltaEtaSeedClusterTrackAtVtx())
137  << " dphi " << std::abs(electron.deltaPhiSuperClusterTrackAtVtx())
138  << endl;
139 
140  bool passEleSelection = false;
141 
142  // Electron ET
143  float electronPt = electron.pt();
144 
145  if( electronPt > ele_iso_pt_) {
146 
147  double isoDr03 = electron.dr03TkSumPt() + electron.dr03EcalRecHitSumEt() + electron.dr03HcalTowerSumEt();
148  double eleEta = fabs(electron.eta());
149  if (eleEta <= 1.485 && isoDr03 < ele_iso_combIso_eb_) {
150  if( electron.mva_Isolated() > ele_iso_mva_eb_ )
151  passEleSelection = true;
152  }
153  else if (eleEta > 1.485 && isoDr03 < ele_iso_combIso_ee_) {
154  if( electron.mva_Isolated() > ele_iso_mva_ee_ )
155  passEleSelection = true;
156  }
157 
158  }
159 
160  // cout << " My OLD MVA " << pfcand.mva_e_pi() << " MyNEW MVA " << electron.mva() << endl;
161  if(electron.mva_e_pi() > ele_noniso_mva_) {
162  if (validHoverE || !badHcal_eleEnable_) {
163  passEleSelection = true;
164  } else {
165  bool EE = (std::abs(electron.eta()) > 1.485); // for prefer consistency with above than with E/gamma for now
167  (std::abs(1.0-electron.eSuperClusterOverP())/electron.ecalEnergy() < badHcal_eInvPInv_[EE]) &&
168  (std::abs(electron.deltaEtaSeedClusterTrackAtVtx()) < badHcal_dEta_[EE]) && // looser in case of misalignment
170  passEleSelection = true;
171  }
172  }
173  }
174 
175  return passEleSelection && passGsfElePreSelWithOnlyConeHadem(electron);
176 }
double eta() const final
momentum pseudorapidity
const float ele_iso_mva_eb_
float eSuperClusterOverP() const
Definition: GsfElectron.h:249
const bool debug_
const float ele_iso_mva_ee_
double pt() const final
transverse momentum
int charge() const final
electric charge
Definition: LeafCandidate.h:91
float hcalOverEcalValid() const
Definition: GsfElectron.h:453
const float ele_iso_pt_
std::array< float, 2 > badHcal_full5x5_sigmaIetaIeta_
float full5x5_sigmaIetaIeta() const
Definition: GsfElectron.h:462
std::array< float, 2 > badHcal_dPhi_
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:256
float hcalOverEcal() const
Definition: GsfElectron.h:448
float dr03TkSumPt() const
Definition: GsfElectron.h:552
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool passGsfElePreSelWithOnlyConeHadem(const reco::GsfElectron &) const
const float ele_iso_combIso_ee_
const float ele_iso_combIso_eb_
std::array< float, 2 > badHcal_dEta_
float deltaEtaSeedClusterTrackAtVtx() const
Definition: GsfElectron.h:259
const float ele_noniso_mva_
float ecalEnergy() const
Definition: GsfElectron.h:860
float mva_Isolated() const
Definition: GsfElectron.h:701
float dr03EcalRecHitSumEt() const
Definition: GsfElectron.h:554
float mva_e_pi() const
Definition: GsfElectron.h:702
float dr03HcalTowerSumEt() const
Definition: GsfElectron.h:557
double phi() const final
momentum azimuthal angle
std::array< float, 2 > badHcal_eInvPInv_
bool PFEGammaFilters::passGsfElePreSelWithOnlyConeHadem ( const reco::GsfElectron ele) const
private

Definition at line 429 of file PFEGammaFilters.cc.

References reco::GsfElectron::ecalDrivenSeed(), ele_ecalDrivenHademPreselCut_, ele_maxElePtForOnlyMVAPresel_, reco::GsfElectron::hadronicOverEm(), reco::GsfElectron::passingCutBasedPreselection(), reco::GsfElectron::passingMvaPreselection(), and reco::LeafCandidate::pt().

Referenced by passElectronSelection().

430 {
431  bool passCutBased=ele.passingCutBasedPreselection();
432  if(ele.hadronicOverEm()>ele_ecalDrivenHademPreselCut_) passCutBased = false;
433  bool passMVA = ele.passingMvaPreselection();
434  if(!ele.ecalDrivenSeed()){
435  if(ele.pt() > ele_maxElePtForOnlyMVAPresel_) return passMVA && passCutBased;
436  else return passMVA;
437  }else return passCutBased || passMVA;
438 }
const float ele_ecalDrivenHademPreselCut_
double pt() const final
transverse momentum
bool passingCutBasedPreselection() const
Definition: GsfElectron.h:719
bool passingMvaPreselection() const
Definition: GsfElectron.h:735
float hadronicOverEm() const
Definition: GsfElectron.h:495
const float ele_maxElePtForOnlyMVAPresel_
bool ecalDrivenSeed() const
Definition: GsfElectron.h:188
bool PFEGammaFilters::passPhotonSelection ( const reco::Photon photon) const

Definition at line 79 of file PFEGammaFilters.cc.

References badHcal_phoEnable_, badHcal_phoTrkSolidConeIso_offs_, badHcal_phoTrkSolidConeIso_slope_, gather_cfg::cout, debug_, reco::Photon::ecalRecHitSumEtConeDR03(), reco::LeafCandidate::eta(), reco::Photon::hadTowOverEm(), reco::Photon::hadTowOverEmValid(), reco::Photon::hcalTowerSumEtConeDR03(), reco::Photon::isEB(), ph_combIso_, ph_Et_, ph_loose_hoe_, ph_sietaieta_eb_, ph_sietaieta_ee_, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::Photon::sigmaIetaIeta(), reco::Photon::trkSumPtHollowConeDR03(), and reco::Photon::trkSumPtSolidConeDR03().

Referenced by PFAlgo::processBlock().

79  {
80  // First simple selection, same as the Run1 to be improved in CMSSW_710
81 
82 
83  // Photon ET
84  if(photon.pt() < ph_Et_ ) return false;
85  bool validHoverE = photon.hadTowOverEmValid();
86  if (debug_) std::cout<< "PFEGammaFilters:: photon pt " << photon.pt()
87  << " eta, phi " << photon.eta() << ", " << photon.phi()
88  << " isoDr03 " << (photon.trkSumPtHollowConeDR03()+photon.ecalRecHitSumEtConeDR03()+photon.hcalTowerSumEtConeDR03()) << " (cut: " << ph_combIso_ << ")"
89  << " H/E " << photon.hadTowOverEm() << " (valid? " << validHoverE << ", cut: " << ph_loose_hoe_ << ")"
90  << " s(ieie) " << photon.sigmaIetaIeta() << " (cut: " << (photon.isEB() ? ph_sietaieta_eb_ : ph_sietaieta_ee_) << ")"
91  << " isoTrkDr03Solid " << (photon.trkSumPtSolidConeDR03()) << " (cut: " << (
92  validHoverE || !badHcal_phoEnable_ ?
93  -1 :
95  << std::endl;
96 
97  if (photon.hadTowOverEm() >ph_loose_hoe_ ) return false;
98  //Isolation variables in 0.3 cone combined
100  return false;
101 
102  //patch for bad hcal
104  return false;
105  }
106 
107  if(photon.isEB()) {
108  if(photon.sigmaIetaIeta() > ph_sietaieta_eb_)
109  return false;
110  }
111  else {
112  if(photon.sigmaIetaIeta() > ph_sietaieta_ee_)
113  return false;
114  }
115 
116 
117  return true;
118 }
float trkSumPtSolidConeDR03() const
Definition: Photon.h:453
double eta() const final
momentum pseudorapidity
const float ph_Et_
float hcalTowerSumEtConeDR03() const
Hcal isolation sum.
Definition: Photon.h:441
const bool debug_
float badHcal_phoTrkSolidConeIso_offs_
double pt() const final
transverse momentum
float trkSumPtHollowConeDR03() const
Definition: Photon.h:455
float sigmaIetaIeta() const
Definition: Photon.h:237
float hadTowOverEmValid() const
returns false if hadTowOverEm is not reliably estimated (e.g. because hcal was off or masked) ...
Definition: Photon.h:228
const float ph_loose_hoe_
float hadTowOverEm() const
the ration of hadronic energy in towers behind the BCs in the SC and the SC energy ...
Definition: Photon.h:221
float badHcal_phoTrkSolidConeIso_slope_
const float ph_sietaieta_ee_
const float ph_sietaieta_eb_
bool isEB() const
Definition: Photon.h:121
float ecalRecHitSumEtConeDR03() const
Isolation variables in cone dR=0.3.
Definition: Photon.h:439
double phi() const final
momentum azimuthal angle
const float ph_combIso_

Member Data Documentation

std::array<float,2> PFEGammaFilters::badHcal_dEta_
private

Definition at line 77 of file PFEGammaFilters.h.

Referenced by passElectronSelection(), and PFEGammaFilters().

std::array<float,2> PFEGammaFilters::badHcal_dPhi_
private

Definition at line 78 of file PFEGammaFilters.h.

Referenced by passElectronSelection(), and PFEGammaFilters().

std::array<float,2> PFEGammaFilters::badHcal_eInvPInv_
private

Definition at line 76 of file PFEGammaFilters.h.

Referenced by passElectronSelection(), and PFEGammaFilters().

bool PFEGammaFilters::badHcal_eleEnable_
private

Definition at line 79 of file PFEGammaFilters.h.

Referenced by passElectronSelection(), and PFEGammaFilters().

std::array<float,2> PFEGammaFilters::badHcal_full5x5_sigmaIetaIeta_
private

Definition at line 75 of file PFEGammaFilters.h.

Referenced by passElectronSelection(), and PFEGammaFilters().

bool PFEGammaFilters::badHcal_phoEnable_
private

Definition at line 84 of file PFEGammaFilters.h.

Referenced by passPhotonSelection(), and PFEGammaFilters().

float PFEGammaFilters::badHcal_phoTrkSolidConeIso_offs_
private

Definition at line 82 of file PFEGammaFilters.h.

Referenced by passPhotonSelection(), and PFEGammaFilters().

float PFEGammaFilters::badHcal_phoTrkSolidConeIso_slope_
private

Definition at line 83 of file PFEGammaFilters.h.

Referenced by passPhotonSelection(), and PFEGammaFilters().

const bool PFEGammaFilters::debug_ = false
private

Definition at line 86 of file PFEGammaFilters.h.

Referenced by passElectronSelection(), and passPhotonSelection().

const float PFEGammaFilters::ele_ecalDrivenHademPreselCut_
private

Definition at line 58 of file PFEGammaFilters.h.

Referenced by passGsfElePreSelWithOnlyConeHadem().

const float PFEGammaFilters::ele_iso_combIso_eb_
private

Definition at line 54 of file PFEGammaFilters.h.

Referenced by passElectronSelection().

const float PFEGammaFilters::ele_iso_combIso_ee_
private

Definition at line 55 of file PFEGammaFilters.h.

Referenced by passElectronSelection().

const float PFEGammaFilters::ele_iso_mva_eb_
private

Definition at line 52 of file PFEGammaFilters.h.

Referenced by passElectronSelection().

const float PFEGammaFilters::ele_iso_mva_ee_
private

Definition at line 53 of file PFEGammaFilters.h.

Referenced by passElectronSelection().

const float PFEGammaFilters::ele_iso_pt_
private

Definition at line 51 of file PFEGammaFilters.h.

Referenced by passElectronSelection().

float PFEGammaFilters::ele_maxDPhiIN_
private

Definition at line 72 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxE_
private

Definition at line 63 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxEcalEOverP_1_
private

Definition at line 69 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxEcalEOverP_2_
private

Definition at line 70 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxEcalEOverPRes_
private

Definition at line 65 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxEeleOverPout_
private

Definition at line 71 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxEeleOverPoutRes_
private

Definition at line 66 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxEleHcalEOverEcalE_
private

Definition at line 64 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

const float PFEGammaFilters::ele_maxElePtForOnlyMVAPresel_
private

Definition at line 59 of file PFEGammaFilters.h.

Referenced by passGsfElePreSelWithOnlyConeHadem().

float PFEGammaFilters::ele_maxHcalE_
private

Definition at line 61 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxHcalEOverEcalE_
private

Definition at line 68 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxHcalEOverP_
private

Definition at line 67 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxNtracks_
private

Definition at line 60 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::ele_maxTrackPOverEele_
private

Definition at line 62 of file PFEGammaFilters.h.

Referenced by isElectronSafeForJetMET(), and PFEGammaFilters().

const unsigned int PFEGammaFilters::ele_missinghits_
private

Definition at line 57 of file PFEGammaFilters.h.

Referenced by isElectron().

const float PFEGammaFilters::ele_noniso_mva_
private

Definition at line 56 of file PFEGammaFilters.h.

Referenced by passElectronSelection().

const float PFEGammaFilters::ph_combIso_
private

Definition at line 43 of file PFEGammaFilters.h.

Referenced by passPhotonSelection().

const float PFEGammaFilters::ph_Et_
private

Definition at line 42 of file PFEGammaFilters.h.

Referenced by passPhotonSelection().

const float PFEGammaFilters::ph_loose_hoe_
private

Definition at line 44 of file PFEGammaFilters.h.

Referenced by passPhotonSelection().

const float PFEGammaFilters::ph_sietaieta_eb_
private

Definition at line 45 of file PFEGammaFilters.h.

Referenced by passPhotonSelection().

const float PFEGammaFilters::ph_sietaieta_ee_
private

Definition at line 46 of file PFEGammaFilters.h.

Referenced by passPhotonSelection().

float PFEGammaFilters::pho_sumPtTrackIso_
private

Definition at line 47 of file PFEGammaFilters.h.

Referenced by isPhotonSafeForJetMET(), and PFEGammaFilters().

float PFEGammaFilters::pho_sumPtTrackIsoSlope_
private

Definition at line 48 of file PFEGammaFilters.h.

Referenced by isPhotonSafeForJetMET(), and PFEGammaFilters().