CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1t::MicroGMTCancelOutUnit Class Reference

#include <MicroGMTCancelOutUnit.h>

Public Member Functions

void initialise (L1TMuonGlobalParamsHelper *)
 Initialisation from ES record. More...
 
 MicroGMTCancelOutUnit ()
 
void setCancelOutBits (GMTInternalWedges &, tftype, cancelmode)
 Cancel out between sectors/wedges in one track finder. More...
 
void setCancelOutBitsOverlapBarrel (GMTInternalWedges &, GMTInternalWedges &, cancelmode)
 Cancel-out between overlap and barrel track finders. More...
 
void setCancelOutBitsOverlapEndcap (GMTInternalWedges &, GMTInternalWedges &, cancelmode)
 Cancel-out between overlap and endcap track finders. More...
 
virtual ~MicroGMTCancelOutUnit ()
 

Private Member Functions

void getCoordinateCancelBits (std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
 Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on eta/phi coordinates. More...
 
void getTrackAddrCancelBits (cancelmode, std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
 Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on track addresses. More...
 
void getTrackAddrCancelBitsKfBMTF (std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
 Do the track address-based cancel-out for the BMTF algorithm using the Kalman Filter. More...
 
void getTrackAddrCancelBitsOrigBMTF (std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
 Do the track address-based cancel-out for the original BMTF algorithm. More...
 

Private Attributes

std::shared_ptr< MicroGMTMatchQualLUTm_boNegMatchQualLUT
 
std::shared_ptr< MicroGMTMatchQualLUTm_boPosMatchQualLUT
 
std::shared_ptr< MicroGMTMatchQualLUTm_brlSingleMatchQualLUT
 
std::shared_ptr< MicroGMTMatchQualLUTm_foNegMatchQualLUT
 
std::shared_ptr< MicroGMTMatchQualLUTm_foPosMatchQualLUT
 
std::shared_ptr< MicroGMTMatchQualLUTm_fwdNegSingleMatchQualLUT
 
std::shared_ptr< MicroGMTMatchQualLUTm_fwdPosSingleMatchQualLUT
 
std::map< int, std::shared_ptr< MicroGMTMatchQualLUT > > m_lutDict
 
std::shared_ptr< MicroGMTMatchQualLUTm_ovlNegSingleMatchQualLUT
 
std::shared_ptr< MicroGMTMatchQualLUTm_ovlPosSingleMatchQualLUT
 

Detailed Description

Definition at line 13 of file MicroGMTCancelOutUnit.h.

Constructor & Destructor Documentation

◆ MicroGMTCancelOutUnit()

l1t::MicroGMTCancelOutUnit::MicroGMTCancelOutUnit ( )

Definition at line 6 of file MicroGMTCancelOutUnit.cc.

6 {}

◆ ~MicroGMTCancelOutUnit()

l1t::MicroGMTCancelOutUnit::~MicroGMTCancelOutUnit ( )
virtual

Definition at line 8 of file MicroGMTCancelOutUnit.cc.

8 {}

Member Function Documentation

◆ getCoordinateCancelBits()

void l1t::MicroGMTCancelOutUnit::getCoordinateCancelBits ( std::vector< std::shared_ptr< GMTInternalMuon >> &  coll1,
std::vector< std::shared_ptr< GMTInternalMuon >> &  coll2 
)
private

Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on eta/phi coordinates.

Definition at line 137 of file MicroGMTCancelOutUnit.cc.

References funct::abs(), l1t::bmtf, HLT_2024v11_cff::dEta, l1t::emtf_neg, l1t::emtf_pos, HLTMuonOfflineAnalyzer_cfi::etaFine, l1t::MicroGMTMatchQualLUT::getDeltaEtaWidth(), l1t::MicroGMTMatchQualLUT::getDeltaPhiWidth(), l1trig_cff::hwEta, createfilelist::int, l1t::MicroGMTMatchQualLUT::lookup(), and m_lutDict.

Referenced by setCancelOutBits(), setCancelOutBitsOverlapBarrel(), and setCancelOutBitsOverlapEndcap().

138  {
139  if (coll1.empty() || coll2.empty()) {
140  return;
141  }
142  tftype coll1TfType = (*coll1.begin())->trackFinderType();
143  tftype coll2TfType = (*coll2.begin())->trackFinderType();
144  if (coll2TfType != tftype::bmtf && coll1TfType % 2 != coll2TfType % 2) {
145  edm::LogError("Detector side mismatch")
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;
150  return;
151  }
152 
153  MicroGMTMatchQualLUT* matchLUT = m_lutDict.at(coll1TfType + coll2TfType * 10).get();
154 
155  for (auto mu_w1 = coll1.begin(); mu_w1 != coll1.end(); ++mu_w1) {
156  int etaFine1 = (*mu_w1)->hwHF();
157  // for EMTF muons set eta fine bit to true since hwHF is the halo bit
158  if (coll1TfType == tftype::emtf_pos || coll1TfType == tftype::emtf_neg) {
159  etaFine1 = 1;
160  }
161  for (auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) {
162  int etaFine2 = (*mu_w2)->hwHF();
163  // for EMTF muons set eta fine bit to true since hwHF is the halo bit
164  if (coll2TfType == tftype::emtf_pos || coll2TfType == tftype::emtf_neg) {
165  etaFine2 = 1;
166  }
167  // both muons must have the eta fine bit set in order to use the eta fine part of the LUT
168  int etaFine = (int)(etaFine1 > 0 && etaFine2 > 0);
169 
170  // The LUT for cancellation takes reduced width phi and eta, we need the LSBs
171  int dPhiMask = (1 << matchLUT->getDeltaPhiWidth()) - 1;
172  int dEtaMask = (1 << matchLUT->getDeltaEtaWidth()) - 1;
173 
174  int dPhi = (*mu_w1)->hwGlobalPhi() - (*mu_w2)->hwGlobalPhi();
175  dPhi = std::abs(dPhi);
176  if (dPhi > 338)
177  dPhi -= 576; // shifts dPhi to [-pi, pi) in integer scale
178  dPhi = std::abs(dPhi);
179  int dEta = std::abs((*mu_w1)->hwEta() - (*mu_w2)->hwEta());
180  // check first if the delta is within the LSBs that the LUT takes, otherwise the distance
181  // is greater than what we want to cancel -> e.g. 31(int) is max => 31*0.01 = 0.31 (rad)
182  // LUT takes 5 LSB for dEta and 3 LSB for dPhi
183  if (dEta <= dEtaMask && dPhi <= dPhiMask) {
184  int match = matchLUT->lookup(etaFine, dEta & dEtaMask, dPhi & dPhiMask);
185  if (match == 1) {
186  if ((*mu_w1)->hwQual() > (*mu_w2)->hwQual()) {
187  (*mu_w2)->setHwCancelBit(1);
188  } else {
189  (*mu_w1)->setHwCancelBit(1);
190  }
191  }
192  }
193  }
194  }
195  }
Log< level::Error, false > LogError
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::map< int, std::shared_ptr< MicroGMTMatchQualLUT > > m_lutDict

◆ getTrackAddrCancelBits()

void l1t::MicroGMTCancelOutUnit::getTrackAddrCancelBits ( cancelmode  mode,
std::vector< std::shared_ptr< GMTInternalMuon >> &  coll1,
std::vector< std::shared_ptr< GMTInternalMuon >> &  coll2 
)
private

Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on track addresses.

Definition at line 197 of file MicroGMTCancelOutUnit.cc.

References l1t::bmtf, l1t::emtf_neg, l1t::emtf_pos, getTrackAddrCancelBitsKfBMTF(), getTrackAddrCancelBitsOrigBMTF(), l1t::kftracks, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, and DiMuonV_cfg::tracks.

Referenced by setCancelOutBits(), setCancelOutBitsOverlapBarrel(), and setCancelOutBitsOverlapEndcap().

199  {
200  if (coll1.empty() || coll2.empty()) {
201  return;
202  }
203  // Address based cancel out for BMTF
204  if ((*coll1.begin())->trackFinderType() == tftype::bmtf && (*coll2.begin())->trackFinderType() == tftype::bmtf) {
205  if (mode == cancelmode::tracks) {
206  getTrackAddrCancelBitsOrigBMTF(coll1, coll2);
207  } else if (mode == cancelmode::kftracks) {
208  getTrackAddrCancelBitsKfBMTF(coll1, coll2);
209  }
210  // Address based cancel out for EMTF
211  } else if (((*coll1.begin())->trackFinderType() == tftype::emtf_pos &&
212  (*coll2.begin())->trackFinderType() == tftype::emtf_pos) ||
213  ((*coll1.begin())->trackFinderType() == tftype::emtf_neg &&
214  (*coll2.begin())->trackFinderType() == tftype::emtf_neg)) {
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) {
222  continue;
223  }
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) {
235  continue;
236  }
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];
241 
242  int nMatchedStations = 0;
243  if (me1_ch_s2 != 0 && me1_ch_s1 == me1_ch_s2 + 3 && me1_seg_s1 == me1_seg_s2) {
244  ++nMatchedStations;
245  }
246  if (me2_ch_s2 != 0 && me2_ch_s1 == me2_ch_s2 + 2 && me2_seg_s1 == me2_seg_s2) {
247  ++nMatchedStations;
248  }
249  if (me3_ch_s2 != 0 && me3_ch_s1 == me3_ch_s2 + 2 && me3_seg_s1 == me3_seg_s2) {
250  ++nMatchedStations;
251  }
252  if (me4_ch_s2 != 0 && me4_ch_s1 == me4_ch_s2 + 2 && me4_seg_s1 == me4_seg_s2) {
253  ++nMatchedStations;
254  }
255 
256  //std::cout << "Shared hits found: " << nMatchedStations << std::endl;
257  if (nMatchedStations > 0) {
258  if ((*mu_s1)->origin().hwQual() >= (*mu_s2)->origin().hwQual()) {
259  (*mu_s2)->setHwCancelBit(1);
260  } else {
261  (*mu_s1)->setHwCancelBit(1);
262  }
263  }
264  }
265  }
266  } else {
267  edm::LogError("Cancel out not implemented")
268  << "Address based cancel out is currently only implemented for the barrel track finder.";
269  }
270  }
Log< level::Error, false > LogError
void getTrackAddrCancelBitsKfBMTF(std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
Do the track address-based cancel-out for the BMTF algorithm using the Kalman Filter.
void getTrackAddrCancelBitsOrigBMTF(std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
Do the track address-based cancel-out for the original BMTF algorithm.

◆ getTrackAddrCancelBitsKfBMTF()

void l1t::MicroGMTCancelOutUnit::getTrackAddrCancelBitsKfBMTF ( std::vector< std::shared_ptr< GMTInternalMuon >> &  coll1,
std::vector< std::shared_ptr< GMTInternalMuon >> &  coll2 
)
private

Do the track address-based cancel-out for the BMTF algorithm using the Kalman Filter.

Definition at line 350 of file MicroGMTCancelOutUnit.cc.

References mps_fire::i.

Referenced by getTrackAddrCancelBits().

351  {
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]);
361  //std::cout << "Track address 1: wheelSide (1 == negative side): " << wheelSide_w1 << ", wheelNum: " << wheelNum_w1 << ", stations1234: 0x" << hex << stations_w1[0] << stations_w1[1] << stations_w1[2] << stations_w1[3] << dec << std::endl;
362  //std::cout << "Muon1 eta: " << (*mu_w1)->hwEta() << " phi: " << (*mu_w1)->hwGlobalPhi() << " pT: " << (*mu_w1)->hwPt() << " qual: " << (*mu_w1)->origin().hwQual() << std::endl;
363 
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]);
373  // std::cout << "Track address 2: wheelSide (1 == negative side): " << wheelSide_w2 << ", wheelNum: " << wheelNum_w2 << ", stations1234: 0x" << hex << stations_w2[0] << stations_w2[1] << stations_w2[2] << stations_w2[3] << dec << std::endl;
374  // std::cout << "Muon2 eta: " << (*mu_w2)->hwEta() << " phi: " << (*mu_w2)->hwGlobalPhi() << " pT: " << (*mu_w2)->hwPt() << " qual: " << (*mu_w2)->origin().hwQual() << std::endl;
375 
376  int nMatchedStations = 0;
377  // search for duplicates in stations 1-3
378  for (int i = 0; i < 3; ++i) {
379  if (wheelSide_w1 == wheelSide_w2) { // both tracks are on the same detector side
380  if (wheelNum_w1 == wheelNum_w2) { // both tracks have the same reference wheel
381  if ((stations_w1[i] == 0x2 && stations_w2[i] == 0x0) ||
382  (stations_w1[i] == 0x3 && stations_w2[i] == 0x1) ||
383  (stations_w1[i] == 0x0 && stations_w2[i] == 0x4) ||
384  (stations_w1[i] == 0x1 && 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)) {
389  ++nMatchedStations;
390  }
391  } else if (wheelNum_w1 == wheelNum_w2 - 1) { // track 2 is one wheel higher than track 1
392  if ((stations_w1[i] == 0xA && stations_w2[i] == 0x0) ||
393  (stations_w1[i] == 0xB && stations_w2[i] == 0x1) ||
394  (stations_w1[i] == 0x8 && stations_w2[i] == 0x4) ||
395  (stations_w1[i] == 0x9 && stations_w2[i] == 0x5)) {
396  ++nMatchedStations;
397  }
398  } else if (wheelNum_w1 == wheelNum_w2 + 1) { // track 2 is one wheel lower than track 1
399  if ((stations_w1[i] == 0x2 && 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] == 0x1 && stations_w2[i] == 0xD)) {
403  ++nMatchedStations;
404  }
405  }
406  } else { // If one muon in 0+ and one muon in 0- (0+ and 0- are physically the same wheel), however wheel 0 is not split in kalman algorithm
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] == 0x1) ||
410  (stations_w1[i] == 0x8 && stations_w2[i] == 0x4) ||
411  (stations_w1[i] == 0x9 && stations_w2[i] == 0x5)) {
412  ++nMatchedStations;
413  }
414  } else if (wheelNum_w1 == 1 && wheelNum_w2 == 0) {
415  if ((stations_w1[i] == 0x2 && 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] == 0x1 && stations_w2[i] == 0xD)) {
419  ++nMatchedStations;
420  }
421  }
422  }
423  }
424  //std::cout << "Shared hits found: " << nMatchedStations << std::endl;
425  if (nMatchedStations > 0) {
426  if ((*mu_w1)->origin().hwQual() >= (*mu_w2)->origin().hwQual()) {
427  (*mu_w2)->setHwCancelBit(1);
428  } else {
429  (*mu_w1)->setHwCancelBit(1);
430  }
431  }
432  }
433  }
434  }

