File indexing completed on 2024-04-06 12:20:48
0001 #include "L1Trigger/L1TMuon/interface/MicroGMTConfiguration.h"
0002
0003 unsigned l1t::MicroGMTConfiguration::getTwosComp(const int signed_int, const int width) {
0004 if (signed_int >= 0) {
0005 return (unsigned)signed_int;
0006 }
0007 int all_one = (1 << width) - 1;
0008 return ((-signed_int) ^ all_one) + 1;
0009 }
0010
0011 int l1t::MicroGMTConfiguration::calcGlobalPhi(int locPhi, tftype t, int proc) {
0012 int globPhi = 0;
0013 if (t == bmtf) {
0014
0015 globPhi = (proc) * 48 + locPhi;
0016
0017 globPhi += 576 - 24;
0018
0019 globPhi = globPhi % 576;
0020 } else {
0021
0022 globPhi = (proc) * 96 + locPhi;
0023
0024 globPhi = (globPhi + 600) % 576;
0025 }
0026 return globPhi;
0027 }
0028
0029 int l1t::MicroGMTConfiguration::setOutputMuonQuality(int muQual, tftype type, int haloBit, unsigned fwVersion) {
0030 if (fwVersion >= 0x8010000) {
0031
0032 return muQual;
0033 } else if (haloBit == 1 && (type == tftype::emtf_neg || type == tftype::emtf_pos)) {
0034
0035 return 0xF;
0036 } else {
0037
0038 return muQual & 0xC;
0039 }
0040 }
0041
0042 int l1t::MicroGMTConfiguration::calcMuonHwEtaExtra(const l1t::Muon& mu) { return mu.hwEta() + mu.hwDEtaExtra(); }
0043
0044 int l1t::MicroGMTConfiguration::calcMuonHwPhiExtra(const l1t::Muon& mu) {
0045 auto hwPhiExtra = mu.hwPhi() + mu.hwDPhiExtra();
0046 while (hwPhiExtra < 0) {
0047 hwPhiExtra += 576;
0048 }
0049 while (hwPhiExtra > 575) {
0050 hwPhiExtra -= 576;
0051 }
0052 return hwPhiExtra;
0053 }
0054
0055 double l1t::MicroGMTConfiguration::calcMuonEtaExtra(const l1t::Muon& mu) { return calcMuonHwEtaExtra(mu) * 0.010875; }
0056
0057 double l1t::MicroGMTConfiguration::calcMuonPhiExtra(const l1t::Muon& mu) {
0058
0059 math::PtEtaPhiMLorentzVector vec{0., 0., calcMuonHwPhiExtra(mu) * 0.010908, 0.};
0060 return vec.phi();
0061 }