Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:54

0001 #include "EventFilter/L1TRawToDigi/interface/OmtfLinkMappingCsc.h"
0002 
0003 namespace omtf {
0004 
0005   MapEleIndex2CscDet mapEleIndex2CscDet() {
0006     MapEleIndex2CscDet result;
0007     for (unsigned int fed = 1380; fed <= 1381; fed++) {
0008       //Endcap label. 1=forward (+Z); 2=backward (-Z)
0009       unsigned int endcap = (fed == 1380) ? 2 : 1;
0010       for (unsigned int amc = 1; amc <= 6; amc++) {
0011         for (unsigned int link = 0; link <= 34; link++) {
0012           unsigned int stat = 0;
0013           unsigned int ring = 0;
0014           unsigned int cham = 0;
0015           switch (link) {
0016             case (0): {
0017               stat = 1;
0018               ring = 2;
0019               cham = 3;
0020               break;
0021             }  //  (0,  9, 2, 3 ), --channel_0  OV1A_4 chamber_ME1/2/3  layer_9 input 2, 3
0022             case (1): {
0023               stat = 1;
0024               ring = 2;
0025               cham = 4;
0026               break;
0027             }  //  (1,  9, 4, 5 ), --channel_1  OV1A_5 chamber_ME1/2/4  layer_9 input 4, 5
0028             case (2): {
0029               stat = 1;
0030               ring = 2;
0031               cham = 5;
0032               break;
0033             }  //  (2,  9, 6, 7 ), --channel_2  OV1A_6 chamber_ME1/2/5  layer_9 input 6, 7
0034             case (3): {
0035               stat = 1;
0036               ring = 3;
0037               cham = 3;
0038               break;
0039             }  //  (3,  6, 2, 3 ), --channel_3  OV1A_7 chamber_ME1/3/3  layer_6 input 2, 3
0040             case (4): {
0041               stat = 1;
0042               ring = 3;
0043               cham = 4;
0044               break;
0045             }  //  (4,  6, 4, 5 ), --channel_4  OV1A_8 chamber_ME1/3/4  layer_6 input 4, 5
0046             case (5): {
0047               stat = 1;
0048               ring = 3;
0049               cham = 5;
0050               break;
0051             }  //  (5,  6, 6, 7 ), --channel_5  OV1A_9 chamber_ME1/3/5  layer_6 input 6, 7
0052             case (6): {
0053               stat = 1;
0054               ring = 2;
0055               cham = 6;
0056               break;
0057             }  //  (6,  9, 8, 9 ), --channel_6  OV1B_4 chamber_ME1/2/6  layer_9 input 8, 9
0058             case (7): {
0059               stat = 1;
0060               ring = 2;
0061               cham = 7;
0062               break;
0063             }  //  (7,  9, 10,11), --channel_7  OV1B_5 chamber_ME1/2/7  layer_9 input 10,11
0064             case (8): {
0065               stat = 1;
0066               ring = 2;
0067               cham = 8;
0068               break;
0069             }  //  (8,  9, 12,13), --channel_8  OV1B_6 chamber_ME1/2/8  layer_9 input 12,13
0070             case (9): {
0071               stat = 1;
0072               ring = 3;
0073               cham = 6;
0074               break;
0075             }  //  (9,  6, 8, 9 ), --channel_9  OV1B_7 chamber_ME1/3/6  layer_6 input 8, 9
0076             case (10): {
0077               stat = 1;
0078               ring = 3;
0079               cham = 7;
0080               break;
0081             }  //  (10, 6, 10,11), --channel_10 OV1B_8 chamber_ME1/3/7  layer_6 input 10,11
0082             case (11): {
0083               stat = 1;
0084               ring = 3;
0085               cham = 8;
0086               break;
0087             }  //  (11, 6, 12,13), --channel_11 OV1B_9 chamber_ME1/3/8  layer_6 input 12,13
0088             case (12): {
0089               stat = 2;
0090               ring = 2;
0091               cham = 3;
0092               break;
0093             }  //  (12, 7, 2, 3 ), --channel_0  OV2_4  chamber_ME2/2/3  layer_7 input 2, 3
0094             case (13): {
0095               stat = 2;
0096               ring = 2;
0097               cham = 4;
0098               break;
0099             }  //  (13, 7, 4, 5 ), --channel_1  OV2_5  chamber_ME2/2/4  layer_7 input 4, 5
0100             case (14): {
0101               stat = 2;
0102               ring = 2;
0103               cham = 5;
0104               break;
0105             }  //  (14, 7, 6, 7 ), --channel_2  OV2_6  chamber_ME2/2/5  layer_7 input 6, 7
0106             case (15): {
0107               stat = 2;
0108               ring = 2;
0109               cham = 6;
0110               break;
0111             }  //  (15, 7, 8, 9 ), --channel_3  OV2_7  chamber_ME2/2/6  layer_7 input 8, 9
0112             case (16): {
0113               stat = 2;
0114               ring = 2;
0115               cham = 7;
0116               break;
0117             }  //  (16, 7, 10,11), --channel_4  OV2_8  chamber_ME2/2/7  layer_7 input 10,11
0118             case (17): {
0119               stat = 2;
0120               ring = 2;
0121               cham = 8;
0122               break;
0123             }  //  (17, 7, 12,13), --channel_5  OV2_9  chamber_ME2/2/8  layer_7 input 12,13
0124             case (18): {
0125               stat = 3;
0126               ring = 2;
0127               cham = 3;
0128               break;
0129             }  //  (18, 8, 2, 3 ), --channel_6  OV3_4  chamber_ME3/2/3  layer_8 input 2, 3
0130             case (19): {
0131               stat = 3;
0132               ring = 2;
0133               cham = 4;
0134               break;
0135             }  //  (19, 8, 4, 5 ), --channel_7  OV3_5  chamber_ME3/2/4  layer_8 input 4, 5
0136             case (20): {
0137               stat = 3;
0138               ring = 2;
0139               cham = 5;
0140               break;
0141             }  //  (20, 8, 6, 7 ), --channel_8  OV3_6  chamber_ME3/2/5  layer_8 input 6, 7
0142             case (21): {
0143               stat = 3;
0144               ring = 2;
0145               cham = 6;
0146               break;
0147             }  //  (21, 8, 8, 9 ), --channel_9  OV3_7  chamber_ME3/2/6  layer_8 input 8, 9
0148             case (22): {
0149               stat = 3;
0150               ring = 2;
0151               cham = 7;
0152               break;
0153             }  //  (22, 8, 10,11), --channel_10 OV3_8  chamber_ME3/2/7  layer_8 input 10,11
0154             case (23): {
0155               stat = 3;
0156               ring = 2;
0157               cham = 8;
0158               break;
0159             }  //  (23, 8, 12,13), --channel_11 OV3_9  chamber_ME3/2/8  layer_8 input 12,13
0160             case (24): {
0161               stat = 4;
0162               ring = 2;
0163               cham = 3;
0164               break;
0165             }  //--(24,  ,      ), --channel_3  OV4_4  chamber_ME4/2/3  layer   input
0166             case (25): {
0167               stat = 4;
0168               ring = 2;
0169               cham = 4;
0170               break;
0171             }  //--(25,  ,      ), --channel_4  OV4_5  chamber_ME4/2/4  layer   input
0172             case (26): {
0173               stat = 4;
0174               ring = 2;
0175               cham = 5;
0176               break;
0177             }  //--(26,  ,      ), --channel_5  OV4_6  chamber_ME4/2/5  layer   input
0178             case (27): {
0179               stat = 4;
0180               ring = 2;
0181               cham = 6;
0182               break;
0183             }  //--(27,  ,      ), --channel_7  OV4_7  chamber_ME4/2/6  layer   input
0184             case (28): {
0185               stat = 4;
0186               ring = 2;
0187               cham = 7;
0188               break;
0189             }  //--(28,  ,      ), --channel_8  OV4_8  chamber_ME4/2/7  layer   input
0190             case (29): {
0191               stat = 4;
0192               ring = 2;
0193               cham = 8;
0194               break;
0195             }  //--(29,  ,      ), --channel_9  OV4_9  chamber_ME4/2/8  layer   input
0196             case (30): {
0197               stat = 1;
0198               ring = 2;
0199               cham = 2;
0200               break;
0201             }  //  (30, 9, 0, 1 ), --channel_0  OV1B_6 chamber_ME1/2/2  layer_9 input 0, 1
0202             case (31): {
0203               stat = 1;
0204               ring = 3;
0205               cham = 2;
0206               break;
0207             }  //  (31, 6, 0, 1 ), --channel_1  OV1B_9 chamber_ME1/3/2  layer_6 input 0, 1
0208             case (32): {
0209               stat = 2;
0210               ring = 2;
0211               cham = 2;
0212               break;
0213             }  //  (32, 7, 0, 1 ), --channel_2  OV2_9  chamber_ME2/2/2  layer_7 input 0, 1
0214             case (33): {
0215               stat = 3;
0216               ring = 2;
0217               cham = 2;
0218               break;
0219             }  //  (33, 8, 0, 1 ), --channel_3  ON3_9  chamber_ME3/2/2  layer_8 input 0, 1
0220             case (34): {
0221               stat = 4;
0222               ring = 2;
0223               cham = 2;
0224               break;
0225             }  //--(34,  ,      ), --channel_4  ON4_9  chamber_ME4/2/2  layer   input
0226             default: {
0227               stat = 0;
0228               ring = 0;
0229               cham = 0;
0230               break;
0231             }
0232           }
0233           if (ring != 0) {
0234             int chamber = cham + (amc - 1) * 6;
0235             if (chamber > 36)
0236               chamber -= 36;
0237             CSCDetId cscDetId(endcap, stat, ring, chamber, 0);
0238             EleIndex omtfEle(fed, amc, link);
0239             result[omtfEle] = cscDetId;
0240           }
0241         }
0242       }
0243     }
0244     return result;
0245   }
0246 
0247   MapCscDet2EleIndex mapCscDet2EleIndex() {
0248     MapCscDet2EleIndex result;
0249     MapEleIndex2CscDet omtf2cscs = mapEleIndex2CscDet();
0250 
0251     for (const auto& omtf2csc : omtf2cscs) {
0252       uint32_t rawId = omtf2csc.second;
0253       auto it = result.find(rawId);
0254       if (result.end() == it) {
0255         result[rawId] = std::make_pair(omtf2csc.first, EleIndex());
0256       } else {
0257         it->second.second = omtf2csc.first;
0258       }
0259     }
0260 
0261     return result;
0262   }
0263 
0264 }  // namespace omtf