◆ getTrackAddrCancelBitsOrigBMTF()

void l1t::MicroGMTCancelOutUnit::getTrackAddrCancelBitsOrigBMTF ( std::vector< std::shared_ptr< GMTInternalMuon >> &  coll1,
std::vector< std::shared_ptr< GMTInternalMuon >> &  coll2 
)
private

Do the track address-based cancel-out for the original BMTF algorithm.

Definition at line 272 of file MicroGMTCancelOutUnit.cc.

References mps_fire::i.

Referenced by getTrackAddrCancelBits().

273  {
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]);
283  //std::cout << "Track address 1: wheelSide (1 == negative side): " << wheelSide_w1 << ", wheelNum: " << wheelNum_w1 << ", stations1234: 0x" << hex << stations_w1[0] << stations_w1[1] << stations_w1[2] << stations_w1[3] << dec << std::endl;
284 
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]);
294  //std::cout << "Track address 2: wheelSide (1 == negative side): " << wheelSide_w2 << ", wheelNum: " << wheelNum_w2 << ", stations1234: 0x" << hex << stations_w2[0] << stations_w2[1] << stations_w2[2] << stations_w2[3] << dec << std::endl;
295 
296  int nMatchedStations = 0;
297  // search for duplicates in stations 2-4
298  for (int i = 1; i < 4; ++i) {
299  if (wheelSide_w1 == wheelSide_w2) { // both tracks are on the same detector side
300  if (wheelNum_w1 == wheelNum_w2) { // both tracks have the same reference wheel
301  if ((stations_w1[i] == 0x0 && stations_w2[i] == 0x2) ||
302  (stations_w1[i] == 0x1 && stations_w2[i] == 0x3) ||
303  (stations_w1[i] == 0x4 && stations_w2[i] == 0x0) ||
304  (stations_w1[i] == 0x5 && stations_w2[i] == 0x1) ||
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)) {
309  ++nMatchedStations;
310  }
311  } else if (wheelNum_w1 == wheelNum_w2 - 1) { // track 2 is one wheel higher than track 1
312  if ((stations_w1[i] == 0x0 && stations_w2[i] == 0xA) ||
313  (stations_w1[i] == 0x1 && stations_w2[i] == 0xB) ||
314  (stations_w1[i] == 0x4 && stations_w2[i] == 0x8) ||
315  (stations_w1[i] == 0x5 && stations_w2[i] == 0x9)) {
316  ++nMatchedStations;
317  }
318  } else if (wheelNum_w1 == wheelNum_w2 + 1) { // track 2 is one wheel lower than track 1
319  if ((stations_w1[i] == 0x8 && stations_w2[i] == 0x2) ||
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] == 0x1)) {
323  ++nMatchedStations;
324  }
325  }
326  } else {
327  if (wheelNum_w1 == 0 &&
328  wheelNum_w2 == 0) { // both tracks are on either side of the central wheel (+0 and -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)) {
333  ++nMatchedStations;
334  }
335  }
336  }
337  }
338  //std::cout << "Shared hits found: " << nMatchedStations << std::endl;
339  if (nMatchedStations > 0) {
340  if ((*mu_w1)->origin().hwQual() >= (*mu_w2)->origin().hwQual()) {
341  (*mu_w2)->setHwCancelBit(1);
342  } else {
343  (*mu_w1)->setHwCancelBit(1);
344  }
345  }
346  }
347  }
348  }

