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 uint16_t linear) const
 convert from linear Et scale to rank scale More...
 
uint16_t rank (const double EtInGeV) const
 convert from physical Et in GeV 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::L1CaloEtScale ( )

default constructor, for testing (out = in)

Definition at line 23 of file L1CaloEtScale.cc.

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

23  :
24  m_linScaleMax(0x3ff),
25  m_rankScaleMax(0x3f),
26  m_linearLsb(1.0)
27 {
28  for (unsigned i=0; i<m_rankScaleMax; i++) {
29  m_thresholds.push_back(m_linearLsb * i);
30  }
31 }
uint16_t m_linScaleMax
linear scale maximum
Definition: L1CaloEtScale.h:72
uint16_t m_rankScaleMax
rank scale maximum
Definition: L1CaloEtScale.h:75
double m_linearLsb
LSB of linear scale in GeV.
Definition: L1CaloEtScale.h:79
std::vector< double > m_thresholds
thresholds associated with rank scale in GeV
Definition: L1CaloEtScale.h:82
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 35 of file L1CaloEtScale.cc.

35  :
36  m_linScaleMax(0x3ff),
37  m_rankScaleMax(0x3f),
38  m_linearLsb(linearLsbInGeV),
39  m_thresholds(thresholdsInGeV) {
40 
41  // protect against too many thresholds!
42  // while ( m_threshold.size() > (L1GctJetScale::maxRank+1) ) {
43  // m_thresholds.pop_back();
44  // }
45 
46 }
uint16_t m_linScaleMax
linear scale maximum
Definition: L1CaloEtScale.h:72
uint16_t m_rankScaleMax
rank scale maximum
Definition: L1CaloEtScale.h:75
double m_linearLsb
LSB of linear scale in GeV.
Definition: L1CaloEtScale.h:79
std::vector< double > m_thresholds
thresholds associated with rank scale in GeV
Definition: L1CaloEtScale.h:82
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 50 of file L1CaloEtScale.cc.

50  :
53  m_linearLsb(linearLsbInGeV),
54  m_thresholds(thresholdsInGeV) {
55 
56 }
uint16_t m_linScaleMax
linear scale maximum
Definition: L1CaloEtScale.h:72
uint16_t m_rankScaleMax
rank scale maximum
Definition: L1CaloEtScale.h:75
double m_linearLsb
LSB of linear scale in GeV.
Definition: L1CaloEtScale.h:79
std::vector< double > m_thresholds
thresholds associated with rank scale in GeV
Definition: L1CaloEtScale.h:82
unsigned linScaleMax() const
Definition: L1CaloEtScale.h:47
unsigned rankScaleMax() const
Definition: L1CaloEtScale.h:50
L1CaloEtScale::~L1CaloEtScale ( )

Definition at line 59 of file L1CaloEtScale.cc.

59  {
60 
61 }

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.

Referenced by L1ScalesTester::analyze(), L1GctValidation::analyze(), linearLsb(), l1t::Stage1Layer2DiTauAlgorithm::processEvent(), L1TPhysicalEtAdder::produce(), and L1ExtraParticlesProd::produce().

83  {
84 
85  // return bin centre, except for highest bin
86 // if (rank < m_thresholds.size()-1) {
87 // return (m_thresholds[rank+1]+m_thresholds[rank]) / 2;
88 // }
89 // else {
90 // return m_thresholds.back();
91 // }
92 
93 // return bin lower edge
94  try {
95  return m_thresholds.at(rank);
96  }
97  catch(std::out_of_range const&) {
98  throw cms::Exception("OutOfRange") << "Index out of range in L1CaloEtScale::et(rank)" << std::endl;
99  }
100 
101 }
uint16_t rank(const uint16_t linear) const
convert from linear Et scale to rank scale
std::vector< double > m_thresholds
thresholds associated with rank scale in GeV
Definition: L1CaloEtScale.h:82
const std::vector<double>& L1CaloEtScale::getThresholds ( ) const
inline
double L1CaloEtScale::linearLsb ( ) const
inline
unsigned L1CaloEtScale::linScaleMax ( ) const
inline

