16 import FWCore.ParameterSet.Config
as cms
17 import FWCore.ParameterSet.VarParsing
as VarParsing
19 process = cms.Process(
"FAKE")
21 process.maxEvents = cms.untracked.PSet(
22 input = cms.untracked.int32(-1)
25 process.source = cms.Source(
"PoolSource",
26 fileNames = cms.untracked.vstring()
29 from EventFilter.Utilities.EvFDaqDirector_cfi
import EvFDaqDirector
as _EvFDaqDirector
30 process.EvFDaqDirector = _EvFDaqDirector.clone(
36 process.writer = cms.OutputModule(
"RawStreamFileWriterForBU",
37 source = cms.InputTag(
'rawDataCollector'),
38 numEventsPerFile = cms.uint32(0)
41 process.endpath = cms.EndPath(process.writer)
43 process.load(
'FWCore.MessageService.MessageLogger_cfi')
44 process.MessageLogger.cerr.FwkReport.reportEvery = 0
48 for name
in 'filePrepend',
'maxEvents',
'outputFile',
'secondaryOutputFile',
'section',
'tag',
'storePrepend',
'totalSections':
49 del options._register[name]
50 del options._beenSet[name]
51 del options._info[name]
52 del options._types[name]
53 if name
in options._singletons:
54 del options._singletons[name]
55 if name
in options._lists:
56 del options._lists[name]
57 if name
in options._noCommaSplit:
58 del options._noCommaSplit[name]
59 if name
in options._noDefaultClear:
60 del options._noDefaultClear[name]
63 options.register(
'runNumber',
65 VarParsing.VarParsing.multiplicity.singleton,
66 VarParsing.VarParsing.varType.int,
69 options.register(
'lumiNumber',
71 VarParsing.VarParsing.multiplicity.singleton,
72 VarParsing.VarParsing.varType.int,
73 "Luminosity section number to use")
75 options.register(
'eventsPerLumi',
77 VarParsing.VarParsing.multiplicity.singleton,
78 VarParsing.VarParsing.varType.int,
79 "Number of events in the given luminosity section to process")
81 options.register(
'eventsPerFile',
83 VarParsing.VarParsing.multiplicity.singleton,
84 VarParsing.VarParsing.varType.int,
85 "Split the output into files with at most this number of events")
87 options.register(
'rawDataCollection',
89 VarParsing.VarParsing.multiplicity.singleton,
90 VarParsing.VarParsing.varType.string,
91 "FEDRawDataCollection to be repacked into RAW format")
93 options.register(
'outputPath',
95 VarParsing.VarParsing.multiplicity.singleton,
96 VarParsing.VarParsing.varType.string,
97 "Output directory for the FED RAW data files")
99 options.parseArguments()
102 if options.runNumber <= 0:
103 sys.stderr.write(
'Invalid run number\n')
106 if options.lumiNumber
is not None and options.lumiNumber <= 0:
107 sys.stderr.write(
'Invalid luminosity section number\n')
110 if options.eventsPerLumi == 0
or options.eventsPerLumi < -1:
111 sys.stderr.write(
'Invalid number of events per luminosity section\n')
114 if options.eventsPerFile <= 0:
115 sys.stderr.write(
'Invalid number of events per output file\n')
119 process.source.fileNames = options.inputFiles
120 if options.lumiNumber
is not None:
122 process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange(
'%d:%d' % (options.runNumber, options.lumiNumber))
123 process.maxEvents.input = options.eventsPerLumi
124 process.EvFDaqDirector.runNumber = options.runNumber
125 process.EvFDaqDirector.baseDir = options.outputPath
126 process.EvFDaqDirector.buBaseDir = options.outputPath
127 process.writer.source = options.rawDataCollection
128 process.writer.numEventsPerFile = options.eventsPerFile
129 process.MessageLogger.cerr.FwkReport.reportEvery = options.eventsPerFile
132 outputRunPath = f
'{options.outputPath}/run{options.runNumber:06d}' 133 os.makedirs(outputRunPath, exist_ok=
True)
134 open(f
'{outputRunPath}/fu.lock',
'w').close()