LUT for conversion of Ht components x and y to magnitude and angle. More...
#include <L1GctHtMissLut.h>
Public Types | |
enum | numberOfBits { kHxOrHyMissComponentNBits = 8, kHtMissMagnitudeNBits = 7, kHtMissAngleNBits = 5 } |
Public Member Functions | |
const double | componentLsb () const |
const L1CaloEtScale * | etScale () const |
Return the Lut functions and parameters. | |
std::vector< unsigned > | getThresholdsGct () const |
std::vector< double > | getThresholdsGeV () const |
Get thresholds. | |
L1GctHtMissLut () | |
Default constructor. | |
L1GctHtMissLut (const L1CaloEtScale *const scale, const double lsb) | |
Constructor for use with emulator. | |
L1GctHtMissLut (const L1GctHtMissLut &lut) | |
Copy constructor. | |
L1GctHtMissLut | operator= (const L1GctHtMissLut &lut) |
Overload = operator. | |
void | setEtScale (const L1CaloEtScale *const fn) |
Set the functions. | |
void | setExEyLsb (const double lsb) |
virtual | ~L1GctHtMissLut () |
Destructor. | |
Public Attributes | |
static const int | NData = L1GctHtMissLut::kHtMissMagnitudeNBits+L1GctHtMissLut::kHtMissAngleNBits |
Static Public Attributes | |
static const int | NAddress = 2*L1GctHtMissLut::kHxOrHyMissComponentNBits |
Protected Member Functions | |
virtual uint16_t | value (const uint16_t lutAddress) const |
Private Attributes | |
double | m_componentLsb |
const L1CaloEtScale * | m_etScale |
Friends | |
std::ostream & | operator<< (std::ostream &os, const L1GctHtMissLut &lut) |
Overload << operator. |
LUT for conversion of Ht components x and y to magnitude and angle.
Definition at line 21 of file L1GctHtMissLut.h.
Definition at line 26 of file L1GctHtMissLut.h.
L1GctHtMissLut::L1GctHtMissLut | ( | const L1CaloEtScale *const | scale, |
const double | lsb | ||
) |
Constructor for use with emulator.
Definition at line 11 of file L1GctHtMissLut.cc.
References L1GctLut< 16, 12 >::m_setupOk.
: L1GctLut<NAddress,NData>(), m_etScale(scale), m_componentLsb(lsb) { if (scale != 0) m_setupOk = true; }
L1GctHtMissLut::L1GctHtMissLut | ( | ) |
Default constructor.
Definition at line 19 of file L1GctHtMissLut.cc.
: L1GctLut<NAddress,NData>(), m_etScale(0), m_componentLsb(1.0) { }
L1GctHtMissLut::L1GctHtMissLut | ( | const L1GctHtMissLut & | lut | ) |
Copy constructor.
Definition at line 26 of file L1GctHtMissLut.cc.
References m_etScale, and L1GctLut< 16, 12 >::m_setupOk.
: L1GctLut<NAddress,NData>(), m_etScale(lut.etScale()), m_componentLsb(lut.componentLsb()) { if (m_etScale != 0) m_setupOk = true; }
L1GctHtMissLut::~L1GctHtMissLut | ( | ) | [virtual] |
const double L1GctHtMissLut::componentLsb | ( | ) | const [inline] |
Definition at line 54 of file L1GctHtMissLut.h.
References m_componentLsb.
Referenced by L1GctMet::componentLsb().
{ return m_componentLsb; }
const L1CaloEtScale* L1GctHtMissLut::etScale | ( | ) | const [inline] |
Return the Lut functions and parameters.
Definition at line 53 of file L1GctHtMissLut.h.
References m_etScale.
Referenced by L1GctMet::etScale().
{ return m_etScale; }
std::vector< unsigned > L1GctHtMissLut::getThresholdsGct | ( | ) | const |
Definition at line 85 of file L1GctHtMissLut.cc.
References L1CaloEtScale::getThresholds(), m_componentLsb, m_etScale, and query::result.
{ std::vector<unsigned> result; std::vector<double> thresholdsGeV = m_etScale->getThresholds(); for (std::vector<double>::const_iterator thr=thresholdsGeV.begin(); thr != thresholdsGeV.end(); thr++) { result.push_back(static_cast<unsigned>((*thr)/(m_componentLsb))); } return result; }
std::vector< double > L1GctHtMissLut::getThresholdsGeV | ( | ) | const |
Get thresholds.
Definition at line 80 of file L1GctHtMissLut.cc.
References L1CaloEtScale::getThresholds(), and m_etScale.
{ return m_etScale->getThresholds(); }
L1GctHtMissLut L1GctHtMissLut::operator= | ( | const L1GctHtMissLut & | lut | ) |
Overload = operator.
Definition at line 96 of file L1GctHtMissLut.cc.
References cond::rpcobtemp::temp.
{ L1GctHtMissLut temp(lut); return temp; }
void L1GctHtMissLut::setEtScale | ( | const L1CaloEtScale *const | fn | ) | [inline] |
Set the functions.
Definition at line 49 of file L1GctHtMissLut.h.
References m_etScale, and L1GctLut< 16, 12 >::m_setupOk.
Referenced by L1GctMet::setEtScale().
void L1GctHtMissLut::setExEyLsb | ( | const double | lsb | ) | [inline] |
Definition at line 50 of file L1GctHtMissLut.h.
References m_componentLsb.
Referenced by L1GctMet::setEtComponentLsb().
{ m_componentLsb = lsb; }
uint16_t L1GctHtMissLut::value | ( | const uint16_t | lutAddress | ) | const [protected, virtual] |
Implements L1GctLut< 16, 12 >.
Definition at line 39 of file L1GctHtMissLut.cc.
References kHtMissAngleNBits, kHtMissMagnitudeNBits, kHxOrHyMissComponentNBits, m_componentLsb, m_etScale, M_PI, L1CaloEtScale::rank(), query::result, and mathSSE::sqrt().
{ uint16_t result=0; if (lutAddress!=0) { static const int maxComponent = 1<<kHxOrHyMissComponentNBits; static const int componentMask = maxComponent-1; static const int magnitudeMask = (1<<kHtMissMagnitudeNBits) - 1; static const int angleMask = (1<<kHtMissAngleNBits) - 1; // Extract the bits corresponding to hx and hy components int hxCompGct = static_cast<int>(lutAddress>>kHxOrHyMissComponentNBits) & componentMask; int hyCompGct = static_cast<int>(lutAddress) & componentMask; // These are twos-complement integers - if the MSB is set, the value is negative if (hxCompGct >= maxComponent/2) hxCompGct -= maxComponent; if (hyCompGct >= maxComponent/2) hyCompGct -= maxComponent; // Convert to GeV. Add 0.5 to each component to compensate for truncation errors. double hxCompGeV = m_componentLsb * (static_cast<double>(hxCompGct) + 0.5); double hyCompGeV = m_componentLsb * (static_cast<double>(hyCompGct) + 0.5); // Convert to magnitude and angle double htMissMag = sqrt(hxCompGeV * hxCompGeV + hyCompGeV * hyCompGeV); double htMissAng = atan2(hyCompGeV, hxCompGeV); if (htMissAng < 0.0) htMissAng += 2.0*M_PI; // Convert back to integer int htMissMagBits = static_cast<int>(m_etScale->rank(htMissMag)) & magnitudeMask; int htMissAngBits = static_cast<int>(htMissAng*9.0/M_PI) & angleMask; // Form the lut output result = (htMissMagBits << kHtMissAngleNBits) | htMissAngBits ; } return result; }
std::ostream& operator<< | ( | std::ostream & | os, |
const L1GctHtMissLut & | lut | ||
) | [friend] |
Overload << operator.
Definition at line 102 of file L1GctHtMissLut.cc.
{ os << "===L1GctHtMissLut===" << std::endl; std::vector<double> thresholds = lut.m_etScale->getThresholds(); std::vector<double>::const_iterator thr = thresholds.begin(); os << "Thresholds are: " << *(thr++); for ( ; thr != thresholds.end(); thr++) { os << ", " << *thr; } os << std::endl; os << "Max values for input to et scale " << lut.m_etScale->linScaleMax() << " and for output " << lut.m_etScale->rankScaleMax() << std::endl; os << "LSB used for conversion is " << lut.m_componentLsb << " GeV" << std::endl; os << "\n===Lookup table contents===\n" << std::endl; const L1GctLut<L1GctHtMissLut::NAddress,L1GctHtMissLut::NData>* temp=&lut; os << *temp; return os; }
double L1GctHtMissLut::m_componentLsb [private] |
Definition at line 69 of file L1GctHtMissLut.h.
Referenced by componentLsb(), getThresholdsGct(), operator<<(), setExEyLsb(), and value().
const L1CaloEtScale* L1GctHtMissLut::m_etScale [private] |
Definition at line 67 of file L1GctHtMissLut.h.
Referenced by etScale(), getThresholdsGct(), getThresholdsGeV(), L1GctHtMissLut(), operator<<(), setEtScale(), and value().
const int L1GctHtMissLut::NAddress = 2*L1GctHtMissLut::kHxOrHyMissComponentNBits [static] |
Definition at line 31 of file L1GctHtMissLut.h.
const int L1GctHtMissLut::NData = L1GctHtMissLut::kHtMissMagnitudeNBits+L1GctHtMissLut::kHtMissAngleNBits |
Definition at line 31 of file L1GctHtMissLut.h.