1 #ifndef L1Trigger_L1TTrackMatch_L1TkHTMissEmulatorProducer_HH 2 #define L1Trigger_L1TTrackMatch_L1TkHTMissEmulatorProducer_HH 54 typedef ap_uint<kInternalPtWidth>
pt_t;
55 typedef ap_int<kInternalEtaWidth>
eta_t;
56 typedef ap_int<kInternalPhiWidth>
phi_t;
58 typedef ap_int<kHTSize>
Et_t;
59 typedef ap_ufixed<kMHTSize, kMHTIntSize>
MHT_t;
79 T digitized_maximum = (1 << (nBits - 1)) - 1;
80 if (digitized_value > digitized_maximum)
81 digitized_value = digitized_maximum;
83 digitized_value = (1 << nBits) - digitized_value;
84 return digitized_value;
89 std::vector<phi_t> cosLUT;
90 for (
unsigned int LUT_idx = 0; LUT_idx <
size; LUT_idx++) {
94 cosLUT.push_back((
phi_t)(0));
99 std::vector<MHTphi_t> atanLUT;
100 atanLUT.reserve(cordicSteps);
101 for (
int cordicStep = 0; cordicStep < cordicSteps; cordicStep++) {
109 std::vector<Et_t> magNormalisationLUT;
110 for (
int cordicStep = 0; cordicStep < cordicSteps; cordicStep++) {
114 return magNormalisationLUT;
125 std::vector<l1tmhtemu::MHTphi_t> atanLUT,
126 std::vector<Et_t> magNormalisationLUT) {
136 if (
x >= 0 && y >= 0) {
141 }
else if (x < 0 && y >= 0) {
146 }
else if (
x < 0 && y < 0) {
160 new_x =
x - (y >>
step);
161 new_y = y + (
x >>
step);
163 new_x =
x + (y >>
step);
164 new_y = y - (
x >>
step);
167 if ((y < 0) ==
sign) {
168 new_phi = phi - atanLUT[
step];
170 new_phi = phi + atanLUT[
step];
179 ret_etmiss.
Et = sqrtval;
180 ret_etmiss.
Phi = phi;
const unsigned int kMHTBins
ap_uint< kMHTPhiSize > MHTphi_t
EtMiss cordicSqrt(Et_t x, Et_t y, int cordicSteps, std::vector< l1tmhtemu::MHTphi_t > atanLUT, std::vector< Et_t > magNormalisationLUT)
std::vector< MHTphi_t > generateaTanLUT(int cordicSteps)
const unsigned int kInternalPhiWidth
const unsigned int kMHTPhiSize
const float kMaxCosLUTPhi
ap_uint< kInternalPtWidth > pt_t
ap_ufixed< kMHTSize, kMHTIntSize > MHT_t
const unsigned int kValidSize
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
const unsigned int kPhiBins
const unsigned int kMHTSize
const unsigned int kInternalPtWidth
ap_int< kInternalEtaWidth > eta_t
const unsigned int kMHTIntSize
const unsigned int kInternalEtaWidth
const unsigned int kMHTPhiBins
std::vector< phi_t > generateCosLUT(unsigned int size)
const unsigned int kUnassignedSize
std::vector< Et_t > generatemagNormalisationLUT(int cordicSteps)
T digitizeSignedValue(double value, unsigned int nBits, double lsb)
const unsigned int kEtExtra
const unsigned int kHTSize
ap_int< kInternalPhiWidth > phi_t
Power< A, B >::type pow(const A &a, const B &b)