◆ initialise()

void l1t::MicroGMTCancelOutUnit::initialise ( L1TMuonGlobalParamsHelper microGMTParamsHelper)

Initialisation from ES record.

Definition at line 10 of file MicroGMTCancelOutUnit.cc.

References l1t::bmtf, L1TMuonGlobalParamsHelper::bONegMatchQualLUT(), L1TMuonGlobalParamsHelper::bOPosMatchQualLUT(), l1t::MicroGMTMatchQualLUTFactory::create(), l1t::emtf_emtf_neg, l1t::emtf_emtf_pos, l1t::emtf_neg, l1t::emtf_pos, L1TMuonGlobalParamsHelper::fONegMatchQualLUT(), L1TMuonGlobalParamsHelper::fOPosMatchQualLUT(), L1TMuonGlobalParamsHelper::fwdNegSingleMatchQualLUT(), L1TMuonGlobalParamsHelper::fwdPosSingleMatchQualLUT(), amcDumpToRaw_cfi::fwVersion, L1TMuonGlobalParamsHelper::fwVersion(), m_boNegMatchQualLUT, m_boPosMatchQualLUT, m_foNegMatchQualLUT, m_foPosMatchQualLUT, m_fwdNegSingleMatchQualLUT, m_fwdPosSingleMatchQualLUT, m_lutDict, m_ovlNegSingleMatchQualLUT, m_ovlPosSingleMatchQualLUT, l1t::omtf_bmtf_neg, l1t::omtf_bmtf_pos, l1t::omtf_emtf_neg, l1t::omtf_emtf_pos, l1t::omtf_neg, l1t::omtf_omtf_neg, l1t::omtf_omtf_pos, l1t::omtf_pos, L1TMuonGlobalParamsHelper::ovlNegSingleMatchQualLUT(), and L1TMuonGlobalParamsHelper::ovlPosSingleMatchQualLUT().

