File indexing completed on 2024-04-06 12:02:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "CondFormats/L1TObjects/interface/L1CaloHcalScale.h"
0014
0015 using std::endl;
0016 using std::ostream;
0017 using std::vector;
0018
0019
0020 L1CaloHcalScale::L1CaloHcalScale(double lsb) {
0021 for (unsigned i = 0; i < nBinRank; i++) {
0022 for (unsigned eta = 0; eta < nBinEta; eta++) {
0023 m_scale[i][eta] = lsb * i;
0024 m_scale[i][eta + nBinEta] = lsb * i;
0025 }
0026 }
0027 }
0028
0029
0030 L1CaloHcalScale::~L1CaloHcalScale() {}
0031
0032
0033 void L1CaloHcalScale::setBin(unsigned short rank, unsigned short eta, short etaSign, double et) {
0034 --eta;
0035 if (rank < nBinRank && eta < nBinEta) {
0036 if (etaSign < 0)
0037 eta += nBinEta;
0038 m_scale[rank][eta] = et;
0039 } else {
0040
0041 }
0042 }
0043
0044
0045 unsigned short L1CaloHcalScale::rank(double et, unsigned short eta, short etaSign) const {
0046 --eta;
0047 if (eta < nBinEta) {
0048 unsigned short out = 0;
0049 if (etaSign < 0)
0050 eta += nBinEta;
0051 for (unsigned i = 0; i < nBinRank; i++) {
0052 if (et >= m_scale[i][eta]) {
0053 out = i;
0054 }
0055 }
0056 return out & (nBinRank - 1);
0057 } else {
0058
0059 }
0060 return nBinRank;
0061 }
0062
0063
0064 double L1CaloHcalScale::et(unsigned short rank, unsigned short eta, short etaSign) const {
0065 --eta;
0066 if (rank < nBinRank && eta < nBinEta) {
0067 if (etaSign < 0)
0068 eta += nBinEta;
0069 return m_scale[rank][eta];
0070 } else
0071 return -1.;
0072 }
0073
0074
0075 void L1CaloHcalScale::print(ostream& s) const {
0076 s << "L1CaloHcalScaleRcd" << endl;
0077 s << "Energy for HCAL inputs into the RCT" << endl;
0078 s << "Each new row is for a given value of 8 bit output of HCAL. Each column is for the respective eta value "
0079 << endl;
0080 for (unsigned rank = 0; rank < nBinRank; rank++) {
0081 s << "rank " << rank << " ";
0082 for (unsigned eta = 0; eta < 2 * nBinEta; eta++) {
0083 s << m_scale[rank][eta] << " ";
0084 }
0085 s << endl;
0086 }
0087 }