CMS 3D CMS Logo

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