CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
L1CaloEtScale Class Reference

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

Public Member Functions

double et (const uint16_t rank) const
 convert from rank to physically meaningful quantity More...
 
const std::vector< double > & getThresholds () const
 get thresholds More...
 
 L1CaloEtScale ()
 default constructor, for testing (out = in) More...
 
 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 More...
 
double linearLsb () const
 get LSB of linear input scale More...
 
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 More...
 
uint16_t rank (const uint16_t linear) const
 convert from linear Et scale to rank scale More...
 
unsigned rankScaleMax () const
 
 ~L1CaloEtScale ()
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

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

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

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 29 of file L1CaloEtScale.h.

Constructor & Destructor Documentation

◆ L1CaloEtScale() [1/3]

L1CaloEtScale::L1CaloEtScale ( )

default constructor, for testing (out = in)

Definition at line 23 of file L1CaloEtScale.cc.

23  : m_linScaleMax(0x3ff), m_rankScaleMax(0x3f), m_linearLsb(1.0) {
24  for (unsigned i = 0; i < m_rankScaleMax; i++) {
25  m_thresholds.push_back(m_linearLsb * i);
26  }
27 }

References mps_fire::i, m_linearLsb, m_rankScaleMax, and m_thresholds.

◆ L1CaloEtScale() [2/3]

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

Definition at line 31 of file L1CaloEtScale.cc.

32  : m_linScaleMax(0x3ff), m_rankScaleMax(0x3f), m_linearLsb(linearLsbInGeV), m_thresholds(thresholdsInGeV) {
33  // protect against too many thresholds!
34  // while ( m_threshold.size() > (L1GctJetScale::maxRank+1) ) {
35  // m_thresholds.pop_back();
36  // }
37 }

◆ L1CaloEtScale() [3/3]

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

general case ctor that sets scale max values

Definition at line 40 of file L1CaloEtScale.cc.

46  m_linearLsb(linearLsbInGeV),
47  m_thresholds(thresholdsInGeV) {}

◆ ~L1CaloEtScale()

L1CaloEtScale::~L1CaloEtScale ( )

Definition at line 49 of file L1CaloEtScale.cc.

49 {}

Member Function Documentation

◆ et()

double L1CaloEtScale::et ( const uint16_t  rank) const

convert from rank to physically meaningful quantity

Definition at line 68 of file L1CaloEtScale.cc.

68  {
69  // return bin centre, except for highest bin
70  // if (rank < m_thresholds.size()-1) {
71  // return (m_thresholds[rank+1]+m_thresholds[rank]) / 2;
72  // }
73  // else {
74  // return m_thresholds.back();
75  // }
76 
77  // return bin lower edge
78  try {
79  return m_thresholds.at(rank);
80  } catch (std::out_of_range const&) {
81  throw cms::Exception("OutOfRange") << "Index out of range in L1CaloEtScale::et(rank)" << std::endl;
82  }
83 }

References Exception, m_thresholds, and rank().

Referenced by L1ScalesTester::analyze(), L1GctValidation::analyze(), L1TPhysicalEtAdder::produce(), and L1ExtraParticlesProd::produce().

◆ getThresholds()

const std::vector<double>& L1CaloEtScale::getThresholds ( ) const
inline

◆ linearLsb()

double L1CaloEtScale::linearLsb ( ) const
inline

◆ linScaleMax()

unsigned L1CaloEtScale::linScaleMax ( ) const
inline

Definition at line 48 of file L1CaloEtScale.h.

48 { return m_linScaleMax; }

References m_linScaleMax.

Referenced by operator<<().

◆ print()

void L1CaloEtScale::print ( std::ostream &  s) const

Definition at line 85 of file L1CaloEtScale.cc.

85  {
86  s << "L1CaloEtScale :" << endl;
87  s << " Input scale max = " << m_linScaleMax << endl;
88  s << " Input LSB = " << m_linearLsb << " GeV" << endl;
89  s << " Rank scale max = " << m_rankScaleMax << endl;
90  for (unsigned i = 0; i < m_thresholds.size(); i++) {
91  s << " Threshold " << i << " = " << m_thresholds[i] << " GeV" << endl;
92  }
93 }

References mps_fire::i, m_linearLsb, m_linScaleMax, m_rankScaleMax, m_thresholds, and alignCSCRings::s.

Referenced by L1ScalesTester::analyze().

◆ rank() [1/2]

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 55 of file L1CaloEtScale.cc.

55  {
56  uint16_t out = 0;
57 
58  for (unsigned i = 0; i < m_thresholds.size() && i < (unsigned)(m_rankScaleMax + 1); i++) {
59  if (EtInGeV >= m_thresholds.at(i)) {
60  out = i;
61  }
62  }
63 
64  return out & m_rankScaleMax;
65 }

References mps_fire::i, m_rankScaleMax, m_thresholds, and MillePedeFileConverter_cfg::out.

◆ rank() [2/2]

uint16_t L1CaloEtScale::rank ( const uint16_t  linear) const

convert from linear Et scale to rank scale

Definition at line 52 of file L1CaloEtScale.cc.

52 { return rank((linear & m_linScaleMax) * m_linearLsb); }

References linear(), m_linearLsb, and m_linScaleMax.

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

◆ rankScaleMax()

unsigned L1CaloEtScale::rankScaleMax ( ) const
inline

Definition at line 51 of file L1CaloEtScale.h.

51 { return m_rankScaleMax; }

References m_rankScaleMax.

Referenced by operator<<(), and L1ExtraParticlesProd::produce().

◆ serialize()

template<class Archive >
void L1CaloEtScale::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 83 of file L1CaloEtScale.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 83 of file L1CaloEtScale.h.

Member Data Documentation

◆ m_linearLsb

double L1CaloEtScale::m_linearLsb
private

LSB of linear scale in GeV.

Definition at line 78 of file L1CaloEtScale.h.

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

◆ m_linScaleMax

uint16_t L1CaloEtScale::m_linScaleMax
private

linear scale maximum

Definition at line 72 of file L1CaloEtScale.h.

Referenced by linScaleMax(), print(), and rank().

◆ m_rankScaleMax

uint16_t L1CaloEtScale::m_rankScaleMax
private

rank scale maximum

Definition at line 75 of file L1CaloEtScale.h.

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

◆ m_thresholds

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

thresholds associated with rank scale in GeV

Definition at line 81 of file L1CaloEtScale.h.

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

mps_fire.i
i
Definition: mps_fire.py:428
L1CaloEtScale::m_linearLsb
double m_linearLsb
LSB of linear scale in GeV.
Definition: L1CaloEtScale.h:78
L1CaloEtScale::rankScaleMax
unsigned rankScaleMax() const
Definition: L1CaloEtScale.h:51
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1CaloEtScale::m_rankScaleMax
uint16_t m_rankScaleMax
rank scale maximum
Definition: L1CaloEtScale.h:75
L1CaloEtScale::linScaleMax
unsigned linScaleMax() const
Definition: L1CaloEtScale.h:48
L1CaloEtScale::m_linScaleMax
uint16_t m_linScaleMax
linear scale maximum
Definition: L1CaloEtScale.h:72
L1CaloEtScale::rank
uint16_t rank(const uint16_t linear) const
convert from linear Et scale to rank scale
Definition: L1CaloEtScale.cc:52
linear
float linear(float x)
Definition: OccupancyPlotMacros.cc:26
Exception
Definition: hltDiff.cc:245
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
L1CaloEtScale::m_thresholds
std::vector< double > m_thresholds
thresholds associated with rank scale in GeV
Definition: L1CaloEtScale.h:81