CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
L1GctMet Class Reference

Stores Level-1 missing Et in (Ex, Ey) form, allowing it to be retrieved as (magnitude, angle) More...

#include <L1GctMet.h>

Classes

struct  etmiss_internal
 
struct  etmiss_vec
 

Public Types

typedef
L1GctWheelEnergyFpga::etComponentType 
etComponentType
 
typedef L1GctUnsignedInt
< L1GctEtMiss::kEtMissPhiNBits
etMissPhiType
 
typedef L1GctUnsignedInt
< L1GctEtMiss::kEtMissNBits
etMissType
 
enum  metAlgoType { cordicTranslate, useHtMissLut, oldGct, floatingPoint }
 

Public Member Functions

const double componentLsb () const
 
const L1CaloEtScaleetScale () const
 
metAlgoType getAlgoType () const
 
unsigned getBitShift () const
 
etComponentType getExComponent () const
 
etComponentType getEyComponent () const
 
const L1GctHtMissLutgetHtMissLut () const
 
 L1GctMet (const unsigned ex=0, const unsigned ey=0, const metAlgoType algo=cordicTranslate)
 
 L1GctMet (const etComponentType &ex, const etComponentType &ey, const metAlgoType algo=cordicTranslate)
 
etmiss_vec metVector () const
 
void setAlgoType (const metAlgoType algo)
 
void setBitShift (const unsigned nbits)
 
void setComponents (const unsigned ex, const unsigned ey)
 
void setComponents (const etComponentType &ex, const etComponentType &ey)
 
void setEtComponentLsb (const double lsb)
 
void setEtScale (const L1CaloEtScale *const fn)
 
void setExComponent (const unsigned ex)
 
void setExComponent (const etComponentType &ex)
 
void setEyComponent (const unsigned ey)
 
void setEyComponent (const etComponentType &ey)
 
 ~L1GctMet ()
 

Private Types

enum  etComponentShift { kExOrEyMissComponentShift = 4 }
 

Private Member Functions

int cordicShiftAndRoundBits (const int e, const unsigned nBits) const
 
etmiss_internal cordicTranslateAlgo (const int ex, const int ey, const bool of) const
 
etmiss_internal floatingPointAlgo (const int ex, const int ey) const
 
const bool inputOverFlow () const
 
etmiss_internal oldGctAlgo (const int ex, const int ey) const
 
etmiss_internal useHtMissLutAlgo (const int ex, const int ey, const bool of) const
 

Private Attributes

metAlgoType m_algoType
 
unsigned short m_bitShift
 
etComponentType m_exComponent
 
etComponentType m_eyComponent
 
L1GctHtMissLutm_htMissLut
 

Detailed Description

Stores Level-1 missing Et in (Ex, Ey) form, allowing it to be retrieved as (magnitude, angle)

Author
Greg Heath
Date
April 2008

Allows the implementation of alternative algorithms

Definition at line 20 of file L1GctMet.h.

Member Typedef Documentation

Definition at line 26 of file L1GctMet.h.

Definition at line 25 of file L1GctMet.h.

Definition at line 24 of file L1GctMet.h.

Member Enumeration Documentation

Enumerator
kExOrEyMissComponentShift 

Definition at line 76 of file L1GctMet.h.

Enumerator
cordicTranslate 
useHtMissLut 
oldGct 
floatingPoint 

Definition at line 22 of file L1GctMet.h.

Constructor & Destructor Documentation

L1GctMet::L1GctMet ( const unsigned  ex = 0,
const unsigned  ey = 0,
const metAlgoType  algo = cordicTranslate 
)

Definition at line 7 of file L1GctMet.cc.

etComponentType m_exComponent
Definition: L1GctMet.h:87
LUT for conversion of Ht components x and y to magnitude and angle.
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:92
etComponentType m_eyComponent
Definition: L1GctMet.h:88
metAlgoType m_algoType
Definition: L1GctMet.h:89
unsigned short m_bitShift
Definition: L1GctMet.h:90
L1GctMet::L1GctMet ( const etComponentType ex,
const etComponentType ey,
const metAlgoType  algo = cordicTranslate 
)

Definition at line 10 of file L1GctMet.cc.

