CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1CaloEtScale Class Reference

#include <CondFormats/L1TObjects/interface/L1CaloEtScale.h>

List of all members.

Public Member Functions

double et (const uint16_t rank) const
 convert from rank to physically meaningful quantity
const std::vector< double > & getThresholds () const
 get thresholds
 L1CaloEtScale ()
 default constructor, for testing (out = in)
 L1CaloEtScale (const double linearLsbInGeV, const std::vector< double > thresholdsInGeV)
 L1CaloEtScale (const unsigned linScaleMax, const unsigned rankScaleMax, const double linearLsbInGeV, const std::vector< double > thresholdsInGeV)
 general case ctor that sets scale max values
double linearLsb () const
 get LSB of linear input scale
unsigned linScaleMax () const
void print (std::ostream &s) const
uint16_t rank (const double EtInGeV) const
 convert from physical Et in GeV to rank scale
uint16_t rank (const uint16_t linear) const
 convert from linear Et scale to rank scale
unsigned rankScaleMax () const
 ~L1CaloEtScale ()

Private Attributes

double m_linearLsb
 LSB of linear scale in GeV.
uint16_t m_linScaleMax
 linear scale maximum
uint16_t m_rankScaleMax
 rank scale maximum
std::vector< double > m_thresholds
 thresholds associated with rank scale in GeV

Detailed Description

Description: Class to handle non-linear scales in L1 calo trigger hardware, including, e/gamma rank, jet rank, Htmiss

Usage: <usage>

Definition at line 27 of file L1CaloEtScale.h.


Constructor & Destructor Documentation

L1CaloEtScale::L1CaloEtScale ( )

default constructor, for testing (out = in)

Definition at line 23 of file L1CaloEtScale.cc.

References i, m_linearLsb, m_rankScaleMax, and m_thresholds.

                             :
  m_linScaleMax(0x3ff),
  m_rankScaleMax(0x3f),
  m_linearLsb(1.0)
{
  for (unsigned i=0; i<m_rankScaleMax; i++) {
    m_thresholds.push_back(m_linearLsb * i);
  }
}
L1CaloEtScale::L1CaloEtScale ( const double  linearLsbInGeV,
const std::vector< double >  thresholdsInGeV 
)

ctor that provides backwards compatibility with fixed scale max values OK to use this with e/gamma and jet rank scales

L1CaloEtScale::L1CaloEtScale ( const unsigned  linScaleMax,
const unsigned  rankScaleMax,
const double  linearLsbInGeV,
const std::vector< double >  thresholdsInGeV 
)

general case ctor that sets scale max values

L1CaloEtScale::~L1CaloEtScale ( )

Definition at line 59 of file L1CaloEtScale.cc.

                              {

}

Member Function Documentation

double L1CaloEtScale::et ( const uint16_t  rank) const

convert from rank to physically meaningful quantity

Definition at line 83 of file L1CaloEtScale.cc.

References Exception, and m_thresholds.

                                                  {

  // return bin centre, except for highest bin
//   if (rank < m_thresholds.size()-1) {
//     return (m_thresholds[rank+1]+m_thresholds[rank]) / 2;
//   }
//   else {
//     return m_thresholds.back();
//   }

// return bin lower edge
  try {
    return m_thresholds.at(rank);
  }
  catch(std::out_of_range) {
    throw cms::Exception("OutOfRange") << "Index out of range in L1CaloEtScale::et(rank)" << std::endl;
  }

}
const std::vector<double>& L1CaloEtScale::getThresholds ( ) const [inline]
double L1CaloEtScale::linearLsb ( ) const [inline]

get LSB of linear input scale

Definition at line 51 of file L1CaloEtScale.h.

References m_linearLsb.

Referenced by L1GctHfEtSumsLut::getThresholdsGct(), operator<<(), and L1GctJetEtCalibrationLut::value().

{ return m_linearLsb; }
unsigned L1CaloEtScale::linScaleMax ( ) const [inline]

Definition at line 45 of file L1CaloEtScale.h.

References m_linScaleMax.

Referenced by operator<<().

{ return m_linScaleMax; }
void L1CaloEtScale::print ( std::ostream &  s) const
uint16_t L1CaloEtScale::rank ( const uint16_t  linear) const

convert from linear Et scale to rank scale

Definition at line 64 of file L1CaloEtScale.cc.

References m_linearLsb, and m_linScaleMax.

Referenced by L1RCTLookupTables::emRank(), L1GctHtMissLut::value(), L1GctJetEtCalibrationLut::value(), and L1GctHfEtSumsLut::value().

                                                        {

  return rank( (linear & m_linScaleMax) * m_linearLsb);

}
uint16_t L1CaloEtScale::rank ( const double  EtInGeV) const

convert from physical Et in GeV to rank scale

convert from Et in GeV to rank

Definition at line 71 of file L1CaloEtScale.cc.

References i, m_rankScaleMax, m_thresholds, and dbtoconf::out.

                                                       {

  uint16_t out = 0;

  for (unsigned i=0; i<m_thresholds.size() && i<(unsigned)(m_rankScaleMax+1); i++) {
    if ( EtInGeV >= m_thresholds.at(i) ) { out = i; }
  }

  return out & m_rankScaleMax;
}
unsigned L1CaloEtScale::rankScaleMax ( ) const [inline]

Definition at line 48 of file L1CaloEtScale.h.

References m_rankScaleMax.

Referenced by operator<<().

{ return m_rankScaleMax; }

Member Data Documentation

double L1CaloEtScale::m_linearLsb [private]

LSB of linear scale in GeV.

Definition at line 77 of file L1CaloEtScale.h.

Referenced by L1CaloEtScale(), linearLsb(), and rank().

uint16_t L1CaloEtScale::m_linScaleMax [private]

linear scale maximum

Definition at line 70 of file L1CaloEtScale.h.

Referenced by linScaleMax(), and rank().

uint16_t L1CaloEtScale::m_rankScaleMax [private]

rank scale maximum

Definition at line 73 of file L1CaloEtScale.h.

Referenced by L1CaloEtScale(), rank(), and rankScaleMax().

std::vector<double> L1CaloEtScale::m_thresholds [private]

thresholds associated with rank scale in GeV

Definition at line 80 of file L1CaloEtScale.h.

Referenced by et(), getThresholds(), L1CaloEtScale(), and rank().