File indexing completed on 2024-04-06 12:20:38
0001 from __future__ import print_function
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 import FWCore.ParameterSet.Config as cms
0016
0017
0018
0019 import FWCore.ParameterSet.VarParsing as VarParsing
0020 options = VarParsing.VarParsing('analysis')
0021 options.register('skipEvents',
0022 0,
0023 VarParsing.VarParsing.multiplicity.singleton,
0024 VarParsing.VarParsing.varType.int,
0025 "Number of events to skip")
0026 options.register('mpFramesPerEvent',
0027 40,
0028 VarParsing.VarParsing.multiplicity.singleton,
0029 VarParsing.VarParsing.varType.int,
0030 "MP frames per event")
0031 options.register('mpLatency',
0032 0,
0033 VarParsing.VarParsing.multiplicity.singleton,
0034 VarParsing.VarParsing.varType.int,
0035 "MP latency (frames)")
0036 options.register('mpOffset',
0037 0,
0038 VarParsing.VarParsing.multiplicity.singleton,
0039 VarParsing.VarParsing.varType.int,
0040 "MP offset (frames)")
0041 options.register('dmFramesPerEvent',
0042 6,
0043 VarParsing.VarParsing.multiplicity.singleton,
0044 VarParsing.VarParsing.varType.int,
0045 "Demux frames per event")
0046 options.register('dmLatency',
0047 0,
0048 VarParsing.VarParsing.multiplicity.singleton,
0049 VarParsing.VarParsing.varType.int,
0050 "Demux latency (frames)")
0051 options.register('dmOffset',
0052 0,
0053 VarParsing.VarParsing.multiplicity.singleton,
0054 VarParsing.VarParsing.varType.int,
0055 "Demux offset (frames)")
0056 options.register('gtFramesPerEvent',
0057 6,
0058 VarParsing.VarParsing.multiplicity.singleton,
0059 VarParsing.VarParsing.varType.int,
0060 "GT frames per event")
0061 options.register('gtLatency',
0062 47,
0063 VarParsing.VarParsing.multiplicity.singleton,
0064 VarParsing.VarParsing.varType.int,
0065 "GT latency (frames)")
0066 options.register('gtOffset',
0067 15,
0068 VarParsing.VarParsing.multiplicity.singleton,
0069 VarParsing.VarParsing.varType.int,
0070 "GT offset (frames)")
0071 options.register('dump',
0072 False,
0073 VarParsing.VarParsing.multiplicity.singleton,
0074 VarParsing.VarParsing.varType.bool,
0075 "Print RAW data")
0076 options.register('debug',
0077 False,
0078 VarParsing.VarParsing.multiplicity.singleton,
0079 VarParsing.VarParsing.varType.bool,
0080 "Enable debug data")
0081 options.register('doMP',
0082 True,
0083 VarParsing.VarParsing.multiplicity.singleton,
0084 VarParsing.VarParsing.varType.bool,
0085 "Read MP data")
0086 options.register('doDemux',
0087 True,
0088 VarParsing.VarParsing.multiplicity.singleton,
0089 VarParsing.VarParsing.varType.bool,
0090 "Read demux data")
0091 options.register('doGT',
0092 True,
0093 VarParsing.VarParsing.multiplicity.singleton,
0094 VarParsing.VarParsing.varType.bool,
0095 "Read GT data")
0096 options.register('newXML',
0097 False,
0098 VarParsing.VarParsing.multiplicity.singleton,
0099 VarParsing.VarParsing.varType.bool,
0100 "New XML Grammar")
0101 options.register('nMP',
0102 11,
0103 VarParsing.VarParsing.multiplicity.singleton,
0104 VarParsing.VarParsing.varType.int,
0105 "Number of MPs")
0106
0107 options.parseArguments()
0108
0109 if (options.maxEvents == -1):
0110 options.maxEvents = 1
0111
0112
0113 process = cms.Process('Raw2Digi')
0114
0115
0116 process.load('Configuration.StandardSequences.Services_cff')
0117 process.load('FWCore.MessageService.MessageLogger_cfi')
0118 process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
0119 process.load('Configuration.Geometry.GeometryDB_cff')
0120 process.load('Configuration.StandardSequences.MagneticField_38T_cff')
0121 process.load('Configuration.StandardSequences.SimL1Emulator_cff')
0122 process.load('Configuration.StandardSequences.EndOfProcess_cff')
0123 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0124
0125 process.maxEvents = cms.untracked.PSet(
0126 input = cms.untracked.int32(options.maxEvents)
0127 )
0128
0129
0130 process.source = cms.Source("EmptySource")
0131
0132 process.options = cms.untracked.PSet(
0133 SkipEvent = cms.untracked.vstring('ProductNotFound')
0134 )
0135
0136
0137
0138 process.output = cms.OutputModule(
0139 "PoolOutputModule",
0140 outputCommands = cms.untracked.vstring("keep *"),
0141 fileName = cms.untracked.string('l1tCalo_2016_EDM.root')
0142 )
0143
0144
0145
0146 process.load("CommonTools.UtilAlgos.TFileService_cfi")
0147 process.TFileService.fileName = cms.string('l1tCalo_2016_histos_'+repr(options.gtOffset)+'-'+repr(options.gtLatency)+'.root')
0148
0149
0150
0151 process.MessageLogger.L1TCaloEvents=dict()
0152 process.MessageLogger.L1TGlobalEvents=dict()
0153 process.MessageLogger.Global=dict()
0154
0155 process.MessageLogger.suppressInfo = cms.untracked.vstring('Geometry', 'AfterSource')
0156
0157 if (options.dump):
0158 process.MessageLogger.files.infos = cms.untracked.PSet(
0159 INFO = cms.untracked.PSet(limit = cms.untracked.int32(0)),
0160 L1TCaloEvents = cms.untracked.PSet(
0161 limit = cms.untracked.int32(10000)
0162 )
0163 )
0164
0165 if (options.debug):
0166
0167 process.MessageLogger.debugModules = cms.untracked.vstring('*')
0168 process.MessageLogger.cerr.threshold = cms.untracked.string('DEBUG')
0169
0170
0171
0172
0173 from Configuration.AlCa.GlobalTag import GlobalTag
0174 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:startup', '')
0175
0176
0177
0178 process.load('EventFilter.L1TRawToDigi.stage2MP7BufferRaw_cff')
0179
0180
0181
0182 dmOffset = options.dmOffset + (options.skipEvents * options.dmFramesPerEvent)
0183
0184 mpOffsets = cms.untracked.vint32()
0185 for i in range (0,options.nMP):
0186 offset = options.mpOffset + (options.skipEvents / options.nMP)
0187 if (i < options.skipEvents % options.nMP):
0188 offset = offset + 1
0189 mpOffsets.append(offset)
0190
0191 boardOffset = options.skipEvents % options.nMP
0192
0193 gtOffset = options.gtOffset + (options.skipEvents * options.gtFramesPerEvent)
0194
0195
0196
0197 print("Job config :")
0198 print("maxEvents = ", options.maxEvents)
0199 print("skipEvents = ", options.skipEvents)
0200 print(" ")
0201
0202
0203 if (options.doMP):
0204 print("MP config :")
0205 print("nBoards = ", options.nMP)
0206 print("mpBoardOffset = ", boardOffset)
0207 print("mpOffset = ", mpOffsets)
0208 print(" ")
0209
0210 process.stage2MPRaw.nFramesPerEvent = cms.untracked.int32(options.mpFramesPerEvent)
0211 process.stage2MPRaw.nFramesOffset = cms.untracked.vuint32(mpOffsets)
0212 process.stage2MPRaw.boardOffset = cms.untracked.int32(boardOffset)
0213
0214 process.stage2MPRaw.rxFile = cms.untracked.string("merge/rx_summary.txt")
0215 process.stage2MPRaw.txFile = cms.untracked.string("merge/tx_summary.txt")
0216
0217
0218 if (options.doDemux):
0219 print("Demux config :")
0220 print("dmOffset = ", dmOffset)
0221 print("dmLatency = ", options.dmLatency)
0222 print(" ")
0223
0224 process.stage2DemuxRaw.nFramesPerEvent = cms.untracked.int32(options.dmFramesPerEvent)
0225 process.stage2DemuxRaw.nFramesOffset = cms.untracked.vuint32(dmOffset)
0226 process.stage2DemuxRaw.nFramesLatency = cms.untracked.vuint32(options.dmLatency)
0227 process.stage2DemuxRaw.rxFile = cms.untracked.string("good/demux/rx_summary.txt")
0228 process.stage2DemuxRaw.txFile = cms.untracked.string("good/demux/tx_summary.txt")
0229
0230
0231 if (options.doGT):
0232 print("GT config :")
0233 print("gtOffset = ", gtOffset)
0234 print("gtLatency = ", options.gtLatency)
0235
0236 process.stage2GTRaw.nFramesPerEvent = cms.untracked.int32(options.gtFramesPerEvent)
0237 process.stage2GTRaw.nFramesOffset = cms.untracked.vuint32(gtOffset)
0238 process.stage2GTRaw.nFramesLatency = cms.untracked.vuint32(options.gtLatency)
0239 process.stage2GTRaw.rxFile = cms.untracked.string("uGT/rx_summary.txt")
0240 process.stage2GTRaw.txFile = cms.untracked.string("uGT/tx_summary.txt")
0241
0242
0243 process.rawDataCollector.verbose = cms.untracked.int32(2)
0244
0245
0246
0247 process.dumpRaw = cms.EDAnalyzer(
0248 "DumpFEDRawDataProduct",
0249 label = cms.untracked.string("rawDataCollector"),
0250 feds = cms.untracked.vint32 ( 1360, 1366, 1404 ),
0251 dumpPayload = cms.untracked.bool ( True )
0252 )
0253
0254
0255 process.load('EventFilter.L1TRawToDigi.caloStage2Digis_cfi')
0256 process.caloStage2Digis.InputLabel = cms.InputTag('rawDataCollector')
0257
0258 process.load('EventFilter.L1TRawToDigi.gtStage2Digis_cfi')
0259 process.gtStage2Digis.InputLabel = cms.InputTag('rawDataCollector')
0260
0261
0262
0263 process.load('L1Trigger.L1TGlobal.StableParametersConfig_cff')
0264 process.load('L1Trigger.L1TGlobal.TriggerMenuXml_cfi')
0265 process.TriggerMenuXml.TriggerMenuLuminosity = 'startup'
0266
0267 process.TriggerMenuXml.DefXmlFile = 'L1Menu_Point5IntegrationTest_2015_v2.xml'
0268 process.TriggerMenuXml.newGrammar = cms.bool(options.newXML)
0269 if(options.newXML):
0270 print("Using new XML Grammar ")
0271
0272 process.TriggerMenuXml.DefXmlFile = 'MuonTest.xml'
0273
0274 process.load('L1Trigger.L1TGlobal.TriggerMenuConfig_cff')
0275 process.es_prefer_l1GtParameters = cms.ESPrefer('l1t::TriggerMenuXmlProducer','TriggerMenuXml')
0276
0277 process.emL1uGtFromGtInput = cms.EDProducer("L1TGlobalProducer",
0278 ProduceL1GtObjectMapRecord = cms.bool(False),
0279 AlgorithmTriggersUnmasked = cms.bool(False),
0280 EmulateBxInEvent = cms.int32(1),
0281 L1DataBxInEvent = cms.int32(1),
0282 AlgorithmTriggersUnprescaled = cms.bool(False),
0283 ProduceL1GtDaqRecord = cms.bool(True),
0284 GmtInputTag = cms.InputTag("gtStage2Digis","GT"),
0285 caloInputTag = cms.InputTag("gtStage2Digis","GT"),
0286 AlternativeNrBxBoardDaq = cms.uint32(0),
0287 BstLengthBytes = cms.int32(-1),
0288 Verbosity = cms.untracked.int32(5)
0289 )
0290
0291 process.emL1uGtFromDemuxOutput = cms.EDProducer("L1TGlobalProducer",
0292 ProduceL1GtObjectMapRecord = cms.bool(False),
0293 AlgorithmTriggersUnmasked = cms.bool(False),
0294 EmulateBxInEvent = cms.int32(1),
0295 L1DataBxInEvent = cms.int32(1),
0296 AlgorithmTriggersUnprescaled = cms.bool(False),
0297 ProduceL1GtDaqRecord = cms.bool(True),
0298 GmtInputTag = cms.InputTag(""),
0299 caloInputTag = cms.InputTag("caloStage2Digis"),
0300 AlternativeNrBxBoardDaq = cms.uint32(0),
0301 BstLengthBytes = cms.int32(-1),
0302 Verbosity = cms.untracked.int32(5)
0303 )
0304
0305
0306
0307
0308 process.load('L1Trigger.L1TCalorimeter.l1tStage2CaloAnalyzer_cfi')
0309 process.l1tStage2CaloAnalyzer.doText = cms.untracked.bool(options.debug)
0310 process.l1tStage2CaloAnalyzer.towerToken = cms.InputTag("caloStage2Digis")
0311 process.l1tStage2CaloAnalyzer.clusterToken = cms.InputTag("None")
0312 process.l1tStage2CaloAnalyzer.mpEGToken = cms.InputTag("None")
0313 process.l1tStage2CaloAnalyzer.mpTauToken = cms.InputTag("None")
0314
0315
0316
0317 process.l1tGlobalAnalyzer = cms.EDAnalyzer('L1TGlobalAnalyzer',
0318 doText = cms.untracked.bool(options.debug),
0319 dmxEGToken = cms.InputTag("caloStage2Digis"),
0320 dmxTauToken = cms.InputTag("None"),
0321 dmxJetToken = cms.InputTag("caloStage2Digis"),
0322 dmxEtSumToken = cms.InputTag("caloStage2Digis"),
0323 muToken = cms.InputTag("gtStage2Digis","GT"),
0324 egToken = cms.InputTag("gtStage2Digis","GT"),
0325 tauToken = cms.InputTag("None"),
0326 jetToken = cms.InputTag("gtStage2Digis","GT"),
0327 etSumToken = cms.InputTag("gtStage2Digis","GT"),
0328 gtAlgToken = cms.InputTag("gtStage2Digis"),
0329 emulDxAlgToken = cms.InputTag("emL1uGtFromDemuxOutput"),
0330 emulGtAlgToken = cms.InputTag("emL1uGtFromGtInput")
0331 )
0332
0333
0334
0335 process.dumpGTRecord = cms.EDAnalyzer("l1t::GtRecordDump",
0336 egInputTag = cms.InputTag("gtStage2Digis","GT"),
0337 muInputTag = cms.InputTag("gtStage2Digis","GT"),
0338 tauInputTag = cms.InputTag(""),
0339 jetInputTag = cms.InputTag("gtStage2Digis","GT"),
0340 etsumInputTag = cms.InputTag("gtStage2Digis","GT"),
0341 uGtRecInputTag = cms.InputTag(""),
0342 uGtAlgInputTag = cms.InputTag("emL1uGtFromGtInput"),
0343 uGtExtInputTag = cms.InputTag(""),
0344 bxOffset = cms.int32(0),
0345 minBx = cms.int32(0),
0346 maxBx = cms.int32(0),
0347 minBxVec = cms.int32(0),
0348 maxBxVec = cms.int32(0),
0349 dumpGTRecord = cms.bool(True),
0350 dumpVectors = cms.bool(True),
0351 tvFileName = cms.string( "TestVector.txt" )
0352 )
0353
0354
0355
0356
0357
0358
0359 process.path = cms.Path(
0360
0361 process.stage2DemuxRaw
0362 +process.stage2GTRaw
0363 +process.rawDataCollector
0364 +process.dumpRaw
0365 +process.caloStage2Digis
0366 +process.gtStage2Digis
0367 +process.emL1uGtFromGtInput
0368
0369
0370
0371
0372 )
0373
0374 if (not options.doMP):
0375 process.path.remove(process.stage2MPRaw)
0376
0377 if (not options.doDemux):
0378 process.path.remove(process.stage2DemuxRaw)
0379
0380 if (not options.doGT):
0381 process.path.remove(process.stage2GTRaw)
0382
0383 process.out = cms.EndPath(
0384 process.output
0385 )
0386