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

Code to process phase2 version of deepTauID v2p5 [12_5_X] #40723

Merged
Prev Previous commit
Next Next commit
Common merged collection of phase-2 electrons for tauID
mbluj committed Jan 27, 2023
commit aca14d917e8d26f34a14f3adc7ccc7eb2f810248
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import FWCore.ParameterSet.Config as cms

# Electron collection merger
mergedSlimmedElectronsForTauId = cms.EDProducer('PATElectronCollectionMerger',
src = cms.VInputTag('slimmedElectrons', 'slimmedElectronsHGC')
)
from RecoTauTag.RecoTau.mergedPhase2SlimmedElectronsForTauId_cff import mergedSlimmedElectronsForTauId

# anti-e phase-2 tauID (Raw)
from RecoTauTag.RecoTau.tauDiscriminationAgainstElectronMVA6Phase2_mvaDefs_cff import mvaNames_phase2, mapping_phase2, workingPoints_phase2
from RecoTauTag.RecoTau.TauDiscriminatorTools import noPrediscriminants
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import FWCore.ParameterSet.Config as cms

# Electron collection merger
mergedSlimmedElectronsForTauId = cms.EDProducer('PATElectronCollectionMerger',
src = cms.VInputTag('slimmedElectrons', 'slimmedElectronsHGC')
)
13 changes: 6 additions & 7 deletions RecoTauTag/RecoTau/python/tools/runTauIdMVA.py
Original file line number Diff line number Diff line change
@@ -669,19 +669,18 @@ def runTauID(self):
disable_CellIndex_workaround = True
))

self.process.slimmedElectronsMerged = cms.EDProducer("PATElectronCollectionMerger",
src = cms.VInputTag("slimmedElectrons","slimmedElectronsHGC")
)
setattr(getattr(self.process, _deepTauName+self.postfix), "electrons", cms.InputTag("slimmedElectronsMerged"))
from RecoTauTag.RecoTau.mergedPhase2SlimmedElectronsForTauId_cff import mergedSlimmedElectronsForTauId
if not hasattr(self.process,"mergedSlimmedElectronsForTauId"):
self.process.mergedSlimmedElectronsForTauId = mergedSlimmedElectronsForTauId
setattr(getattr(self.process, _deepTauName+self.postfix), "electrons", cms.InputTag("mergedSlimmedElectronsForTauId"))
setattr(getattr(self.process, _deepTauName+self.postfix), "vertices", cms.InputTag("offlineSlimmedPrimaryVertices4D"))

self.processDeepProducer(_deepTauName, tauIDSources, workingPoints_)

_deepTauProducer = getattr(self.process,_deepTauName+self.postfix)
_mergedElectrons = self.process.slimmedElectronsMerged
_rerunMvaIsolationTask.add(_mergedElectrons)
_rerunMvaIsolationTask.add(self.process.mergedSlimmedElectronsForTauId)
_rerunMvaIsolationTask.add(_deepTauProducer)
_rerunMvaIsolationSequence += _mergedElectrons
_rerunMvaIsolationSequence += self.process.mergedSlimmedElectronsForTauId
_rerunMvaIsolationSequence += _deepTauProducer

if "againstEle2018" in self.toKeep:
19 changes: 14 additions & 5 deletions RecoTauTag/RecoTau/test/runDeepTauIDsOnMiniAOD.py
Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@

from Configuration.AlCa.GlobalTag import GlobalTag
if phase2:
process.load('Configuration.Geometry.GeometryExtended2026D94Reco_cff')
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '')
inputfile = '/store/mc/Phase2HLTTDRWinter20RECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/MINIAODSIM/PU200_110X_mcRun4_realistic_v3-v3/20000/1EF484CA-52F4-F044-B0CC-D4C636C5F0B9.root'
process.load('Configuration.Geometry.GeometryExtended2026D97Reco_cff')
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T25', '')
inputfile = '/store/mc/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/MINIAODSIM/PU200Phase2D80_113X_mcRun4_realistic_T25_v1_ext1-v1/280000/04e6741c-489a-4fed-9e0c-d7703c274b5a.root'
else:
process.load('Configuration.Geometry.GeometryRecoDB_cff')
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '')
@@ -43,9 +43,14 @@
"deepTau2018v2p5",
# "DPFTau_2016_v0",
# "DPFTau_2016_v1",
#"againstEle2018",
"againstEle2018",
]
if not phase2: toKeep.append("againstEle2018")
if phase2:
toKeep = [ "newDMPhase2v1",
# "deepTau2018v2p5",
"deepTau2026v2p5",
"againstElePhase2v1",
]
tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False,
updatedTauName = updatedTauName,
toKeep = toKeep)
@@ -75,6 +80,10 @@
process.out.outputCommands.append("keep *_"+updatedTauName+"_*_*")
process.out.outputCommands.append("keep *_"+updatedTauName+postfix+"_*_*")

# Adapt to old phase2 input samples where slimmedElectronsHGC are called slimmedElectronsFromMultiCl
if phase2:
process.mergedSlimmedElectronsForTauId.src = ["slimmedElectrons","slimmedElectronsFromMultiCl"]

# Path and EndPath definitions
process.p = cms.Path(
process.rerunMvaIsolationSequence *