etComponentType m_exComponent
Definition: L1GctMet.h:87
LUT for conversion of Ht components x and y to magnitude and angle.
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:92
etComponentType m_eyComponent
Definition: L1GctMet.h:88
metAlgoType m_algoType
Definition: L1GctMet.h:89
unsigned short m_bitShift
Definition: L1GctMet.h:90
L1GctMet::~L1GctMet ( )

Definition at line 13 of file L1GctMet.cc.

13 {}

Member Function Documentation

const double L1GctMet::componentLsb ( ) const

Definition at line 310 of file L1GctMet.cc.

References L1GctHtMissLut::componentLsb(), and m_htMissLut.

310 { return m_htMissLut->componentLsb(); }
const double componentLsb() const
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:92
int L1GctMet::cordicShiftAndRoundBits ( const int  e,
const unsigned  nBits 
) const
private

Definition at line 148 of file L1GctMet.cc.

References alignCSCRings::e, and alignCSCRings::r.

Referenced by cordicTranslateAlgo().

148  {
149  int r;
150  if (nBits == 0) {
151  r = e;
152  } else {
153  r = (((e >> (nBits - 1)) + 1) >> 1);
154  }
155  return r;
156 }
L1GctMet::etmiss_internal L1GctMet::cordicTranslateAlgo ( const int  ex,
const int  ey,
const bool  of 
) const
private

Definition at line 66 of file L1GctMet.cc.

References cordicShiftAndRoundBits(), PVValHelper::dx, PVValHelper::dy, mps_fire::i, L1GctMet::etmiss_internal::mag, L1GctMet::etmiss_internal::phi, mps_fire::result, x, y, and z.

Referenced by metVector().

66  {
67  //---------------------------------------------------------------------------------
68  //
69  // This is an implementation of the CORDIC algorithm (COordinate Rotation for DIgital Computers)
70  //
71  // Starting from an initial two-component vector ex, ey, we perform successively smaller rotations
72  // to transform the y component to zero. At the end of the procedure, the x component is the magnitude
73  // of the original vector, scaled by a known constant factor. The azimuth angle phi is the sum of the
74  // rotations applied.
75  //
76  // The algorithm can be used in a number of different variants for calculation of trigonometric
77  // and hyperbolic functions as well as exponentials, logarithms and square roots. This variant
78  // is called the "vector translation" mode in the Xilinx documentation.
79  //
80  // Original references:
81  // Volder, J., "The CORDIC Trigonometric Computing Technique" IRE Trans. Electronic Computing, Vol.
82  // EC-8, Sept. 1959, pp330-334
83  // Walther, J.S., "A Unified Algorithm for Elementary Functions," Spring Joint computer conf., 1971,
84  // proc., pp379-385
85  //
86  // Other information sources: http://www.xilinx.com/support/documentation/ip_documentation/cordic.pdf;
87  // http://www.fpga-guru.com/files/crdcsrvy.pdf; and http://en.wikipedia.org/wiki/CORDIC
88  //
89  //---------------------------------------------------------------------------------
90 
91  etmiss_internal result;
92 
93  static const int of_val = 0x1FFF; // set components to 8191 (decimal) if there's an overflow on the input
94 
95  static const int n_iterations = 6;
96  // The angle units here are 1/32 of a 5 degree bin.
97  // So a 90 degree rotation is 32*18=576 or 240 hex.
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;
102 
103  const int cordic_scale_factor = 0x26E; // decimal 622
104 
105  int x, y;
106  int dx, dy;
107  int z;
108 
109  if (of) {
110  x = of_val;
111  y = -of_val;
112  z = cordic_starting_angle_090;
113  } else {
114  if (ey >= 0) {
115  x = ey;
116  y = -ex;
117  z = cordic_starting_angle_090;
118  } else {
119  x = -ey;
120  y = ex;
121  z = cordic_starting_angle_270;
122  }
123  }
124 
125  for (int i = 0; i < n_iterations; i++) {
126  dx = cordicShiftAndRoundBits(y, i);
127  dy = cordicShiftAndRoundBits(x, i);
128  if (y >= 0) {
129  x = x + dx;
130  y = y - dy;
131  z = z + cordic_angles[i];
132  } else {
133  x = x - dx;
134  y = y + dy;
135  z = z - cordic_angles[i];
136  }
137  }
138 
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;
145  return result;
146 }
tuple result
Definition: mps_fire.py:311
tuple of
Definition: haddnano.py:40
int cordicShiftAndRoundBits(const int e, const unsigned nBits) const
Definition: L1GctMet.cc:148
const L1CaloEtScale * L1GctMet::etScale ( ) const

