File indexing completed on 2024-04-06 12:09:37
0001 import os
0002 import FWCore.ParameterSet.Config as cms
0003 from FWCore.ParameterSet.VarParsing import VarParsing
0004
0005
0006 def get_root_files(path):
0007 files = os.listdir(path)
0008 root_files = [f for f in files if f.endswith(".root")]
0009 full_paths = [os.path.join(path, f) for f in root_files]
0010 urls = ['file://{0}'.format(f) for f in full_paths]
0011 return urls
0012
0013
0014 options = VarParsing('analysis')
0015 options.register(
0016 'sample',
0017 'TTJet',
0018 VarParsing.multiplicity.singleton,
0019 VarParsing.varType.string,
0020 )
0021
0022 options.setDefault('maxEvents', 2000)
0023 options.setDefault(
0024 'outputFile', 'L1TOffline_L1TStage2CaloLayer2_job1_RAW2DIGI_RECO_DQM.root')
0025
0026 options.parseArguments()
0027
0028 inputFiles = {
0029 'TTJet': get_root_files('/data/TTJet/reco'),
0030 'DoubleEG': get_root_files('/data/DoubleEG'),
0031 }
0032
0033 inputFilesRAW = {
0034 'TTJet': get_root_files('/data/TTJet/raw'),
0035 }
0036
0037
0038 from Configuration.Eras.Era_Run2_2016_cff import Run2_2016
0039 process = cms.Process('L1TStage2EmulatorDQM', Run2_2016)
0040
0041
0042 process.load('Configuration.StandardSequences.Services_cff')
0043 process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
0044 process.load('FWCore.MessageService.MessageLogger_cfi')
0045 process.load('Configuration.EventContent.EventContent_cff')
0046 process.load('SimGeneral.MixingModule.mixNoPU_cfi')
0047 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0048 process.load('Configuration.StandardSequences.MagneticField_cff')
0049 process.load('Configuration.StandardSequences.RawToDigi_cff')
0050 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0051 process.load(
0052 'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0053
0054 process.load("DQMServices.Core.DQM_cfg")
0055 process.load("DQMServices.Components.DQMEnvironment_cfi")
0056
0057 process.MessageLogger.cerr.FwkReport.reportEvery = int(options.maxEvents / 10)
0058
0059 process.maxEvents = cms.untracked.PSet(
0060 input=cms.untracked.int32(options.maxEvents)
0061 )
0062
0063
0064 process.source = cms.Source(
0065 "PoolSource",
0066 fileNames=cms.untracked.vstring(inputFiles[options.sample]),
0067 )
0068 if options.sample == 'TTJet':
0069 process.source.secondaryFileNames = cms.untracked.vstring(inputFilesRAW[
0070 'TTJet'])
0071
0072 process.options = cms.untracked.PSet(
0073
0074 )
0075
0076
0077 process.DQMoutput = cms.OutputModule(
0078 "DQMRootOutputModule",
0079 fileName=cms.untracked.string(options.outputFile)
0080 )
0081
0082
0083
0084
0085 from Configuration.AlCa.GlobalTag import GlobalTag
0086 if options.sample == 'TTJet':
0087 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')
0088 else:
0089 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')
0090
0091
0092 process.raw2digi_step = cms.Path(process.RawToDigi)
0093
0094 process.load('DQMOffline.L1Trigger.L1TEtSumJetOffline_cfi')
0095 process.load('DQMOffline.L1Trigger.L1TEGammaOffline_cfi')
0096 process.load('DQMOffline.L1Trigger.L1TTauOffline_cfi')
0097
0098 if os.environ.get('DEBUG', False):
0099 process.MessageLogger.cout.threshold = cms.untracked.string('DEBUG')
0100 process.MessageLogger.debugModules = cms.untracked.vstring(
0101 '*',
0102 )
0103
0104
0105
0106 process.l1tPFMetNoMuForDQM.pfMETCollection = 'pfMet'
0107
0108 process.dqmoffline_step = cms.Path(
0109 process.goodPFJetsForL1T *
0110 process.l1tPFMetNoMuForDQM *
0111 process.l1tEtSumJetOfflineDQMEmu +
0112 process.l1tEtSumJetOfflineDQM +
0113 process.l1tEGammaOfflineDQM +
0114 process.l1tEGammaOfflineDQMEmu +
0115 process.l1tTauOfflineDQM +
0116 process.l1tTauOfflineDQMEmu
0117 )
0118 if options.sample != 'TTJet':
0119 process.dqmoffline_step.remove(process.l1tEtSumJetOfflineDQMEmu)
0120 process.dqmoffline_step.remove(process.l1tEGammaOfflineDQMEmu)
0121 process.dqmoffline_step.remove(process.l1tTauOfflineDQMEmu)
0122
0123 process.DQMoutput_step = cms.EndPath(process.DQMoutput)
0124
0125 process.schedule = cms.Schedule(
0126 process.raw2digi_step,
0127 )
0128
0129
0130
0131
0132
0133 from L1Trigger.Configuration.customiseReEmul import L1TReEmulFromRAW
0134
0135
0136
0137
0138
0139
0140 process.schedule.append(process.dqmoffline_step)
0141 process.schedule.append(process.DQMoutput_step)