CMS 3D CMS Logo

Classes | Typedefs | Enumerations | Functions | Variables
l1tmhtemu Namespace Reference

Classes

struct  EtMiss
 

Typedefs

typedef ap_int< kHTSizeEt_t
 
typedef ap_int< kInternalEtaWidtheta_t
 
typedef ap_ufixed< kMHTSize, kMHTIntSizeMHT_t
 
typedef ap_uint< kMHTPhiSizeMHTphi_t
 
typedef ap_uint< 5 > ntracks_t
 
typedef ap_int< kInternalPhiWidthphi_t
 
typedef ap_uint< kInternalPtWidthpt_t
 

Enumerations

enum  BitLocations {
  kValidLSB = 0, kValidMSB = kValidLSB + kValidSize - 1, kMHTLSB = kValidMSB + 1, kMHTMSB = kMHTLSB + kMHTSize - 1,
  kMHTPhiLSB = kMHTMSB + 1, kMHTPhiMSB = kMHTPhiLSB + kMHTPhiSize - 1, kHTLSB = kMHTPhiMSB + 1, kHTMSB = kHTLSB + kHTSize - 1,
  kUnassignedLSB = kHTMSB + 1, kUnassignedMSB = kUnassignedLSB + kUnassignedSize - 1
}
 

Functions

EtMiss cordicSqrt (Et_t x, Et_t y, int cordicSteps, std::vector< l1tmhtemu::MHTphi_t > atanLUT, std::vector< Et_t > magNormalisationLUT)
 
template<typename T >
T digitizeSignedValue (double value, unsigned int nBits, double lsb)
 
std::vector< MHTphi_tgenerateaTanLUT (int cordicSteps)
 
std::vector< phi_tgenerateCosLUT (unsigned int size)
 
std::vector< Et_tgeneratemagNormalisationLUT (int cordicSteps)
 

Variables

const unsigned int kEtExtra {10}
 
const unsigned int kHTSize {kInternalPtWidth + kEtExtra}
 
const unsigned int kInternalEtaWidth {l1t::TkJetWord::TkJetBitWidths::kGlbEtaSize}
 
const unsigned int kInternalPhiWidth {l1t::TkJetWord::TkJetBitWidths::kGlbPhiSize}
 
const unsigned int kInternalPtWidth {l1t::TkJetWord::TkJetBitWidths::kPtSize}
 
const float kMaxCosLUTPhi {M_PI}
 
const float kMaxMHT {2048}
 
const float kMaxMHTPhi {2 * M_PI}
 
const unsigned int kMHTBins = 1 << kMHTSize
 
const unsigned int kMHTIntSize {11}
 
const unsigned int kMHTPhiBins = 1 << kMHTPhiSize
 
const unsigned int kMHTPhiSize {13}
 
const unsigned int kMHTSize {16}
 
const unsigned int kPhiBins = 1 << kInternalPhiWidth
 
const double kStepEta {M_PI / (720)}
 
const double kStepMHT = (l1tmhtemu::kMaxMHT / l1tmhtemu::kMHTBins)
 
const double kStepMHTPhi = (l1tmhtemu::kMaxMHTPhi / l1tmhtemu::kMHTPhiBins)
 
const double kStepPhi {M_PI / (720)}
 
const double kStepPt {0.25}
 
const unsigned int kUnassignedSize {64 - (kHTSize + kMHTSize + kMHTPhiSize + kValidSize)}
 
const unsigned int kValidSize {1}
 

Typedef Documentation

◆ Et_t

typedef ap_int<kHTSize> l1tmhtemu::Et_t

Definition at line 58 of file L1TkHTMissEmulatorProducer.h.

◆ eta_t

Definition at line 55 of file L1TkHTMissEmulatorProducer.h.

◆ MHT_t

typedef ap_ufixed<kMHTSize, kMHTIntSize> l1tmhtemu::MHT_t

