CMS 3D CMS Logo

MicroGMTConfiguration.cc
Go to the documentation of this file.
2 
3 unsigned l1t::MicroGMTConfiguration::getTwosComp(const int signed_int, const int width) {
4  if (signed_int >= 0) {
5  return (unsigned)signed_int;
6  }
7  int all_one = (1 << width) - 1;
8  return ((-signed_int) ^ all_one) + 1;
9 }
10 
12  int globPhi = 0;
13  if (t == bmtf) {
14  // each BMTF processor corresponds to a 30 degree wedge = 48 in int-scale
15  globPhi = (proc) * 48 + locPhi;
16  // first processor starts at CMS phi = -15 degrees...
17  globPhi += 576 - 24;
18  // handle wrap-around (since we add the 576-24, the value will never be negative!)
19  globPhi = globPhi % 576;
20  } else {
21  // all others correspond to 60 degree sectors = 96 in int-scale
22  globPhi = (proc) * 96 + locPhi;
23  // first processor starts at CMS phi = 15 degrees (24 in int)... Handle wrap-around with %. Add 576 to make sure the number is positive
24  globPhi = (globPhi + 600) % 576;
25  }
26  return globPhi;
27 }
28 
29 int l1t::MicroGMTConfiguration::setOutputMuonQuality(int muQual, tftype type, int haloBit, unsigned fwVersion) {
30  if (fwVersion >= 0x8010000) {
31  // From 2024 uGMT sends the full quality on to uGT
32  return muQual;
33  } else if (haloBit == 1 && (type == tftype::emtf_neg || type == tftype::emtf_pos)) {
34  // set quality to 0xF if the halo bit is set
35  return 0xF;
36  } else {
37  // use only the two MSBs for the muon to the uGT
38  return muQual & 0xC;
39  }
40 }
41 
42 int l1t::MicroGMTConfiguration::calcMuonHwEtaExtra(const l1t::Muon& mu) { return mu.hwEta() + mu.hwDEtaExtra(); }
43 
45  auto hwPhiExtra = mu.hwPhi() + mu.hwDPhiExtra();
46  while (hwPhiExtra < 0) {
47  hwPhiExtra += 576;
48  }
49  while (hwPhiExtra > 575) {
50  hwPhiExtra -= 576;
51  }
52  return hwPhiExtra;
53 }
54 
55 double l1t::MicroGMTConfiguration::calcMuonEtaExtra(const l1t::Muon& mu) { return calcMuonHwEtaExtra(mu) * 0.010875; }
56 
58  //use the LorentzVector to get phi in the range -pi to +pi exactly as in the emulator
59  math::PtEtaPhiMLorentzVector vec{0., 0., calcMuonHwPhiExtra(mu) * 0.010908, 0.};
60  return vec.phi();
61 }
static unsigned getTwosComp(const int signedInt, const int width)
static int setOutputMuonQuality(int muQual, tftype type, int haloBit, unsigned fwVersion)
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
static int calcMuonHwPhiExtra(const l1t::Muon &mu)
static int calcMuonHwEtaExtra(const l1t::Muon &mu)
static double calcMuonPhiExtra(const l1t::Muon &mu)
Definition: Muon.h:21
static int calcGlobalPhi(int locPhi, tftype t, int proc)
static double calcMuonEtaExtra(const l1t::Muon &mu)