CMS 3D CMS Logo

Classes | Typedefs | Functions | Variables
l1tmhtemu Namespace Reference

Classes

struct  EtMiss
 

Typedefs

typedef ap_int< kInternalPtWidth+kEtExtraEt_t
 
typedef ap_int< kInternalEtaWidtheta_t
 
typedef ap_uint< kMHTSizeMHT_t
 
typedef ap_uint< kMHTPhiSizeMHTphi_t
 
typedef ap_uint< 5 > ntracks_t
 
typedef ap_int< kInternalPhiWidthphi_t
 
typedef ap_uint< kInternalPtWidthpt_t
 

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 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 {4096}
 
const float kMaxMHTPhi {2 * M_PI}
 
const unsigned int kMHTBins = 1 << kMHTSize
 
const unsigned int kMHTPhiBins = 1 << kMHTPhiSize
 
const unsigned int kMHTPhiSize {14}
 
const unsigned int kMHTSize {15}
 
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}
 

Typedef Documentation

◆ Et_t

Definition at line 40 of file L1TkHTMissEmulatorProducer.h.

◆ eta_t

Definition at line 37 of file L1TkHTMissEmulatorProducer.h.

◆ MHT_t

typedef ap_uint<kMHTSize> l1tmhtemu::MHT_t

Definition at line 41 of file L1TkHTMissEmulatorProducer.h.

◆ MHTphi_t

typedef ap_uint<kMHTPhiSize> l1tmhtemu::MHTphi_t

Definition at line 42 of file L1TkHTMissEmulatorProducer.h.

◆ ntracks_t

typedef ap_uint<5> l1tmhtemu::ntracks_t

Definition at line 35 of file L1TkHTMissEmulatorProducer.h.

◆ phi_t

Definition at line 38 of file L1TkHTMissEmulatorProducer.h.

◆ pt_t

Definition at line 36 of file L1TkHTMissEmulatorProducer.h.

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 104 of file L1TkHTMissEmulatorProducer.h.

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

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

108  {
109  Et_t new_x = 0;
110  Et_t new_y = 0;
111 
112  MHTphi_t phi = 0;
113  MHTphi_t new_phi = 0;
114  bool sign = false;
115 
116  EtMiss ret_etmiss;
117 
118  if (x >= 0 && y >= 0) {
119  phi = 0;
120  sign = true;
121  //x = x;
122  //y = y;
123  } else if (x < 0 && y >= 0) {
124  phi = kMHTPhiBins >> 1;
125  sign = false;
126  x = -x;
127  //y = y;
128  } else if (x < 0 && y < 0) {
129  phi = kMHTPhiBins >> 1;
130  sign = true;
131  x = -x;
132  y = -y;
133  } else {
134  phi = kMHTPhiBins;
135  sign = false;
136  //x = x;
137  y = -y;
138  }
139 
140  for (int step = 0; step < cordicSteps; step++) {
141  if (y < 0) {
142  new_x = x - (y >> step);
143  new_y = y + (x >> step);
144  } else {
145  new_x = x + (y >> step);
146  new_y = y - (x >> step);
147  }
148 
149  if ((y < 0) == sign) {
150  new_phi = phi - atanLUT[step];
151  } else {
152  new_phi = phi + atanLUT[step];
153  }
154 
155  x = new_x;
156  y = new_y;
157  phi = new_phi;
158  }
159 
160  float sqrtval = (float(x * magNormalisationLUT[cordicSteps - 1]) / float(kMHTBins)) * float(kStepPt * kStepPhi);
161 
162  ret_etmiss.Et = std::floor(sqrtval / l1tmhtemu::kStepMHT);
163  ret_etmiss.Phi = phi;
164 
165  return ret_etmiss;
166  }
const unsigned int kMHTBins
ap_uint< kMHTPhiSize > MHTphi_t
ap_int< kInternalPtWidth+kEtExtra > Et_t
const unsigned int kMHTPhiBins
float x
step
Definition: StallMonitor.cc:98

◆ digitizeSignedValue()

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

Definition at line 59 of file L1TkHTMissEmulatorProducer.h.

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

