40 std::vector<std::shared_ptr<GMTInternalMuon>> coll1;
42 std::vector<std::shared_ptr<GMTInternalMuon>> coll2;
45 if (trackFinder ==
bmtf) {
48 for (
int currentWedge = 0; currentWedge < maxWedges; ++currentWedge) {
49 for (
const auto&
mu : wedges.at(currentWedge)) {
53 int neighbourWedge = (currentWedge + 1) % maxWedges;
54 for (
const auto&
mu : wedges.at(neighbourWedge)) {
72 std::vector<std::shared_ptr<GMTInternalMuon>> coll1;
75 std::vector<std::shared_ptr<GMTInternalMuon>> coll2;
78 for (
int currentSector = 0; currentSector < 6; ++currentSector) {
79 for (
const auto& omtfMuon : omtfSectors.at(currentSector)) {
80 coll1.push_back(omtfMuon);
86 for (
int i = 0;
i < 4; ++
i) {
87 int currentWedge = (currentSector * 2 +
i) % 12;
88 for (
const auto& bmtfMuon : bmtfWedges.at(currentWedge)) {
89 coll2.push_back(bmtfMuon);
106 std::vector<std::shared_ptr<GMTInternalMuon>> coll1;
109 std::vector<std::shared_ptr<GMTInternalMuon>> coll2;
112 for (
int curOmtfSector = 0; curOmtfSector < 6; ++curOmtfSector) {
113 for (
const auto& omtfMuon : omtfSectors.at(curOmtfSector)) {
114 coll1.push_back(omtfMuon);
120 for (
int i = 0;
i < 3; ++
i) {
122 int curEmtfSector = ((curOmtfSector + 5) +
i) % 6;
123 for (
const auto& emtfMuon : emtfSectors.at(curEmtfSector)) {
124 coll2.push_back(emtfMuon);
138 std::vector<std::shared_ptr<GMTInternalMuon>>& coll2) {
139 if (coll1.empty() || coll2.empty()) {
142 tftype coll1TfType = (*coll1.begin())->trackFinderType();
143 tftype coll2TfType = (*coll2.begin())->trackFinderType();
144 if (coll2TfType !=
tftype::bmtf && coll1TfType % 2 != coll2TfType % 2) {
146 <<
"Overlap-Endcap cancel out between positive and negative detector side attempted. Check eta assignment. "
147 "OMTF candidate: TF type: "
148 << coll1TfType <<
", hwEta: " << (*coll1.begin())->hwEta() <<
". EMTF candidate: TF type: " << coll2TfType
149 <<
", hwEta: " << (*coll2.begin())->hwEta() <<
". TF type even: pos. side; odd: neg. side." << std::endl;
155 for (
auto mu_w1 = coll1.begin(); mu_w1 != coll1.end(); ++mu_w1) {
156 int etaFine1 = (*mu_w1)->hwHF();
161 for (
auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) {
162 int etaFine2 = (*mu_w2)->hwHF();
168 int etaFine = (
int)(etaFine1 > 0 && etaFine2 > 0);
174 int dPhi = (*mu_w1)->hwGlobalPhi() - (*mu_w2)->hwGlobalPhi();
179 int dEta =
std::abs((*mu_w1)->hwEta() - (*mu_w2)->hwEta());
183 if (
dEta <= dEtaMask &&
dPhi <= dPhiMask) {
186 if ((*mu_w1)->hwQual() > (*mu_w2)->hwQual()) {
187 (*mu_w2)->setHwCancelBit(1);
189 (*mu_w1)->setHwCancelBit(1);
198 std::vector<std::shared_ptr<GMTInternalMuon>>& coll2) {
199 if (coll1.empty() || coll2.empty()) {
204 for (
auto mu_w1 = coll1.begin(); mu_w1 != coll1.end(); ++mu_w1) {
205 std::map<int, int> trkAddr_w1 = (*mu_w1)->origin().trackAddress();
206 int wheelNum_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelNum];
207 int wheelSide_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelSide];
208 std::vector<int> stations_w1;
209 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat1]);
210 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat2]);
211 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat3]);
212 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat4]);
215 for (
auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) {
216 std::map<int, int> trkAddr_w2 = (*mu_w2)->origin().trackAddress();
217 int wheelNum_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelNum];
218 int wheelSide_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelSide];
219 std::vector<int> stations_w2;
220 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat1]);
221 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat2]);
222 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat3]);
223 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat4]);
226 int nMatchedStations = 0;
228 for (
int i = 1;
i < 4; ++
i) {
229 if (wheelSide_w1 == wheelSide_w2) {
230 if (wheelNum_w1 == wheelNum_w2) {
231 if ((stations_w1[
i] == 0x0 && stations_w2[
i] == 0
x2) ||
232 (stations_w1[
i] == 0
x1 && stations_w2[
i] == 0x3) ||
233 (stations_w1[
i] == 0x4 && stations_w2[
i] == 0x0) ||
234 (stations_w1[
i] == 0x5 && stations_w2[
i] == 0
x1) ||
235 (stations_w1[
i] == 0x8 && stations_w2[
i] == 0xA) ||
236 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0xB) ||
237 (stations_w1[
i] == 0xC && stations_w2[
i] == 0x8) ||
238 (stations_w1[
i] == 0xD && stations_w2[
i] == 0x9)) {
241 }
else if (wheelNum_w1 == wheelNum_w2 - 1) {
242 if ((stations_w1[
i] == 0x0 && stations_w2[
i] == 0xA) ||
243 (stations_w1[
i] == 0
x1 && stations_w2[
i] == 0xB) ||
244 (stations_w1[
i] == 0x4 && stations_w2[
i] == 0x8) ||
245 (stations_w1[
i] == 0x5 && stations_w2[
i] == 0x9)) {
248 }
else if (wheelNum_w1 == wheelNum_w2 + 1) {
249 if ((stations_w1[
i] == 0x8 && stations_w2[
i] == 0
x2) ||
250 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0x3) ||
251 (stations_w1[
i] == 0xC && stations_w2[
i] == 0x0) ||
252 (stations_w1[
i] == 0xD && stations_w2[
i] == 0
x1)) {
257 if (wheelNum_w1 == 0 &&
259 if ((stations_w1[
i] == 0x8 && stations_w2[
i] == 0xA) ||
260 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0xB) ||
261 (stations_w1[
i] == 0xC && stations_w2[
i] == 0x8) ||
262 (stations_w1[
i] == 0xD && stations_w2[
i] == 0x9)) {
269 if (nMatchedStations > 0) {
270 if ((*mu_w1)->origin().hwQual() >= (*mu_w2)->origin().hwQual()) {
271 (*mu_w2)->setHwCancelBit(1);
273 (*mu_w1)->setHwCancelBit(1);
283 for (
auto mu_s1 = coll1.begin(); mu_s1 != coll1.end(); ++mu_s1) {
284 std::map<int, int> trkAddr_s1 = (*mu_s1)->origin().trackAddress();
285 int me1_ch_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME1Ch];
286 int me2_ch_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME2Ch];
287 int me3_ch_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME3Ch];
288 int me4_ch_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME4Ch];
289 if (me1_ch_s1 + me2_ch_s1 + me3_ch_s1 + me4_ch_s1 == 0) {
292 int me1_seg_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME1Seg];
293 int me2_seg_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME2Seg];
294 int me3_seg_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME3Seg];
295 int me4_seg_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME4Seg];
296 for (
auto mu_s2 = coll2.begin(); mu_s2 != coll2.end(); ++mu_s2) {
297 std::map<int, int> trkAddr_s2 = (*mu_s2)->origin().trackAddress();
298 int me1_ch_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME1Ch];
299 int me2_ch_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME2Ch];
300 int me3_ch_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME3Ch];
301 int me4_ch_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME4Ch];
302 if (me1_ch_s2 + me2_ch_s2 + me3_ch_s2 + me4_ch_s2 == 0) {
305 int me1_seg_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME1Seg];
306 int me2_seg_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME2Seg];
307 int me3_seg_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME3Seg];
308 int me4_seg_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME4Seg];
310 int nMatchedStations = 0;
311 if (me1_ch_s2 != 0 && me1_ch_s1 == me1_ch_s2 + 3 && me1_seg_s1 == me1_seg_s2) {
314 if (me2_ch_s2 != 0 && me2_ch_s1 == me2_ch_s2 + 2 && me2_seg_s1 == me2_seg_s2) {
317 if (me3_ch_s2 != 0 && me3_ch_s1 == me3_ch_s2 + 2 && me3_seg_s1 == me3_seg_s2) {
320 if (me4_ch_s2 != 0 && me4_ch_s1 == me4_ch_s2 + 2 && me4_seg_s1 == me4_seg_s2) {
325 if (nMatchedStations > 0) {
326 if ((*mu_s1)->origin().hwQual() >= (*mu_s2)->origin().hwQual()) {
327 (*mu_s2)->setHwCancelBit(1);
329 (*mu_s1)->setHwCancelBit(1);
336 <<
"Address based cancel out is currently only implemented for the barrel track finder.";