Definition at line 308 of file L1GctMet.cc.

References L1GctHtMissLut::etScale(), and m_htMissLut.

308 { return m_htMissLut->etScale(); }
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:92
const L1CaloEtScale * etScale() const
Return the Lut functions and parameters.
L1GctMet::etmiss_internal L1GctMet::floatingPointAlgo ( const int  ex,
const int  ey 
) const
private

Definition at line 284 of file L1GctMet.cc.

References M_PI, L1GctMet::etmiss_internal::mag, L1GctMet::etmiss_internal::phi, mps_fire::result, and mathSSE::sqrt().

Referenced by metVector().

284  {
285  etmiss_internal result;
286 
287  double fx = static_cast<double>(ex);
288  double fy = static_cast<double>(ey);
289  double fmag = sqrt(fx * fx + fy * fy);
290  double fphi = 36. * atan2(fy, fx) / M_PI;
291 
292  result.mag = static_cast<unsigned>(fmag);
293  if (fphi >= 0) {
294  result.phi = static_cast<unsigned>(fphi);
295  } else {
296  result.phi = static_cast<unsigned>(fphi + 72.);
297  }
298 
299  return result;
300 }
tuple result
Definition: mps_fire.py:311
T sqrt(T t)
Definition: SSEVec.h:19
#define M_PI
metAlgoType L1GctMet::getAlgoType ( ) const
inline

Definition at line 58 of file L1GctMet.h.

References m_algoType.

58 { return m_algoType; }
metAlgoType m_algoType
Definition: L1GctMet.h:89
unsigned L1GctMet::getBitShift ( ) const
inline

Definition at line 63 of file L1GctMet.h.

References m_bitShift.

63 { return m_bitShift; }
unsigned short m_bitShift
Definition: L1GctMet.h:90
etComponentType L1GctMet::getExComponent ( ) const
inline

Definition at line 53 of file L1GctMet.h.

References m_exComponent.

53 { return m_exComponent; }
etComponentType m_exComponent
Definition: L1GctMet.h:87
etComponentType L1GctMet::getEyComponent ( ) const
inline

Definition at line 54 of file L1GctMet.h.

References m_eyComponent.

54 { return m_eyComponent; }
etComponentType m_eyComponent
Definition: L1GctMet.h:88
const L1GctHtMissLut* L1GctMet::getHtMissLut ( ) const
inline

Definition at line 66 of file L1GctMet.h.

References m_htMissLut.

Referenced by L1GctGlobalEnergyAlgos::getHtMissLut().

66 { return m_htMissLut; }
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:92
const bool L1GctMet::inputOverFlow ( ) const
private

Private method to check for an overflow condition on the input components Allows the check to depend on the algorithm type

Definition at line 314 of file L1GctMet.cc.

References kExOrEyMissComponentShift, L1GctHtMissLut::kHxOrHyMissComponentNBits, m_algoType, m_exComponent, m_eyComponent, L1GctTwosComplement< nBits >::overFlow(), mps_fire::result, useHtMissLut, and L1GctTwosComplement< nBits >::value().

Referenced by metVector().

314  {
316 
317  if (m_algoType == useHtMissLut) {
318  static const int maxComponentInput =
320 
321  // Emulate the (symmetric) overflow condition used in the firmware
322  result |= (m_exComponent.value() > maxComponentInput) || (m_exComponent.value() < -maxComponentInput) ||
323  (m_eyComponent.value() > maxComponentInput) || (m_eyComponent.value() < -maxComponentInput);
324  }
325 
326  return result;
327 }
bool overFlow() const
access overflow
etComponentType m_exComponent
Definition: L1GctMet.h:87
tuple result
Definition: mps_fire.py:311
etComponentType m_eyComponent
Definition: L1GctMet.h:88
int value() const
access value as signed int
metAlgoType m_algoType
Definition: L1GctMet.h:89
L1GctMet::etmiss_vec L1GctMet::metVector ( ) const

Definition at line 16 of file L1GctMet.cc.

