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 ( 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, 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 }
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 ( )

destructor

dtor

Definition at line 31 of file L1CaloEcalScale.cc.

31  {
32 
33 }

Member Function Documentation

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

convert from rank to physically meaningful quantity

Definition at line 70 of file L1CaloEcalScale.cc.

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

Referenced by L1CaloInputScaleTester::analyze(), L1RCTLookupTables::convertEcal(), L1TStage2Layer1Producer::produce(), setBin(), and L1Analysis::L1AnalysisCaloTP::SetECAL().

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 }
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
void L1CaloEcalScale::print ( std::ostream &  s) const

Definition at line 82 of file L1CaloEcalScale.cc.

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

Referenced by L1ScalesTester::analyze().

82  {
83  s << "L1CaloEcalScaleRcd" << endl;
84  s << "Energy for ECAL inputs into the RCT" <<endl;
85  s << "Each new row is for a given value of 8 bit output of ECAL. Each column is for the respective eta value " << endl;
86 
87  for (unsigned rank=0; rank<nBinRank; rank++) {
88  s << "rank = " <<rank << " ";
89  for (unsigned eta=0; eta<2*nBinEta; eta++) {
90  s << m_scale[rank][eta] << " " ;
91  }
92  s << endl;
93  }
94 }
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
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 51 of file L1CaloEcalScale.cc.

References PVValHelper::eta, mps_fire::i, m_scale, nBinEta, nBinRank, and MillePedeFileConverter_cfg::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 }
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
static const unsigned short nBinRank
static const unsigned short nBinEta
template<class Archive >
void L1CaloEcalScale::serialize ( Archive &  ar,
const unsigned int  version 
)
private
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 36 of file L1CaloEcalScale.cc.

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

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

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 }
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
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

friend class boost::serialization::access
friend

Definition at line 70 of file L1CaloEcalScale.h.

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

Definition at line 70 of file L1CaloEcalScale.h.

Member Data Documentation

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

thresholds associated with rank scale in GeV

Definition at line 67 of file L1CaloEcalScale.h.

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

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