Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:10

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 import os
0004 import math
0005 
0006 
0007 options = VarParsing.VarParsing ('analysis')
0008 
0009 options.register ('runNumber',
0010                   100, # default value
0011                   VarParsing.VarParsing.multiplicity.singleton,
0012                   VarParsing.VarParsing.varType.int,          # string, int, or float
0013                   "Run Number")
0014 
0015 options.register ('eventsPerLS',
0016                   105,
0017                   VarParsing.VarParsing.multiplicity.singleton,
0018                   VarParsing.VarParsing.varType.int,          # string, int, or float
0019                   "Max LS to generate (0 to disable limit)")
0020 
0021 options.register ('fedMeanSize',
0022                   1024,
0023                   VarParsing.VarParsing.multiplicity.singleton,
0024                   VarParsing.VarParsing.varType.int,          # string, int, or float
0025                   "Mean size of generated (fake) FED raw payload")
0026 
0027 options.register ('frdFileVersion',
0028                   1,
0029                   VarParsing.VarParsing.multiplicity.singleton,
0030                   VarParsing.VarParsing.varType.int,          # string, int, or float
0031                   "Generate raw files with FRD file header with version 1 or separate JSON files with 0")
0032 
0033 
0034 
0035 options.parseArguments()
0036 
0037 process = cms.Process("RRDOUTPUT")
0038 
0039 process.maxEvents = cms.untracked.PSet(
0040     input = cms.untracked.int32(options.eventsPerLS)
0041 )
0042 
0043 process.MessageLogger = cms.Service("MessageLogger",
0044     cout = cms.untracked.PSet(threshold = cms.untracked.string( "INFO" )),
0045     destinations = cms.untracked.vstring( 'cout' )
0046 )
0047 
0048 process.source = cms.Source("EmptySource",
0049      firstRun= cms.untracked.uint32(options.runNumber),
0050      numberEventsInLuminosityBlock = cms.untracked.uint32(options.eventsPerLS),
0051      numberEventsInRun       = cms.untracked.uint32(0)
0052 )
0053 
0054 process.a = cms.EDAnalyzer("ExceptionGenerator",
0055     defaultAction = cms.untracked.int32(0),
0056     defaultQualifier = cms.untracked.int32(0))
0057 
0058 process.s = cms.EDProducer("DaqFakeReader",
0059                            meanSize = cms.untracked.uint32(options.fedMeanSize),
0060                            width = cms.untracked.uint32(int(math.ceil(options.fedMeanSize/2.))),
0061                            tcdsFEDID = cms.untracked.uint32(1024),
0062                            injectErrPpm = cms.untracked.uint32(0)
0063                            )
0064 
0065 process.out = cms.OutputModule("FRDOutputModule",
0066     source = cms.InputTag("s"),
0067     frdVersion = cms.untracked.uint32(6),
0068     frdFileVersion = cms.untracked.uint32(options.frdFileVersion),
0069 #    fileName = cms.untracked.string("frd_output.raw")
0070     )
0071 
0072 process.p = cms.Path(process.s+process.a)
0073 
0074 process.ep = cms.EndPath(process.out)