Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:21

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 
0004 l1GtPatternGenerator = cms.EDAnalyzer("L1GtPatternGenerator",
0005     # input tags for various records
0006     GtInputTag = cms.InputTag("gtDigis"),
0007     GmtInputTag = cms.InputTag("gmtDigis"),
0008     GctInputTag = cms.InputTag("gctDigis"),
0009     CscInputTag = cms.InputTag("gtDigis", "CSC"),
0010     DtInputTag  = cms.InputTag("gtDigis", "DT"),
0011     RpcbInputTag  = cms.InputTag("gtDigis", "RPCb"),
0012     RpcfInputTag  = cms.InputTag("gtDigis", "RPCf"),   
0013 
0014     # file name
0015     PatternFileName = cms.string("GT_GMT_patterns.txt"),
0016 
0017     # bunch crossing numbers to write
0018     bx = cms.vint32(0),
0019 
0020     # header
0021     PatternFileHeader = cms.string(
0022 """#GT_GMT_patterns_VD
0023 #  
0024 # editors - HB 220606
0025 #  
0026 # remarks:
0027 # values in this template are for version VD (same as VB) for the cond-chips of GTL9U (from IVAN)
0028 #
0029 # syntax:
0030 # character "#" indicates a comment line
0031 # header line 1 => hardware of sim- and spy-memories
0032 # header line 2 => hardware location (FPGA-chip) of sim-memories
0033 # header line 3 => channel number of sim-memories (PSB)
0034 # header line 4 => hardware location (FPGA-chip) of spy-memories
0035 # header line 5 => name of patterns
0036 # header line 6 => number of objects (calos, muons) or other declarations
0037 # (header line 7 => only graphics)
0038 # (header line 8 => only text and graphics)
0039 # header line 9 => number of columns, starting with 0
0040 #
0041 # patterns:
0042 # values in column 0 are event numbers (decimal), starting with 0 (synchronisation data)
0043 # patterns for 1024 events (memories of cond-chips on GTL9U can contain only 1024 events) are in this file
0044 # values in columns 1-119 are the hexadecimal patterns, the rightmost digit in a string is LSB
0045 #
0046 # header:
0047 # e |<--------------------------------------------------------------------------PSB/GTL9U(REC)------------------------------------------------------------------------------------------------------------->|<--------------------------------------------------------------------------PSB/GMT(AUF,AUB)--------------------------------------------------------------------------------------------------------------------------------------------------->|<----------------------------------------------------------------GMT REGIONAL MUONs----------------------------------------------------------->|<----GMT(SORT)/GTL9U(REC)----->|<--------------GTL9U(COND)/FDL(ALGO)---------------->|<-----------FDL----------->|
0048 # v |PSB slot13/ch6+7   |PSB slot13/ch4+5   |PSB slot13/ch2+3   |PSB slot13/ch0+1   |PSB slot14/ch6+7   |PSB slot14/ch4+5   |PSB slot14/ch2+3   |PSB slot14/ch0+1   |PSB slot15/ch2+3   |PSB slot15/ch0+1   |PSB slot19/ch6+7   |PSB slot19/ch4+5   |PSB slot19/ch2+3   |PSB slot19/ch0+1   |PSB slot20/ch6+7   |PSB slot20/ch4+5   |PSB slot20/ch2+3   |PSB slot20/ch0+1   |PSB slot21/ch6+7   |PSB slot21/ch4+5   |PSB slot21/ch2+3   |PSB slot21/ch0+1   |GMT INF                            |GMT INC                            |GMT IND                            |GMT INB                            |GMT SORT                       |COND1                     |COND2                     |PSB slot9/ch0+1    |FINOR  |
0049 # e |ch6  ch7  ch6  ch7 |ch4  ch5  ch4  ch5 |ch2  ch3  ch2  ch3 |ch0  ch1  ch0  ch1 |ch6  ch7  ch6  ch7 |ch4  ch5  ch4  ch5 |ch2  ch3  ch2  ch3 |ch0  ch1  ch0  ch1 |ch2  ch3  ch2  ch3 |ch0  ch1  ch0  ch1 |ch6  ch7  ch6  ch7 |ch4  ch5  ch4  ch5 |ch2  ch3  ch2  ch3 |ch0  ch1  ch0  ch1 |ch6  ch7  ch6  ch7 |ch4  ch5  ch4  ch5 |ch2  ch3  ch2  ch3 |ch0  ch1  ch0  ch1 |ch6  ch7  ch6  ch7 |ch4  ch5  ch4  ch5 |ch2  ch3  ch2  ch3 |ch0  ch1  ch0  ch1 |                                   |                                   |                                   |                                   |                               |                          |                          |ch0  ch1  ch0  ch1 |       |
0050 # n |GTL9U REC1         |GTL9U REC1         |GTL9U REC2         |GTL9U REC2         |GTL9U REC2         |GTL9U REC2         |GTL9U REC3         |GTL9U REC3         |GTL9U REC3         |GTL9U REC3         |GMT AUF            |GMT AUF            |GMT AUB            |GMT AUB            |GMT AUF            |GMT AUF            |GMT AUB            |GMT AUB            |GMT AUF            |GMT AUF            |GMT AUB            |GMT AUB            |                                   |                                   |                                   |                                   |GTL9U REC1                     |FDL ALGO                  |FDL ALGO                  |FDL ALGO           |       |
0051 # t |calo1 (ieg)        |calo2 (eg)         |calo3 (jet)        |calo4 (fwdjet)     |calo5 (tau)        |calo6 (esums)      |calo7 (hfbc/etsums)|calo8 (free)       |calo9 (totem)      |calo10 (free)      |MQF4               |MQF3               |MQB2               |MQB1               |MQF8               |MQF7               |MQB6               |MQB5               |MQF12              |MQF11              |MQB10              |MQB9               |RPC forward                        |CSC                                |DT                                 |RPC barrel                         |muon (sorted four)             |algo                      |algo                      |techtrigger        |       |
0052 #   | 1    2    3    4  | 1    2    3    4  | 1    2    3    4  | 1    2    3    4  | 1    2    3    4  | 1    2    3    4  | 1    2    3    4  | 1    2    3    4  | 1    2    3    4  | 1    2    3    4  |45M  45Q   6M   6Q |45M  45Q   6M   6Q |01M  01Q  23M  23Q |01M  01Q  23M  23Q |45M  45Q   6M   6Q |45M  45Q   6M   6Q |01M  01Q  23M  23Q |01M  01Q  23M  23Q |45M  45Q   6M   6Q |45M  45Q   6M   6Q |01M  01Q  23M  23Q |01M  01Q  23M  23Q |   1        2        3        4    |   1        2        3        4    |   1        2        3        4    |   1        2        3        4    |   1       2       3       4   |191--160 159--128 127---96|95----64 63----32 31-----0|15-0 47-32 31-16 63-48|    |
0053 #   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                                   |                                   |                                   |                                   |                               |                          |                          |                   |       |
0054 # columns:              |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                   |                                   |                                   |                                   |                                   |                               |                          |                          |                   |       |
0055 # 0 | 1    2    3    4  | 5    6    7    8  | 9    10   11   12 | 13   14   15   16 | 17   18   19   20 | 21   22   23   24 | 25   26   27   28 | 29   30   31   32 | 33   34   35   36 | 37   38   39   40 | 41   42   43   44 | 45   46   47   48 | 49   50   51   52 | 53   54   55   56 | 57   58   59   60 | 61   62   63   64 | 65   66   67   68 | 69   70   71   72 | 73   74   75   76 | 77   78   79   80 | 81   82   83   84 | 85   86   87   88 |   89       90       91       92   |   93       94       95       96   |   97       98       99      100   |  101      102      103      104   |  105     106     107     108  |  109      110      111   |   112      113      114  | 115  116  117  118|119    |
0056 """),
0057 
0058    # footer                                      
0059    PatternFileFooter = cms.string(""),
0060 
0061    # A vector of column names to be written for each pattern file line
0062    PatternFileColumns = cms.vstring(),
0063    # A vector of the lengths (in bits!) of each column
0064    PatternFileLengths = cms.vuint32(),
0065    # A vector of default values for each column
0066    PatternFileDefaultValues = cms.vuint32(),
0067 
0068    # By default, do not add comments with detailed information
0069    DebugOutput = cms.bool(False)
0070 )
0071 
0072 def addBlock(analyzer, name, count, length, default):
0073     for i in range(1,count+1):
0074         analyzer.PatternFileColumns.append("%s%d" % (name, i))
0075         analyzer.PatternFileLengths.append(length)
0076         analyzer.PatternFileDefaultValues.append(default)
0077 
0078 def addPSB(analyzer, name):
0079     addBlock(analyzer, name, 4, 16, 0)
0080 
0081 
0082 def addRegionalMuons(analyzer, name):
0083     # regional muons are different - they need to have a default of 0x0000ff00 when
0084     # empty to make input cable disconnects recognizable
0085     addBlock(analyzer, name, 4, 32, 0x0000ff00)
0086 
0087 def addGMTMuons(analyzer, name):
0088     addBlock(analyzer, name, 4, 26, 0)
0089 
0090 # set up format:
0091 fields   = l1GtPatternGenerator.PatternFileColumns
0092 lengths  = l1GtPatternGenerator.PatternFileLengths
0093 defaults = l1GtPatternGenerator.PatternFileDefaultValues
0094 
0095 # column 1..20: some fairly standard PSBs (calo1 - calo5)
0096 for name in [ "gctIsoEm", "gctEm", "cenJet", "forJet", "tauJet" ]:
0097     addPSB(l1GtPatternGenerator, name)
0098 
0099 # then the energy sums, which are slightly more complicated
0100 # (calo6)
0101 fields   += ["etTotal1", "etMiss1", "etHad1", "etMissPhi1"]
0102 lengths  += [        16,       16,        16,           16]
0103 defaults += [        0,       0,        0,           0]
0104 
0105 # HF bit counts / etsums (which are mangled in the C++ code)
0106 # (calo7)
0107 fields   += [ "hfPsbValue1_l", "htMiss1", "hfPsbValue1_h", "unknown"]
0108 lengths  += [             16,        16,             16,         16]
0109 defaults += [              0,         0,              0,          0]
0110 
0111 # calo8 - free
0112 addPSB(l1GtPatternGenerator, "unknown")
0113 
0114 # calo9 - "totem", currently
0115 addPSB(l1GtPatternGenerator, "unknown")
0116 
0117 # calo 10 
0118 # BPTX/Castor and TBD data - default to 0xffff to get BPTX triggers matching GT emulator
0119 addBlock(l1GtPatternGenerator, "unknown", 4, 16, 0xffff)
0120 
0121 # 12 more PSBs we don't fill
0122 for i in range(12):
0123     addPSB(l1GtPatternGenerator, "unknown")
0124 
0125 # regional muons
0126 addRegionalMuons(l1GtPatternGenerator, "fwdMuon")
0127 addRegionalMuons(l1GtPatternGenerator, "cscMuon")
0128 addRegionalMuons(l1GtPatternGenerator, "dtMuon")
0129 addRegionalMuons(l1GtPatternGenerator, "brlMuon")
0130 
0131 # global muons
0132 addGMTMuons(l1GtPatternGenerator, "gmtMuon")
0133 
0134 # GT stuff
0135 addBlock(l1GtPatternGenerator, "gtDecisionExt", 2, 32, 0)
0136 addBlock(l1GtPatternGenerator, "gtDecision", 4, 32, 0)
0137 
0138 # tech triggers: a bit complicated, since we like to mix up
0139 #                half-words (see header)
0140 fields   += ["gtTechTrigger1_l", "gtTechTrigger2_l", "gtTechTrigger1_h", "gtTechTrigger2_h"]
0141 lengths  += [                16,                 16,                 16,                 16]
0142 defaults += [                 0,                  0,                  0,                  0]
0143 
0144 fields   += ["gtFinalOr"]
0145 lengths  += [          9]
0146 defaults += [          0]
0147 
0148 # just to make sure the python magic adds up to the proper output format
0149 if len(fields) != 119:
0150     raise ValueError("Expecting 119 data fields (120 - event number) in pattern file format, got %d!" % len(fields) )
0151 
0152 # For debugging: Get an overview of your pattern file format
0153 #print fields
0154 #print lengths
0155 #print defaults