File indexing completed on 2024-04-15 22:39:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 import sys
0015 import os
0016 import FWCore.ParameterSet.Config as cms
0017 import FWCore.ParameterSet.VarParsing as VarParsing
0018
0019 process = cms.Process("FAKE")
0020
0021 process.maxEvents = cms.untracked.PSet(
0022 input = cms.untracked.int32(-1)
0023 )
0024
0025 process.source = cms.Source("PoolSource",
0026 fileNames = cms.untracked.vstring()
0027 )
0028
0029 from EventFilter.Utilities.EvFDaqDirector_cfi import EvFDaqDirector as _EvFDaqDirector
0030 process.EvFDaqDirector = _EvFDaqDirector.clone(
0031 baseDir = "",
0032 buBaseDir = "",
0033 runNumber = 0
0034 )
0035
0036 process.writer = cms.OutputModule("RawStreamFileWriterForBU",
0037 source = cms.InputTag('rawDataCollector'),
0038 numEventsPerFile = cms.uint32(0)
0039 )
0040
0041 process.endpath = cms.EndPath(process.writer)
0042
0043 process.load('FWCore.MessageService.MessageLogger_cfi')
0044 process.MessageLogger.cerr.FwkReport.reportEvery = 0
0045
0046
0047 options = VarParsing.VarParsing ('python')
0048 for name in 'filePrepend', 'maxEvents', 'outputFile', 'secondaryOutputFile', 'section', 'tag', 'storePrepend', 'totalSections':
0049 del options._register[name]
0050 del options._beenSet[name]
0051 del options._info[name]
0052 del options._types[name]
0053 if name in options._singletons:
0054 del options._singletons[name]
0055 if name in options._lists:
0056 del options._lists[name]
0057 if name in options._noCommaSplit:
0058 del options._noCommaSplit[name]
0059 if name in options._noDefaultClear:
0060 del options._noDefaultClear[name]
0061
0062
0063 options.register('runNumber',
0064 0,
0065 VarParsing.VarParsing.multiplicity.singleton,
0066 VarParsing.VarParsing.varType.int,
0067 "Run number to use")
0068
0069 options.register('lumiNumber',
0070 None,
0071 VarParsing.VarParsing.multiplicity.singleton,
0072 VarParsing.VarParsing.varType.int,
0073 "Luminosity section number to use")
0074
0075 options.register('eventsPerLumi',
0076 11650,
0077 VarParsing.VarParsing.multiplicity.singleton,
0078 VarParsing.VarParsing.varType.int,
0079 "Number of events in the given luminosity section to process")
0080
0081 options.register('eventsPerFile',
0082 50,
0083 VarParsing.VarParsing.multiplicity.singleton,
0084 VarParsing.VarParsing.varType.int,
0085 "Split the output into files with at most this number of events")
0086
0087 options.register('rawDataCollection',
0088 'rawDataCollector',
0089 VarParsing.VarParsing.multiplicity.singleton,
0090 VarParsing.VarParsing.varType.string,
0091 "FEDRawDataCollection to be repacked into RAW format")
0092
0093 options.register('outputPath',
0094 os.getcwd(),
0095 VarParsing.VarParsing.multiplicity.singleton,
0096 VarParsing.VarParsing.varType.string,
0097 "Output directory for the FED RAW data files")
0098
0099 options.parseArguments()
0100
0101
0102 if options.runNumber <= 0:
0103 sys.stderr.write('Invalid run number\n')
0104 sys.exit(1)
0105
0106 if options.lumiNumber is not None and options.lumiNumber <= 0:
0107 sys.stderr.write('Invalid luminosity section number\n')
0108 sys.exit(1)
0109
0110 if options.eventsPerLumi == 0 or options.eventsPerLumi < -1:
0111 sys.stderr.write('Invalid number of events per luminosity section\n')
0112 sys.exit(1)
0113
0114 if options.eventsPerFile <= 0:
0115 sys.stderr.write('Invalid number of events per output file\n')
0116 sys.exit(1)
0117
0118
0119 process.source.fileNames = options.inputFiles
0120 if options.lumiNumber is not None:
0121
0122 process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange('%d:%d' % (options.runNumber, options.lumiNumber))
0123 process.maxEvents.input = options.eventsPerLumi
0124 process.EvFDaqDirector.runNumber = options.runNumber
0125 process.EvFDaqDirector.baseDir = options.outputPath
0126 process.EvFDaqDirector.buBaseDir = options.outputPath
0127 process.writer.source = options.rawDataCollection
0128 process.writer.numEventsPerFile = options.eventsPerFile
0129 process.MessageLogger.cerr.FwkReport.reportEvery = options.eventsPerFile
0130
0131
0132 outputRunPath = f'{options.outputPath}/run{options.runNumber:06d}'
0133 os.makedirs(outputRunPath, exist_ok=True)
0134 open(f'{outputRunPath}/fu.lock', 'w').close()