Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:41

0001 import FWCore.ParameterSet.Config as cms
0002 from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask
0003 
0004 from FWCore.ParameterSet.VarParsing import VarParsing
0005 options = VarParsing('analysis')
0006 options.inputFiles = '/store/mc/RunIIFall17MiniAODv2/TTToHadronic_TuneCP5_13TeV-powheg-pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/90000/DCFE3F5F-AE42-E811-B6DB-008CFAF72A64.root'
0007 options.maxEvents = 1000
0008 options.parseArguments()
0009 
0010 process = cms.Process("PATtest")
0011 
0012 ## MessageLogger
0013 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0014 process.MessageLogger.cerr.FwkReport.reportEvery = 100
0015 
0016 
0017 ## Options and Output Report
0018 process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
0019 
0020 ## Source
0021 process.source = cms.Source("PoolSource",
0022     fileNames=cms.untracked.vstring(options.inputFiles)
0023 )
0024 ## Maximal Number of Events
0025 process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(options.maxEvents))
0026 
0027 ## Geometry and Detector Conditions (needed for a few patTuple production steps)
0028 process.load("Configuration.Geometry.GeometryRecoDB_cff")
0029 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0030 from Configuration.AlCa.GlobalTag import GlobalTag
0031 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2017_realistic')
0032 process.load("Configuration.StandardSequences.MagneticField_cff")
0033 
0034 ## Output Module Configuration (expects a path 'p')
0035 from PhysicsTools.PatAlgos.patEventContent_cff import patEventContentNoCleaning
0036 process.out = cms.OutputModule("PoolOutputModule",
0037                                fileName = cms.untracked.string('patTuple.root'),
0038                                ## save only events passing the full path
0039                                #SelectEvents = cms.untracked.PSet( SelectEvents = cms.vstring('p') ),
0040                                ## save PAT output; you need a '*' to unpack the list of commands
0041                                ## 'patEventContent'
0042                                outputCommands = cms.untracked.vstring('drop *', *patEventContentNoCleaning )
0043                                )
0044 
0045 patAlgosToolsTask = getPatAlgosToolsTask(process)
0046 process.outpath = cms.EndPath(process.out, patAlgosToolsTask)
0047 
0048 ## and add them to the event content
0049 from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection
0050 from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsAll as pfParticleNetJetTagsAll
0051 
0052 updateJetCollection(
0053    process,
0054    jetSource = cms.InputTag('slimmedJetsAK8'),
0055    pvSource = cms.InputTag('offlineSlimmedPrimaryVertices'),
0056    svSource = cms.InputTag('slimmedSecondaryVertices'),
0057    rParam = 0.8,
0058    jetCorrections = ('AK8PFPuppi', cms.vstring(['L2Relative', 'L3Absolute']), 'None'),
0059    btagDiscriminators = pfParticleNetJetTagsAll
0060    )
0061 
0062 from Configuration.EventContent.EventContent_cff import MINIAODSIMEventContent
0063 process.out.outputCommands.append('keep *_slimmedJetsAK8*_*_*')
0064 process.out.outputCommands.append('keep *_offlineSlimmedPrimaryVertices*_*_*')
0065 process.out.outputCommands.append('keep *_slimmedSecondaryVertices*_*_*')
0066 process.out.outputCommands.append('keep *_selectedPatJets*_*_*')
0067 process.out.outputCommands.append('keep *_selectedUpdatedPatJets*_*_*')
0068 process.out.outputCommands.append('keep *_updatedPatJets*_*_*')
0069 
0070 process.out.fileName = 'test_particle_net_MINIAODSIM.root'