References cordicTranslate, cordicTranslateAlgo(), floatingPoint, floatingPointAlgo(), inputOverFlow(), m_algoType, m_bitShift, m_exComponent, m_eyComponent, L1GctMet::etmiss_vec::mag, L1GctMet::etmiss_internal::mag, oldGct, oldGctAlgo(), L1GctUnsignedInt< nBits >::overFlow(), L1GctTwosComplement< nBits >::overFlow(), L1GctMet::etmiss_vec::phi, L1GctMet::etmiss_internal::phi, mps_fire::result, L1GctUnsignedInt< nBits >::setOverFlow(), L1GctUnsignedInt< nBits >::setValue(), useHtMissLut, useHtMissLutAlgo(), and L1GctTwosComplement< nBits >::value().

Referenced by L1GctGlobalEnergyAlgos::process().

16  {
17  etmiss_vec result;
18  etmiss_internal algoResult;
19  switch (m_algoType) {
20  case cordicTranslate:
21  algoResult = cordicTranslateAlgo(
23  break;
24 
25  case useHtMissLut:
26  algoResult = useHtMissLutAlgo(
28  break;
29 
30  case oldGct:
32  break;
33 
34  case floatingPoint:
36  break;
37 
38  default:
39  algoResult.mag = 0;
40  algoResult.phi = 0;
41  break;
42  }
43 
44  // The parameter m_bitShift allows us to discard additional LSB
45  // in order to change the output scale.
46  result.mag.setValue(algoResult.mag >> (m_bitShift));
47  result.phi.setValue(algoResult.phi);
48 
49  result.mag.setOverFlow(result.mag.overFlow() || inputOverFlow());
50 
51  return result;
52 }
bool overFlow() const
access overflow
etComponentType m_exComponent
Definition: L1GctMet.h:87
const bool inputOverFlow() const
Definition: L1GctMet.cc:314
etmiss_internal useHtMissLutAlgo(const int ex, const int ey, const bool of) const
Definition: L1GctMet.cc:158
etmiss_internal oldGctAlgo(const int ex, const int ey) const
Definition: L1GctMet.cc:198
tuple result
Definition: mps_fire.py:311
etmiss_internal cordicTranslateAlgo(const int ex, const int ey, const bool of) const
Definition: L1GctMet.cc:66
etComponentType m_eyComponent
Definition: L1GctMet.h:88
int value() const
access value as signed int
etmiss_internal floatingPointAlgo(const int ex, const int ey) const
Definition: L1GctMet.cc:284
metAlgoType m_algoType
Definition: L1GctMet.h:89
unsigned short m_bitShift
Definition: L1GctMet.h:90
L1GctMet::etmiss_internal L1GctMet::oldGctAlgo ( const int  ex,
const int  ey 
) const
private

Definition at line 198 of file L1GctMet.cc.

References funct::abs(), b, PixelTestBeamValidation_cfi::Dx, PixelTestBeamValidation_cfi::Dy, mps_fire::i, L1GctMet::etmiss_internal::mag, SiStripPI::max, L1GctMet::etmiss_internal::phi, mps_fire::result, and alignCSCRings::s.

Referenced by metVector().

198  {
199  //---------------------------------------------------------------------------------
200  //
201  // Calculates magnitude and direction of missing Et, given measured Ex and Ey.
202  //
203  // The algorithm used is suitable for implementation in hardware, using integer
204  // multiplication, addition and comparison and bit shifting operations.
205  //
206  // Proceed in two stages. The first stage gives a result that lies between
207  // 92% and 100% of the true Et, with the direction measured in 45 degree bins.
208  // The final precision depends on the number of factors used in corrFact.
209  // The present version with eleven factors gives a precision of 1% on Et, and
210  // finds the direction to the nearest 5 degrees.
211  //
212  //---------------------------------------------------------------------------------
213  etmiss_internal result;
214 
215  unsigned eneCoarse, phiCoarse;
216  unsigned eneCorect, phiCorect;
217 
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};
221 
222  std::vector<bool> s(3);
223  unsigned Mx, My, Mw;
224 
225  unsigned Dx, Dy;
226  unsigned eFact;
227 
228  unsigned b, phibin;
229  bool midphi = false;
230 
231  // Here's the coarse calculation, with just one multiply operation
232  //
233  My = static_cast<unsigned>(abs(ey));
234  Mx = static_cast<unsigned>(abs(ex));
235  Mw = (((Mx + My) * root2fact) + 0x80) >> 8;
236 
237  s.at(0) = (ey < 0);
238  s.at(1) = (ex < 0);
239  s.at(2) = (My > Mx);
240 
241  phibin = 0;
242  b = 0;
243  for (int i = 0; i < 3; i++) {
244  if (s.at(i)) {
245  b = 1 - b;
246  }
247  phibin = 2 * phibin + b;
248  }
249 
250  eneCoarse = std::max(std::max(Mx, My), Mw);
251  phiCoarse = phibin * 9;
252 
253  // For the fine calculation we multiply both input components
254  // by all the factors in the corrFact list in order to find
255  // the required corrections to the energy and angle
256  //
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)) {
261  midphi = false;
262  break;
263  }
264  if ((Mx + Dx) >= (My - Dy) && (My + Dy) >= (Mx - Dx)) {
265  midphi = true;
266  break;
267  }
268  }
269  eneCorect = (eneCoarse * (128 + eFact)) >> 7;
270  if (midphi ^ (b == 1)) {
271  phiCorect = phiCoarse + 8 - corrDphi[eFact];
272  } else {
273  phiCorect = phiCoarse + corrDphi[eFact];
274  }
275 
276  // Store the result of the calculation
277  //
278  result.mag = eneCorect;
279  result.phi = phiCorect;
280 
281  return result;
282 }
tuple result
Definition: mps_fire.py:311
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double b
Definition: hdecay.h:118
void L1GctMet::setAlgoType ( const metAlgoType  algo)
inline

