CMS 3D CMS Logo

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::kEtMissPhiNBitsetMissPhiType
 
typedef L1GctUnsignedInt< L1GctEtMiss::kEtMissNBitsetMissType
 
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 28 of file L1GctMet.h.

Definition at line 27 of file L1GctMet.h.

Definition at line 26 of file L1GctMet.h.

Member Enumeration Documentation

Enumerator
kExOrEyMissComponentShift 

Definition at line 72 of file L1GctMet.h.

Enumerator
cordicTranslate 
useHtMissLut 
oldGct 
floatingPoint 

Definition at line 24 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.

7  :
8  m_exComponent(ex),
9  m_eyComponent(ey),
11  m_bitShift(0),
13 { }
etComponentType m_exComponent
Definition: L1GctMet.h:84
LUT for conversion of Ht components x and y to magnitude and angle.
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:89
etComponentType m_eyComponent
Definition: L1GctMet.h:85
metAlgoType m_algoType
Definition: L1GctMet.h:86
unsigned short m_bitShift
Definition: L1GctMet.h:87
L1GctMet::L1GctMet ( const etComponentType ex,
const etComponentType ey,
const metAlgoType  algo = cordicTranslate 
)

Definition at line 15 of file L1GctMet.cc.

15  :
16  m_exComponent(ex),
17  m_eyComponent(ey),
19  m_bitShift(0),
21 { }
etComponentType m_exComponent
Definition: L1GctMet.h:84
LUT for conversion of Ht components x and y to magnitude and angle.
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:89
etComponentType m_eyComponent
Definition: L1GctMet.h:85
metAlgoType m_algoType
Definition: L1GctMet.h:86
unsigned short m_bitShift
Definition: L1GctMet.h:87
L1GctMet::~L1GctMet ( )

Definition at line 23 of file L1GctMet.cc.

23 {}

Member Function Documentation

const double L1GctMet::componentLsb ( ) const

Definition at line 333 of file L1GctMet.cc.

References L1GctHtMissLut::componentLsb(), and m_htMissLut.

Referenced by getHtMissLut().

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

Definition at line 161 of file L1GctMet.cc.

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

Referenced by cordicTranslateAlgo().

162 {
163  int r;
164  if (nBits==0) {
165  r = e;
166  } else {
167  r = (((e>>(nBits-1)) + 1)>>1);
168  }
169  return r;
170 }
L1GctMet::etmiss_internal L1GctMet::cordicTranslateAlgo ( const int  ex,
const int  ey,
const bool  of 
) const
private

Definition at line 79 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().

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

Definition at line 328 of file L1GctMet.cc.

References L1GctHtMissLut::etScale(), and m_htMissLut.

Referenced by getHtMissLut().

329 {
330  return m_htMissLut->etScale();
331 }
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:89
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 297 of file L1GctMet.cc.

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

Referenced by metVector().

298 {
299 
300  etmiss_internal result;
301 
302  double fx = static_cast<double>(ex);
303  double fy = static_cast<double>(ey);
304  double fmag = sqrt(fx*fx + fy*fy);
305  double fphi = 36.*atan2(fy, fx)/M_PI;
306 
307  result.mag = static_cast<unsigned>(fmag);
308  if (fphi>=0) {
309  result.phi = static_cast<unsigned>(fphi);
310  } else {
311  result.phi = static_cast<unsigned>(fphi+72.);
312  }
313 
314  return result;
315 
316 }
T sqrt(T t)
Definition: SSEVec.h:18
#define M_PI
metAlgoType L1GctMet::getAlgoType ( ) const
inline

Definition at line 54 of file L1GctMet.h.

References m_algoType.

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

Definition at line 59 of file L1GctMet.h.

References m_bitShift.

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

Definition at line 49 of file L1GctMet.h.

References m_exComponent.

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

Definition at line 50 of file L1GctMet.h.

References m_eyComponent.

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

Definition at line 62 of file L1GctMet.h.