Referenced by L1TMuonProducer::beginRun().

10  {
11  int fwVersion = microGMTParamsHelper->fwVersion();
13  microGMTParamsHelper->bOPosMatchQualLUT(), cancel_t::omtf_bmtf_pos, fwVersion);
15  microGMTParamsHelper->bONegMatchQualLUT(), cancel_t::omtf_bmtf_neg, fwVersion);
17  microGMTParamsHelper->fOPosMatchQualLUT(), cancel_t::omtf_emtf_pos, fwVersion);
19  microGMTParamsHelper->fONegMatchQualLUT(), cancel_t::omtf_emtf_neg, fwVersion);
28 
37  }
std::shared_ptr< MicroGMTMatchQualLUT > m_ovlNegSingleMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_foPosMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_fwdNegSingleMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_fwdPosSingleMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_boPosMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_boNegMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_ovlPosSingleMatchQualLUT
std::shared_ptr< MicroGMTMatchQualLUT > m_foNegMatchQualLUT
static ReturnType create(const std::string &filename, const double maxDR, const double fEta, const double fEtaCoarse, const double fPhi, cancel_t cancelType, const int fwVersion)
std::map< int, std::shared_ptr< MicroGMTMatchQualLUT > > m_lutDict

◆ setCancelOutBits()