Definition at line 57 of file L1GctMet.h.

References m_algoType.

57 { m_algoType = algo; }
metAlgoType m_algoType
Definition: L1GctMet.h:89
void L1GctMet::setBitShift ( const unsigned  nbits)
inline

Definition at line 62 of file L1GctMet.h.

References m_bitShift.

Referenced by L1GctGlobalEnergyAlgos::L1GctGlobalEnergyAlgos().

62 { m_bitShift = nbits; }
unsigned short m_bitShift
Definition: L1GctMet.h:90
void L1GctMet::setComponents ( const unsigned  ex,
const unsigned  ey 
)
inline

Definition at line 41 of file L1GctMet.h.

References setExComponent(), and setEyComponent().

Referenced by L1GctGlobalEnergyAlgos::process().

41  {
42  setExComponent(ex);
43  setEyComponent(ey);
44  }
void setEyComponent(const unsigned ey)
Definition: L1GctMet.cc:59
void setExComponent(const unsigned ex)
Definition: L1GctMet.cc:54
void L1GctMet::setComponents ( const etComponentType ex,
const etComponentType ey 
)
inline

Definition at line 45 of file L1GctMet.h.

References setExComponent(), and setEyComponent().

45  {
46  setExComponent(ex);
47  setEyComponent(ey);
48  }
void setEyComponent(const unsigned ey)
Definition: L1GctMet.cc:59
void setExComponent(const unsigned ex)
Definition: L1GctMet.cc:54
void L1GctMet::setEtComponentLsb ( const double  lsb)

Definition at line 304 of file L1GctMet.cc.

References kExOrEyMissComponentShift, m_htMissLut, and L1GctHtMissLut::setExEyLsb().

Referenced by L1GctGlobalEnergyAlgos::setJetFinderParams().

304  {
305  m_htMissLut->setExEyLsb(lsb * static_cast<double>(1 << kExOrEyMissComponentShift));
306 }
void setExEyLsb(const double lsb)
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:92
void L1GctMet::setEtScale ( const L1CaloEtScale *const  fn)

Definition at line 302 of file L1GctMet.cc.

References m_htMissLut, and L1GctHtMissLut::setEtScale().

Referenced by L1GctGlobalEnergyAlgos::setHtMissScale().

302 { m_htMissLut->setEtScale(fn); }
void setEtScale(const L1CaloEtScale *const fn)
Set the functions.
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:92
void L1GctMet::setExComponent ( const unsigned  ex)

Definition at line 54 of file L1GctMet.cc.

References groupFilesInBlocks::temp.

Referenced by setComponents().

54  {
57 }
void setExComponent(const unsigned ex)
Definition: L1GctMet.cc:54
L1GctWheelEnergyFpga::etComponentType etComponentType
Definition: L1GctMet.h:26
void L1GctMet::setExComponent ( const etComponentType ex)
inline

Definition at line 51 of file L1GctMet.h.

References m_exComponent.

