Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3 ele ID is added to the cleaned 126 nanoAOD electron module + DQM (Run3 EffArea is applied only to the EGamma supported variables) #40045

Merged
merged 11 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 55 additions & 12 deletions PhysicsTools/NanoAOD/python/electrons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
############################FOR bitmapVIDForEle main defn#############################
electron_id_modules_WorkingPoints_nanoAOD = cms.PSet(
modules = cms.vstring(
'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V1_cff',
'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V2_cff',
'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Winter22_122X_V1_cff',
'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV70_cff',
'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff',
'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff',
Expand All @@ -18,6 +18,16 @@
'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer17UL_ID_ISO_cff',
'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer18UL_ID_ISO_cff',
),
WorkingPoints = cms.vstring(
"egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-veto",
"egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-loose",
"egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-medium",
"egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-tight"
)
)

# Use Fall17-94X-V2 as default for Run 2
run2_nanoAOD_ANY.toModify(electron_id_modules_WorkingPoints_nanoAOD,
WorkingPoints = cms.vstring(
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-veto",
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-loose",
Expand All @@ -44,6 +54,16 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
)
_bitmapVIDForEle_docstring = _get_bitmapVIDForEle_docstring(electron_id_modules_WorkingPoints_nanoAOD.modules,bitmapVIDForEle.WorkingPoints)

bitmapVIDForEleFall17V2 = bitmapVIDForEle.clone(
WorkingPoints = cms.vstring(
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-veto",
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-loose",
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-medium",
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-tight",
)
)
_bitmapVIDForEleFall17V2_docstring = _get_bitmapVIDForEle_docstring(electron_id_modules_WorkingPoints_nanoAOD.modules, bitmapVIDForEleFall17V2.WorkingPoints)

bitmapVIDForEleHEEP = bitmapVIDForEle.clone(
WorkingPoints = cms.vstring("egmGsfElectronIDs:heepElectronID-HEEPV70"
)
Expand All @@ -53,6 +73,19 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
#######################ISO ELE defn(in principle should be an import####################
##PhysicsTools/NanoAOD/python/EleIsoValueMapProducer_cfi.py
isoForEle = cms.EDProducer("EleIsoValueMapProducer",
src = cms.InputTag("slimmedElectrons"),
relative = cms.bool(False),
rho_MiniIso = cms.InputTag("fixedGridRhoFastjetAll"),
rho_PFIso = cms.InputTag("fixedGridRhoFastjetAll"),
EAFile_MiniIso = cms.FileInPath("RecoEgamma/ElectronIdentification/data/Run3_Winter22/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_122X.txt"),
EAFile_PFIso = cms.FileInPath("RecoEgamma/ElectronIdentification/data/Run3_Winter22/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_122X.txt"),
)

run2_nanoAOD_ANY.toModify(isoForEle,
EAFile_MiniIso = cms.FileInPath("RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
EAFile_PFIso = cms.FileInPath("RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),)

isoForEleFall17V2 = cms.EDProducer("EleIsoValueMapProducer",
src = cms.InputTag("slimmedElectrons"),
relative = cms.bool(False),
rho_MiniIso = cms.InputTag("fixedGridRhoFastjetAll"),
Expand Down Expand Up @@ -113,11 +146,13 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
mvaIso = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17IsoV2Values"),
mvaNoIso = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17NoIsoV2Values"),
mvaHZZIso = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Summer18ULIdIsoValues"),
miniIsoChg = cms.InputTag("isoForEle:miniIsoChg"),
miniIsoAll = cms.InputTag("isoForEle:miniIsoAll"),
miniIsoChg = cms.InputTag("isoForEleFall17V2:miniIsoChg"),
miniIsoAll = cms.InputTag("isoForEleFall17V2:miniIsoAll"),
PFIsoChg = cms.InputTag("isoForEle:PFIsoChg"),
PFIsoAll = cms.InputTag("isoForEle:PFIsoAll"),
PFIsoAll04 = cms.InputTag("isoForEle:PFIsoAll04"),
PFIsoAll04 = cms.InputTag("isoForEleFall17V2:PFIsoAll04"),
PFIsoChgFall17V2 = cms.InputTag("isoForEleFall17V2:PFIsoChg"),
PFIsoAllFall17V2 = cms.InputTag("isoForEleFall17V2:PFIsoAll"),
ptRatio = cms.InputTag("ptRatioRelForEle:ptRatio"),
ptRel = cms.InputTag("ptRatioRelForEle:ptRel"),
jetNDauChargedMVASel = cms.InputTag("ptRatioRelForEle:jetNDauChargedMVASel"),
Expand Down Expand Up @@ -146,18 +181,19 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
mvaNoIso_WP80 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-noIso-V2-wp80"),
mvaNoIso_WPL = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-noIso-V2-wpLoose"),

cutbasedID_Fall17_V1_veto = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-veto"),
cutbasedID_Fall17_V1_loose = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-loose"),
cutbasedID_Fall17_V1_medium = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-medium"),
cutbasedID_Fall17_V1_tight = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-tight"),
cutbasedID_Fall17_V2_veto = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-veto"),
cutbasedID_Fall17_V2_loose = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-loose"),
cutbasedID_Fall17_V2_medium = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-medium"),
cutbasedID_Fall17_V2_tight = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-tight"),
cutbasedID_RunIIIWinter22_veto = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-veto"),
cutbasedID_RunIIIWinter22_loose = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-loose"),
cutbasedID_RunIIIWinter22_medium = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-medium"),
cutbasedID_RunIIIWinter22_tight = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-tight"),
cutbasedID_HEEP = cms.InputTag("egmGsfElectronIDs:heepElectronID-HEEPV70"),
),
userInts = cms.PSet(
VIDNestedWPBitmap = cms.InputTag("bitmapVIDForEle"),
VIDNestedWPBitmapFall17V2 = cms.InputTag("bitmapVIDForEleFall17V2"),
VIDNestedWPBitmapHEEP = cms.InputTag("bitmapVIDForEleHEEP"),
seedGain = cms.InputTag("seedGainEle"),
),
Expand Down Expand Up @@ -243,14 +279,18 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
mvaNoIso_WPL = Var("userInt('mvaNoIso_WPL')",bool,doc="MVA noIso ID V2 loose WP"),
mvaHZZIso = Var("userFloat('mvaHZZIso')", float,doc="HZZ MVA Iso ID score"),

cutBased = Var("userInt('cutbasedID_Fall17_V2_veto')+userInt('cutbasedID_Fall17_V2_loose')+userInt('cutbasedID_Fall17_V2_medium')+userInt('cutbasedID_Fall17_V2_tight')",int,doc="cut-based ID Fall17 V2 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"),
cutBased = Var("userInt('cutbasedID_RunIIIWinter22_veto')+userInt('cutbasedID_RunIIIWinter22_loose')+userInt('cutbasedID_RunIIIWinter22_medium')+userInt('cutbasedID_RunIIIWinter22_tight')",int,doc="cut-based ID RunIII Winter22 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"),
cutBasedFall17V2 = Var("userInt('cutbasedID_Fall17_V2_veto')+userInt('cutbasedID_Fall17_V2_loose')+userInt('cutbasedID_Fall17_V2_medium')+userInt('cutbasedID_Fall17_V2_tight')",int,doc="cut-based ID Fall17 V2 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"),
vidNestedWPBitmap = Var("userInt('VIDNestedWPBitmap')",int,doc=_bitmapVIDForEle_docstring),
vidNestedWPBitmapFall17V2 = Var("userInt('VIDNestedWPBitmapFall17V2')",int,doc=_bitmapVIDForEleFall17V2_docstring),
vidNestedWPBitmapHEEP = Var("userInt('VIDNestedWPBitmapHEEP')",int,doc=_bitmapVIDForEleHEEP_docstring),
cutBased_HEEP = Var("userInt('cutbasedID_HEEP')",bool,doc="cut-based HEEP ID"),
miniPFRelIso_chg = Var("userFloat('miniIsoChg')/pt",float,doc="mini PF relative isolation, charged component"),
miniPFRelIso_all = Var("userFloat('miniIsoAll')/pt",float,doc="mini PF relative isolation, total (with scaled rho*EA PU corrections)"),
pfRelIso03_chg = Var("userFloat('PFIsoChg')/pt",float,doc="PF relative isolation dR=0.3, charged component"),
pfRelIso03_all = Var("userFloat('PFIsoAll')/pt",float,doc="PF relative isolation dR=0.3, total (with rho*EA PU corrections)"),
pfRelIso03_chgFall17V2 = Var("userFloat('PFIsoChgFall17V2')/pt",float,doc="PF relative isolation dR=0.3 with 94 EffArea, charged component"),
pfRelIso03_allFall17V2 = Var("userFloat('PFIsoAllFall17V2')/pt",float,doc="PF relative isolation dR=0.3 with 94 EffArea, total (with rho*EA PU corrections)"),
jetRelIso = Var("?userCand('jetForLepJetVar').isNonnull()?(1./userFloat('ptRatio'))-1.:userFloat('PFIsoAll04')/pt",float,doc="Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet)",precision=8),
jetPtRelv2 = Var("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0",float,doc="Relative momentum of the lepton with respect to the closest jet after subtracting the lepton",precision=8),
dr03TkSumPt = Var("?pt>35?dr03TkSumPt():0",float,doc="Non-PF track isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8),
Expand Down Expand Up @@ -282,10 +322,13 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
dEscaleDown=Var("userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energyScaleDownNew')", float, doc="ecal energy scale shifted 1 sigma down (adding gain/stat/syst in quadrature)", precision=8),
dEsigmaUp=Var("userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energySigmaUpNew')", float, doc="ecal energy smearing value shifted 1 sigma up", precision=8),
dEsigmaDown=Var("userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energySigmaDownNew')", float, doc="ecal energy smearing value shifted 1 sigma up", precision=8),

cutBased = Var("userInt('cutbasedID_Fall17_V2_veto')+userInt('cutbasedID_Fall17_V2_loose')+userInt('cutbasedID_Fall17_V2_medium')+userInt('cutbasedID_Fall17_V2_tight')",int,doc="cut-based ID Fall17 V2 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"),
cutBasedFall17V2 = None,
vidNestedWPBitmapFall17V2 = None,
pfRelIso03_chgFall17V2 = None,
pfRelIso03_allFall17V2 = None
)


#############electron Table END#####################
# Depends on particlelevel producer run in particlelevel_cff
tautaggerForMatching = cms.EDProducer("GenJetTauTaggerProducer",
Expand Down Expand Up @@ -333,7 +376,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints):
genparticles = cms.InputTag("finalGenParticles"),
)

electronTask = cms.Task(bitmapVIDForEle,bitmapVIDForEleHEEP,isoForEle,ptRatioRelForEle,seedGainEle,calibratedPatElectronsNano,slimmedElectronsWithUserData,finalElectrons)
electronTask = cms.Task(bitmapVIDForEle,bitmapVIDForEleFall17V2,bitmapVIDForEleHEEP,isoForEle,isoForEleFall17V2,ptRatioRelForEle,seedGainEle,calibratedPatElectronsNano,slimmedElectronsWithUserData,finalElectrons)
electronTablesTask = cms.Task(electronMVATTH, electronTable)
electronMCTask = cms.Task(tautaggerForMatching, matchingElecPhoton, electronsMCMatchForTable, electronsMCMatchForTableAlt, electronMCTable)

Expand Down
10 changes: 10 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
plots = _boostedTauPlotsV10
)

_Electron_Run2_plots = cms.VPSet()
for plot in nanoDQM.vplots.Electron.plots:
if 'Fall17V2' not in plot.name.value():
_Electron_Run2_plots.append(plot)
run2_nanoAOD_ANY.toModify(
nanoDQM.vplots.Electron,
plots = _Electron_Run2_plots
)


## MC
nanoDQMMC = nanoDQM.clone()
nanoDQMMC.vplots.Electron.sels.Prompt = cms.string("genPartFlav == 1")
Expand Down
4 changes: 4 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
Plot1D('cleanmask', 'cleanmask', 1, 0.5, 1.5, 'simple cleaning mask with priority to leptons'),
Plot1D('convVeto', 'convVeto', 2, -0.5, 1.5, 'pass conversion veto'),
Plot1D('cutBased', 'cutBased', 5, -0.5, 4.5, 'cut-based ID (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'),
Plot1D('cutBasedFall17V2', 'cutBasedFall17V2', 5, -0.5, 4.5, 'cut-based ID Fall17 V2 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'),
Plot1D('cutBased_HEEP', 'cutBased_HEEP', 2, -0.5, 1.5, 'cut-based HEEP ID'),
Plot1D('deltaEtaSC', 'deltaEtaSC', 20, -0.2, 0.2, 'delta eta (SC,ele) with sign'),
Plot1D('dr03EcalRecHitSumEt', 'dr03EcalRecHitSumEt', 20, 0, 30, 'Non-PF Ecal isolation within a delta R cone of 0.3 with electron pt > 35 GeV'),
Expand Down Expand Up @@ -95,6 +96,8 @@
Plot1D('pdgId', 'pdgId', 27, -13.5, 13.5, 'PDG code assigned by the event reconstruction (not by MC truth)'),
Plot1D('pfRelIso03_all', 'pfRelIso03_all', 20, 0, 2, 'PF relative isolation dR=0.3, total (with rho*EA PU corrections)'),
Plot1D('pfRelIso03_chg', 'pfRelIso03_chg', 20, 0, 2, 'PF relative isolation dR=0.3, charged component'),
Plot1D('pfRelIso03_allFall17V2', 'pfRelIso03_all', 20, 0, 2, 'PF relative isolation dR=0.3 with 94 EffArea, total (with rho*EA PU corrections)'),
Plot1D('pfRelIso03_chgFall17V2', 'pfRelIso03_chg', 20, 0, 2, 'PF relative isolation dR=0.3 with 94 EffArea, charged component'),
Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
NoPlot('photonIdx'),
Plot1D('pt', 'pt', 20, 0, 200, 'pt (corrected)'),
Expand All @@ -105,6 +108,7 @@
Plot1D('sip3d', 'sip3d', 20, 0, 20, '3D impact parameter significance wrt first PV, in cm'),
Plot1D('tightCharge', 'tightCharge', 3, -0.5, 2.5, 'Tight charge criteria (0:none, 1:isGsfScPixChargeConsistent, 2:isGsfCtfScPixChargeConsistent)'),
NoPlot('vidNestedWPBitmap'),
NoPlot('vidNestedWPBitmapFall17V2'),
NoPlot('vidNestedWPBitmapHEEP'),
Plot1D('dEscaleUp', 'dEscaleUp', 100, -0.01, 0.01, '#Delta E scaleUp'),
Plot1D('dEscaleDown', 'dEscaleDown', 100, -0.01, 0.01, '#Delta E scaleDown'),
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def _add_deepFlavour(process):
'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV71_cff',
'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V1_cff',
'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V2_cff',
'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Winter22_122X_V1_cff',
'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff',
'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff',
'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V2_cff',
Expand Down
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/1204275/contributions/5064343/attachments/2529616/4353987/Electron_cutbasedID_preliminaryID.pdf
# (slides 4 to 7)
#
# The effective areas are based on 90% efficient contours
#
# |eta| min |eta| max effective area
0.000 1.000 0.1243
1.000 1.479 0.1458
1.479 2.000 0.0992
2.000 2.200 0.0794
2.200 2.300 0.0762
2.300 2.400 0.0766
2.400 2.500 0.1003
Loading