Definition at line 59 of file L1TkHTMissEmulatorProducer.h.

◆ MHTphi_t

typedef ap_uint<kMHTPhiSize> l1tmhtemu::MHTphi_t

Definition at line 60 of file L1TkHTMissEmulatorProducer.h.

◆ ntracks_t

typedef ap_uint<5> l1tmhtemu::ntracks_t

Definition at line 53 of file L1TkHTMissEmulatorProducer.h.

◆ phi_t

Definition at line 56 of file L1TkHTMissEmulatorProducer.h.

◆ pt_t

Definition at line 54 of file L1TkHTMissEmulatorProducer.h.

Enumeration Type Documentation

◆ BitLocations

Enumerator
kValidLSB 
kValidMSB 
kMHTLSB 
kMHTMSB 
kMHTPhiLSB 
kMHTPhiMSB 
kHTLSB 
kHTMSB 
kUnassignedLSB 
kUnassignedMSB 

Definition at line 36 of file L1TkHTMissEmulatorProducer.h.

36  {
37  // The location of the least significant bit (LSB) and most significant bit (MSB) in the sum word for different fields
38  kValidLSB = 0,
40  kMHTLSB = kValidMSB + 1,
41  kMHTMSB = kMHTLSB + kMHTSize - 1,
42  kMHTPhiLSB = kMHTMSB + 1,
44  kHTLSB = kMHTPhiMSB + 1,
45  kHTMSB = kHTLSB + kHTSize - 1,
46  kUnassignedLSB = kHTMSB + 1,
48  };
const unsigned int kMHTPhiSize
const unsigned int kValidSize
const unsigned int kMHTSize
const unsigned int kUnassignedSize
const unsigned int kHTSize

Function Documentation

◆ cordicSqrt()

EtMiss l1tmhtemu::cordicSqrt ( Et_t  x,
Et_t  y,
int  cordicSteps,
std::vector< l1tmhtemu::MHTphi_t atanLUT,
std::vector< Et_t magNormalisationLUT 
)
inline

Definition at line 122 of file L1TkHTMissEmulatorProducer.h.

References l1tmhtemu::EtMiss::Et, nano_mu_digi_cff::float, kMHTBins, kMHTPhiBins, kStepPhi, kStepPt, l1tmhtemu::EtMiss::Phi, Validation_hcalonly_cfi::sign, and x.

Referenced by L1TkHTMissEmulatorProducer::produce(), and L1TrackerEtMissEmulatorProducer::produce().

126  {
127  Et_t new_x = 0;
128  Et_t new_y = 0;
129 
130  MHTphi_t phi = 0;
131  MHTphi_t new_phi = 0;
132  bool sign = false;
133 
134  EtMiss ret_etmiss;
135 
136  if (x >= 0 && y >= 0) {
137  phi = 0;
138  sign = true;
139  //x = x;
140  //y = y;
141  } else if (x < 0 && y >= 0) {
142  phi = kMHTPhiBins >> 1;
143  sign = false;
144  x = -x;
145  //y = y;
146  } else if (x < 0 && y < 0) {
147  phi = kMHTPhiBins >> 1;
148  sign = true;
149  x = -x;
150  y = -y;
151  } else {
152  phi = kMHTPhiBins;
153  sign = false;
154  //x = x;
155  y = -y;
156  }
157 
158  for (int step = 0; step < cordicSteps; step++) {
159  if (y < 0) {
160  new_x = x - (y >> step);
161  new_y = y + (x >> step);
162  } else {
163  new_x = x + (y >> step);
164  new_y = y - (x >> step);
165  }
166 
167  if ((y < 0) == sign) {
168  new_phi = phi - atanLUT[step];
169  } else {
170  new_phi = phi + atanLUT[step];
171  }
172 
173  x = new_x;
174  y = new_y;
175  phi = new_phi;
176  }
177 
178  float sqrtval = (float(x * magNormalisationLUT[cordicSteps - 1]) / (float)kMHTBins) * float(kStepPt * kStepPhi);
179  ret_etmiss.Et = sqrtval;
180  ret_etmiss.Phi = phi;
181 
182  return ret_etmiss;
183  }
const unsigned int kMHTBins
ap_uint< kMHTPhiSize > MHTphi_t
const unsigned int kMHTPhiBins
float x
step
Definition: StallMonitor.cc:83
ap_int< kHTSize > Et_t

