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>>& coll1,
199 std::vector<std::shared_ptr<GMTInternalMuon>>& coll2) {
200 if (coll1.empty() || coll2.empty()) {
215 for (
auto mu_s1 = coll1.begin(); mu_s1 != coll1.end(); ++mu_s1) {
216 std::map<int, int> trkAddr_s1 = (*mu_s1)->origin().trackAddress();
217 int me1_ch_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME1Ch];
218 int me2_ch_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME2Ch];
219 int me3_ch_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME3Ch];
220 int me4_ch_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME4Ch];
221 if (me1_ch_s1 + me2_ch_s1 + me3_ch_s1 + me4_ch_s1 == 0) {
224 int me1_seg_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME1Seg];
225 int me2_seg_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME2Seg];
226 int me3_seg_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME3Seg];
227 int me4_seg_s1 = trkAddr_s1[l1t::RegionalMuonCand::emtfAddress::kME4Seg];
228 for (
auto mu_s2 = coll2.begin(); mu_s2 != coll2.end(); ++mu_s2) {
229 std::map<int, int> trkAddr_s2 = (*mu_s2)->origin().trackAddress();
230 int me1_ch_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME1Ch];
231 int me2_ch_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME2Ch];
232 int me3_ch_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME3Ch];
233 int me4_ch_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME4Ch];
234 if (me1_ch_s2 + me2_ch_s2 + me3_ch_s2 + me4_ch_s2 == 0) {
237 int me1_seg_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME1Seg];
238 int me2_seg_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME2Seg];
239 int me3_seg_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME3Seg];
240 int me4_seg_s2 = trkAddr_s2[l1t::RegionalMuonCand::emtfAddress::kME4Seg];
242 int nMatchedStations = 0;
243 if (me1_ch_s2 != 0 && me1_ch_s1 == me1_ch_s2 + 3 && me1_seg_s1 == me1_seg_s2) {
246 if (me2_ch_s2 != 0 && me2_ch_s1 == me2_ch_s2 + 2 && me2_seg_s1 == me2_seg_s2) {
249 if (me3_ch_s2 != 0 && me3_ch_s1 == me3_ch_s2 + 2 && me3_seg_s1 == me3_seg_s2) {
252 if (me4_ch_s2 != 0 && me4_ch_s1 == me4_ch_s2 + 2 && me4_seg_s1 == me4_seg_s2) {
257 if (nMatchedStations > 0) {
258 if ((*mu_s1)->origin().hwQual() >= (*mu_s2)->origin().hwQual()) {
259 (*mu_s2)->setHwCancelBit(1);
261 (*mu_s1)->setHwCancelBit(1);
268 <<
"Address based cancel out is currently only implemented for the barrel track finder.";
273 std::vector<std::shared_ptr<GMTInternalMuon>>& coll2) {
274 for (
auto mu_w1 = coll1.begin(); mu_w1 != coll1.end(); ++mu_w1) {
275 std::map<int, int> trkAddr_w1 = (*mu_w1)->origin().trackAddress();
276 int wheelNum_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelNum];
277 int wheelSide_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelSide];
278 std::vector<int> stations_w1;
279 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat1]);
280 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat2]);
281 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat3]);
282 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat4]);
285 for (
auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) {
286 std::map<int, int> trkAddr_w2 = (*mu_w2)->origin().trackAddress();
287 int wheelNum_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelNum];
288 int wheelSide_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelSide];
289 std::vector<int> stations_w2;
290 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat1]);
291 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat2]);
292 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat3]);
293 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat4]);
296 int nMatchedStations = 0;
298 for (
int i = 1;
i < 4; ++
i) {
299 if (wheelSide_w1 == wheelSide_w2) {
300 if (wheelNum_w1 == wheelNum_w2) {
301 if ((stations_w1[
i] == 0x0 && stations_w2[
i] == 0
x2) ||
302 (stations_w1[
i] == 0
x1 && stations_w2[
i] == 0x3) ||
303 (stations_w1[
i] == 0x4 && stations_w2[
i] == 0x0) ||
304 (stations_w1[
i] == 0x5 && stations_w2[
i] == 0
x1) ||
305 (stations_w1[
i] == 0x8 && stations_w2[
i] == 0xA) ||
306 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0xB) ||
307 (stations_w1[
i] == 0xC && stations_w2[
i] == 0x8) ||
308 (stations_w1[
i] == 0xD && stations_w2[
i] == 0x9)) {
311 }
else if (wheelNum_w1 == wheelNum_w2 - 1) {
312 if ((stations_w1[
i] == 0x0 && stations_w2[
i] == 0xA) ||
313 (stations_w1[
i] == 0
x1 && stations_w2[
i] == 0xB) ||
314 (stations_w1[
i] == 0x4 && stations_w2[
i] == 0x8) ||
315 (stations_w1[
i] == 0x5 && stations_w2[
i] == 0x9)) {
318 }
else if (wheelNum_w1 == wheelNum_w2 + 1) {
319 if ((stations_w1[
i] == 0x8 && stations_w2[
i] == 0
x2) ||
320 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0x3) ||
321 (stations_w1[
i] == 0xC && stations_w2[
i] == 0x0) ||
322 (stations_w1[
i] == 0xD && stations_w2[
i] == 0
x1)) {
327 if (wheelNum_w1 == 0 &&
329 if ((stations_w1[
i] == 0x8 && stations_w2[
i] == 0xA) ||
330 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0xB) ||
331 (stations_w1[
i] == 0xC && stations_w2[
i] == 0x8) ||
332 (stations_w1[
i] == 0xD && stations_w2[
i] == 0x9)) {
339 if (nMatchedStations > 0) {
340 if ((*mu_w1)->origin().hwQual() >= (*mu_w2)->origin().hwQual()) {
341 (*mu_w2)->setHwCancelBit(1);
343 (*mu_w1)->setHwCancelBit(1);
351 std::vector<std::shared_ptr<GMTInternalMuon>>& coll2) {
352 for (
auto mu_w1 = coll1.begin(); mu_w1 != coll1.end(); ++mu_w1) {
353 std::map<int, int> trkAddr_w1 = (*mu_w1)->origin().trackAddress();
354 int wheelNum_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelNum];
355 int wheelSide_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelSide];
356 std::vector<int> stations_w1;
357 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat1]);
358 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat2]);
359 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat3]);
360 stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat4]);
364 for (
auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) {
365 std::map<int, int> trkAddr_w2 = (*mu_w2)->origin().trackAddress();
366 int wheelNum_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelNum];
367 int wheelSide_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelSide];
368 std::vector<int> stations_w2;
369 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat1]);
370 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat2]);
371 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat3]);
372 stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat4]);
376 int nMatchedStations = 0;
378 for (
int i = 0;
i < 3; ++
i) {
379 if (wheelSide_w1 == wheelSide_w2) {
380 if (wheelNum_w1 == wheelNum_w2) {
381 if ((stations_w1[
i] == 0
x2 && stations_w2[
i] == 0x0) ||
382 (stations_w1[
i] == 0x3 && stations_w2[
i] == 0
x1) ||
383 (stations_w1[
i] == 0x0 && stations_w2[
i] == 0x4) ||
384 (stations_w1[
i] == 0
x1 && stations_w2[
i] == 0x5) ||
385 (stations_w1[
i] == 0xA && stations_w2[
i] == 0x8) ||
386 (stations_w1[
i] == 0xB && stations_w2[
i] == 0x9) ||
387 (stations_w1[
i] == 0x8 && stations_w2[
i] == 0xC) ||
388 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0xD)) {
391 }
else if (wheelNum_w1 == wheelNum_w2 - 1) {
392 if ((stations_w1[
i] == 0xA && stations_w2[
i] == 0x0) ||
393 (stations_w1[
i] == 0xB && stations_w2[
i] == 0
x1) ||
394 (stations_w1[
i] == 0x8 && stations_w2[
i] == 0x4) ||
395 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0x5)) {
398 }
else if (wheelNum_w1 == wheelNum_w2 + 1) {
399 if ((stations_w1[
i] == 0
x2 && stations_w2[
i] == 0x8) ||
400 (stations_w1[
i] == 0x3 && stations_w2[
i] == 0x9) ||
401 (stations_w1[
i] == 0x0 && stations_w2[
i] == 0xC) ||
402 (stations_w1[
i] == 0
x1 && stations_w2[
i] == 0xD)) {
407 if (wheelNum_w1 == 0 && wheelNum_w2 == 1) {
408 if ((stations_w1[
i] == 0xA && stations_w2[
i] == 0x0) ||
409 (stations_w1[
i] == 0xB && stations_w2[
i] == 0
x1) ||
410 (stations_w1[
i] == 0x8 && stations_w2[
i] == 0x4) ||
411 (stations_w1[
i] == 0x9 && stations_w2[
i] == 0x5)) {
414 }
else if (wheelNum_w1 == 1 && wheelNum_w2 == 0) {
415 if ((stations_w1[
i] == 0
x2 && stations_w2[
i] == 0x8) ||
416 (stations_w1[
i] == 0x3 && stations_w2[
i] == 0x9) ||
417 (stations_w1[
i] == 0x0 && stations_w2[
i] == 0xC) ||
418 (stations_w1[
i] == 0
x1 && stations_w2[
i] == 0xD)) {
425 if (nMatchedStations > 0) {
426 if ((*mu_w1)->origin().hwQual() >= (*mu_w2)->origin().hwQual()) {
427 (*mu_w2)->setHwCancelBit(1);
429 (*mu_w1)->setHwCancelBit(1);