File indexing completed on 2024-11-27 03:17:45
0001
0002
0003
0004
0005
0006 import FWCore.ParameterSet.Config as cms
0007
0008
0009
0010 import FWCore.ParameterSet.VarParsing as VarParsing
0011 options = VarParsing.VarParsing('analysis')
0012 options.register('skipEvents',
0013 0,
0014 VarParsing.VarParsing.multiplicity.singleton,
0015 VarParsing.VarParsing.varType.int,
0016 "Number of events to skip")
0017 options.register('fwVersion',
0018 268501043,
0019 VarParsing.VarParsing.multiplicity.singleton,
0020 VarParsing.VarParsing.varType.int,
0021 "Firmware version for unpacker configuration")
0022 options.register('demuxFWVersion',
0023 268501079,
0024 VarParsing.VarParsing.multiplicity.singleton,
0025 VarParsing.VarParsing.varType.int,
0026 "Firmware version for demux unpacker configuration")
0027 options.register('mpFramesPerEvent',
0028 40,
0029 VarParsing.VarParsing.multiplicity.singleton,
0030 VarParsing.VarParsing.varType.int,
0031 "MP frames per event")
0032 options.register('mpLatency',
0033 0,
0034 VarParsing.VarParsing.multiplicity.singleton,
0035 VarParsing.VarParsing.varType.int,
0036 "MP latency (frames)")
0037 options.register('mpOffset',
0038 0,
0039 VarParsing.VarParsing.multiplicity.singleton,
0040 VarParsing.VarParsing.varType.int,
0041 "MP offset (frames)")
0042 options.register('mpHeaderFrames',
0043 0,
0044 VarParsing.VarParsing.multiplicity.singleton,
0045 VarParsing.VarParsing.varType.int,
0046 "MP header frames in tx")
0047 options.register('mpKeyLinkRx',
0048 0,
0049 VarParsing.VarParsing.multiplicity.singleton,
0050 VarParsing.VarParsing.varType.int,
0051 "MP packet key link (Rx)")
0052 options.register('mpKeyLinkTx',
0053 0,
0054 VarParsing.VarParsing.multiplicity.singleton,
0055 VarParsing.VarParsing.varType.int,
0056 "MP packet key link (Tx)")
0057 options.register('dmFramesPerEvent',
0058 6,
0059 VarParsing.VarParsing.multiplicity.singleton,
0060 VarParsing.VarParsing.varType.int,
0061 "Demux frames per event")
0062 options.register('dmLatency',
0063 0,
0064 VarParsing.VarParsing.multiplicity.singleton,
0065 VarParsing.VarParsing.varType.int,
0066 "Demux latency (frames)")
0067 options.register('dmOffset',
0068 29,
0069 VarParsing.VarParsing.multiplicity.singleton,
0070 VarParsing.VarParsing.varType.int,
0071 "Demux offset (frames)")
0072 options.register('gtFramesPerEvent',
0073 6,
0074 VarParsing.VarParsing.multiplicity.singleton,
0075 VarParsing.VarParsing.varType.int,
0076 "GT frames per event")
0077 options.register('gtLatency',
0078 47,
0079 VarParsing.VarParsing.multiplicity.singleton,
0080 VarParsing.VarParsing.varType.int,
0081 "GT latency (frames)")
0082 options.register('gtOffset',
0083 15,
0084 VarParsing.VarParsing.multiplicity.singleton,
0085 VarParsing.VarParsing.varType.int,
0086 "GT offset (frames)")
0087 options.register('dump',
0088 False,
0089 VarParsing.VarParsing.multiplicity.singleton,
0090 VarParsing.VarParsing.varType.bool,
0091 "Print RAW data")
0092 options.register('debug',
0093 True,
0094 VarParsing.VarParsing.multiplicity.singleton,
0095 VarParsing.VarParsing.varType.bool,
0096 "Enable debug data")
0097 options.register('doMP',
0098 True,
0099 VarParsing.VarParsing.multiplicity.singleton,
0100 VarParsing.VarParsing.varType.bool,
0101 "Read MP data")
0102 options.register('doDemux',
0103 True,
0104 VarParsing.VarParsing.multiplicity.singleton,
0105 VarParsing.VarParsing.varType.bool,
0106 "Read demux data")
0107 options.register('doGT',
0108 False,
0109 VarParsing.VarParsing.multiplicity.singleton,
0110 VarParsing.VarParsing.varType.bool,
0111 "Read GT data")
0112 options.register('nMP',
0113 9,
0114 VarParsing.VarParsing.multiplicity.singleton,
0115 VarParsing.VarParsing.varType.int,
0116 "Number of MPs")
0117
0118 options.parseArguments()
0119
0120 if (options.maxEvents == -1):
0121 options.maxEvents = 1
0122
0123
0124 process = cms.Process('Raw2Digi')
0125
0126
0127 process.load('Configuration.StandardSequences.Services_cff')
0128 process.load('FWCore.MessageService.MessageLogger_cfi')
0129 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0130 process.load('Configuration.Geometry.GeometryDB_cff')
0131 process.load('Configuration.StandardSequences.MagneticField_38T_cff')
0132 process.load('Configuration.StandardSequences.SimL1Emulator_cff')
0133 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0134 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0135
0136 process.maxEvents = cms.untracked.PSet(
0137 input = cms.untracked.int32(options.maxEvents)
0138 )
0139
0140
0141 process.source = cms.Source("EmptySource")
0142
0143 process.options = cms.untracked.PSet(
0144 SkipEvent = cms.untracked.vstring('ProductNotFound')
0145 )
0146
0147
0148
0149 process.output = cms.OutputModule(
0150 "PoolOutputModule",
0151 outputCommands = cms.untracked.vstring("keep *"),
0152 fileName = cms.untracked.string('l1tCalo_2016_EDM.root')
0153 )
0154
0155
0156
0157 process.load("CommonTools.UtilAlgos.TFileService_cfi")
0158 process.TFileService.fileName = cms.string('l1tCalo_2016_histos.root')
0159
0160
0161
0162 process.MessageLogger.L1TCaloEvents=dict()
0163
0164 process.MessageLogger.suppressInfo = cms.untracked.vstring('Geometry', 'AfterSource')
0165
0166 if (options.dump):
0167 process.MessageLogger.files.infos = cms.untracked.PSet(
0168 INFO = cms.untracked.PSet(limit = cms.untracked.int32(0)),
0169 L1TCaloEvents = cms.untracked.PSet(
0170 limit = cms.untracked.int32(10000)
0171 )
0172 )
0173
0174 if (options.debug):
0175
0176 process.MessageLogger.debugModules = cms.untracked.vstring('*')
0177 process.MessageLogger.cerr.threshold = cms.untracked.string('DEBUG')
0178
0179
0180
0181
0182 from Configuration.AlCa.GlobalTag import GlobalTag
0183 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:startup', '')
0184
0185
0186
0187 process.load('EventFilter.L1TRawToDigi.stage2MP7BufferRaw_cff')
0188
0189
0190 dmOffset = options.dmOffset + (options.skipEvents * options.dmFramesPerEvent)
0191
0192 mpOffsets = cms.untracked.vint32()
0193 for i in range (0,options.nMP):
0194 offset = options.mpOffset + (options.skipEvents / options.nMP)
0195 if (i < options.skipEvents % options.nMP):
0196 offset = offset + 1
0197 mpOffsets.append(int(offset))
0198
0199 mpLatencies = cms.untracked.vint32()
0200 for i in range (0,options.nMP):
0201 mpLatencies.append(0)
0202
0203 boardIds = cms.untracked.vint32(range(0,options.nMP))
0204
0205 boardOffset = options.skipEvents % options.nMP
0206
0207 gtOffset = options.gtOffset + (options.skipEvents * options.gtFramesPerEvent)
0208
0209
0210 print("Job config :")
0211 print("maxEvents = ", options.maxEvents)
0212 print("skipEvents = ", options.skipEvents)
0213 print(" ")
0214
0215
0216 if (options.doMP):
0217 print("MP config :")
0218 print("nBoards = ", options.nMP)
0219 print("mpBoardOffset = ", boardOffset)
0220 print("mpOffset = ", mpOffsets)
0221 print(" ")
0222
0223 mpBlock = cms.untracked.PSet(
0224 rxBlockLength = cms.untracked.vint32(40,40,40,40,
0225 40,40,40,40,
0226 40,40,40,40,
0227 40,40,40,40,
0228 40,40,40,40,
0229 40,40,40,40,
0230 40,40,40,40,
0231 40,40,40,40,
0232 40,40,40,40,
0233 40,40,40,40,
0234 40,40,40,40,
0235 40,40,40,40,
0236 40,40,40,40,
0237 40,40,40,40,
0238 40,40,40,40,
0239 40,40,40,40,
0240 40,40,40,40,
0241 40,40,40,40),
0242
0243 txBlockLength = cms.untracked.vint32(0,0,0,0,
0244 0,0,0,0,
0245 0,0,0,0,
0246 0,0,0,0,
0247 0,0,0,0,
0248 0,0,0,0,
0249 0,0,0,0,
0250 0,0,0,0,
0251 0,0,0,0,
0252 0,0,0,0,
0253 0,0,0,0,
0254 0,0,0,0,
0255 0,0,0,0,
0256 0,0,0,0,
0257 0,0,0,0,
0258 11,11,11,11,
0259 11,11,0,0,
0260 0,0,0,0)
0261 )
0262
0263 mpBlocks = cms.untracked.VPSet()
0264
0265 for block in range(0,options.nMP):
0266 mpBlocks.append(mpBlock)
0267
0268 process.stage2MPRaw.nFramesPerEvent = cms.untracked.int32(options.mpFramesPerEvent)
0269 process.stage2MPRaw.nFramesOffset = cms.untracked.vuint32(mpOffsets)
0270 process.stage2MPRaw.nFramesLatency = cms.untracked.vuint32(mpLatencies)
0271 process.stage2MPRaw.boardOffset = cms.untracked.int32(boardOffset)
0272 process.stage2MPRaw.rxKeyLink = cms.untracked.int32(options.mpKeyLinkRx)
0273 process.stage2MPRaw.txKeyLink = cms.untracked.int32(options.mpKeyLinkTx)
0274 process.stage2MPRaw.boardId = cms.untracked.vint32(boardIds)
0275 process.stage2MPRaw.nHeaderFrames = cms.untracked.int32(options.mpHeaderFrames)
0276 process.stage2MPRaw.rxFile = cms.untracked.string("mp_rx_summary.txt")
0277 process.stage2MPRaw.txFile = cms.untracked.string("mp_tx_summary.txt")
0278 process.stage2MPRaw.blocks = cms.untracked.VPSet(mpBlocks)
0279 process.stage2MPRaw.fwVersion = cms.untracked.int32(options.fwVersion)
0280
0281
0282 if (options.doDemux):
0283 print("Demux config :")
0284 print("dmOffset = ", dmOffset)
0285 print("dmLatency = ", options.dmLatency)
0286 print(" ")
0287
0288 process.stage2DemuxRaw.nFramesPerEvent = cms.untracked.int32(options.dmFramesPerEvent)
0289 process.stage2DemuxRaw.nFramesOffset = cms.untracked.vuint32(dmOffset)
0290
0291 process.stage2DemuxRaw.nFramesLatency = cms.untracked.vuint32(options.dmLatency+1)
0292 process.stage2DemuxRaw.rxFile = cms.untracked.string("demux_rx_summary.txt")
0293 process.stage2DemuxRaw.txFile = cms.untracked.string("demux_tx_summary.txt")
0294 process.stage2DemuxRaw.fwVersion = cms.untracked.int32(options.demuxFWVersion)
0295
0296
0297 if (options.doGT):
0298 print("GT config :")
0299 print("gtOffset = ", gtOffset)
0300 print("gtLatency = ", options.gtLatency)
0301
0302 process.stage2GTRaw.nFramesPerEvent = cms.untracked.int32(options.gtFramesPerEvent)
0303 process.stage2GTRaw.nFramesOffset = cms.untracked.vuint32(gtOffset)
0304 process.stage2GTRaw.nFramesLatency = cms.untracked.vuint32(options.gtLatency)
0305 process.stage2GTRaw.rxFile = cms.untracked.string("uGT/rx_summary.txt")
0306 process.stage2GTRaw.txFile = cms.untracked.string("uGT/tx_summary.txt")
0307
0308
0309 process.rawDataCollector.verbose = cms.untracked.int32(2)
0310
0311
0312
0313 process.dumpRaw = cms.EDAnalyzer(
0314 "DumpFEDRawDataProduct",
0315 token = cms.untracked.InputTag("rawDataCollector"),
0316 feds = cms.untracked.vint32 ( 1360, 1366, 1404 ),
0317 dumpPayload = cms.untracked.bool ( options.dump )
0318 )
0319
0320
0321 process.load('EventFilter.L1TRawToDigi.caloStage2Digis_cfi')
0322 process.caloStage2Digis.InputLabel = cms.InputTag('rawDataCollector')
0323 process.caloStage2Digis.debug = cms.untracked.bool(options.debug)
0324 process.caloStage2Digis.FWId = cms.uint32(options.fwVersion)
0325 process.caloStage2Digis.DmxFWId = cms.uint32(options.demuxFWVersion)
0326 process.caloStage2Digis.FWOverride = cms.bool(True)
0327 process.caloStage2Digis.TMTCheck = cms.bool(False)
0328
0329 process.load('EventFilter.L1TRawToDigi.gtStage2Digis_cfi')
0330 process.gtStage2Digis.InputLabel = cms.InputTag('rawDataCollector')
0331
0332
0333 process.load('L1Trigger.L1TCalorimeter.l1tStage2CaloAnalyzer_cfi')
0334 process.l1tStage2CaloAnalyzer.clusterToken = cms.InputTag("None")
0335
0336
0337
0338 process.path = cms.Path(
0339 process.stage2MPRaw
0340 +process.stage2DemuxRaw
0341 +process.stage2GTRaw
0342 +process.rawDataCollector
0343
0344 +process.caloStage2Digis
0345 +process.gtStage2Digis
0346 +process.l1tStage2CaloAnalyzer
0347 )
0348
0349 if (not options.doMP):
0350 process.path.remove(process.stage2MPRaw)
0351
0352 if (not options.doDemux):
0353 process.path.remove(process.stage2DemuxRaw)
0354
0355 if (not options.doGT):
0356 process.path.remove(process.stage2GTRaw)
0357
0358 process.out = cms.EndPath(
0359 process.output
0360 )
0361
0362