◆ digitizeSignedValue()

template<typename T >
T l1tmhtemu::digitizeSignedValue ( double  value,
unsigned int  nBits,
double  lsb 
)

Definition at line 77 of file L1TkHTMissEmulatorProducer.h.

References funct::abs(), and l1tHGCalVFEProducer_cfi::lsb.

77  {
78  T digitized_value = std::floor(std::abs(value) / lsb);
79  T digitized_maximum = (1 << (nBits - 1)) - 1; // The remove 1 bit from nBits to account for the sign
80  if (digitized_value > digitized_maximum)
81  digitized_value = digitized_maximum;
82  if (value < 0)
83  digitized_value = (1 << nBits) - digitized_value; // two's complement encoding
84  return digitized_value;
85  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: value.py:1
long double T

◆ generateaTanLUT()

std::vector<MHTphi_t> l1tmhtemu::generateaTanLUT ( int  cordicSteps)
inline

Definition at line 98 of file L1TkHTMissEmulatorProducer.h.

References kMHTPhiBins, M_PI, and conifer::pow().

Referenced by L1TkHTMissEmulatorProducer::L1TkHTMissEmulatorProducer().

98  { // Fill atan LUT with integer values
99  std::vector<MHTphi_t> atanLUT;
100  atanLUT.reserve(cordicSteps);
101  for (int cordicStep = 0; cordicStep < cordicSteps; cordicStep++) {
102  atanLUT.push_back(MHTphi_t(round((kMHTPhiBins * atan(pow(2, -1 * cordicStep))) / (2 * M_PI))));
103  }
104  return atanLUT;
105  }
constexpr int pow(int x)
Definition: conifer.h:24
ap_uint< kMHTPhiSize > MHTphi_t
#define M_PI
const unsigned int kMHTPhiBins

◆ generateCosLUT()

std::vector<phi_t> l1tmhtemu::generateCosLUT ( unsigned int  size)
inline

Definition at line 87 of file L1TkHTMissEmulatorProducer.h.

References funct::cos(), kInternalPhiWidth, and kStepPhi.

Referenced by L1TkHTMissEmulatorProducer::L1TkHTMissEmulatorProducer().

87  { // Fill cosine LUT with integer values
88  float phi = 0;
89  std::vector<phi_t> cosLUT;
90  for (unsigned int LUT_idx = 0; LUT_idx < size; LUT_idx++) {
91  cosLUT.push_back(digitizeSignedValue<phi_t>(cos(phi), l1tmhtemu::kInternalPhiWidth, l1tmhtemu::kStepPhi));
93  }
94  cosLUT.push_back((phi_t)(0)); //Prevent overflow in last bin
95  return cosLUT;
96  }
size
Write out results.
const unsigned int kInternalPhiWidth
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
ap_int< kInternalPhiWidth > phi_t

◆ generatemagNormalisationLUT()

std::vector<Et_t> l1tmhtemu::generatemagNormalisationLUT ( int  cordicSteps)
inline

Definition at line 107 of file L1TkHTMissEmulatorProducer.h.

References kMHTBins, conifer::pow(), and heppy_batch::val.

Referenced by L1TkHTMissEmulatorProducer::L1TkHTMissEmulatorProducer().

107  {
108  float val = 1.0;
109  std::vector<Et_t> magNormalisationLUT;
110  for (int cordicStep = 0; cordicStep < cordicSteps; cordicStep++) {
111  val = val / (pow(1 + pow(4, -1 * cordicStep), 0.5));
112  magNormalisationLUT.push_back(Et_t(round(kMHTBins * val)));
113  }
114  return magNormalisationLUT;
115  }
const unsigned int kMHTBins
constexpr int pow(int x)
Definition: conifer.h:24
ap_int< kHTSize > Et_t

Variable Documentation

◆ kEtExtra

const unsigned int l1tmhtemu::kEtExtra {10}

Definition at line 28 of file L1TkHTMissEmulatorProducer.h.

◆ kHTSize

const unsigned int l1tmhtemu::kHTSize {kInternalPtWidth + kEtExtra}

Definition at line 33 of file L1TkHTMissEmulatorProducer.h.

◆ kInternalEtaWidth

const unsigned int l1tmhtemu::kInternalEtaWidth {l1t::TkJetWord::TkJetBitWidths::kGlbEtaSize}

◆ kInternalPhiWidth

const unsigned int l1tmhtemu::kInternalPhiWidth {l1t::TkJetWord::TkJetBitWidths::kGlbPhiSize}

◆ kInternalPtWidth

const unsigned int l1tmhtemu::kInternalPtWidth {l1t::TkJetWord::TkJetBitWidths::kPtSize}

◆ kMaxCosLUTPhi

const float l1tmhtemu::kMaxCosLUTPhi {M_PI}

◆ kMaxMHT

const float l1tmhtemu::kMaxMHT {2048}

Definition at line 50 of file L1TkHTMissEmulatorProducer.h.

◆ kMaxMHTPhi

const float l1tmhtemu::kMaxMHTPhi {2 * M_PI}

Definition at line 51 of file L1TkHTMissEmulatorProducer.h.

◆ kMHTBins

const unsigned int l1tmhtemu::kMHTBins = 1 << kMHTSize

Definition at line 62 of file L1TkHTMissEmulatorProducer.h.

Referenced by cordicSqrt(), and generatemagNormalisationLUT().

◆ kMHTIntSize

const unsigned int l1tmhtemu::kMHTIntSize {11}

Definition at line 31 of file L1TkHTMissEmulatorProducer.h.

◆ kMHTPhiBins

const unsigned int l1tmhtemu::kMHTPhiBins = 1 << kMHTPhiSize

◆ kMHTPhiSize

const unsigned int l1tmhtemu::kMHTPhiSize {13}

Definition at line 32 of file L1TkHTMissEmulatorProducer.h.

◆ kMHTSize

const unsigned int l1tmhtemu::kMHTSize {16}

Definition at line 30 of file L1TkHTMissEmulatorProducer.h.

◆ kPhiBins

const unsigned int l1tmhtemu::kPhiBins = 1 << kInternalPhiWidth

Definition at line 72 of file L1TkHTMissEmulatorProducer.h.

◆ kStepEta

const double l1tmhtemu::kStepEta {M_PI / (720)}

◆ kStepMHT

const double l1tmhtemu::kStepMHT = (l1tmhtemu::kMaxMHT / l1tmhtemu::kMHTBins)

Definition at line 69 of file L1TkHTMissEmulatorProducer.h.

◆ kStepMHTPhi

const double l1tmhtemu::kStepMHTPhi = (l1tmhtemu::kMaxMHTPhi / l1tmhtemu::kMHTPhiBins)

Definition at line 70 of file L1TkHTMissEmulatorProducer.h.

Referenced by L1TkHTMissEmulatorProducer::produce().

◆ kStepPhi

const double l1tmhtemu::kStepPhi {M_PI / (720)}

◆ kStepPt

const double l1tmhtemu::kStepPt {0.25}

◆ kUnassignedSize

const unsigned int l1tmhtemu::kUnassignedSize {64 - (kHTSize + kMHTSize + kMHTPhiSize + kValidSize)}

◆ kValidSize

const unsigned int l1tmhtemu::kValidSize {1}