CMS 3D CMS Logo

L1CaloEcalScale.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1TObjects
4 // Class : L1CaloEcalScale
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 L1CaloEcalScale::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 L1CaloEcalScale::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 L1CaloEcalScale::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 L1CaloEcalScale::print(ostream& s) const {
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 }
mps_fire.i
i
Definition: mps_fire.py:355
L1CaloEcalScale::et
double et(unsigned short rank, unsigned short eta, short etaSign) const
convert from rank to physically meaningful quantity
Definition: L1CaloEcalScale.cc:64
L1CaloEcalScale::nBinRank
static const unsigned short nBinRank
Definition: L1CaloEcalScale.h:31
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1CaloEcalScale::rank
uint16_t rank(double et, unsigned short eta, short etaSign) const
convert from physical Et in GeV to rank scale
Definition: L1CaloEcalScale.cc:45
L1CaloEcalScale::L1CaloEcalScale
L1CaloEcalScale(double lsb=1.0)
constructor (creates a linear scale with an LSB - no LSB gives identity)
Definition: L1CaloEcalScale.cc:20
PVValHelper::eta
Definition: PVValidationHelpers.h:69
L1CaloEcalScale::print
void print(std::ostream &s) const
Definition: L1CaloEcalScale.cc:75
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
L1CaloEcalScale::m_scale
double m_scale[nBinRank][2 *nBinEta]
thresholds associated with rank scale in GeV
Definition: L1CaloEcalScale.h:64
L1CaloEcalScale.h
L1CaloEcalScale::setBin
void setBin(unsigned short rank, unsigned short eta, short etaSign, double et)
set scale element; use this to create non-linear scales
Definition: L1CaloEcalScale.cc:33
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
L1CaloEcalScale::nBinEta
static const unsigned short nBinEta
Definition: L1CaloEcalScale.h:32
L1CaloEcalScale::~L1CaloEcalScale
~L1CaloEcalScale()
destructor
Definition: L1CaloEcalScale.cc:30