51 { m_exComponent = ex; }
etComponentType m_exComponent
Definition: L1GctMet.h:87
void L1GctMet::setEyComponent ( const unsigned  ey)

Definition at line 59 of file L1GctMet.cc.

References groupFilesInBlocks::temp.

Referenced by setComponents().

59  {
62 }
void setEyComponent(const unsigned ey)
Definition: L1GctMet.cc:59
L1GctWheelEnergyFpga::etComponentType etComponentType
Definition: L1GctMet.h:26
void L1GctMet::setEyComponent ( const etComponentType ey)
inline

Definition at line 52 of file L1GctMet.h.

References m_eyComponent.

52 { m_eyComponent = ey; }
etComponentType m_eyComponent
Definition: L1GctMet.h:88
L1GctMet::etmiss_internal L1GctMet::useHtMissLutAlgo ( const int  ex,
const int  ey,
const bool  of 
) const
private

Definition at line 158 of file L1GctMet.cc.

References funct::abs(), kExOrEyMissComponentShift, L1GctHtMissLut::kHtMissAngleNBits, L1GctHtMissLut::kHtMissMagnitudeNBits, L1GctHtMissLut::kHxOrHyMissComponentNBits, L1GctLut< NAddressBits, NDataBits >::lutValue(), m_htMissLut, L1GctMet::etmiss_internal::mag, L1GctMet::etmiss_internal::phi, and mps_fire::result.

Referenced by metVector().

158  {
159  // The firmware discards the LSB of the input values, before forming
160  // the address for the LUT. We do the same here.
161  static const int maxComponent = 1 << L1GctHtMissLut::kHxOrHyMissComponentNBits;
162  static const int componentMask = maxComponent - 1;
163  static const int maxPosComponent = componentMask >> 1;
164 
165  static const int maxInput = 1 << (L1GctHtMissLut::kHxOrHyMissComponentNBits + kExOrEyMissComponentShift - 1);
166 
167  static const unsigned resultMagMask = (1 << L1GctHtMissLut::kHtMissMagnitudeNBits) - 1;
168  static const unsigned resultPhiMask = (1 << L1GctHtMissLut::kHtMissAngleNBits) - 1;
169 
170  etmiss_internal result;
171 
172  if (m_htMissLut == nullptr) {
173  result.mag = 0;
174  result.phi = 0;
175 
176  } else {
177  // Extract the bit fields of the input components to be used for the LUT address
178  int hxCompBits = (ex >> kExOrEyMissComponentShift) & componentMask;
179  int hyCompBits = (ey >> kExOrEyMissComponentShift) & componentMask;
180 
181  if (of || (abs(ex) >= maxInput) || (abs(ey) >= maxInput)) {
182  hxCompBits = maxPosComponent;
183  hyCompBits = maxPosComponent;
184  }
185 
186  // Perform the table lookup to get the missing Ht magnitude and phi
187  uint16_t lutAddress = static_cast<uint16_t>((hxCompBits << L1GctHtMissLut::kHxOrHyMissComponentNBits) | hyCompBits);
188 
189  uint16_t lutData = m_htMissLut->lutValue(lutAddress);
190 
191  result.mag = static_cast<unsigned>(lutData >> L1GctHtMissLut::kHtMissAngleNBits) & resultMagMask;
192  result.phi = static_cast<unsigned>(lutData) & resultPhiMask;
193  }
194 
195  return result;
196 }
tuple result
Definition: mps_fire.py:311
tuple of
Definition: haddnano.py:40
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:92
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
Definition: L1GctLut.h:102

Member Data Documentation

metAlgoType L1GctMet::m_algoType
private

Definition at line 89 of file L1GctMet.h.

Referenced by getAlgoType(), inputOverFlow(), metVector(), and setAlgoType().

unsigned short L1GctMet::m_bitShift
private

Definition at line 90 of file L1GctMet.h.

Referenced by getBitShift(), metVector(), and setBitShift().

etComponentType L1GctMet::m_exComponent
private

Definition at line 87 of file L1GctMet.h.

Referenced by getExComponent(), inputOverFlow(), metVector(), and setExComponent().

etComponentType L1GctMet::m_eyComponent
private

Definition at line 88 of file L1GctMet.h.

Referenced by getEyComponent(), inputOverFlow(), metVector(), and setEyComponent().

L1GctHtMissLut* L1GctMet::m_htMissLut
private