File indexing completed on 2024-04-06 12:20:59
0001 #include "L1Trigger/L1TMuonEndCap/interface/TrackTools.h"
0002
0003 namespace emtf {
0004
0005 int calc_ring(int station, int csc_ID, int strip) {
0006 if (station > 1) {
0007 if (csc_ID < 4)
0008 return 1;
0009 else if (csc_ID < 10)
0010 return 2;
0011 else
0012 return -999;
0013 } else if (station == 1) {
0014 if (csc_ID < 4 && strip > 127)
0015 return 4;
0016 else if (csc_ID < 4 && strip >= 0)
0017 return 1;
0018 else if (csc_ID > 3 && csc_ID < 7)
0019 return 2;
0020 else if (csc_ID > 6 && csc_ID < 10)
0021 return 3;
0022 else
0023 return -999;
0024 } else
0025 return -999;
0026 }
0027
0028 int calc_chamber(int station, int sector, int subsector, int ring, int csc_ID) {
0029 int chamber = -999;
0030 if (station == 1) {
0031 chamber = ((sector - 1) * 6) + csc_ID + 2;
0032 if (ring == 2)
0033 chamber -= 3;
0034 if (ring == 3)
0035 chamber -= 6;
0036 if (subsector == 2)
0037 chamber += 3;
0038 if (chamber > 36)
0039 chamber -= 36;
0040 } else if (ring == 1) {
0041 chamber = ((sector - 1) * 3) + csc_ID + 1;
0042 if (chamber > 18)
0043 chamber -= 18;
0044 } else if (ring == 2) {
0045 chamber = ((sector - 1) * 6) + csc_ID - 3 + 2;
0046 if (chamber > 36)
0047 chamber -= 36;
0048 }
0049 return chamber;
0050 }
0051
0052
0053 int calc_uGMT_chamber(int csc_ID, int subsector, int neighbor, int station) {
0054 if (station == 1) {
0055 if (csc_ID == 3 && neighbor == 1 && subsector == 2)
0056 return 1;
0057 else if (csc_ID == 6 && neighbor == 1 && subsector == 2)
0058 return 2;
0059 else if (csc_ID == 9 && neighbor == 1 && subsector == 2)
0060 return 3;
0061 else if (csc_ID == 3 && neighbor == 0 && subsector == 2)
0062 return 4;
0063 else if (csc_ID == 6 && neighbor == 0 && subsector == 2)
0064 return 5;
0065 else if (csc_ID == 9 && neighbor == 0 && subsector == 2)
0066 return 6;
0067 else
0068 return 0;
0069 } else {
0070 if (csc_ID == 3 && neighbor == 1)
0071 return 1;
0072 else if (csc_ID == 9 && neighbor == 1)
0073 return 2;
0074 else if (csc_ID == 3 && neighbor == 0)
0075 return 3;
0076 else if (csc_ID == 9 && neighbor == 0)
0077 return 4;
0078 else
0079 return 0;
0080 }
0081 }
0082
0083
0084
0085 int get_trigger_sector(int ring, int station, int chamber) {
0086 int result = 0;
0087 if (station > 1 && ring > 1) {
0088 result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1;
0089 } else if (station == 1) {
0090 result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1;
0091 } else {
0092 result = ((static_cast<unsigned>(chamber - 2) & 0x1f) / 3) + 1;
0093 }
0094 return (result <= 6) ? result
0095 : 6;
0096 }
0097
0098
0099
0100 int get_trigger_csc_ID(int ring, int station, int chamber) {
0101 int result = 0;
0102 if (station == 1) {
0103 result = (chamber) % 3 + 1;
0104 switch (ring) {
0105 case 1:
0106 break;
0107 case 2:
0108 result += 3;
0109 break;
0110 case 3:
0111 result += 6;
0112 break;
0113 case 4:
0114 result = (chamber + 1) % 3 + 1;
0115 break;
0116 }
0117 } else {
0118 if (ring == 1) {
0119 result = (chamber + 1) % 3 + 1;
0120 } else {
0121 result = (chamber + 3) % 6 + 4;
0122 }
0123 }
0124 return result;
0125 }
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141 std::pair<int, int> get_csc_max_strip_and_wire(int station, int ring) {
0142 int max_strip = 0;
0143 int max_wire = 0;
0144 if (station == 1 && ring == 4) {
0145 max_strip = 96;
0146 max_wire = 48;
0147 } else if (station == 1 && ring == 1) {
0148 max_strip = 128;
0149 max_wire = 48;
0150 } else if (station == 1 && ring == 2) {
0151 max_strip = 160;
0152 max_wire = 64;
0153 } else if (station == 1 && ring == 3) {
0154 max_strip = 128;
0155 max_wire = 32;
0156 } else if (station == 2 && ring == 1) {
0157 max_strip = 160;
0158 max_wire = 112;
0159 } else if (station >= 3 && ring == 1) {
0160 max_strip = 160;
0161 max_wire = 96;
0162 } else if (station >= 2 && ring == 2) {
0163 max_strip = 160;
0164 max_wire = 64;
0165 }
0166 return std::make_pair(max_strip, max_wire);
0167 }
0168
0169 std::pair<int, int> get_csc_max_pattern_and_quality(int station, int ring) {
0170 int max_pattern = 11;
0171 int max_quality = 16;
0172 return std::make_pair(max_pattern, max_quality);
0173 }
0174
0175 int get_csc_max_slope(int station, int ring, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB) {
0176 int max_slope = 65536;
0177 if (useRun3CCLUT_OTMB and (ring == 1 or ring == 4))
0178 max_slope = 16;
0179 if (useRun3CCLUT_TMB and (ring == 2 or ring == 3))
0180 max_slope = 16;
0181 return max_slope;
0182 }
0183
0184 }