Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23477 from UAEDF-tomc/eleCutBasedId_V2
Implementation of Fall17 cutbased Electron ID V2
- Loading branch information
Showing
7 changed files
with
380 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# This file contains Effective Area constants for | ||
# computing pile-up corrections for the neutral hadron and photon | ||
# isolation for an electron object. | ||
# Documentation: | ||
# | ||
# https://indico.cern.ch/event/697576/contributions/2940576/attachments/1620927/2578913/eleIdTuning.pdf | ||
# (slides 3 to 5) | ||
# | ||
# The effective areas are based on 90% efficient contours | ||
# | ||
# |eta| min |eta| max effective area | ||
0.000 1.000 0.1440 | ||
1.000 1.479 0.1562 | ||
1.479 2.000 0.1032 | ||
2.000 2.200 0.0859 | ||
2.200 2.300 0.1116 | ||
2.300 2.400 0.1321 | ||
2.400 2.500 0.1654 |
77 changes: 77 additions & 0 deletions
77
RecoEgamma/ElectronIdentification/plugins/cuts/GsfEleRelPFIsoScaledCut.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "PhysicsTools/SelectorUtils/interface/CutApplicatorWithEventContentBase.h" | ||
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" | ||
#include "RecoEgamma/EgammaTools/interface/EffectiveAreas.h" | ||
|
||
|
||
class GsfEleRelPFIsoScaledCut : public CutApplicatorWithEventContentBase { | ||
public: | ||
GsfEleRelPFIsoScaledCut(const edm::ParameterSet& c); | ||
|
||
result_type operator()(const reco::GsfElectronPtr&) const final; | ||
|
||
void setConsumes(edm::ConsumesCollector&) final; | ||
void getEventContent(const edm::EventBase&) final; | ||
|
||
double value(const reco::CandidatePtr& cand) const final; | ||
|
||
CandidateType candidateType() const final { | ||
return ELECTRON; | ||
} | ||
|
||
private: | ||
const float barrelC0_, endcapC0_, barrelCpt_, endcapCpt_, barrelCutOff_; | ||
EffectiveAreas effectiveAreas_; | ||
edm::Handle<double> rhoHandle_; | ||
}; | ||
|
||
DEFINE_EDM_PLUGIN(CutApplicatorFactory, GsfEleRelPFIsoScaledCut, "GsfEleRelPFIsoScaledCut"); | ||
|
||
GsfEleRelPFIsoScaledCut::GsfEleRelPFIsoScaledCut(const edm::ParameterSet& c) : | ||
CutApplicatorWithEventContentBase(c), | ||
barrelC0_(c.getParameter<double>("barrelC0")), | ||
endcapC0_(c.getParameter<double>("endcapC0")), | ||
barrelCpt_(c.getParameter<double>("barrelCpt")), | ||
endcapCpt_(c.getParameter<double>("endcapCpt")), | ||
barrelCutOff_(c.getParameter<double>("barrelCutOff")), | ||
effectiveAreas_((c.getParameter<edm::FileInPath>("effAreasConfigFile")).fullPath()) | ||
{ | ||
edm::InputTag rhoTag = c.getParameter<edm::InputTag>("rho"); | ||
contentTags_.emplace("rho",rhoTag); | ||
} | ||
|
||
void GsfEleRelPFIsoScaledCut::setConsumes(edm::ConsumesCollector& cc){ | ||
auto rho = cc.consumes<double>(contentTags_["rho"]); | ||
contentTokens_.emplace("rho", rho); | ||
} | ||
|
||
void GsfEleRelPFIsoScaledCut::getEventContent(const edm::EventBase& ev){ | ||
ev.getByLabel(contentTags_["rho"], rhoHandle_); | ||
} | ||
|
||
CutApplicatorBase::result_type GsfEleRelPFIsoScaledCut::operator()(const reco::GsfElectronPtr& cand) const { | ||
// Establish the cut value | ||
double absEta = std::abs(cand->superCluster()->eta()); | ||
|
||
const float C0 = (absEta < barrelCutOff_ ? barrelC0_ : endcapC0_); | ||
const float Cpt = (absEta < barrelCutOff_ ? barrelCpt_ : endcapCpt_); | ||
const float isoCut = C0+Cpt/cand->pt(); | ||
|
||
return value(cand) < isoCut; | ||
} | ||
|
||
double GsfEleRelPFIsoScaledCut::value(const reco::CandidatePtr& cand) const { | ||
|
||
// Establish the cut value | ||
reco::GsfElectronPtr ele(cand); | ||
double absEta = std::abs(ele->superCluster()->eta()); | ||
|
||
// Compute the combined isolation with effective area correction | ||
auto pfIso = ele->pfIsolationVariables(); | ||
const float chad = pfIso.sumChargedHadronPt; | ||
const float nhad = pfIso.sumNeutralHadronEt; | ||
const float pho = pfIso.sumPhotonEt; | ||
const float eA = effectiveAreas_.getEffectiveArea(absEta); | ||
const float rho = rhoHandle_.isValid() ? (float)(*rhoHandle_) : 0; // std::max likes float arguments | ||
const float iso = chad + std::max(0.0f, nhad + pho - rho*eA); | ||
return iso/cand->pt(); | ||
} |
183 changes: 183 additions & 0 deletions
183
...amma/ElectronIdentification/python/Identification/cutBasedElectronID_Fall17_94X_V2_cff.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
from PhysicsTools.SelectorUtils.centralIDRegistry import central_id_registry | ||
|
||
import FWCore.ParameterSet.Config as cms | ||
|
||
# Common functions and classes for ID definition are imported here: | ||
from RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_tools \ | ||
import ( EleWorkingPoint_V5, | ||
IsolationCutInputs_V2, | ||
configureVIDCutBasedEleID_V5 ) | ||
|
||
# | ||
# The ID cuts below are optimized IDs on Fall17 simulation with 94X-based production | ||
# The cut values are taken from the twiki: | ||
# https://twiki.cern.ch/twiki/bin/view/CMS/CutBasedElectronIdentificationRun2 | ||
# (where they may not stay, if a newer version of cuts becomes available for these | ||
# conditions) | ||
# See also the presentation explaining these working points (this will not change): | ||
# https://indico.cern.ch/event/697079/ | ||
# | ||
# | ||
|
||
# Veto working point Barrel and Endcap | ||
#V2 of IDs good for Moriond 18 | ||
idName = "cutBasedElectronID-Fall17-94X-V2-veto" | ||
WP_Veto_EB = EleWorkingPoint_V5( | ||
idName = idName , # idName | ||
full5x5_sigmaIEtaIEtaCut = 0.0126 , # full5x5_sigmaIEtaIEtaCut | ||
dEtaInSeedCut = 0.00463 , # dEtaInSeedCut | ||
dPhiInCut = 0.148 , # dPhiInCut | ||
hOverECut_C0 = 0.05 , # hOverECut | ||
hOverECut_CE = 1.16 , | ||
hOverECut_Cr = 0.0324 , | ||
relCombIsolationWithEACut_C0 = 0.198 , # relCombIsolationWithEACut | ||
relCombIsolationWithEACut_Cpt = 0.506 , | ||
absEInverseMinusPInverseCut = 0.209 , # absEInverseMinusPInverseCut | ||
# conversion veto cut needs no parameters, so not mentioned | ||
missingHitsCut = 2 # missingHitsCut | ||
) | ||
|
||
WP_Veto_EE = EleWorkingPoint_V5( | ||
idName = idName , # idName | ||
full5x5_sigmaIEtaIEtaCut = 0.0457 , # full5x5_sigmaIEtaIEtaCut | ||
dEtaInSeedCut = 0.00814 , # dEtaInSeedCut | ||
dPhiInCut = 0.19 , # dPhiInCut | ||
hOverECut_C0 = 0.05 , # hOverECut | ||
hOverECut_CE = 2.54 , | ||
hOverECut_Cr = 0.183 , | ||
relCombIsolationWithEACut_C0 = 0.203 , # relCombIsolationWithEACut | ||
relCombIsolationWithEACut_Cpt = 0.963 , | ||
absEInverseMinusPInverseCut = 0.132 , # absEInverseMinusPInverseCut | ||
# conversion veto cut needs no parameters, so not mentioned | ||
missingHitsCut = 3 # missingHitsCut | ||
) | ||
|
||
# Loose working point Barrel and Endcap | ||
idName = "cutBasedElectronID-Fall17-94X-V2-loose" | ||
WP_Loose_EB = EleWorkingPoint_V5( | ||
idName = idName , # idName | ||
full5x5_sigmaIEtaIEtaCut = 0.0112 , # full5x5_sigmaIEtaIEtaCut | ||
dEtaInSeedCut = 0.00377 , # dEtaInSeedCut | ||
dPhiInCut = 0.0884 , # dPhiInCut | ||
hOverECut_C0 = 0.05 , # hOverECut | ||
hOverECut_CE = 1.16 , | ||
hOverECut_Cr = 0.0324 , | ||
relCombIsolationWithEACut_C0 = 0.112 , # relCombIsolationWithEACut | ||
relCombIsolationWithEACut_Cpt = 0.506 , | ||
absEInverseMinusPInverseCut = 0.193 , # absEInverseMinusPInverseCut | ||
# conversion veto cut needs no parameters, so not mentioned | ||
missingHitsCut = 1 # missingHitsCut | ||
) | ||
|
||
WP_Loose_EE = EleWorkingPoint_V5( | ||
idName = idName , # idName | ||
full5x5_sigmaIEtaIEtaCut = 0.0425 , # full5x5_sigmaIEtaIEtaCut | ||
dEtaInSeedCut = 0.00674 , # dEtaInSeedCut | ||
dPhiInCut = 0.169 , # dPhiInCut | ||
hOverECut_C0 = 0.0441 , # hOverECut | ||
hOverECut_CE = 2.54 , | ||
hOverECut_Cr = 0.183 , | ||
relCombIsolationWithEACut_C0 = 0.108 , # relCombIsolationWithEACut | ||
relCombIsolationWithEACut_Cpt = 0.963 , | ||
absEInverseMinusPInverseCut = 0.111 , # absEInverseMinusPInverseCut | ||
# conversion veto cut needs no parameters, so not mentioned | ||
missingHitsCut = 1 # missingHitsCut | ||
) | ||
|
||
# Medium working point Barrel and Endcap | ||
idName = "cutBasedElectronID-Fall17-94X-V2-medium" | ||
WP_Medium_EB = EleWorkingPoint_V5( | ||
idName = idName , # idName | ||
full5x5_sigmaIEtaIEtaCut = 0.0106 , # full5x5_sigmaIEtaIEtaCut | ||
dEtaInSeedCut = 0.0032 , # dEtaInSeedCut | ||
dPhiInCut = 0.0547 , # dPhiInCut | ||
hOverECut_C0 = 0.046 , # hOverECut | ||
hOverECut_CE = 1.16 , | ||
hOverECut_Cr = 0.0324 , | ||
relCombIsolationWithEACut_C0 = 0.0478 , # relCombIsolationWithEACut | ||
relCombIsolationWithEACut_Cpt = 0.506 , | ||
absEInverseMinusPInverseCut = 0.184 , # absEInverseMinusPInverseCut | ||
# conversion veto cut needs no parameters, so not mentioned | ||
missingHitsCut = 1 # missingHitsCut | ||
) | ||
|
||
WP_Medium_EE = EleWorkingPoint_V5( | ||
idName = idName , # idName | ||
full5x5_sigmaIEtaIEtaCut = 0.0387 , # full5x5_sigmaIEtaIEtaCut | ||
dEtaInSeedCut = 0.00632 , # dEtaInSeedCut | ||
dPhiInCut = 0.0394 , # dPhiInCut | ||
hOverECut_C0 = 0.0275 , # hOverECut | ||
hOverECut_CE = 2.52 , | ||
hOverECut_Cr = 0.183 , | ||
relCombIsolationWithEACut_C0 = 0.0658 , # relCombIsolationWithEACut | ||
relCombIsolationWithEACut_Cpt = 0.963 , | ||
absEInverseMinusPInverseCut = 0.0721 , # absEInverseMinusPInverseCut | ||
# conversion veto cut needs no parameters, so not mentioned | ||
missingHitsCut = 1 # missingHitsCut | ||
) | ||
|
||
# Tight working point Barrel and Endcap | ||
idName = "cutBasedElectronID-Fall17-94X-V2-tight" | ||
WP_Tight_EB = EleWorkingPoint_V5( | ||
idName = idName , # idName | ||
full5x5_sigmaIEtaIEtaCut = 0.0104 , # full5x5_sigmaIEtaIEtaCut | ||
dEtaInSeedCut = 0.00255 , # dEtaInSeedCut | ||
dPhiInCut = 0.022 , # dPhiInCut | ||
hOverECut_C0 = 0.026 , # hOverECut | ||
hOverECut_CE = 1.15 , | ||
hOverECut_Cr = 0.0324 , | ||
relCombIsolationWithEACut_C0 = 0.0287 , # relCombIsolationWithEACut | ||
relCombIsolationWithEACut_Cpt = 0.506 , | ||
absEInverseMinusPInverseCut = 0.159 , # absEInverseMinusPInverseCut | ||
# conversion veto cut needs no parameters, so not mentioned | ||
missingHitsCut = 1 # missingHitsCut | ||
) | ||
|
||
WP_Tight_EE = EleWorkingPoint_V5( | ||
idName = idName , # idName | ||
full5x5_sigmaIEtaIEtaCut = 0.0353 , # full5x5_sigmaIEtaIEtaCut | ||
dEtaInSeedCut = 0.00501 , # dEtaInSeedCut | ||
dPhiInCut = 0.0236 , # dPhiInCut | ||
hOverECut_C0 = 0.0188 , # hOverECut | ||
hOverECut_CE = 2.06 , | ||
hOverECut_Cr = 0.183 , | ||
relCombIsolationWithEACut_C0 = 0.0445 , # relCombIsolationWithEACut | ||
relCombIsolationWithEACut_Cpt = 0.963 , | ||
absEInverseMinusPInverseCut = 0.0197 , # absEInverseMinusPInverseCut | ||
# conversion veto cut needs no parameters, so not mentioned | ||
missingHitsCut = 1 # missingHitsCut | ||
) | ||
|
||
# Second, define what effective areas to use for pile-up correction | ||
isoInputs = IsolationCutInputs_V2( | ||
# phoIsolationEffAreas | ||
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt" | ||
) | ||
|
||
|
||
# | ||
# Set up VID configuration for all cuts and working points | ||
# | ||
|
||
cutBasedElectronID_Fall17_94X_V2_veto = configureVIDCutBasedEleID_V5(WP_Veto_EB, WP_Veto_EE, isoInputs) | ||
cutBasedElectronID_Fall17_94X_V2_loose = configureVIDCutBasedEleID_V5(WP_Loose_EB, WP_Loose_EE, isoInputs) | ||
cutBasedElectronID_Fall17_94X_V2_medium = configureVIDCutBasedEleID_V5(WP_Medium_EB, WP_Medium_EE, isoInputs) | ||
cutBasedElectronID_Fall17_94X_V2_tight = configureVIDCutBasedEleID_V5(WP_Tight_EB, WP_Tight_EE, isoInputs) | ||
|
||
# The MD5 sum numbers below reflect the exact set of cut variables | ||
# and values above. If anything changes, one has to | ||
# 1) comment out the lines below about the registry and the isPOGApproved lines, | ||
# 2) run "calculateIdMD5 <this file name> <one of the VID config names just above> | ||
# 3) update the MD5 sum strings below and uncomment the lines again. | ||
# | ||
|
||
central_id_registry.register(cutBasedElectronID_Fall17_94X_V2_veto.idName, '74e217e3ece16b49bd337026a29fc3e9') | ||
central_id_registry.register(cutBasedElectronID_Fall17_94X_V2_loose.idName, '5547e2c8b5c222192519c41bff05bc2e') | ||
central_id_registry.register(cutBasedElectronID_Fall17_94X_V2_medium.idName, '48702f025a8df2c527f53927af8b66d0') | ||
central_id_registry.register(cutBasedElectronID_Fall17_94X_V2_tight.idName, 'c06761e199f084f5b0f7868ac48a3e19') | ||
|
||
### for now until we have a database... | ||
cutBasedElectronID_Fall17_94X_V2_veto.isPOGApproved = cms.untracked.bool(True) | ||
cutBasedElectronID_Fall17_94X_V2_loose.isPOGApproved = cms.untracked.bool(True) | ||
cutBasedElectronID_Fall17_94X_V2_medium.isPOGApproved = cms.untracked.bool(True) | ||
cutBasedElectronID_Fall17_94X_V2_tight.isPOGApproved = cms.untracked.bool(True) |
Oops, something went wrong.