CMS 3D CMS Logo

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

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

Public Member Functions

double et (unsigned short rank, unsigned short eta, short etaSign) const
 convert from rank to physically meaningful quantity More...
 
 L1CaloHcalScale (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...
 
 ~L1CaloHcalScale ()
 destructor More...
 

Static Public Attributes

static const unsigned short nBinEta = 32
 
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 L1CaloHcalScale.h.

Constructor & Destructor Documentation

◆ L1CaloHcalScale()

L1CaloHcalScale::L1CaloHcalScale ( 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 L1CaloHcalScale.cc.

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 }

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

◆ ~L1CaloHcalScale()

L1CaloHcalScale::~L1CaloHcalScale ( )

destructor

dtor

Definition at line 30 of file L1CaloHcalScale.cc.

30 {}

Member Function Documentation

◆ et()

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

convert from rank to physically meaningful quantity

Definition at line 64 of file L1CaloHcalScale.cc.

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 }

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

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

◆ print()

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

Definition at line 75 of file L1CaloHcalScale.cc.

75  {
76  s << "L1CaloHcalScaleRcd" << endl;
77  s << "Energy for HCAL inputs into the RCT" << endl;
78  s << "Each new row is for a given value of 8 bit output of HCAL. Each column is for the respective eta value "
79  << endl;
80  for (unsigned rank = 0; rank < nBinRank; rank++) {
81  s << "rank " << rank << " ";
82  for (unsigned eta = 0; eta < 2 * nBinEta; eta++) {
83  s << m_scale[rank][eta] << " ";
84  }
85  s << endl;
86  }
87 }

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

Referenced by L1ScalesTester::analyze().

◆ rank()

unsigned short L1CaloHcalScale::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 L1CaloHcalScale.cc.

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 }

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

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

◆ serialize()

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

◆ setBin()

void L1CaloHcalScale::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 L1CaloHcalScale.cc.

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 }

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

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

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 66 of file L1CaloHcalScale.h.

◆ cond::serialization::access

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

Definition at line 66 of file L1CaloHcalScale.h.

Member Data Documentation

◆ m_scale

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

thresholds associated with rank scale in GeV

Definition at line 64 of file L1CaloHcalScale.h.

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

◆ nBinEta

const unsigned short L1CaloHcalScale::nBinEta = 32
static

◆ nBinRank

const unsigned short L1CaloHcalScale::nBinRank = 1 << 8
static
mps_fire.i
i
Definition: mps_fire.py:428
L1CaloHcalScale::et
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
Definition: L1CaloHcalScale.cc:64
L1CaloHcalScale::nBinRank
static const unsigned short nBinRank
Definition: L1CaloHcalScale.h:31
hgcalVFEProducer_cfi.lsb
lsb
Definition: hgcalVFEProducer_cfi.py:80
L1CaloHcalScale::rank
uint16_t rank(double et, unsigned short eta, short etaSign) const
convert from physical Et in GeV to rank scale
Definition: L1CaloHcalScale.cc:45
alignCSCRings.s
s
Definition: alignCSCRings.py:92
PVValHelper::eta
Definition: PVValidationHelpers.h:70
L1CaloHcalScale::nBinEta
static const unsigned short nBinEta
Definition: L1CaloHcalScale.h:32
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
L1CaloHcalScale::m_scale
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
Definition: L1CaloHcalScale.h:64