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 #Instructions:
0007 #     before running this script make sure that you have access to %fffBaseDir%/ramdisk and %fffBaseDir%/data
0008 #     these parameters can also be changed in startFU.py and startBU.py scripts
0009 #user = os.environ['USER']
0010 
0011 options = VarParsing.VarParsing ('analysis')
0012 
0013 options.register ('runNumber',
0014                   100, # default value
0015                   VarParsing.VarParsing.multiplicity.singleton,
0016                   VarParsing.VarParsing.varType.int,          # string, int, or float
0017                   "Run Number")
0018 
0019 options.register ('buBaseDir',
0020                   'ramdisk/', # default value
0021                   VarParsing.VarParsing.multiplicity.singleton,
0022                   VarParsing.VarParsing.varType.string,          # string, int, or float
0023                   "BU base directory")
0024 
0025 options.register ('fffBaseDir',
0026                   '.', # default value
0027                   VarParsing.VarParsing.multiplicity.singleton,
0028                   VarParsing.VarParsing.varType.string,          # string, int, or float
0029                   "FFF base directory")
0030 
0031 options.register ('maxLS',
0032                   0,
0033                   VarParsing.VarParsing.multiplicity.singleton,
0034                   VarParsing.VarParsing.varType.int,          # string, int, or float
0035                   "Max LS to generate (0 to disable limit)")
0036 
0037 options.register ('eventsPerLS',
0038                   105,
0039                   VarParsing.VarParsing.multiplicity.singleton,
0040                   VarParsing.VarParsing.varType.int,          # string, int, or float
0041                   "Max LS to generate (0 to disable limit)")
0042 
0043 options.register ('eventsPerFile',
0044                   20,
0045                   VarParsing.VarParsing.multiplicity.singleton,
0046                   VarParsing.VarParsing.varType.int,          # string, int, or float
0047                   "Number of events per raw file")
0048 
0049 options.register ('fedMeanSize',
0050                   1024,
0051                   VarParsing.VarParsing.multiplicity.singleton,
0052                   VarParsing.VarParsing.varType.int,          # string, int, or float
0053                   "Mean size of generated (fake) FED raw payload")
0054 
0055 options.register ('frdFileVersion',
0056                   0,
0057                   VarParsing.VarParsing.multiplicity.singleton,
0058                   VarParsing.VarParsing.varType.int,          # string, int, or float
0059                   "Generate raw files with FRD file header with version 1 or separate JSON files with 0")
0060 
0061 
0062 
0063 options.parseArguments()
0064 
0065 #try to create 'ramdisk' directory
0066 try:
0067     os.makedirs(options.fffBaseDir+"/"+options.buBaseDir)
0068 except:pass
0069 
0070 
0071 cmsswbase = os.path.expandvars("$CMSSW_BASE/")
0072 
0073 process = cms.Process("FAKEBU")
0074 if options.maxLS==0:
0075   process.maxEvents = cms.untracked.PSet(
0076       input = cms.untracked.int32(-1)
0077   )
0078 else:
0079   process.maxEvents = cms.untracked.PSet(
0080       input = cms.untracked.int32(options.eventsPerLS * options.maxLS)
0081   )
0082 
0083 process.options = cms.untracked.PSet(
0084 )
0085 
0086 process.MessageLogger = cms.Service("MessageLogger",
0087                                     destinations = cms.untracked.vstring( 'cout' ),
0088                                     cout = cms.untracked.PSet( FwkReport =
0089                                                                cms.untracked.PSet(reportEvery = cms.untracked.int32(1000),
0090                                                                                   optionalPSet = cms.untracked.bool(True),
0091                                                                                   limit = cms.untracked.int32(10000000)
0092                                                                                   ),
0093                                                                threshold = cms.untracked.string( "INFO" )
0094                                                                )
0095                                     )
0096 
0097 process.source = cms.Source("EmptySource",
0098      firstRun= cms.untracked.uint32(options.runNumber),
0099      numberEventsInLuminosityBlock = cms.untracked.uint32(options.eventsPerLS),
0100      numberEventsInRun       = cms.untracked.uint32(0)
0101 )
0102 
0103 process.EvFDaqDirector = cms.Service("EvFDaqDirector",
0104     runNumber = cms.untracked.uint32(options.runNumber),
0105     baseDir = cms.untracked.string(options.fffBaseDir+"/"+options.buBaseDir),
0106     buBaseDir = cms.untracked.string(options.fffBaseDir+"/"+options.buBaseDir),
0107     directorIsBU = cms.untracked.bool(True),
0108     useFileBroker = cms.untracked.bool(False),
0109     fileBrokerHost = cms.untracked.string("")
0110 )
0111 
0112 #throttle when running with no limit
0113 if options.maxLS==0:
0114     process.EvFBuildingThrottle = cms.Service("EvFBuildingThrottle",
0115         highWaterMark = cms.untracked.double(0.80),
0116         lowWaterMark = cms.untracked.double(0.75),
0117         sleepmSecs  = cms.untracked.uint32(500))
0118 
0119 process.a = cms.EDAnalyzer("ExceptionGenerator",
0120     defaultAction = cms.untracked.int32(0),
0121     defaultQualifier = cms.untracked.int32(0))
0122 
0123 process.s = cms.EDProducer("DaqFakeReader",
0124                            fillRandom = cms.untracked.bool(True),
0125                            meanSize = cms.untracked.uint32(options.fedMeanSize),
0126                            width = cms.untracked.uint32(int(math.ceil(options.fedMeanSize/2.))),
0127                            tcdsFEDID = cms.untracked.uint32(1024),
0128                            injectErrPpm = cms.untracked.uint32(0)
0129                            )
0130 
0131 process.out = cms.OutputModule("RawStreamFileWriterForBU",
0132     source = cms.InputTag("s"),
0133     numEventsPerFile = cms.uint32(options.eventsPerFile),
0134     frdVersion = cms.uint32(6),
0135     frdFileVersion = cms.uint32(options.frdFileVersion)
0136     )
0137 
0138 process.p = cms.Path(process.s+process.a)
0139 
0140 process.ep = cms.EndPath(process.out)