Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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