1 #ifndef L1Trigger_L1TTrackMatch_L1TkHTMissEmulatorProducer_HH 2 #define L1Trigger_L1TTrackMatch_L1TkHTMissEmulatorProducer_HH 36 typedef ap_uint<kInternalPtWidth>
pt_t;
37 typedef ap_int<kInternalEtaWidth>
eta_t;
38 typedef ap_int<kInternalPhiWidth>
phi_t;
40 typedef ap_int<kInternalPtWidth + kEtExtra>
Et_t;
41 typedef ap_uint<kMHTSize>
MHT_t;
61 T digitized_maximum = (1 << (nBits - 1)) - 1;
62 if (digitized_value > digitized_maximum)
63 digitized_value = digitized_maximum;
65 digitized_value = (1 << nBits) - digitized_value;
66 return digitized_value;
71 std::vector<phi_t> cosLUT;
72 for (
unsigned int LUT_idx = 0; LUT_idx <
size; LUT_idx++) {
76 cosLUT.push_back((
phi_t)(0));
81 std::vector<MHTphi_t> atanLUT;
82 atanLUT.reserve(cordicSteps);
83 for (
int cordicStep = 0; cordicStep < cordicSteps; cordicStep++) {
91 std::vector<Et_t> magNormalisationLUT;
92 for (
int cordicStep = 0; cordicStep < cordicSteps; cordicStep++) {
96 return magNormalisationLUT;
107 std::vector<l1tmhtemu::MHTphi_t> atanLUT,
108 std::vector<Et_t> magNormalisationLUT) {
118 if (
x >= 0 && y >= 0) {
123 }
else if (x < 0 && y >= 0) {
128 }
else if (
x < 0 && y < 0) {
142 new_x =
x - (y >>
step);
143 new_y = y + (
x >>
step);
145 new_x =
x + (y >>
step);
146 new_y = y - (
x >>
step);
149 if ((y < 0) ==
sign) {
150 new_phi = phi - atanLUT[
step];
152 new_phi = phi + atanLUT[
step];
163 ret_etmiss.
Phi = phi;
ap_uint< kMHTSize > MHT_t
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
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 kInternalEtaWidth
ap_int< kInternalPtWidth+kEtExtra > Et_t
const unsigned int kMHTPhiBins
std::vector< phi_t > generateCosLUT(unsigned int size)
std::vector< Et_t > generatemagNormalisationLUT(int cordicSteps)
T digitizeSignedValue(double value, unsigned int nBits, double lsb)
const unsigned int kEtExtra
ap_int< kInternalPhiWidth > phi_t
Power< A, B >::type pow(const A &a, const B &b)