void l1t::MicroGMTCancelOutUnit::setCancelOutBits ( GMTInternalWedges wedges,
tftype  trackFinder,
cancelmode  mode 
)

Cancel out between sectors/wedges in one track finder.

Definition at line 39 of file MicroGMTCancelOutUnit.cc.

References l1t::bmtf, getCoordinateCancelBits(), getTrackAddrCancelBits(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, and amptDefaultParameters_cff::mu.

Referenced by L1TMuonProducer::produce().

39  {
40  std::vector<std::shared_ptr<GMTInternalMuon>> coll1;
41  coll1.reserve(3);
42  std::vector<std::shared_ptr<GMTInternalMuon>> coll2;
43  coll2.reserve(3);
44  int maxWedges = 6;
45  if (trackFinder == bmtf) {
46  maxWedges = 12;
47  }
48  for (int currentWedge = 0; currentWedge < maxWedges; ++currentWedge) {
49  for (const auto& mu : wedges.at(currentWedge)) {
50  coll1.push_back(mu);
51  }
52  // handle wrap around: max "wedge" has to be compared to first "wedge"
53  int neighbourWedge = (currentWedge + 1) % maxWedges;
54  for (const auto& mu : wedges.at(neighbourWedge)) {
55  coll2.push_back(mu);
56  }
58  getCoordinateCancelBits(coll2, coll1); // in case of a tie coll1 muon wins
59  } else {
60  getTrackAddrCancelBits(mode, coll1, coll2);
61  }
62 
63  coll1.clear();
64  coll2.clear();
65  }
66  }
void getCoordinateCancelBits(std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on eta/phi coo...
void getTrackAddrCancelBits(cancelmode, std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on track addre...

◆ setCancelOutBitsOverlapBarrel()

void l1t::MicroGMTCancelOutUnit::setCancelOutBitsOverlapBarrel ( GMTInternalWedges omtfSectors,
GMTInternalWedges bmtfWedges,
cancelmode  mode 
)

Cancel-out between overlap and barrel track finders.

Definition at line 68 of file MicroGMTCancelOutUnit.cc.

References getCoordinateCancelBits(), getTrackAddrCancelBits(), mps_fire::i, and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

Referenced by L1TMuonProducer::produce().

70  {
71  // overlap sector collection
72  std::vector<std::shared_ptr<GMTInternalMuon>> coll1;
73  coll1.reserve(3);
74  // barrel wedge collection with 4 wedges
75  std::vector<std::shared_ptr<GMTInternalMuon>> coll2;
76  coll2.reserve(12);
77 
78  for (int currentSector = 0; currentSector < 6; ++currentSector) {
79  for (const auto& omtfMuon : omtfSectors.at(currentSector)) {
80  coll1.push_back(omtfMuon);
81  }
82  // BMTF | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 0 |
83  // OMTF | 0 | 1 | 2 | 3 | 4 | 5 |
84  // cancel OMTF sector x with corresponding BMTF wedge + the two on either side;
85  // e.g. OMTF 0 with BMTF 0, 1, 2, 3, OMTF 2 with BMTF 4, 5, 6, 7 etc.
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);
90  }
91  }
93  getCoordinateCancelBits(coll1, coll2);
94  } else {
95  getTrackAddrCancelBits(mode, coll1, coll2);
96  }
97  coll1.clear();
98  coll2.clear();
99  }
100  }
void getCoordinateCancelBits(std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on eta/phi coo...
void getTrackAddrCancelBits(cancelmode, std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on track addre...

◆ setCancelOutBitsOverlapEndcap()

void l1t::MicroGMTCancelOutUnit::setCancelOutBitsOverlapEndcap ( GMTInternalWedges omtfSectors,
GMTInternalWedges emtfSectors,
cancelmode  mode 
)

Cancel-out between overlap and endcap track finders.

Definition at line 102 of file MicroGMTCancelOutUnit.cc.

References getCoordinateCancelBits(), getTrackAddrCancelBits(), mps_fire::i, and ALCARECOPromptCalibProdSiPixelAli0T_cff::mode.

Referenced by L1TMuonProducer::produce().

104  {
105  // overlap sector collection
106  std::vector<std::shared_ptr<GMTInternalMuon>> coll1;
107  coll1.reserve(3);
108  // endcap sector collection with 3 sectors
109  std::vector<std::shared_ptr<GMTInternalMuon>> coll2;
110  coll2.reserve(9);
111 
112  for (int curOmtfSector = 0; curOmtfSector < 6; ++curOmtfSector) {
113  for (const auto& omtfMuon : omtfSectors.at(curOmtfSector)) {
114  coll1.push_back(omtfMuon);
115  }
116  // OMTF | 0 | 1 | 2 | 3 | 4 | 5 |
117  // EMTF | 0 | 1 | 2 | 3 | 4 | 5 |
118  // cancel OMTF sector x with corresponding EMTF sector + the ones on either side;
119  // e.g. OMTF 1 with EMTF 0, 1, 2; OMTF 0 with EMTF 5, 0, 1 etc.
120  for (int i = 0; i < 3; ++i) {
121  // handling the wrap around: adding 5 because 0 has to be compared to 5
122  int curEmtfSector = ((curOmtfSector + 5) + i) % 6;
123  for (const auto& emtfMuon : emtfSectors.at(curEmtfSector)) {
124  coll2.push_back(emtfMuon);
125  }
126  }
127  if (mode == cancelmode::coordinate) {
128  getCoordinateCancelBits(coll1, coll2);
129  } else {
130  getTrackAddrCancelBits(mode, coll1, coll2);
131  }
132  coll1.clear();
133  coll2.clear();
134  }
135  }
void getCoordinateCancelBits(std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on eta/phi coo...
void getTrackAddrCancelBits(cancelmode, std::vector< std::shared_ptr< GMTInternalMuon >> &, std::vector< std::shared_ptr< GMTInternalMuon >> &)
Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on track addre...

Member Data Documentation

◆ m_boNegMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_boNegMatchQualLUT
private

Definition at line 45 of file MicroGMTCancelOutUnit.h.

Referenced by initialise().

◆ m_boPosMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_boPosMatchQualLUT
private

Definition at line 44 of file MicroGMTCancelOutUnit.h.

Referenced by initialise().

◆ m_brlSingleMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_brlSingleMatchQualLUT
private

Definition at line 48 of file MicroGMTCancelOutUnit.h.

◆ m_foNegMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_foNegMatchQualLUT
private

Definition at line 47 of file MicroGMTCancelOutUnit.h.

Referenced by initialise().

◆ m_foPosMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_foPosMatchQualLUT
private

Definition at line 46 of file MicroGMTCancelOutUnit.h.

Referenced by initialise().

◆ m_fwdNegSingleMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_fwdNegSingleMatchQualLUT
private

Definition at line 52 of file MicroGMTCancelOutUnit.h.

Referenced by initialise().

◆ m_fwdPosSingleMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_fwdPosSingleMatchQualLUT
private

Definition at line 51 of file MicroGMTCancelOutUnit.h.

Referenced by initialise().

◆ m_lutDict

std::map<int, std::shared_ptr<MicroGMTMatchQualLUT> > l1t::MicroGMTCancelOutUnit::m_lutDict
private

Definition at line 53 of file MicroGMTCancelOutUnit.h.

Referenced by getCoordinateCancelBits(), and initialise().

◆ m_ovlNegSingleMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_ovlNegSingleMatchQualLUT
private

Definition at line 50 of file MicroGMTCancelOutUnit.h.

Referenced by initialise().

◆ m_ovlPosSingleMatchQualLUT

std::shared_ptr<MicroGMTMatchQualLUT> l1t::MicroGMTCancelOutUnit::m_ovlPosSingleMatchQualLUT
private

Definition at line 49 of file MicroGMTCancelOutUnit.h.

Referenced by initialise().