References componentLsb(), etScale(), m_htMissLut, setEtComponentLsb(), and setEtScale().

Referenced by L1GctGlobalEnergyAlgos::getHtMissLut().

62 { return m_htMissLut; }
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:89
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 340 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().

341 {
343 
344  if (m_algoType == useHtMissLut) {
345  static const int maxComponentInput = ( 1 << (L1GctHtMissLut::kHxOrHyMissComponentNBits+kExOrEyMissComponentShift-1) ) - 1;
346 
347  // Emulate the (symmetric) overflow condition used in the firmware
348  result |= (m_exComponent.value() > maxComponentInput) || (m_exComponent.value() < -maxComponentInput) ||
349  (m_eyComponent.value() > maxComponentInput) || (m_eyComponent.value() < -maxComponentInput);
350  }
351 
352  return result;
353 }
bool overFlow() const
access overflow
etComponentType m_exComponent
Definition: L1GctMet.h:84
etComponentType m_eyComponent
Definition: L1GctMet.h:85
int value() const
access value as signed int
metAlgoType m_algoType
Definition: L1GctMet.h:86
L1GctMet::etmiss_vec L1GctMet::metVector ( ) const

Definition at line 27 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().

28 {
29  etmiss_vec result;
30  etmiss_internal algoResult;
31  switch (m_algoType)
32  {
33  case cordicTranslate:
35  break;
36 
37  case useHtMissLut:
39  break;
40 
41  case oldGct:
42  algoResult = oldGctAlgo (m_exComponent.value(), m_eyComponent.value());
43  break;
44 
45  case floatingPoint:
47  break;
48 
49  default:
50  algoResult.mag = 0;
51  algoResult.phi = 0;
52  break;
53  }
54 
55  // The parameter m_bitShift allows us to discard additional LSB
56  // in order to change the output scale.
57  result.mag.setValue(algoResult.mag>>(m_bitShift));
58  result.phi.setValue(algoResult.phi);
59 
60  result.mag.setOverFlow( result.mag.overFlow() || inputOverFlow() );
61 
62  return result;
63 
64 }
bool overFlow() const
access overflow
etComponentType m_exComponent
Definition: L1GctMet.h:84
const bool inputOverFlow() const
Definition: L1GctMet.cc:340
etmiss_internal useHtMissLutAlgo(const int ex, const int ey, const bool of) const
Definition: L1GctMet.cc:174
etmiss_internal oldGctAlgo(const int ex, const int ey) const
Definition: L1GctMet.cc:219
etmiss_internal cordicTranslateAlgo(const int ex, const int ey, const bool of) const
Definition: L1GctMet.cc:79
etComponentType m_eyComponent
Definition: L1GctMet.h:85
int value() const
access value as signed int
etmiss_internal floatingPointAlgo(const int ex, const int ey) const
Definition: L1GctMet.cc:297
metAlgoType m_algoType
Definition: L1GctMet.h:86
unsigned short m_bitShift
Definition: L1GctMet.h:87
L1GctMet::etmiss_internal L1GctMet::oldGctAlgo ( const int  ex,
const int  ey 
) const
private

Definition at line 219 of file L1GctMet.cc.

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

Referenced by metVector().

