CMS 3D CMS Logo

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

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

Public Member Functions

double et (unsigned short rank, unsigned short eta, short etaSign) const
 convert from rank to physically meaningful quantity More...
 
 L1CaloEcalScale (double lsb=1.0)
 constructor (creates a linear scale with an LSB - no LSB gives identity) More...
 
void print (std::ostream &s) const
 
uint16_t rank (double et, unsigned short eta, short etaSign) const
 convert from physical Et in GeV to rank scale More...
 
void setBin (unsigned short rank, unsigned short eta, short etaSign, double et)
 set scale element; use this to create non-linear scales More...
 
 ~L1CaloEcalScale ()
 destructor More...
 

Static Public Attributes

static const unsigned short nBinEta = 28
 
static const unsigned short nBinRank = 1 << 8
 

Private Member Functions

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

Private Attributes

double m_scale [nBinRank][2 *nBinEta]
 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 conversion between Et scales in L1 hardware

Usage: <usage>

Definition at line 28 of file L1CaloEcalScale.h.

Constructor & Destructor Documentation

◆ L1CaloEcalScale()

L1CaloEcalScale::L1CaloEcalScale ( double  lsb = 1.0)

constructor (creates a linear scale with an LSB - no LSB gives identity)

construct a linear scale with a particular LSB

Definition at line 20 of file L1CaloEcalScale.cc.

References PVValHelper::eta, mps_fire::i, l1tHGCalVFEProducer_cfi::lsb, m_scale, nBinEta, and nBinRank.

20  {
21  for (unsigned i = 0; i < nBinRank; i++) {
22  for (unsigned eta = 0; eta < nBinEta; eta++) {
23  m_scale[i][eta] = lsb * i;
24  m_scale[i][eta + nBinEta] = lsb * i;
25  }
26  }
27 }
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
static const unsigned short nBinRank
static const unsigned short nBinEta

◆ ~L1CaloEcalScale()

L1CaloEcalScale::~L1CaloEcalScale ( )

destructor

dtor

Definition at line 30 of file L1CaloEcalScale.cc.

30 {}

Member Function Documentation

◆ et()

double L1CaloEcalScale::et ( unsigned short  rank,
unsigned short  eta,
short  etaSign 
) const

convert from rank to physically meaningful quantity

Definition at line 64 of file L1CaloEcalScale.cc.

References PVValHelper::eta, m_scale, nBinEta, nBinRank, and rank().

Referenced by L1CaloInputScaleTester::analyze(), L1RCTLookupTables::convertEcal(), L1TStage2Layer1Producer::produce(), rank(), and setBin().

64  {
65  --eta; // input eta index starts at 1
66  if (rank < nBinRank && eta < nBinEta) {
67  if (etaSign < 0)
68  eta += nBinEta;
69  return m_scale[rank][eta];
70  } else
71  return -1.;
72 }
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
uint16_t rank(double et, unsigned short eta, short etaSign) const
convert from physical Et in GeV to rank scale
static const unsigned short nBinRank
static const unsigned short nBinEta

◆ print()

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

Definition at line 75 of file L1CaloEcalScale.cc.

References PVValHelper::eta, m_scale, nBinEta, nBinRank, rank(), and alignCSCRings::s.

Referenced by L1ScalesTester::analyze().

75  {
76  s << "L1CaloEcalScaleRcd" << endl;
77  s << "Energy for ECAL inputs into the RCT" << endl;
78  s << "Each new row is for a given value of 8 bit output of ECAL. Each column is for the respective eta value "
79  << endl;
80 
81  for (unsigned rank = 0; rank < nBinRank; rank++) {
82  s << "rank = " << rank << " ";
83  for (unsigned eta = 0; eta < 2 * nBinEta; eta++) {
84  s << m_scale[rank][eta] << " ";
85  }
86  s << endl;
87  }
88 }
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
uint16_t rank(double et, unsigned short eta, short etaSign) const
convert from physical Et in GeV to rank scale
static const unsigned short nBinRank
static const unsigned short nBinEta

◆ rank()

unsigned short L1CaloEcalScale::rank ( double  et,
unsigned short  eta,
short  etaSign 
) const

convert from physical Et in GeV to rank scale

convert from Et in GeV to rank

Definition at line 45 of file L1CaloEcalScale.cc.

References et(), PVValHelper::eta, mps_fire::i, m_scale, nBinEta, nBinRank, and MillePedeFileConverter_cfg::out.

Referenced by et(), print(), and setBin().

45  {
46  --eta; // input eta index starts at 1
47  if (eta < nBinEta) {
48  unsigned short out = 0;
49  if (etaSign < 0)
50  eta += nBinEta;
51  for (unsigned i = 0; i < nBinRank; i++) {
52  if (et >= m_scale[i][eta]) {
53  out = i;
54  }
55  }
56  return out & (nBinRank - 1);
57  } else {
58  // throw
59  }
60  return nBinRank;
61 }
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
static const unsigned short nBinRank
static const unsigned short nBinEta

◆ serialize()

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

◆ setBin()

void L1CaloEcalScale::setBin ( unsigned short  rank,
unsigned short  eta,
short  etaSign,
double  et 
)

set scale element; use this to create non-linear scales

set scale bin

Definition at line 33 of file L1CaloEcalScale.cc.

References et(), PVValHelper::eta, m_scale, nBinEta, nBinRank, and rank().

Referenced by L1RCTSaveInput::analyze(), and L1RCTLutWriter::analyze().

33  {
34  --eta; // input eta index starts at 1
35  if (rank < nBinRank && eta < nBinEta) {
36  if (etaSign < 0)
37  eta += nBinEta;
38  m_scale[rank][eta] = et;
39  } else {
40  // throw
41  }
42 }
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
uint16_t rank(double et, unsigned short eta, short etaSign) const
convert from physical Et in GeV to rank scale
static const unsigned short nBinRank
static const unsigned short nBinEta

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 66 of file L1CaloEcalScale.h.

◆ cond::serialization::access

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

Definition at line 66 of file L1CaloEcalScale.h.

Member Data Documentation

◆ m_scale

double L1CaloEcalScale::m_scale[nBinRank][2 *nBinEta]
private

thresholds associated with rank scale in GeV

Definition at line 64 of file L1CaloEcalScale.h.

Referenced by et(), L1CaloEcalScale(), print(), rank(), and setBin().

◆ nBinEta

const unsigned short L1CaloEcalScale::nBinEta = 28
static

◆ nBinRank

const unsigned short L1CaloEcalScale::nBinRank = 1 << 8
static