CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ( 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.

References eta, i, m_scale, nBinEta, and nBinRank.

21 {
22  for (unsigned i=0; i<nBinRank; i++) {
23  for (unsigned eta=0; eta<nBinEta; eta++) {
24  m_scale[i][eta] = lsb * i;
25  m_scale[i][eta+nBinEta] = lsb * i;
26  }
27  }
28 }
int i
Definition: DBlmapReader.cc:9
static const unsigned short nBinRank
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
static const unsigned short nBinEta
L1CaloHcalScale::~L1CaloHcalScale ( )

destructor

dtor

Definition at line 31 of file L1CaloHcalScale.cc.

31  {
32 
33 }

Member Function Documentation

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

convert from rank to physically meaningful quantity

Definition at line 70 of file L1CaloHcalScale.cc.

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

Referenced by L1RCTLookupTables::convertHcal(), and setBin().

72  {
73  --eta ; // input eta index starts at 1
74  if (rank < nBinRank && eta < nBinEta) {
75  if( etaSign < 0 ) eta += nBinEta ;
76  return m_scale[rank][eta];
77  }
78  else return -1.;
79 }
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
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
static const unsigned short nBinEta
void L1CaloHcalScale::print ( std::ostream &  s) const

Definition at line 82 of file L1CaloHcalScale.cc.

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

Referenced by L1CaloHcalScaleConfigOnlineProd::newObject().

82  {
83  s << "L1CaloHcalScaleRcd" << endl;
84  s << "Energy for HCAL inputs into the RCT" <<endl;
85  s << "Each new row is for a given value of 8 bit output of HCAL. Each column is for the respective eta value " << endl;
86  for (unsigned rank=0; rank<nBinRank; rank++) {
87  s << "rank " << rank << " ";
88  for (unsigned eta=0; eta<2*nBinEta; eta++) {
89  s << m_scale[rank][eta] << " " ;
90  }
91  s << endl;
92  }
93 }
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
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
static const unsigned short nBinEta
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 51 of file L1CaloHcalScale.cc.

References eta, i, m_scale, nBinEta, nBinRank, and dbtoconf::out.

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

53  {
54  --eta ; // input eta index starts at 1
55  if (eta < nBinEta) {
56  unsigned short out = 0;
57  if( etaSign < 0 ) eta += nBinEta ;
58  for (unsigned i=0; i<nBinRank; i++) {
59  if ( et >= m_scale[i][eta] ) { out = i; }
60  }
61  return out & (nBinRank-1);
62  }
63  else {
64  // throw
65  }
66  return nBinRank ;
67 }
int i
Definition: DBlmapReader.cc:9
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
static const unsigned short nBinRank
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
tuple out
Definition: dbtoconf.py:99
static const unsigned short nBinEta
template<class Archive >
void L1CaloHcalScale::serialize ( Archive &  ar,
const unsigned int  version 
)
private
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 36 of file L1CaloHcalScale.cc.

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

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

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

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 70 of file L1CaloHcalScale.h.

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

Definition at line 70 of file L1CaloHcalScale.h.

Member Data Documentation

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

thresholds associated with rank scale in GeV

Definition at line 67 of file L1CaloHcalScale.h.

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

const unsigned short L1CaloHcalScale::nBinEta = 32
static
const unsigned short L1CaloHcalScale::nBinRank = 1<<8
static