220 {
221  //---------------------------------------------------------------------------------
222  //
223  // Calculates magnitude and direction of missing Et, given measured Ex and Ey.
224  //
225  // The algorithm used is suitable for implementation in hardware, using integer
226  // multiplication, addition and comparison and bit shifting operations.
227  //
228  // Proceed in two stages. The first stage gives a result that lies between
229  // 92% and 100% of the true Et, with the direction measured in 45 degree bins.
230  // The final precision depends on the number of factors used in corrFact.
231  // The present version with eleven factors gives a precision of 1% on Et, and
232  // finds the direction to the nearest 5 degrees.
233  //
234  //---------------------------------------------------------------------------------
235  etmiss_internal result;
236 
237  unsigned eneCoarse, phiCoarse;
238  unsigned eneCorect, phiCorect;
239 
240  const unsigned root2fact = 181;
241  const unsigned corrFact[11] = {24, 39, 51, 60, 69, 77, 83, 89, 95, 101, 106};
242  const unsigned corrDphi[11] = { 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4};
243 
244  std::vector<bool> s(3);
245  unsigned Mx, My, Mw;
246 
247  unsigned Dx, Dy;
248  unsigned eFact;
249 
250  unsigned b,phibin;
251  bool midphi=false;
252 
253  // Here's the coarse calculation, with just one multiply operation
254  //
255  My = static_cast<unsigned>(abs(ey));
256  Mx = static_cast<unsigned>(abs(ex));
257  Mw = (((Mx+My)*root2fact)+0x80)>>8;
258 
259  s.at(0) = (ey<0);
260  s.at(1) = (ex<0);
261  s.at(2) = (My>Mx);
262 
263  phibin = 0; b = 0;
264  for (int i=0; i<3; i++) {
265  if (s.at(i)) { b=1-b;} phibin = 2*phibin + b;
266  }
267 
268  eneCoarse = std::max(std::max(Mx, My), Mw);
269  phiCoarse = phibin*9;
270 
271  // For the fine calculation we multiply both input components
272  // by all the factors in the corrFact list in order to find
273  // the required corrections to the energy and angle
274  //
275  for (eFact=0; eFact<10; eFact++) {
276  Dx = (Mx*corrFact[eFact])>>8;
277  Dy = (My*corrFact[eFact])>>8;
278  if ((Dx>=My) || (Dy>=Mx)) {midphi=false; break;}
279  if ((Mx+Dx)>=(My-Dy) && (My+Dy)>=(Mx-Dx)) {midphi=true; break;}
280  }
281  eneCorect = (eneCoarse*(128+eFact))>>7;
282  if (midphi ^ (b==1)) {
283  phiCorect = phiCoarse + 8 - corrDphi[eFact];
284  } else {
285  phiCorect = phiCoarse + corrDphi[eFact];
286  }
287 
288  // Store the result of the calculation
289  //
290  result.mag = eneCorect;
291  result.phi = phiCorect;
292 
293  return result;
294 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double b
Definition: hdecay.h:120
void L1GctMet::setAlgoType ( const metAlgoType  algo)
inline

Definition at line 53 of file L1GctMet.h.

References patPFMETCorrections_cff::algo, and m_algoType.

void L1GctMet::setBitShift ( const unsigned  nbits)
inline

Definition at line 58 of file L1GctMet.h.

References m_bitShift.

Referenced by L1GctGlobalEnergyAlgos::L1GctGlobalEnergyAlgos().

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

Definition at line 43 of file L1GctMet.h.

References setExComponent(), and setEyComponent().

Referenced by L1GctGlobalEnergyAlgos::process().

43 { setExComponent(ex); setEyComponent(ey); }
void setEyComponent(const unsigned ey)
Definition: L1GctMet.cc:71
void setExComponent(const unsigned ex)
Definition: L1GctMet.cc:66
void L1GctMet::setComponents ( const etComponentType ex,
const etComponentType ey 
)
inline

Definition at line 44 of file L1GctMet.h.

References setExComponent(), and setEyComponent().

44 { setExComponent(ex); setEyComponent(ey); }
void setEyComponent(const unsigned ey)
Definition: L1GctMet.cc:71
void setExComponent(const unsigned ex)
Definition: L1GctMet.cc:66
void L1GctMet::setEtComponentLsb ( const double  lsb)

Definition at line 323 of file L1GctMet.cc.

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

Referenced by getHtMissLut(), and L1GctGlobalEnergyAlgos::setJetFinderParams().

324 {
325  m_htMissLut->setExEyLsb( lsb * static_cast<double>( 1<<kExOrEyMissComponentShift ) );
326 }
void setExEyLsb(const double lsb)
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:89
void L1GctMet::setEtScale ( const L1CaloEtScale *const  fn)

Definition at line 318 of file L1GctMet.cc.

References m_htMissLut, and L1GctHtMissLut::setEtScale().

Referenced by getHtMissLut(), and L1GctGlobalEnergyAlgos::setHtMissScale().

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

Definition at line 66 of file L1GctMet.cc.

References groupFilesInBlocks::temp.

Referenced by setComponents().

66  {
69 }
void setExComponent(const unsigned ex)
Definition: L1GctMet.cc:66
L1GctWheelEnergyFpga::etComponentType etComponentType
Definition: L1GctMet.h:28
void L1GctMet::setExComponent ( const etComponentType ex)
inline

Definition at line 47 of file L1GctMet.h.

References m_exComponent.

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

Definition at line 71 of file L1GctMet.cc.

References groupFilesInBlocks::temp.

Referenced by setComponents().

71  {
74 }
void setEyComponent(const unsigned ey)
Definition: L1GctMet.cc:71
L1GctWheelEnergyFpga::etComponentType etComponentType
Definition: L1GctMet.h:28
void L1GctMet::setEyComponent ( const etComponentType ey)
inline

Definition at line 48 of file L1GctMet.h.

References m_eyComponent.

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

Definition at line 174 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().

175 {
176  // The firmware discards the LSB of the input values, before forming
177  // the address for the LUT. We do the same here.
178  static const int maxComponent = 1<<L1GctHtMissLut::kHxOrHyMissComponentNBits;
179  static const int componentMask = maxComponent-1;
180  static const int maxPosComponent = componentMask >> 1;
181 
182  static const int maxInput = 1<<(L1GctHtMissLut::kHxOrHyMissComponentNBits+kExOrEyMissComponentShift-1);
183 
184  static const unsigned resultMagMask = (1<<L1GctHtMissLut::kHtMissMagnitudeNBits) - 1;
185  static const unsigned resultPhiMask = (1<<L1GctHtMissLut::kHtMissAngleNBits) - 1;
186 
187  etmiss_internal result;
188 
189  if (m_htMissLut == nullptr) {
190 
191  result.mag = 0;
192  result.phi = 0;
193 
194  } else {
195 
196  // Extract the bit fields of the input components to be used for the LUT address
197  int hxCompBits = (ex >> kExOrEyMissComponentShift) & componentMask;
198  int hyCompBits = (ey >> kExOrEyMissComponentShift) & componentMask;
199 
200  if (of || (abs(ex) >= maxInput) || (abs(ey) >= maxInput)) {
201  hxCompBits = maxPosComponent;
202  hyCompBits = maxPosComponent;
203  }
204 
205  // Perform the table lookup to get the missing Ht magnitude and phi
206  uint16_t lutAddress = static_cast<uint16_t> ( (hxCompBits << L1GctHtMissLut::kHxOrHyMissComponentNBits) | hyCompBits );
207 
208  uint16_t lutData = m_htMissLut->lutValue(lutAddress);
209 
210  result.mag = static_cast<unsigned>(lutData>>L1GctHtMissLut::kHtMissAngleNBits) & resultMagMask;
211  result.phi = static_cast<unsigned>(lutData) & resultPhiMask;
212 
213  }
214 
215  return result;
216 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1GctHtMissLut * m_htMissLut
Definition: L1GctMet.h:89
uint16_t lutValue(const uint16_t lutAddress) const
Access the look-up table contents for a given Address.
Definition: L1GctLut.h:104

Member Data Documentation

metAlgoType L1GctMet::m_algoType
private

Definition at line 86 of file L1GctMet.h.

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

unsigned short L1GctMet::m_bitShift
private

Definition at line 87 of file L1GctMet.h.

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

etComponentType L1GctMet::m_exComponent
private

Definition at line 84 of file L1GctMet.h.

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

etComponentType L1GctMet::m_eyComponent
private

Definition at line 85 of file L1GctMet.h.

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

L1GctHtMissLut* L1GctMet::m_htMissLut
private