CMS 3D CMS Logo

L1CaloHcalScale.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1TObjects
4 // Class : L1CaloHcalScale
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Author:
10 // Created: Wed Sep 27 17:18:27 CEST 2006
11 // $Id:
12 
14 
15 using std::endl;
16 using std::ostream;
17 using std::vector;
18 
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 }
28 
31 
33 void L1CaloHcalScale::setBin(unsigned short rank, unsigned short eta, short etaSign, double et) {
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 }
43 
45 unsigned short L1CaloHcalScale::rank(double et, unsigned short eta, short etaSign) const {
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 }
62 
63 // convert from rank to Et/GeV
64 double L1CaloHcalScale::et(unsigned short rank, unsigned short eta, short etaSign) const {
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 }
73 
74 // pretty print
75 void L1CaloHcalScale::print(ostream& s) const {
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 }
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.h
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
L1CaloHcalScale::print
void print(std::ostream &s) const
Definition: L1CaloHcalScale.cc:75
PVValHelper::eta
Definition: PVValidationHelpers.h:70
L1CaloHcalScale::nBinEta
static const unsigned short nBinEta
Definition: L1CaloHcalScale.h:32
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
L1CaloHcalScale::~L1CaloHcalScale
~L1CaloHcalScale()
destructor
Definition: L1CaloHcalScale.cc:30
L1CaloHcalScale::setBin
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
Definition: L1CaloHcalScale.cc:33
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
L1CaloHcalScale::L1CaloHcalScale
L1CaloHcalScale(double lsb=1.0)
constructor (creates a linear scale with an LSB - no LSB gives identity)
Definition: L1CaloHcalScale.cc:20
L1CaloHcalScale::m_scale
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
Definition: L1CaloHcalScale.h:64