Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-04 04:35:08

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 _eventsPerFile = 12
0004 _gttLatency = 156+120
0005 _gttNumberOfPVs = 10
0006 
0007 #####################################################################################################################
0008 ## Barrel configurations: 54 regions, 6 puppi output links, only write out the layer 1 outputs for now
0009 _barrelWriterOutputOnly = cms.PSet(
0010     partition = cms.string("Barrel"),
0011     tmuxFactor = cms.uint32(6),
0012     outputLinksPuppi = cms.vuint32(*range(6)),
0013     outputLinkEgamma = cms.int32(6),
0014     nEgammaObjectsOut = cms.uint32(16),
0015     nInputFramesPerBX = cms.uint32(9),
0016     nOutputFramesPerBX = cms.uint32(9),
0017     fileFormat = cms.string("EMPv2"),
0018     inputFileExtension = cms.string("txt.gz"),
0019     outputFileExtension = cms.string("txt.gz"),
0020     maxLinesPerInputFile = cms.uint32(1024),
0021     maxLinesPerOutputFile = cms.uint32(1024),
0022     eventsPerFile = cms.uint32(_eventsPerFile),
0023     tfTimeSlices = cms.VPSet(),
0024     gctNLinksEcal = cms.uint32(1),
0025     gctNLinksHad = cms.uint32(2),
0026     gctSectors = cms.VPSet(),
0027     gmtTimeSlices = cms.VPSet(),
0028     gmtNumberOfMuons = cms.uint32(12),
0029     gttLink = cms.int32(-1),
0030     gttLatency = cms.uint32(156+10),
0031     gttNumberOfPVs = cms.uint32(_gttNumberOfPVs),
0032 )
0033 ## Barrel (54) split in 3 phi slices
0034 barrelWriterOutputOnlyPhiConfigs = [
0035     _barrelWriterOutputOnly.clone(
0036         outputRegions = cms.vuint32(*[3*ip+9*ie+i for ie in range(6) for i in range(3) ]),
0037         outputBoard = cms.int32(ip),
0038         outputFileName = cms.string("l1BarrelPhi%d-outputs" % (ip+1))
0039     ) for ip in range(3)
0040 ]
0041 
0042 barrelSerenityPhi1Config = barrelWriterOutputOnlyPhiConfigs[0].clone(
0043     tfTimeSlices = cms.VPSet(*[cms.PSet(tfSectors = cms.VPSet(*[ cms.PSet(tfLink = cms.int32(-1)) for s in range(18) ])) for t in range(3)]),
0044     gctSectors = cms.VPSet(*[cms.PSet(
0045         gctLinksHad = cms.vint32(-1,-1),
0046         gctLinksEcal = cms.vint32(-1),
0047         ) for s in range(3)]),
0048     gmtTimeSlices = cms.VPSet(*[cms.PSet(gmtLink = cms.int32(4*17+t)) for t in range(3)]),
0049 )
0050 barrelSerenityVU9PPhi1Config = barrelSerenityPhi1Config.clone(
0051     gttLink = cms.int32(4*28+3),
0052     inputFileName = cms.string("l1BarrelPhi1Serenity-inputs-vu9p"),
0053     outputFileName = cms.string("l1BarrelPhi1Serenity-outputs")
0054 )
0055 barrelSerenityVU13PPhi1Config = barrelSerenityPhi1Config.clone(
0056     gttLink = cms.int32(4*25+3),
0057     gmtTimeSlices = cms.VPSet(*[cms.PSet(gmtLink = cms.int32(4*18+t)) for t in range(3)]),
0058     inputFileName = cms.string("l1BarrelPhi1Serenity-inputs-vu13p"),
0059 )
0060 for t in range(3):
0061    for ie in range(2):
0062     for i,s in enumerate([8, 0, 1, 2, 3]):
0063         loglink = 3*(i+5*ie)+t
0064         physlink = loglink+4*1 if loglink < 15 else (loglink-15)+4*25
0065         barrelSerenityVU9PPhi1Config.tfTimeSlices[t].tfSectors[s+9*ie].tfLink = physlink
0066         physlink = loglink+4*0 if loglink < 15 else (loglink-15)+4*28
0067         barrelSerenityVU13PPhi1Config.tfTimeSlices[t].tfSectors[s+9*ie].tfLink = physlink
0068 for i,s in enumerate([0,1]):
0069    barrelSerenityVU9PPhi1Config.gctSectors[s].gctLinksHad  = [3*i+4*18, 3*i+4*18+1]
0070    barrelSerenityVU9PPhi1Config.gctSectors[s].gctLinksEcal = [3*i+4*18+2]
0071    gctLinks = list(range(4*17,4*17+4)) + list(range(4*19,4*19+2))
0072    barrelSerenityVU13PPhi1Config.gctSectors[s].gctLinksHad  = [gctLinks[3*i], gctLinks[3*i+1]]
0073    barrelSerenityVU13PPhi1Config.gctSectors[s].gctLinksEcal = [gctLinks[3*i+2]]
0074 
0075 barrelWriterConfigs =  barrelWriterOutputOnlyPhiConfigs
0076 
0077 
0078 #####################################################################################################################
0079 ## HGcal configuration: write out both inputs and outputs
0080 _hgcalWriterConfig = cms.PSet(
0081     partition = cms.string("HGCal"),
0082     tmuxFactor = cms.uint32(6),
0083     nEgammaObjectsOut = cms.uint32(16),
0084     nInputFramesPerBX = cms.uint32(9),
0085     nOutputFramesPerBX = cms.uint32(9),
0086     fileFormat = cms.string("EMPv2"),
0087     inputFileExtension = cms.string("txt.gz"),
0088     outputFileExtension = cms.string("txt.gz"),
0089     maxLinesPerInputFile = cms.uint32(1024),
0090     maxLinesPerOutputFile = cms.uint32(1024),
0091     eventsPerFile = cms.uint32(_eventsPerFile),
0092     tfTimeSlices = cms.VPSet(*[cms.PSet(tfSectors = cms.VPSet()) for i in range(3)]),
0093     hgcTimeSlices = cms.VPSet(*[cms.PSet(hgcSectors = cms.VPSet()) for i in range(3)]),
0094     gmtTimeSlices = cms.VPSet(*[cms.PSet(gmtLink = cms.int32(-1)) for i in range(3)]),
0095     gmtNumberOfMuons = cms.uint32(12),
0096     gttLink = cms.int32(-1),
0097     gttLatency = cms.uint32(_gttLatency),
0098     gttNumberOfPVs = cms.uint32(_gttNumberOfPVs),
0099     outputLinksPuppi = cms.vuint32(*range(3)),
0100     outputLinkEgamma = cms.int32(3),
0101 )
0102 ## Ideal configuration: 27 input links from tf, 36 from hgc, 3 from gmt, 1 from gtt, in this order; output 3 puppi + 1 e/gamma
0103 _hgcalPosWriterConfig = _hgcalWriterConfig.clone(
0104     outputRegions = cms.vuint32(*[i+9 for i in range(9)]),
0105     outputBoard = cms.int32(1),
0106 )
0107 _hgcalNegWriterConfig = _hgcalPosWriterConfig.clone(
0108     outputRegions = [i for i in range(9)],
0109     outputBoard = 0,
0110 )
0111 hgcalPosOutputWriterConfig = _hgcalPosWriterConfig.clone(
0112    outputFileName = cms.string("l1HGCalPos-outputs") 
0113 )
0114 hgcalNegOutputWriterConfig = _hgcalNegWriterConfig.clone(
0115    outputFileName = cms.string("l1HGCalNeg-outputs") 
0116 )
0117 ## Current configurations for VU9P
0118 hgcalPosVU9PWriterConfig = _hgcalPosWriterConfig.clone()
0119 hgcalNegVU9PWriterConfig = _hgcalNegWriterConfig.clone()
0120 for t in range(3):
0121     hgcalPosVU9PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(-1))         for i in range(9) ] # neg
0122     hgcalPosVU9PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(3*i+t+4*1))  for i in range(4) ] # pos, left quads
0123     hgcalPosVU9PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(3*i+t+4*26)) for i in range(5) ] # pos, right quads
0124     hgcalNegVU9PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(3*i+t+4*1))  for i in range(4) ] # neg, left quads
0125     hgcalNegVU9PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(3*i+t+4*26)) for i in range(5) ] # neg, right quads
0126     hgcalNegVU9PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(-1))         for i in range(9) ] # pos
0127     hgcQuads =  [list(range(4*i,4*i+4)) for i in [10,11,12,13]]
0128     hgcQuads += [[4*14+1,4*14+2,4*14+3,4*15+3]] # mixed quad
0129     hgcQuads += [list(range(4*i,4*i+4)) for i in [16,17,18,19]]
0130     hgcalPosVU9PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(-1,-1,-1,-1))      for i in range(3) ] # neg
0131     hgcalPosVU9PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(*hgcQuads[3*i+t])) for i in range(3) ] # pos
0132     hgcalNegVU9PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(*hgcQuads[3*i+t])) for i in range(3) ] # neg
0133     hgcalNegVU9PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(-1,-1,-1,-1))      for i in range(3) ] # pos
0134     hgcalPosVU9PWriterConfig.gmtTimeSlices[t].gmtLink = cms.int32(4*15+((t+2)%3))
0135     hgcalNegVU9PWriterConfig.gmtTimeSlices[t].gmtLink = cms.int32(4*15+((t+2)%3))
0136 hgcalPosVU9PWriterConfig.gttLink = 4*14+0
0137 hgcalNegVU9PWriterConfig.gttLink = 4*14+0
0138 hgcalPosVU9PWriterConfig.inputFileName = cms.string("l1HGCalPos-inputs-vu9p") 
0139 hgcalNegVU9PWriterConfig.inputFileName = cms.string("l1HGCalNeg-inputs-vu9p") 
0140 ## Current configurations for VU13P 
0141 hgcalPosVU13PWriterConfig = _hgcalPosWriterConfig.clone()
0142 hgcalNegVU13PWriterConfig = _hgcalNegWriterConfig.clone()
0143 for t in range(3):
0144     hgcalPosVU13PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(-1))         for i in range(9) ] # neg
0145     hgcalPosVU13PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(3*i+t+4*0))  for i in range(5) ] # pos, left quads
0146     hgcalPosVU13PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(3*i+t+4*28)) for i in range(4) ] # pos, right quads
0147     hgcalNegVU13PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(3*i+t+4*0))  for i in range(5) ] # neg, left quads
0148     hgcalNegVU13PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(3*i+t+4*28)) for i in range(4) ] # neg, right quads
0149     hgcalNegVU13PWriterConfig.tfTimeSlices[t].tfSectors += [ cms.PSet(tfLink = cms.int32(-1))         for i in range(9) ] # pos
0150     hgcQuads =  [list(range(4*i,4*i+4)) for i in [12,13,14,  16,17,  19,20,21,22]]
0151     hgcalPosVU13PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(-1,-1,-1,-1)) for i in range(3) ] # neg
0152     hgcalPosVU13PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(*hgcQuads[3*i+t])) for i in range(3) ] # pos
0153     hgcalNegVU13PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(*hgcQuads[3*i+t])) for i in range(3) ] # neg
0154     hgcalNegVU13PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(-1,-1,-1,-1)) for i in range(3) ] # pos
0155     hgcalPosVU13PWriterConfig.gmtTimeSlices[t].gmtLink = cms.int32(4*18+t)
0156     hgcalNegVU13PWriterConfig.gmtTimeSlices[t].gmtLink = cms.int32(4*18+t)
0157 hgcalPosVU13PWriterConfig.gttLink = 4*25+3
0158 hgcalNegVU13PWriterConfig.gttLink = 4*25+3
0159 hgcalPosVU13PWriterConfig.inputFileName = cms.string("l1HGCalPos-inputs-vu13p") 
0160 hgcalNegVU13PWriterConfig.inputFileName = cms.string("l1HGCalNeg-inputs-vu13p") 
0161 
0162 ## Enable outputs and both boards
0163 hgcalWriterConfigs = [ 
0164     hgcalPosOutputWriterConfig, 
0165     hgcalNegOutputWriterConfig, 
0166     hgcalPosVU9PWriterConfig,
0167     hgcalNegVU9PWriterConfig,
0168     hgcalPosVU13PWriterConfig,
0169     hgcalNegVU13PWriterConfig
0170 ]
0171 
0172 #####################################################################################################################
0173 ## Forward HGCal configuration: only outputs for now, 18 regions, 12 candidates x region, 4 output fibers
0174 _hgcalNoTKWriterConfig = cms.PSet(
0175     partition = cms.string("HGCalNoTk"),
0176     tmuxFactor = cms.uint32(6),
0177     outputRegions = cms.vuint32(*range(18)),
0178     nInputFramesPerBX = cms.uint32(9),
0179     nOutputFramesPerBX = cms.uint32(9),
0180     fileFormat = cms.string("EMPv2"),
0181     inputFileExtension = cms.string("txt.gz"),
0182     outputFileExtension = cms.string("txt.gz"),
0183     maxLinesPerInputFile = cms.uint32(1024),
0184     maxLinesPerOutputFile = cms.uint32(1024),
0185     eventsPerFile = cms.uint32(_eventsPerFile),
0186     hgcTimeSlices = cms.VPSet(*[cms.PSet(hgcSectors = cms.VPSet()) for i in range(3)]),
0187     gmtTimeSlices = cms.VPSet(*[cms.PSet(gmtLink = cms.int32(-1)) for  i in range(3)]),
0188     gmtNumberOfMuons = cms.uint32(12),
0189     #gttLink = cms.int32(-1),
0190     #gttLatency = cms.uint32(_gttLatency),
0191     #gttNumberOfPVs = cms.uint32(_gttNumberOfPVs),
0192 )
0193 hgcalNoTKOutputWriterConfig = _hgcalNoTKWriterConfig.clone(
0194     outputLinksPuppi = cms.vuint32(*range(4)),
0195     outputFileName = cms.string("l1HGCalNoTK-outputs")
0196 )
0197 hgcalNoTKVU13PWriterConfig = _hgcalNoTKWriterConfig.clone()
0198 for t in range(3):
0199     for isec in range(6):
0200         q0 = 3*isec + (6 if isec < 3 else 8)
0201         hgcalNoTKVU13PWriterConfig.hgcTimeSlices[t].hgcSectors += [ cms.PSet(hgcLinks = cms.vint32(*[4*q0+4*t+j for j in range(4)])) ]
0202 hgcalNoTKVU13PWriterConfig.inputFileName = cms.string("l1HGCalNoTK-inputs-vu13p") # vu9p uses the same cabling for now
0203 
0204 hgcalNoTKWriterConfigs = [ 
0205     hgcalNoTKOutputWriterConfig,
0206     hgcalNoTKVU13PWriterConfig
0207 ]
0208 
0209 #####################################################################################################################
0210 ## TM18 configuration
0211 _barrelSerenityTM18 = _barrelWriterOutputOnly.clone(
0212     tmuxFactor = cms.uint32(18),
0213     tfTimeSlices = None,
0214     tfSectors = cms.VPSet(*[cms.PSet(tfLink = cms.int32(-1)) for i in range(18)]),
0215     gmtTimeSlices = None,
0216     gmtLink = cms.int32(4*18+0),
0217     gttLink = 4*28+3,
0218     eventsPerFile = 4,
0219 )
0220 barrelSerenityOutputTM18WriterConfig = _barrelSerenityTM18.clone(
0221     outputRegions = cms.vuint32(*range(54)),
0222     outputBoard = cms.int32(0),
0223     outputFileName = cms.string("l1BarrelSerenityTM18-outputs")
0224 )
0225 barrelSerenityVU13PTM18WriterConfig = _barrelSerenityTM18.clone(
0226     inputFileName = cms.string("l1BarrelSerenityTM18-inputs-vu13p"),
0227     gttLatency = cms.uint32(167), # shorter, to fit 6 events in 1024 lines
0228     maxLinesPerInputFile = cms.uint32(1024+167), # anything beyond 986 will be nulls
0229     gctNLinksEcal = 1,
0230     gctNLinksHad = 1,
0231     gctSectors = cms.VPSet(*[cms.PSet(
0232         gctLinksHad = cms.vint32(4*18+1+s),
0233         gctLinksEcal = cms.vint32(4*18+1+s),
0234     ) for s in range(3)]),
0235 )
0236 for ie in range(2):
0237     for iphi in range(9):
0238         isec = 9*ie+iphi 
0239         barrelSerenityVU13PTM18WriterConfig.tfSectors[isec].tfLink = (isec if isec < 12 else (4*30+(isec-12)))
0240 
0241 barrelSerenityTM18WriterConfigs = [
0242     barrelSerenityOutputTM18WriterConfig,
0243     barrelSerenityVU13PTM18WriterConfig
0244 ]
0245 
0246 _hgcalWriterTM18 = _hgcalWriterConfig.clone(
0247     tmuxFactor = cms.uint32(18),
0248     tfTimeSlices = None,
0249     tfSectors = cms.VPSet(*[cms.PSet(tfLink = cms.int32(-1)) for i in range(18)]),
0250     hgcTimeSlices = None,
0251     hgcSectors = cms.VPSet(*[cms.PSet(hgcLinks = cms.vint32()) for i in range(6)]),
0252     gmtTimeSlices = None,
0253     gmtLink = cms.int32(4*27+0),
0254     gttLink = 4*27+3,
0255     eventsPerFile = 4,
0256 )
0257 hgcalWriterOutputTM18WriterConfig = _hgcalWriterTM18.clone(
0258    outputFileName = cms.string("l1HGCalTM18-outputs"),
0259    outputRegions = cms.vuint32(*range(18)),
0260    outputLinksPuppi = cms.vuint32(*range(2)),
0261    outputLinkEgamma = cms.int32(2),
0262 )
0263 hgcalWriterVU9PTM18WriterConfig = _hgcalWriterTM18.clone(
0264    inputFileName = cms.string("l1HGCalTM18-inputs-vu9p"),
0265    gttLatency = cms.uint32(167), # shorter, to fit 6 events in 1024 lines
0266    maxLinesPerInputFile = cms.uint32(1024+167), # anything beyond 986 will be nulls
0267    gmtLink = 4*15+2,
0268    gttLink = 0,
0269 )
0270 hgcalWriterVU13PTM18WriterConfig = hgcalWriterVU9PTM18WriterConfig.clone(
0271    inputFileName = cms.string("l1HGCalTM18-inputs-vu13p"),
0272    gmtLink = 4*18+0,
0273    gttLink = 4*28+3,
0274 )
0275 for ie in range(2):
0276     for iphi in range(9):
0277         isec, ilink = 9*ie+iphi, 2*iphi+ie
0278         hgcalWriterVU9PTM18WriterConfig.tfSectors[isec].tfLink = (ilink+2 if ilink < 10 else (4*28+(ilink-10)))
0279         hgcalWriterVU13PTM18WriterConfig.tfSectors[isec].tfLink = (ilink if ilink < 12 else (4*30+(ilink-12)))
0280     for iphi in range(3):
0281         isec, ilink = 3*ie+iphi, 2*iphi+ie
0282         if ilink < 2:
0283             hgcalWriterVU9PTM18WriterConfig.hgcSectors[isec].hgcLinks += range(4*(12+ilink),4*(12+ilink)+4)
0284         else:
0285             hgcalWriterVU9PTM18WriterConfig.hgcSectors[isec].hgcLinks += range(4*(14+ilink),4*(14+ilink)+4)
0286         if ilink < 3:
0287             hgcalWriterVU13PTM18WriterConfig.hgcSectors[isec].hgcLinks += range(4*(12+ilink),4*(12+ilink)+4)
0288         elif ilink < 5:
0289             hgcalWriterVU13PTM18WriterConfig.hgcSectors[isec].hgcLinks += range(4*(13+ilink),4*(13+ilink)+4)
0290         else:
0291             hgcalWriterVU13PTM18WriterConfig.hgcSectors[isec].hgcLinks += range(4*(14+ilink),4*(14+ilink)+4)
0292 
0293 hgcalTM18WriterConfigs = [
0294     hgcalWriterOutputTM18WriterConfig,
0295     hgcalWriterVU9PTM18WriterConfig,
0296     hgcalWriterVU13PTM18WriterConfig
0297 ]
0298 hgcalNoTKOutputTM18WriterConfig = _hgcalWriterTM18.clone(
0299    outputFileName = cms.string("l1HGCalTM18-outputs-fwd"),
0300    outputRegions = cms.vuint32(*range(18)),
0301    outputBoard = cms.int32(-1),#0,1),
0302    outputLinksPuppi = cms.vuint32(*range(2)),
0303    outputLinkEgamma = cms.int32(-1),
0304 )
0305 
0306 #####################################################################################################################
0307 ## HF configuration (to be better defined later)
0308 #####################################################################################################################
0309 ## HF configuration not realistic, 3 links per endcap, write out the layer 1 outputs for now
0310 _hfWriterOutputOnly = cms.PSet(
0311     partition = cms.string("HF"),
0312     tmuxFactor = cms.uint32(6),
0313     outputLinksPuppi = cms.vuint32(*range(3)),
0314     nOutputFramesPerBX = cms.uint32(9),
0315     fileFormat = cms.string("EMPv2"),
0316     outputFileExtension = cms.string("txt.gz"),
0317     maxLinesPerOutputFile = cms.uint32(1024),
0318     eventsPerFile = cms.uint32(_eventsPerFile),
0319 )
0320 hfWriterConfigs = [
0321     _hfWriterOutputOnly.clone(
0322         outputRegions = cms.vuint32(*[9*ie+i for i in range(9)]),
0323         outputFileName = cms.string("l1HF%s-outputs" % ("Pos" if ie else "Neg")),
0324     ) for ie in range(2)
0325 ]
0326 
0327