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 '125X_dataRun3_relval_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/relval/CMSSW_12_6_0_pre5/SingleMuon/FEVTDEBUGHLT/125X_dataRun3_HLT_relval_v3_RelVal_2022C-v2/2590000//053845fa-aa05-48a3-8bc0-c833cfdd3e53.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_ZMuSkim.root',
0031 VarParsing.VarParsing.multiplicity.singleton,
0032 VarParsing.VarParsing.varType.string,
0033 "Folder and name ame for output ntuple")
0034
0035 options.register('runOnMC',
0036 False,
0037 VarParsing.VarParsing.multiplicity.singleton,
0038 VarParsing.VarParsing.varType.bool,
0039 "Apply customizations to run on MC")
0040
0041 options.parseArguments()
0042
0043 process = cms.Process("MUNTUPLES",eras.Run3)
0044
0045 process.load('FWCore.MessageService.MessageLogger_cfi')
0046
0047 process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True),
0048 numberOfThreads = cms.untracked.uint32(4))
0049 process.MessageLogger.cerr.FwkReport.reportEvery = 100
0050 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(options.nEvents))
0051
0052 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0053 process.GlobalTag.globaltag = cms.string(options.globalTag)
0054
0055 process.source = cms.Source("PoolSource",
0056 fileNames = cms.untracked.vstring(options.inputFile),
0057 secondaryFileNames = cms.untracked.vstring()
0058 )
0059
0060 process.load('Configuration/StandardSequences/GeometryRecoDB_cff')
0061 process.load("Configuration.StandardSequences.MagneticField_cff")
0062
0063 process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi")
0064 process.load('TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAny_cfi')
0065 process.load('TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAlong_cfi')
0066 process.load('TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorOpposite_cfi')
0067
0068 process.load('Configuration.StandardSequences.RawToDigi_Data_cff')
0069 process.load('DPGAnalysis.MuonTools.muNtupleProducer_cff')
0070
0071 import EventFilter.RPCRawToDigi.rpcUnpacker_cfi
0072 process.muonRPCDigis = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone()
0073
0074 process.nanoMuDPGPath = cms.Path(process.muonDTDigis
0075 + process.muonRPCDigis
0076 + process.muonGEMDigis
0077 + process.twinMuxStage2Digis
0078 + process.bmtfDigis
0079 + process.muNtupleProducer)
0080
0081 process.load("PhysicsTools.NanoAOD.NanoAODEDMEventContent_cff")
0082
0083 process.out = cms.OutputModule("NanoAODOutputModule",
0084 fileName = cms.untracked.string(options.ntupleName),
0085 outputCommands = process.NANOAODEventContent.outputCommands \
0086 + ["keep nanoaodFlatTable_*_*_*",
0087 "drop edmTriggerResults_*_*_*"],
0088 SelectEvents = cms.untracked.PSet(
0089 SelectEvents=cms.vstring("nanoMuDPGPath")
0090 )
0091 )
0092
0093 process.end = cms.EndPath(process.out)
0094
0095 process.schedule = cms.Schedule(process.nanoMuDPGPath, process.end)
0096
0097 if options.runOnMC :
0098 from DPGAnalysis.MuonTools.customiseMuNtuples_cff import customiseForRunningOnMC
0099 customiseForRunningOnMC(process,"p")