Definition at line 47 of file L1CaloEtScale.h.

References m_linScaleMax.

Referenced by l1t::JetToGtPtScales(), operator<<(), and l1t::TauToGtPtScales().

47 { return m_linScaleMax; }
uint16_t m_linScaleMax
linear scale maximum
Definition: L1CaloEtScale.h:72
void L1CaloEtScale::print ( std::ostream &  s) const

Definition at line 103 of file L1CaloEtScale.cc.

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

Referenced by L1ScalesTester::analyze(), and getThresholds().

103  {
104  s << "L1CaloEtScale :" << endl;
105  s << " Input scale max = " << m_linScaleMax << endl;
106  s << " Input LSB = " << m_linearLsb << " GeV" << endl;
107  s << " Rank scale max = " << m_rankScaleMax << endl;
108  for (unsigned i=0; i<m_thresholds.size(); i++) {
109  s << " Threshold " << i << " = " << m_thresholds[i] << " GeV" << endl;
110  }
111 }
uint16_t m_linScaleMax
linear scale maximum
Definition: L1CaloEtScale.h:72
uint16_t m_rankScaleMax
rank scale maximum
Definition: L1CaloEtScale.h:75
double m_linearLsb
LSB of linear scale in GeV.
Definition: L1CaloEtScale.h:79
std::vector< double > m_thresholds
thresholds associated with rank scale in GeV
Definition: L1CaloEtScale.h:82
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 L1ScalesTester::analyze(), L1RCTLookupTables::emRank(), l1t::JetToGtPtScales(), linearLsb(), l1t::Stage1Layer2DiTauAlgorithm::processEvent(), l1t::TauToGtPtScales(), L1GctJetEtCalibrationLut::value(), L1GctHtMissLut::value(), and L1GctHfEtSumsLut::value().

64  {
65 
66  return rank( (linear & m_linScaleMax) * m_linearLsb);
67 
68 }
uint16_t m_linScaleMax
linear scale maximum
Definition: L1CaloEtScale.h:72
double m_linearLsb
LSB of linear scale in GeV.
Definition: L1CaloEtScale.h:79
uint16_t rank(const uint16_t linear) const
convert from linear Et scale to rank scale
float linear(float x)
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 mps_fire::i, m_rankScaleMax, m_thresholds, and MillePedeFileConverter_cfg::out.

71  {
72 
73  uint16_t out = 0;
74 
75  for (unsigned i=0; i<m_thresholds.size() && i<(unsigned)(m_rankScaleMax+1); i++) {
76  if ( EtInGeV >= m_thresholds.at(i) ) { out = i; }
77  }
78 
79  return out & m_rankScaleMax;
80 }
uint16_t m_rankScaleMax
rank scale maximum
Definition: L1CaloEtScale.h:75
std::vector< double > m_thresholds
thresholds associated with rank scale in GeV
Definition: L1CaloEtScale.h:82
unsigned L1CaloEtScale::rankScaleMax ( ) const
inline

Definition at line 50 of file L1CaloEtScale.h.

References m_rankScaleMax.

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

50 { return m_rankScaleMax; }
uint16_t m_rankScaleMax
rank scale maximum
Definition: L1CaloEtScale.h:75
template<class Archive >
void L1CaloEtScale::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 85 of file L1CaloEtScale.h.

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

Definition at line 85 of file L1CaloEtScale.h.

Member Data Documentation

double L1CaloEtScale::m_linearLsb
private

LSB of linear scale in GeV.

Definition at line 79 of file L1CaloEtScale.h.

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

uint16_t L1CaloEtScale::m_linScaleMax
private

linear scale maximum

Definition at line 72 of file L1CaloEtScale.h.

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

uint16_t L1CaloEtScale::m_rankScaleMax
private

rank scale maximum

Definition at line 75 of file L1CaloEtScale.h.

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

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

thresholds associated with rank scale in GeV

Definition at line 82 of file L1CaloEtScale.h.

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