File indexing completed on 2024-11-27 03:17:55
0001
0002 import sys
0003
0004 """
0005 Description: script used for offline validation of the Global Trigger firmware and emulator agreement
0006 (Contacts: Richard Cavanaugh, Elisa Fontanesi)
0007 -----------------------------------------------------------------------------------------------------
0008 The parameters can be changed by adding command line arguments of the form:
0009 runGlobalFakeInputProducer.py nevents=-1
0010 The latter can be used to change parameters in crab.
0011 Running on 3564 events (=one orbit) is recommended for test vector production for GT firmware validation.
0012 """
0013
0014 job = 0
0015 njob = 1
0016 nevents = 3564
0017 rootout = False
0018 dump = False
0019 newXML = False
0020
0021
0022
0023
0024 if len(sys.argv) == 2 and ':' in sys.argv[1]:
0025 argv = sys.argv[1].split(':')
0026 else:
0027 argv = sys.argv[1:]
0028
0029 for arg in argv:
0030 (k, v) = map(str.strip, arg.split('='))
0031 if k not in globals():
0032 raise "Unknown argument '%s'!" % (k,)
0033 if isinstance(globals()[k], bool):
0034 globals()[k] = v.lower() in ('y', 'yes', 'true', 't', '1')
0035 elif isinstance(globals()[k], int):
0036 globals()[k] = int(v)
0037 else:
0038 globals()[k] = v
0039
0040 neventsPerJob = int(nevents/njob)
0041 skip = job * neventsPerJob
0042
0043 if skip>4:
0044 skip = skip-4
0045 neventsPerJob = neventsPerJob+4
0046
0047 import FWCore.ParameterSet.Config as cms
0048
0049 process = cms.Process('L1TEMULATION')
0050
0051 process.load('Configuration.StandardSequences.Services_cff')
0052 process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff')
0053
0054
0055
0056
0057
0058 process.load('FWCore.MessageService.MessageLogger_cfi')
0059
0060
0061
0062 process.MessageLogger.debugModules = ["simGtStage2Digis"]
0063 process.MessageLogger.debugModules = ["l1t|Global"]
0064 process.MessageLogger.cerr = cms.untracked.PSet(
0065 threshold = cms.untracked.string('DEBUG')
0066 )
0067
0068
0069 process.MessageLogger.l1t_debug = cms.untracked.PSet()
0070 process.MessageLogger.l1t = cms.untracked.PSet(
0071 limit = cms.untracked.int32(100000),
0072 )
0073
0074
0075
0076
0077
0078 process.maxEvents = cms.untracked.PSet(
0079 input = cms.untracked.int32(neventsPerJob)
0080 )
0081
0082 process.source = cms.Source("PoolSource",
0083 secondaryFileNames = cms.untracked.vstring(),
0084 fileNames = cms.untracked.vstring(
0085
0086 "/store/relval/CMSSW_14_0_1/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/140X_mcRun3_2024_realistic_v4_PU_AlpakaVal_AlpakaDeviceVSHost-v14/50000/34ae12a4-2d90-4d5d-b243-e949af0952ae.root",
0087 "/store/relval/CMSSW_14_0_1/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/140X_mcRun3_2024_realistic_v4_PU_AlpakaVal_AlpakaDeviceVSHost-v14/50000/5c08de0e-0571-4792-aa37-1b7d1915dbda.root",
0088 "/store/relval/CMSSW_14_0_1/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/140X_mcRun3_2024_realistic_v4_PU_AlpakaVal_AlpakaDeviceVSHost-v14/50000/1aed742b-2f48-4cc3-8758-24153c38c79b.root",
0089 "/store/relval/CMSSW_14_0_1/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/140X_mcRun3_2024_realistic_v4_PU_AlpakaVal_AlpakaDeviceVSHost-v14/50000/096ba83b-620d-449d-a408-ebb209b54d76.root"
0090 ),
0091 skipEvents = cms.untracked.uint32(skip)
0092 )
0093
0094 process.output =cms.OutputModule("PoolOutputModule",
0095 outputCommands = cms.untracked.vstring('keep *'),
0096 fileName = cms.untracked.string('testGlobalMCInputProducer_'+repr(job)+'.root')
0097 )
0098
0099 process.options = cms.untracked.PSet(
0100 wantSummary = cms.bool(True)
0101 )
0102
0103
0104
0105
0106 process.load("CommonTools.UtilAlgos.TFileService_cfi")
0107 process.TFileService.fileName = cms.string('l1t_histos.root')
0108
0109
0110
0111
0112 from Configuration.AlCa.GlobalTag import GlobalTag
0113 process.GlobalTag = GlobalTag(process.GlobalTag, '123X_mcRun3_2021_realistic_v13', '')
0114
0115
0116
0117
0118 process.load('L1Trigger.L1TGlobal.GlobalParameters_cff')
0119 process.load("L1Trigger.L1TGlobal.TriggerMenu_cff")
0120 xmlMenu="L1Menu_Collisions2024_v1_1_0.xml"
0121 process.TriggerMenu.L1TriggerMenuFile = cms.string(xmlMenu)
0122 process.ESPreferL1TXML = cms.ESPrefer("L1TUtmTriggerMenuESProducer","TriggerMenu")
0123
0124
0125
0126 process.dumpMenu = cms.EDAnalyzer("L1MenuViewer")
0127
0128
0129 useMCtoGT = True
0130
0131 process.dumpGT = cms.EDAnalyzer("l1t::GtInputDump",
0132 egInputTag = cms.InputTag("gtInput"),
0133 muInputTag = cms.InputTag("gtInput"),
0134 muShowerInputTag = cms.InputTag("gtInput"),
0135 tauInputTag = cms.InputTag("gtInput"),
0136 jetInputTag = cms.InputTag("gtInput"),
0137 etsumInputTag = cms.InputTag("gtInput"),
0138 minBx = cms.int32(0),
0139 maxBx = cms.int32(0)
0140 )
0141 process.dumpED = cms.EDAnalyzer("EventContentAnalyzer")
0142 process.dumpES = cms.EDAnalyzer("PrintEventSetupContent")
0143
0144 process.mcL1GTinput = cms.EDProducer("l1t::GenToInputProducer",
0145 bxFirst = cms.int32(-2),
0146 bxLast = cms.int32(2),
0147 maxMuCand = cms.int32(8),
0148 maxMuShowerCand = cms.int32(8),
0149 maxJetCand = cms.int32(12),
0150 maxEGCand = cms.int32(12),
0151 maxTauCand = cms.int32(8),
0152 jetEtThreshold = cms.double(1),
0153 tauEtThreshold = cms.double(1),
0154 egEtThreshold = cms.double(1),
0155 muEtThreshold = cms.double(1),
0156 emptyBxTrailer = cms.int32(5),
0157 emptyBxEvt = cms.int32(neventsPerJob)
0158 )
0159
0160 process.mcL1GTinput.maxMuCand = cms.int32(8)
0161 process.mcL1GTinput.maxMuShowerCand = cms.int32(8)
0162 process.mcL1GTinput.maxJetCand = cms.int32(12)
0163 process.mcL1GTinput.maxEGCand = cms.int32(12)
0164 process.mcL1GTinput.maxTauCand = cms.int32(8)
0165
0166
0167
0168
0169 process.fakeL1GTinput = cms.EDProducer("l1t::FakeInputProducer",
0170
0171
0172 egParams = cms.untracked.PSet(
0173 egBx = cms.untracked.vint32(-2, -1, 0, 0, 1, 2),
0174 egHwPt = cms.untracked.vint32(10, 20, 30, 61, 40, 50),
0175 egHwPhi = cms.untracked.vint32(11, 21, 31, 61, 41, 51),
0176 egHwEta = cms.untracked.vint32(12, 22, 32, 62, 42, 52),
0177 egIso = cms.untracked.vint32( 0, 0, 1, 1, 0, 0)
0178 ),
0179
0180 muParams = cms.untracked.PSet(
0181 muBx = cms.untracked.vint32(-2, -1, 0, 0, 1, 2),
0182 muHwPt = cms.untracked.vint32(5, 20, 30, 61, 40, 50),
0183 muHwPhi = cms.untracked.vint32(11, 21, 31, 61, 41, 51),
0184 muHwEta = cms.untracked.vint32(12, 22, 32, 62, 42, 52),
0185 muIso = cms.untracked.vint32( 0, 0, 1, 1, 0, 0)
0186 ),
0187
0188 tauParams = cms.untracked.PSet(
0189 tauBx = cms.untracked.vint32(),
0190 tauHwPt = cms.untracked.vint32(),
0191 tauHwPhi = cms.untracked.vint32(),
0192 tauHwEta = cms.untracked.vint32(),
0193 tauIso = cms.untracked.vint32()
0194 ),
0195
0196 jetParams = cms.untracked.PSet(
0197 jetBx = cms.untracked.vint32( 0, 0, 2, 1, 1, 2),
0198 jetHwPt = cms.untracked.vint32(100, 200, 130, 170, 85, 145),
0199 jetHwPhi = cms.untracked.vint32( 2, 67, 10, 3, 78, 10),
0200 jetHwEta = cms.untracked.vint32( 110, -99, 11, 0, 17, 11)
0201 ),
0202
0203 etsumParams = cms.untracked.PSet(
0204 etsumBx = cms.untracked.vint32( -2, -1, 0, 1, 2),
0205 etsumHwPt = cms.untracked.vint32( 2, 1, 204, 3, 4),
0206 etsumHwPhi = cms.untracked.vint32( 2, 1, 20, 3, 4)
0207 )
0208 )
0209
0210
0211
0212
0213 process.load('L1Trigger.L1TGlobal.simGtExtFakeProd_cfi')
0214 process.simGtExtFakeProd.bxFirst = cms.int32(-2)
0215 process.simGtExtFakeProd.bxLast = cms.int32(2)
0216 process.simGtExtFakeProd.setBptxAND = cms.bool(True)
0217 process.simGtExtFakeProd.setBptxPlus = cms.bool(True)
0218 process.simGtExtFakeProd.setBptxMinus = cms.bool(True)
0219 process.simGtExtFakeProd.setBptxOR = cms.bool(True)
0220
0221
0222
0223
0224 process.load('L1Trigger.L1TGlobal.simGtStage2Digis_cfi')
0225 process.simGtStage2Digis.useMuonShowers = cms.bool(True)
0226 process.simGtStage2Digis.PrescaleSet = cms.uint32(1)
0227 process.simGtStage2Digis.ExtInputTag = cms.InputTag("simGtExtFakeProd")
0228 process.simGtStage2Digis.MuonInputTag = cms.InputTag("gtInput")
0229 process.simGtStage2Digis.MuonShowerInputTag = cms.InputTag("gtInput")
0230 process.simGtStage2Digis.EGammaInputTag = cms.InputTag("gtInput")
0231 process.simGtStage2Digis.TauInputTag = cms.InputTag("gtInput")
0232 process.simGtStage2Digis.JetInputTag = cms.InputTag("gtInput")
0233 process.simGtStage2Digis.EtSumInputTag = cms.InputTag("gtInput")
0234 process.simGtStage2Digis.EmulateBxInEvent = cms.int32(1)
0235
0236
0237
0238
0239 process.dumpGTRecord = cms.EDAnalyzer("l1t::GtRecordDump",
0240 egInputTag = cms.InputTag("gtInput"),
0241 muInputTag = cms.InputTag("gtInput"),
0242 muShowerInputTag = cms.InputTag("gtInput"),
0243 tauInputTag = cms.InputTag("gtInput"),
0244 jetInputTag = cms.InputTag("gtInput"),
0245 etsumInputTag = cms.InputTag("gtInput"),
0246 uGtAlgInputTag = cms.InputTag("simGtStage2Digis"),
0247 uGtExtInputTag = cms.InputTag("simGtExtFakeProd"),
0248 uGtObjectMapInputTag = cms.InputTag("simGtStage2Digis"),
0249 bxOffset = cms.int32(skip),
0250 minBx = cms.int32(-2),
0251 maxBx = cms.int32(2),
0252 minBxVec = cms.int32(0),
0253 maxBxVec = cms.int32(0),
0254 dumpGTRecord = cms.bool(True),
0255 dumpGTObjectMap= cms.bool(False),
0256 dumpTrigResults= cms.bool(False),
0257 dumpVectors = cms.bool(True),
0258 tvFileName = cms.string( ("TestVector_ttBar_%03d.txt") % job ),
0259 tvVersion = cms.int32(3),
0260 ReadPrescalesFromFile = cms.bool(True),
0261 psFileName = cms.string( "prescale_L1TGlobal.csv" ),
0262 psColumn = cms.int32(1),
0263 unprescaleL1Algos = cms.bool(False),
0264 unmaskL1Algos = cms.bool(False)
0265 )
0266
0267 process.load("L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi")
0268 process.l1GtTrigReport.L1GtRecordInputTag = "simGtStage2Digis"
0269 process.l1GtTrigReport.PrintVerbosity = 2
0270 process.report = cms.Path(process.l1GtTrigReport)
0271
0272 process.MessageLogger.debugModules = ["MuCondition"]
0273
0274 if useMCtoGT:
0275 process.gtInput = process.mcL1GTinput.clone()
0276 else:
0277 process.gtInput = process.fakeL1GTinput.clone()
0278
0279
0280
0281
0282 process.load('EventFilter.L1TRawToDigi.gtStage2Raw_cfi')
0283 process.gtStage2Raw.GtInputTag = cms.InputTag("simGtStage2Digis")
0284 process.gtStage2Raw.ExtInputTag = cms.InputTag("simGtExtFakeProd")
0285 process.gtStage2Raw.EGammaInputTag = cms.InputTag("gtInput")
0286 process.gtStage2Raw.TauInputTag = cms.InputTag("gtInput")
0287 process.gtStage2Raw.JetInputTag = cms.InputTag("gtInput")
0288 process.gtStage2Raw.EtSumInputTag = cms.InputTag("gtInput")
0289 process.gtStage2Raw.MuonInputTag = cms.InputTag("gtInput")
0290 process.gtStage2Raw.MuonShowerInputTag = cms.InputTag("gtInput")
0291
0292 process.load('EventFilter.L1TRawToDigi.gtStage2Digis_cfi')
0293 process.newGtStage2Digis = process.gtStage2Digis.clone()
0294 process.newGtStage2Digis.InputLabel = cms.InputTag('gtStage2Raw')
0295
0296
0297
0298 process.dumpRaw = cms.EDAnalyzer(
0299 "DumpFEDRawDataProduct",
0300 label = cms.untracked.string("gtStage2Raw"),
0301 feds = cms.untracked.vint32 ( 1404 ),
0302 dumpPayload = cms.untracked.bool ( True )
0303 )
0304
0305 process.newDumpGTRecord = cms.EDAnalyzer("l1t::GtRecordDump",
0306 egInputTag = cms.InputTag("newGtStage2Digis","EGamma"),
0307 muInputTag = cms.InputTag("newGtStage2Digis","Muon"),
0308 muShowerInputTag = cms.InputTag("newGtStage2Digis", "MuonShower"),
0309 tauInputTag = cms.InputTag("newGtStage2Digis","Tau"),
0310 jetInputTag = cms.InputTag("newGtStage2Digis","Jet"),
0311 etsumInputTag = cms.InputTag("newGtStage2Digis","EtSum"),
0312 uGtAlgInputTag = cms.InputTag("newGtStage2Digis"),
0313 uGtExtInputTag = cms.InputTag("newGtStage2Digis"),
0314 uGtObjectMapInputTag = cms.InputTag("simGtStage2Digis"),
0315 bxOffset = cms.int32(skip),
0316 minBx = cms.int32(0),
0317 maxBx = cms.int32(0),
0318 minBxVec = cms.int32(0),
0319 maxBxVec = cms.int32(0),
0320 dumpGTRecord = cms.bool(True),
0321 dumpGTObjectMap= cms.bool(True),
0322 dumpTrigResults= cms.bool(False),
0323 dumpVectors = cms.bool(False),
0324 tvFileName = cms.string( ("TestVector_%03d.txt") % job ),
0325 ReadPrescalesFromFile = cms.bool(False),
0326 psFileName = cms.string( "prescale_L1TGlobal.csv" ),
0327 psColumn = cms.int32(1)
0328 )
0329
0330
0331
0332
0333 process.l1tGlobalAnalyzer = cms.EDAnalyzer('L1TGlobalAnalyzer',
0334 doText = cms.untracked.bool(False),
0335 gmuToken = cms.InputTag("None"),
0336 dmxEGToken = cms.InputTag("None"),
0337 dmxTauToken = cms.InputTag("None"),
0338 dmxJetToken = cms.InputTag("None"),
0339 dmxEtSumToken = cms.InputTag("None"),
0340 muToken = cms.InputTag("gtInput"),
0341 egToken = cms.InputTag("gtInput"),
0342 tauToken = cms.InputTag("gtInput"),
0343 jetToken = cms.InputTag("gtInput"),
0344 etSumToken = cms.InputTag("gtInput"),
0345 gtAlgToken = cms.InputTag("simGtStage2Digis"),
0346 emulDxAlgToken = cms.InputTag("None"),
0347 emulGtAlgToken = cms.InputTag("simGtStage2Digis")
0348 )
0349
0350
0351
0352
0353
0354 process.p1 = cms.Path(
0355
0356
0357 process.dumpMenu
0358 *process.gtInput
0359
0360 *process.simGtExtFakeProd
0361 *process.simGtStage2Digis
0362 *process.dumpGTRecord
0363
0364
0365
0366
0367
0368
0369
0370
0371 *process.l1tGlobalAnalyzer
0372
0373
0374
0375
0376 )
0377
0378
0379
0380
0381 process.schedule = cms.Schedule(
0382 process.p1
0383 )
0384
0385 if rootout:
0386 process.outpath = cms.EndPath(process.output)
0387 process.schedule.append(process.outpath)
0388
0389
0390 process.options = cms.untracked.PSet(wantSummary = cms.untracked.bool(True))
0391
0392
0393
0394
0395
0396 if dump:
0397 outfile = open('dump_runGlobalFakeInputProducer_'+repr(job)+'.py','w')
0398 print(process.dumpPython(), file=outfile)
0399 outfile.close()