File indexing completed on 2024-04-15 22:39:33
0001
0002
0003 import FWCore.ParameterSet.Config as cms
0004
0005
0006
0007
0008
0009 updatedTauName = "slimmedTausNewID"
0010 minimalOutput = True
0011 eventsToProcess = 100
0012 nThreads = 1
0013 phase2 = False
0014
0015 useSONIC = False
0016
0017 if not useSONIC:
0018 process = cms.Process('TauID')
0019 else:
0020 from Configuration.ProcessModifiers.deepTauSonicTriton_cff import deepTauSonicTriton
0021 process = cms.Process('TauID', deepTauSonicTriton)
0022 process.load("HeterogeneousCore.SonicTriton.TritonService_cff")
0023 process.TritonService.verbose = True
0024 process.TritonService.fallback.enable = True
0025
0026 process.TritonService.fallback.useGPU = False
0027 process.load('Configuration.StandardSequences.MagneticField_cff')
0028 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0029 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0030
0031 from Configuration.AlCa.GlobalTag import GlobalTag
0032 if phase2:
0033 process.load('Configuration.Geometry.GeometryExtended2026D97Reco_cff')
0034 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T25', '')
0035 inputfile = '/store/mc/Phase2Spring21DRMiniAOD/TTbar_TuneCP5_14TeV-pythia8/MINIAODSIM/PU200Phase2D80_113X_mcRun4_realistic_T25_v1_ext1-v1/280000/04e6741c-489a-4fed-9e0c-d7703c274b5a.root'
0036 else:
0037 process.load('Configuration.Geometry.GeometryRecoDB_cff')
0038 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2018_realistic', '')
0039 inputfile = '/store/mc/RunIISummer20UL18MiniAOD/TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/106X_upgrade2018_realistic_v11_L1v1-v2/00000/009636D7-07B2-DB49-882D-C251FD62CCE7.root'
0040
0041
0042 process.source = cms.Source('PoolSource', fileNames = cms.untracked.vstring(
0043
0044 inputfile
0045 ))
0046
0047 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(eventsToProcess) )
0048
0049
0050 import RecoTauTag.RecoTau.tools.runTauIdMVA as tauIdConfig
0051 toKeep = [ "mvaIso", "mvaIsoDR0p3", "mvaIsoNewDM",
0052
0053 "deepTau2017v2p1",
0054 "deepTau2018v2p5",
0055
0056
0057 "againstEle",
0058 ]
0059 if phase2:
0060 toKeep = [ "newDMPhase2v1",
0061
0062 "deepTau2026v2p5",
0063 "againstElePhase2v1",
0064 ]
0065 tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False,
0066 updatedTauName = updatedTauName,
0067 toKeep = toKeep)
0068 tauIdEmbedder.runTauID()
0069
0070 postfix = "Ver2"
0071 tauIdEmbedder2 = tauIdConfig.TauIDEmbedder(process, debug = False,
0072 originalTauName = "slimmedTaus",
0073 updatedTauName = updatedTauName+postfix,
0074 postfix = postfix,
0075 toKeep = toKeep)
0076 tauIdEmbedder2.runTauID()
0077
0078
0079 process.out = cms.OutputModule("PoolOutputModule",
0080 fileName = cms.untracked.string('patTuple_newTauIDs.root'),
0081 compressionAlgorithm = cms.untracked.string('LZMA'),
0082 compressionLevel = cms.untracked.int32(4),
0083 outputCommands = cms.untracked.vstring('drop *')
0084 )
0085 if not minimalOutput:
0086 print("Store full MiniAOD EventContent")
0087 from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent
0088 from PhysicsTools.PatAlgos.slimming.MicroEventContent_cff import MiniAODOverrideBranchesSplitLevel
0089 process.out.outputCommands = MINIAODSIMEventContent.outputCommands
0090 process.out.overrideBranchesSplitLevel = MiniAODOverrideBranchesSplitLevel
0091 process.out.outputCommands.append("keep *_"+updatedTauName+"_*_*")
0092 process.out.outputCommands.append("keep *_"+updatedTauName+postfix+"_*_*")
0093
0094
0095 if phase2:
0096 process.mergedSlimmedElectronsForTauId.src = ["slimmedElectrons","slimmedElectronsFromMultiCl"]
0097
0098
0099 process.p = cms.Path(
0100 process.rerunMvaIsolationSequence *
0101 getattr(process,updatedTauName)
0102 * getattr(process,"rerunMvaIsolationSequence"+postfix) *
0103 getattr(process,updatedTauName+postfix)
0104 )
0105 process.endjob = cms.EndPath(process.endOfProcess)
0106 process.outpath = cms.EndPath(process.out)
0107
0108 process.schedule = cms.Schedule(process.p,process.endjob,process.outpath)
0109
0110
0111 process.load('FWCore.MessageLogger.MessageLogger_cfi')
0112 if process.maxEvents.input.value()>10:
0113 process.MessageLogger.cerr.FwkReport.reportEvery = process.maxEvents.input.value()//10
0114 if process.maxEvents.input.value()>10000 or process.maxEvents.input.value()<0:
0115 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
0116
0117 process.options = cms.untracked.PSet(
0118 wantSummary = cms.untracked.bool(False),
0119 numberOfThreads = cms.untracked.uint32(nThreads),
0120 numberOfStreams = cms.untracked.uint32(0)
0121 )