File indexing completed on 2024-05-31 04:19:32
0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 import os
0005
0006 options = VarParsing.VarParsing ('analysis')
0007
0008 options.register ('runNumber',
0009 100101,
0010 VarParsing.VarParsing.multiplicity.singleton,
0011 VarParsing.VarParsing.varType.int,
0012 "Run Number")
0013
0014 options.register ('buBaseDir',
0015 'ramdisk',
0016 VarParsing.VarParsing.multiplicity.singleton,
0017 VarParsing.VarParsing.varType.string,
0018 "BU base directory")
0019
0020 options.register ('fuBaseDir',
0021 'data',
0022 VarParsing.VarParsing.multiplicity.singleton,
0023 VarParsing.VarParsing.varType.string,
0024 "BU base directory")
0025
0026 options.register ('fffBaseDir',
0027 '.',
0028 VarParsing.VarParsing.multiplicity.singleton,
0029 VarParsing.VarParsing.varType.string,
0030 "FFF base directory")
0031
0032 options.register ('numThreads',
0033 3,
0034 VarParsing.VarParsing.multiplicity.singleton,
0035 VarParsing.VarParsing.varType.int,
0036 "Number of CMSSW threads")
0037
0038 options.register ('numFwkStreams',
0039 2,
0040 VarParsing.VarParsing.multiplicity.singleton,
0041 VarParsing.VarParsing.varType.int,
0042 "Number of CMSSW streams")
0043
0044 options.register ('numEventsToWrite',
0045 -1,
0046 VarParsing.VarParsing.multiplicity.singleton,
0047 VarParsing.VarParsing.varType.int,
0048 "Number of Events to process. -1 means all.")
0049
0050
0051 options.parseArguments()
0052
0053 cmsswbase = os.path.expandvars("$CMSSW_BASE/")
0054
0055 process = cms.Process("TESTFU")
0056 process.maxEvents = cms.untracked.PSet(
0057 input = cms.untracked.int32(options.numEventsToWrite)
0058 )
0059 if options.numEventsToWrite == 0:
0060 process.maxEvents.input = 1
0061
0062 process.options = cms.untracked.PSet(
0063 numberOfThreads = cms.untracked.uint32(options.numThreads),
0064 numberOfStreams = cms.untracked.uint32(options.numFwkStreams),
0065 numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(2)
0066 )
0067 process.MessageLogger = cms.Service("MessageLogger",
0068 cout = cms.untracked.PSet(threshold = cms.untracked.string( "ERROR" )),
0069 destinations = cms.untracked.vstring( 'cout' )
0070 )
0071
0072 process.FastMonitoringService = cms.Service("FastMonitoringService",
0073 sleepTime = cms.untracked.int32(1)
0074 )
0075
0076 process.EvFDaqDirector = cms.Service("EvFDaqDirector",
0077 useFileBroker = cms.untracked.bool(False),
0078 fileBrokerHostFromCfg = cms.untracked.bool(True),
0079 fileBrokerHost = cms.untracked.string("htcp40.cern.ch"),
0080 runNumber = cms.untracked.uint32(options.runNumber),
0081 baseDir = cms.untracked.string(options.fffBaseDir+"/"+options.fuBaseDir),
0082 buBaseDir = cms.untracked.string(options.fffBaseDir+"/"+options.buBaseDir),
0083 directorIsBU = cms.untracked.bool(False),
0084 )
0085
0086 try:
0087 os.makedirs(options.fffBaseDir+"/"+options.fuBaseDir+"/run"+str(options.runNumber).zfill(6))
0088 except Exception as ex:
0089 print(str(ex))
0090 pass
0091
0092 ram_dir_path=options.buBaseDir+"/run"+str(options.runNumber).zfill(6)+"/"
0093
0094 process.source = cms.Source("FedRawDataInputSource",
0095 getLSFromFilename = cms.untracked.bool(True),
0096 verifyChecksum = cms.untracked.bool(True),
0097 useL1EventID = cms.untracked.bool(False),
0098 eventChunkSize = cms.untracked.uint32(8),
0099 eventChunkBlock = cms.untracked.uint32(8),
0100 numBuffers = cms.untracked.uint32(2),
0101 maxBufferedFiles = cms.untracked.uint32(2),
0102 fileListMode = cms.untracked.bool(True),
0103 fileNames = cms.untracked.vstring(
0104 ram_dir_path+"run100101_ls0001_index000000.raw",
0105 ram_dir_path+"run100101_ls0001_index000001.raw",
0106 ram_dir_path+"run100101_ls0002_index000000.raw",
0107 ram_dir_path+"run100101_ls0002_index000001.raw"
0108 )
0109
0110 )
0111
0112 process.PrescaleService = cms.Service( "PrescaleService",
0113 forceDefault = cms.bool( False ),
0114 prescaleTable = cms.VPSet(
0115 cms.PSet( pathName = cms.string( "HLT_Physics" ),
0116 prescales = cms.vuint32( 10)
0117 ),
0118 cms.PSet( pathName = cms.string( "HLT_Muon" ),
0119 prescales = cms.vuint32( 100 )
0120 )
0121 ),
0122 lvl1DefaultLabel = cms.string( "Default" ),
0123 lvl1Labels = cms.vstring( 'Default' )
0124 )
0125
0126
0127 process.pre = cms.EDFilter("PrescaleEventFilter", offset = cms.uint32(0), prescale=cms.uint32(1))
0128 if options.numEventsToWrite:
0129 process.pre.offset = 2
0130 process.pre.prescale = 4
0131
0132 process.filter1 = cms.EDFilter("HLTPrescaler",
0133 L1GtReadoutRecordTag = cms.InputTag( "hltGtDigis" )
0134 )
0135 process.filter2 = cms.EDFilter("HLTPrescaler",
0136 L1GtReadoutRecordTag = cms.InputTag( "hltGtDigis" )
0137 )
0138
0139 process.a = cms.EDAnalyzer("ExceptionGenerator",
0140 defaultAction = cms.untracked.int32(0),
0141 defaultQualifier = cms.untracked.int32(58))
0142
0143 process.b = cms.EDAnalyzer("ExceptionGenerator",
0144 defaultAction = cms.untracked.int32(0),
0145 defaultQualifier = cms.untracked.int32(5))
0146
0147
0148 import EventFilter.OnlineMetaDataRawToDigi.tcdsRawToDigi_cfi
0149 process.tcdsRawToDigi = EventFilter.OnlineMetaDataRawToDigi.tcdsRawToDigi_cfi.tcdsRawToDigi.clone()
0150 process.tcdsRawToDigi.InputLabel = cms.InputTag("rawDataCollector")
0151
0152 process.HLT_Physics = cms.Path(process.a*process.tcdsRawToDigi*process.filter1*process.pre)
0153 process.HLT_Muon = cms.Path(process.b*process.filter2*process.pre)
0154
0155 process.streamA = cms.OutputModule("GlobalEvFOutputModule",
0156 SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring( 'HLT_Physics' ))
0157 )
0158
0159 process.streamB = cms.OutputModule("GlobalEvFOutputModule",
0160 SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring( 'HLT_Muon' ))
0161 )
0162
0163 process.streamDQM = cms.OutputModule("GlobalEvFOutputModule",
0164 SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring( 'HLT_Physics', 'HLT_Muon' ))
0165 )
0166
0167 process.streamD = cms.OutputModule("EventStreamFileWriter",
0168 SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring( 'HLT_Muon' ))
0169 )
0170
0171 process.hltJson = cms.EDAnalyzer("HLTriggerJSONMonitoring")
0172
0173 process.DQMStore = cms.Service( "DQMStore",
0174 verbose = cms.untracked.int32( 0 ),
0175 saveByLumi = cms.untracked.bool( False ),
0176 )
0177
0178 from DQMServices.FileIO.DQMFileSaverPB_cfi import dqmSaver
0179 process.hltDQMFileSaver = dqmSaver
0180
0181 process.daqHistoTest = cms.EDProducer("DaqTestHistograms",
0182 numberOfHistograms = cms.untracked.uint32(50),
0183 lumisectionRange = cms.untracked.uint32(20)
0184 )
0185
0186 process.ep = cms.EndPath(
0187 process.streamA
0188 + process.streamB
0189 + process.streamDQM
0190
0191 + process.hltJson
0192 + process.daqHistoTest
0193 + process.hltDQMFileSaver
0194 )