File indexing completed on 2024-04-06 12:06:32
0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 from Configuration.StandardSequences.Eras import eras
0004 from Configuration.AlCa.GlobalTag import GlobalTag
0005
0006 import subprocess
0007 import sys
0008
0009 options = VarParsing.VarParsing()
0010
0011 options.register('globalTag',
0012 '124X_dataRun3_Prompt_v4',
0013 VarParsing.VarParsing.multiplicity.singleton,
0014 VarParsing.VarParsing.varType.string,
0015 "Global Tag")
0016
0017 options.register('nEvents',
0018 1000,
0019 VarParsing.VarParsing.multiplicity.singleton,
0020 VarParsing.VarParsing.varType.int,
0021 "Maximum number of processed events")
0022
0023 options.register('inputFile',
0024 '/store/data/Run2022E/ZeroBias/RAW/v1/000/359/751/00000/6ee95dd0-8fb4-4693-90b9-f7a3fbd2fdeb.root',
0025 VarParsing.VarParsing.multiplicity.singleton,
0026 VarParsing.VarParsing.varType.string,
0027 "EOS folder with input files")
0028
0029 options.register('ntupleName',
0030 './MuDPGNtuple_nanoAOD_ZeroBias.root',
0031 VarParsing.VarParsing.multiplicity.singleton,
0032 VarParsing.VarParsing.varType.string,
0033 "Folder and name ame for output ntuple")
0034
0035 options.parseArguments()
0036
0037 process = cms.Process("MUNTUPLES",eras.Run3)
0038
0039 process.load('FWCore.MessageService.MessageLogger_cfi')
0040
0041 process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True),
0042 numberOfThreads = cms.untracked.uint32(4))
0043 process.MessageLogger.cerr.FwkReport.reportEvery = 100
0044 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(options.nEvents))
0045
0046 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0047 process.GlobalTag.globaltag = cms.string(options.globalTag)
0048
0049 process.source = cms.Source("PoolSource",
0050 fileNames = cms.untracked.vstring(options.inputFile),
0051 secondaryFileNames = cms.untracked.vstring()
0052 )
0053
0054 process.load('Configuration/StandardSequences/GeometryRecoDB_cff')
0055 process.load("Configuration.StandardSequences.MagneticField_cff")
0056
0057 process.load('Configuration.StandardSequences.RawToDigi_Data_cff')
0058 process.load('RecoLocalMuon.Configuration.RecoLocalMuon_cff')
0059
0060 process.load('DPGAnalysis.MuonTools.muNtupleProducerRaw_cff')
0061
0062 import EventFilter.RPCRawToDigi.rpcUnpacker_cfi
0063 process.muonRPCDigis = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone()
0064
0065 process.nanoMuDPGPath = cms.Path(process.muonDTDigis
0066 + process.muonCSCDigis
0067 + process.muonRPCDigis
0068 + process.muonGEMDigis
0069 + process.rpcRecHits
0070 + process.gemRecHits
0071 + process.muNtupleProducerRaw)
0072
0073 process.load("PhysicsTools.NanoAOD.NanoAODEDMEventContent_cff")
0074
0075 process.out = cms.OutputModule("NanoAODOutputModule",
0076 fileName = cms.untracked.string(options.ntupleName),
0077 outputCommands = process.NANOAODEventContent.outputCommands \
0078 + ["keep nanoaodFlatTable_*_*_*",
0079 "drop edmTriggerResults_*_*_*"],
0080 SelectEvents = cms.untracked.PSet(
0081 SelectEvents=cms.vstring("nanoMuDPGPath")
0082 )
0083 )
0084
0085 process.end = cms.EndPath(process.out)
0086
0087 process.schedule = cms.Schedule(process.nanoMuDPGPath, process.end)