17 inline unsigned index (
unsigned fRange,
unsigned fCapId) {
return fCapId * 4 + fRange;}
18 inline unsigned range (
unsigned fIndex) {
return fIndex % 4;}
19 inline unsigned capId (
unsigned fIndex) {
return fIndex / 4;}
23 unsigned range = fShape.
range (fAdc);
29 for (
unsigned range = 0; range < 4; range++) {
30 float qieCharge = fCharge *
slope (fCapId, range) +
offset (fCapId, range);
31 unsigned nbin = fShape.
nbins();
32 unsigned minBin = nbin * range;
33 unsigned maxBin = minBin + nbin - 1;
34 float qieChargeMax = fShape.
highEdge (maxBin);
35 if (qieCharge <= qieChargeMax) {
36 for (
unsigned bin = minBin;
bin <= maxBin;
bin++) {
43 else if (range == 3) {
44 return ( 4 * nbin - 1);
59 if (fCapId < 4U && fRange < 4U) {
63 std::cerr <<
"HcalQIECoder::setOffset-> Wrong parameters capid/range: " << fCapId <<
'/' << fRange << std::endl;
68 if (fCapId < 4U && fRange < 4U) {
72 std::cerr <<
"HcalQIECoder::setSlope-> Wrong parameters capid/range: " << fCapId <<
'/' << fRange << std::endl;
float slope(unsigned fCapId, unsigned fRange) const
void setOffset(unsigned fCapId, unsigned fRange, float fValue)
float offset(unsigned fCapId, unsigned fRange) const
float center(unsigned fAdc) const
unsigned adc(const HcalQIEShape &fShape, float fCharge, unsigned fCapId) const
fC + capid [0..3] -> ADC conversion
unsigned range(unsigned fAdc) const
void setSlope(unsigned fCapId, unsigned fRange, float fValue)
float highEdge(unsigned fAdc) const
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.