8 : m_exComponent(ex), m_eyComponent(ey), m_algoType(
algo), m_bitShift(0), m_htMissLut(new
L1GctHtMissLut()) {}
11 : m_exComponent(ex), m_eyComponent(ey), m_algoType(
algo), m_bitShift(0), m_htMissLut(new
L1GctHtMissLut()) {}
93 static const int of_val = 0x1FFF;
95 static const int n_iterations = 6;
98 const int cordic_angles[n_iterations] = {0x120, 0x0AA, 0x05A, 0x02E, 0x017, 0x00B};
99 const int cordic_starting_angle_090 = 0x240;
100 const int cordic_starting_angle_270 = 0x6C0;
101 const int cordic_angle_360 = 0x900;
103 const int cordic_scale_factor = 0x26E;
112 z = cordic_starting_angle_090;
117 z = cordic_starting_angle_090;
121 z = cordic_starting_angle_270;
125 for (
int i = 0;
i < n_iterations;
i++) {
131 z =
z + cordic_angles[
i];
135 z =
z - cordic_angles[
i];
139 int scaled_magnitude =
x * cordic_scale_factor;
140 int adjusted_angle = ((
z < 0) ? (
z + cordic_angle_360) :
z) % cordic_angle_360;
141 result.mag = scaled_magnitude >> 10;
142 result.phi = adjusted_angle >> 5;
143 if (
result.mag > (
unsigned)of_val)
144 result.mag = (
unsigned)of_val;
153 r = (((
e >> (nBits - 1)) + 1) >> 1);
162 static const int componentMask = maxComponent - 1;
163 static const int maxPosComponent = componentMask >> 1;
181 if (
of || (
abs(ex) >= maxInput) || (
abs(ey) >= maxInput)) {
182 hxCompBits = maxPosComponent;
183 hyCompBits = maxPosComponent;
192 result.phi =
static_cast<unsigned>(lutData) & resultPhiMask;
216 unsigned eneCorect, phiCorect;
218 const unsigned root2fact = 181;
219 const unsigned corrFact[11] = {24, 39, 51, 60, 69, 77, 83, 89, 95, 101, 106};
220 const unsigned corrDphi[11] = {0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4};
222 std::vector<bool>
s(3);
233 My =
static_cast<unsigned>(
abs(ey));
234 Mx =
static_cast<unsigned>(
abs(ex));
235 Mw = (((Mx + My) * root2fact) + 0x80) >> 8;
243 for (
int i = 0;
i < 3;
i++) {
247 phibin = 2 * phibin +
b;
257 for (eFact = 0; eFact < 10; eFact++) {
258 Dx = (Mx * corrFact[eFact]) >> 8;
259 Dy = (My * corrFact[eFact]) >> 8;
260 if ((
Dx >= My) || (
Dy >= Mx)) {
264 if ((Mx +
Dx) >= (My -
Dy) && (My +
Dy) >= (Mx -
Dx)) {
269 eneCorect = (eneCoarse * (128 + eFact)) >> 7;
270 if (midphi ^ (
b == 1)) {
271 phiCorect =
phiCoarse + 8 - corrDphi[eFact];
287 double fx =
static_cast<double>(ex);
288 double fy =
static_cast<double>(ey);
292 result.mag =
static_cast<unsigned>(fmag);
294 result.phi =
static_cast<unsigned>(fphi);
296 result.phi =
static_cast<unsigned>(fphi + 72.);
318 static const int maxComponentInput =
etmiss_internal floatingPointAlgo(const int ex, const int ey) const
etmiss_vec metVector() const
etComponentType m_exComponent
void setEtScale(const L1CaloEtScale *const fn)
Set the functions.
L1GctMet(const unsigned ex=0, const unsigned ey=0, const metAlgoType algo=cordicTranslate)
static constexpr int kHxOrHyMissComponentNBits
static constexpr int kHtMissMagnitudeNBits
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
const double componentLsb() const
int value() const
access value as signed int
LUT for conversion of Ht components x and y to magnitude and angle.
const bool inputOverFlow() const
void setEyComponent(const unsigned ey)
void setExComponent(const unsigned ex)
etmiss_internal cordicTranslateAlgo(const int ex, const int ey, const bool of) const
void setEtScale(const L1CaloEtScale *const fn)
Abs< T >::type abs(const T &t)
void setExEyLsb(const double lsb)
etmiss_internal oldGctAlgo(const int ex, const int ey) const
L1GctHtMissLut * m_htMissLut
etComponentType m_eyComponent
etmiss_internal useHtMissLutAlgo(const int ex, const int ey, const bool of) const
const L1CaloEtScale * etScale() const
static constexpr int kHtMissAngleNBits
const L1CaloEtScale * etScale() const
Return the Lut functions and parameters.
bool overFlow() const
access overflow
int cordicShiftAndRoundBits(const int e, const unsigned nBits) const
const double componentLsb() const
unsigned short m_bitShift
void setEtComponentLsb(const double lsb)
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)