Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-05 05:20:44

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/Run3Summer23BPixMiniAODv4/TTtoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/MINIAODSIM/130X_mcRun3_2023_realistic_postBPix_v2-v3/2520000/00488681-4f49-4bdc-89e6-198da9e42a17.root'
0007 options.maxEvents = 10
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 = 1
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_2023_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.pfGlobalParticleTransformerAK8_cff import _pfGlobalParticleTransformerAK8JetTagsProbs as pfGlobalParticleTransformerAK8JetTagsProbs
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 = pfGlobalParticleTransformerAK8JetTagsProbs
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_globalpart_MINIAODSIM_noragged.root'