File indexing completed on 2023-08-06 22:43:24
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 process.EvFDaqDirector = cms.Service( "EvFDaqDirector",
0030 runNumber = cms.untracked.uint32( 0 ),
0031 baseDir = cms.untracked.string( "" ),
0032 buBaseDir = cms.untracked.string( "" ),
0033 useFileBroker = cms.untracked.bool( False ),
0034 fileBrokerKeepAlive = cms.untracked.bool( True ),
0035 fileBrokerPort = cms.untracked.string( "8080" ),
0036 fileBrokerUseLocalLock = cms.untracked.bool( True ),
0037 fuLockPollInterval = cms.untracked.uint32( 2000 ),
0038 requireTransfersPSet = cms.untracked.bool( False ),
0039 selectedTransferMode = cms.untracked.string( "" ),
0040 mergingPset = cms.untracked.string( "" ),
0041 outputAdler32Recheck = cms.untracked.bool( False ),
0042 )
0043
0044 process.writer = cms.OutputModule("RawStreamFileWriterForBU",
0045 source = cms.InputTag('rawDataCollector'),
0046 numEventsPerFile = cms.uint32(0)
0047 )
0048
0049 process.endpath = cms.EndPath(process.writer)
0050
0051 process.load('FWCore.MessageService.MessageLogger_cfi')
0052 process.MessageLogger.cerr.FwkReport.reportEvery = 0
0053
0054
0055 options = VarParsing.VarParsing ('python')
0056 for name in 'filePrepend', 'maxEvents', 'outputFile', 'secondaryOutputFile', 'section', 'tag', 'storePrepend', 'totalSections':
0057 del options._register[name]
0058 del options._beenSet[name]
0059 del options._info[name]
0060 del options._types[name]
0061 if name in options._singletons:
0062 del options._singletons[name]
0063 if name in options._lists:
0064 del options._lists[name]
0065 if name in options._noCommaSplit:
0066 del options._noCommaSplit[name]
0067 if name in options._noDefaultClear:
0068 del options._noDefaultClear[name]
0069
0070
0071 options.register('runNumber',
0072 0,
0073 VarParsing.VarParsing.multiplicity.singleton,
0074 VarParsing.VarParsing.varType.int,
0075 "Run number to use")
0076
0077 options.register('lumiNumber',
0078 None,
0079 VarParsing.VarParsing.multiplicity.singleton,
0080 VarParsing.VarParsing.varType.int,
0081 "Luminosity section number to use")
0082
0083 options.register('eventsPerLumi',
0084 11650,
0085 VarParsing.VarParsing.multiplicity.singleton,
0086 VarParsing.VarParsing.varType.int,
0087 "Number of events in the given luminosity section to process")
0088
0089 options.register('eventsPerFile',
0090 50,
0091 VarParsing.VarParsing.multiplicity.singleton,
0092 VarParsing.VarParsing.varType.int,
0093 "Split the output into files with at most this number of events")
0094
0095 options.register('rawDataCollection',
0096 'rawDataCollector',
0097 VarParsing.VarParsing.multiplicity.singleton,
0098 VarParsing.VarParsing.varType.string,
0099 "FEDRawDataCollection to be repacked into RAW format")
0100
0101 options.register('outputPath',
0102 os.getcwd(),
0103 VarParsing.VarParsing.multiplicity.singleton,
0104 VarParsing.VarParsing.varType.string,
0105 "Output directory for the FED RAW data files")
0106
0107 options.parseArguments()
0108
0109
0110 if options.runNumber <= 0:
0111 sys.stderr.write('Invalid run number\n')
0112 sys.exit(1)
0113
0114 if options.lumiNumber is not None and options.lumiNumber <= 0:
0115 sys.stderr.write('Invalid luminosity section number\n')
0116 sys.exit(1)
0117
0118 if options.eventsPerLumi == 0 or options.eventsPerLumi < -1:
0119 sys.stderr.write('Invalid number of events per luminosity section\n')
0120 sys.exit(1)
0121
0122 if options.eventsPerFile <= 0:
0123 sys.stderr.write('Invalid number of events per output file\n')
0124 sys.exit(1)
0125
0126
0127 process.source.fileNames = options.inputFiles
0128 if options.lumiNumber is not None:
0129
0130 process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange('%d:%d' % (options.runNumber, options.lumiNumber))
0131 process.maxEvents.input = options.eventsPerLumi
0132 process.EvFDaqDirector.runNumber = options.runNumber
0133 process.EvFDaqDirector.baseDir = options.outputPath
0134 process.EvFDaqDirector.buBaseDir = options.outputPath
0135 process.writer.source = options.rawDataCollection
0136 process.writer.numEventsPerFile = options.eventsPerFile
0137 process.MessageLogger.cerr.FwkReport.reportEvery = options.eventsPerFile
0138
0139
0140 outputRunPath = f'{options.outputPath}/run{options.runNumber:06d}'
0141 os.makedirs(outputRunPath, exist_ok=True)
0142 open(f'{outputRunPath}/fu.lock', 'w').close()