59  {
60  T digitized_value = std::floor(std::abs(value) / lsb);
61  T digitized_maximum = (1 << (nBits - 1)) - 1; // The remove 1 bit from nBits to account for the sign
62  if (digitized_value > digitized_maximum)
63  digitized_value = digitized_maximum;
64  if (value < 0)
65  digitized_value = (1 << nBits) - digitized_value; // two's complement encoding
66  return digitized_value;
67  }
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 80 of file L1TkHTMissEmulatorProducer.h.

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

Referenced by L1TkHTMissEmulatorProducer::L1TkHTMissEmulatorProducer().

80  { // Fill atan LUT with integer values
81  std::vector<MHTphi_t> atanLUT;
82  atanLUT.reserve(cordicSteps);
83  for (int cordicStep = 0; cordicStep < cordicSteps; cordicStep++) {
84  atanLUT.push_back(MHTphi_t(round((kMHTPhiBins * atan(pow(2, -1 * cordicStep))) / (2 * M_PI))));
85  }
86  return atanLUT;
87  }
ap_uint< kMHTPhiSize > MHTphi_t
#define M_PI
const unsigned int kMHTPhiBins
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ generateCosLUT()

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

Definition at line 69 of file L1TkHTMissEmulatorProducer.h.

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

Referenced by L1TkHTMissEmulatorProducer::L1TkHTMissEmulatorProducer().

69  { // Fill cosine LUT with integer values
70  float phi = 0;
71  std::vector<phi_t> cosLUT;
72  for (unsigned int LUT_idx = 0; LUT_idx < size; LUT_idx++) {
73  cosLUT.push_back(digitizeSignedValue<phi_t>(cos(phi), l1tmhtemu::kInternalPhiWidth, l1tmhtemu::kStepPhi));
75  }
76  cosLUT.push_back((phi_t)(0)); //Prevent overflow in last bin
77  return cosLUT;
78  }
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 89 of file L1TkHTMissEmulatorProducer.h.

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

Referenced by L1TkHTMissEmulatorProducer::L1TkHTMissEmulatorProducer().

89  {
90  float val = 1.0;
91  std::vector<Et_t> magNormalisationLUT;
92  for (int cordicStep = 0; cordicStep < cordicSteps; cordicStep++) {
93  val = val / (pow(1 + pow(4, -1 * cordicStep), 0.5));
94  magNormalisationLUT.push_back(Et_t(round(kMHTBins * val)));
95  }
96  return magNormalisationLUT;
97  }
const unsigned int kMHTBins
ap_int< kInternalPtWidth+kEtExtra > Et_t
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

Variable Documentation

◆ kEtExtra

const unsigned int l1tmhtemu::kEtExtra {10}

Definition at line 28 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 {4096}

Definition at line 32 of file L1TkHTMissEmulatorProducer.h.

◆ kMaxMHTPhi

const float l1tmhtemu::kMaxMHTPhi {2 * M_PI}

Definition at line 33 of file L1TkHTMissEmulatorProducer.h.

◆ kMHTBins

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

Definition at line 44 of file L1TkHTMissEmulatorProducer.h.

Referenced by cordicSqrt(), and generatemagNormalisationLUT().

◆ kMHTPhiBins

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

◆ kMHTPhiSize

const unsigned int l1tmhtemu::kMHTPhiSize {14}

Definition at line 31 of file L1TkHTMissEmulatorProducer.h.

◆ kMHTSize

const unsigned int l1tmhtemu::kMHTSize {15}

Definition at line 30 of file L1TkHTMissEmulatorProducer.h.

◆ kPhiBins

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

Definition at line 54 of file L1TkHTMissEmulatorProducer.h.

◆ kStepEta

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

◆ kStepMHT

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

Definition at line 51 of file L1TkHTMissEmulatorProducer.h.

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

◆ kStepMHTPhi

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

Definition at line 52 of file L1TkHTMissEmulatorProducer.h.

Referenced by L1TkHTMissEmulatorProducer::produce().

◆ kStepPhi

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

◆ kStepPt

const double l1tmhtemu::kStepPt {0.25}