File indexing completed on 2024-04-06 12:21:02
0001 #include "L1Trigger/L1TMuonEndCapPhase2/interface/DAQ/TPrimitives.h"
0002
0003 #include "L1Trigger/L1TMuonEndCapPhase2/interface/Utils/CSCUtils.h"
0004
0005 namespace emtf::phase2::csc {
0006
0007
0008 int getNext10DegChamber(int chamber) { return (chamber == 36) ? 1 : (chamber + 1); }
0009
0010 int getPrev10DegChamber(int chamber) { return (chamber == 1) ? 36 : (chamber - 1); }
0011
0012 int getNext20DegChamber(int chamber) { return (chamber == 18) ? 1 : (chamber + 1); }
0013
0014 int getPrev20DegChamber(int chamber) { return (chamber == 1) ? 18 : (chamber - 1); }
0015
0016
0017 bool isTPInSector(int sp_endcap, int sp_sector, int tp_endcap, int tp_sector) {
0018 return sp_endcap == tp_endcap && sp_sector == tp_sector;
0019 }
0020
0021 bool isTPInNeighborSector(
0022 int sp_endcap, int sp_sector, int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_id) {
0023
0024 int neighbor_sector = ((sp_sector == 1) ? 6 : sp_sector - 1);
0025
0026 if ((sp_endcap != tp_endcap) || (neighbor_sector != tp_sector))
0027 return false;
0028
0029
0030 if (tp_station == 1)
0031 return (tp_subsector == 2) && (tp_id == 3 || tp_id == 6 || tp_id == 9);
0032
0033
0034 return tp_id == 3 || tp_id == 9;
0035 }
0036
0037
0038
0039 int getId(int station, int ring, int chamber) {
0040 int result = 0;
0041
0042 if (station == 1) {
0043 result = (chamber) % 3 + 1;
0044
0045 switch (ring) {
0046 case 1:
0047 break;
0048 case 2:
0049 result += 3;
0050 break;
0051 case 3:
0052 result += 6;
0053 break;
0054 case 4:
0055 break;
0056 }
0057 } else {
0058 if (ring == 1) {
0059 result = (chamber + 1) % 3 + 1;
0060 } else {
0061 result = (chamber + 3) % 6 + 4;
0062 }
0063 }
0064
0065 return result;
0066 }
0067
0068
0069
0070 int getTriggerSector(int station, int ring, int chamber) {
0071 int result = 0;
0072
0073 if (station > 1 && ring > 1) {
0074 result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1;
0075 } else if (station == 1) {
0076 result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1;
0077 } else {
0078 result = ((static_cast<unsigned>(chamber - 2) & 0x1f) / 3) + 1;
0079 }
0080
0081 return (result <= 6) ? result
0082 : 6;
0083 }
0084
0085 int getTriggerSubsector(int station, int chamber) {
0086
0087 if (station != 1) {
0088 return 0;
0089 }
0090
0091
0092 if ((chamber % 6) > 2) {
0093 return 1;
0094 }
0095
0096 return 2;
0097 }
0098
0099
0100 Facing getFaceDirection(int station, int ring, int chamber) {
0101 bool is_not_overlapping = (station == 1 && ring == 3);
0102
0103
0104 if (is_not_overlapping)
0105 return Facing::kRear;
0106
0107
0108
0109 bool is_even = (chamber % 2 == 0);
0110
0111 if (station < 3)
0112 return (is_even ? Facing::kRear : Facing::kFront);
0113
0114 return (is_even ? Facing::kFront : Facing::kRear);
0115 }
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 std::pair<int, int> getMaxStripAndWire(int station, int ring) {
0132 int max_strip = 0;
0133 int max_wire = 0;
0134
0135 if (station == 1 && ring == 4) {
0136 max_strip = 96;
0137 max_wire = 48;
0138 } else if (station == 1 && ring == 1) {
0139 max_strip = 128;
0140 max_wire = 48;
0141 } else if (station == 1 && ring == 2) {
0142 max_strip = 160;
0143 max_wire = 64;
0144 } else if (station == 1 && ring == 3) {
0145 max_strip = 128;
0146 max_wire = 32;
0147 } else if (station == 2 && ring == 1) {
0148 max_strip = 160;
0149 max_wire = 112;
0150 } else if (station >= 3 && ring == 1) {
0151 max_strip = 160;
0152 max_wire = 96;
0153 } else if (station >= 2 && ring == 2) {
0154 max_strip = 160;
0155 max_wire = 64;
0156 }
0157
0158 return std::make_pair(max_strip, max_wire);
0159 }
0160
0161 std::pair<int, int> getMaxPatternAndQuality(int station, int ring) {
0162 int max_pattern = 11;
0163 int max_quality = 16;
0164
0165 return std::make_pair(max_pattern, max_quality);
0166 }
0167
0168 }