Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:11

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 import EventFilter.L1TXRawToDigi.util as util
0005 
0006 from FWCore.ParameterSet.VarParsing import VarParsing
0007 
0008 options = VarParsing()
0009 options.register('runNumber', 0, VarParsing.multiplicity.singleton, VarParsing.varType.int, 'Run to analyze')
0010 options.register('lumis', '1-max', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Lumis')
0011 options.register('dataStream', '/ExpressPhysics/Run2015D-Express-v3/FEVT', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Dataset to look for run in')
0012 options.register('inputFiles', [], VarParsing.multiplicity.list, VarParsing.varType.string, 'Manual file list input, will query DAS if empty')
0013 options.register('inputFileList', '', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'Manual file list input, will query DAS if empty')
0014 options.register('useORCON', False, VarParsing.multiplicity.singleton, VarParsing.varType.bool, 'Use ORCON for conditions.  This is necessary for very recent runs where conditions have not propogated to Frontier')
0015 options.parseArguments()
0016 
0017 def formatLumis(lumistring, run) :
0018     lumis = (lrange.split('-') for lrange in lumistring.split(','))
0019     runlumis = (['%d:%s' % (run,lumi) for lumi in lrange] for lrange in lumis)
0020     return ['-'.join(l) for l in runlumis]
0021 
0022 print('Getting files for run %d...' % options.runNumber)
0023 if len(options.inputFiles) is 0 and options.inputFileList is '' :
0024     inputFiles = util.getFilesForRun(options.runNumber, options.dataStream)
0025 elif len(options.inputFileList) > 0 :
0026     with open(options.inputFileList) as f :
0027         inputFiles = list((line.strip() for line in f))
0028 else :
0029     inputFiles = cms.untracked.vstring(options.inputFiles)
0030 if len(inputFiles) is 0 :
0031     raise Exception('No files found for dataset %s run %d' % (options.dataStream, options.runNumber))
0032 print('Ok, time to analyze')
0033 
0034 process = cms.Process("L1TCaloLayer1Test")
0035 
0036 process.load("FWCore.MessageService.MessageLogger_cfi")
0037 process.load('EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi')
0038 
0039 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
0040 
0041 process.source = cms.Source("PoolSource",
0042     fileNames = cms.untracked.vstring(
0043         inputFiles
0044     ),
0045 #    lumisToProcess = cms.untracked.VLuminosityBlockRange(formatLumis(options.lumis, options.runNumber))
0046 )
0047 
0048 process.out = cms.OutputModule("PoolOutputModule",
0049     fileName = cms.untracked.string('/data/dasu/l1tCaloLayer1Digis.root'),
0050     outputCommands = cms.untracked.vstring('drop *', 'keep *_*_*_L1TCaloLayer1Test')
0051 )
0052 
0053 process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff')
0054 process.GlobalTag.globaltag = '74X_dataRun2_Express_v1'
0055 
0056 process.p = cms.Path(process.l1tCaloLayer1Digis)
0057 
0058 process.e = cms.EndPath(process.out)