#include <HcalChannelCoder.h>
Public Member Functions | |
int | adc (const QieShape &fShape, double fCharge, int fCapId) const |
fC + capid[0..3] -> ADC conversion | |
double | charge (const QieShape &fShape, int fAdc, int fCapId) const |
ADC[0..127]+capid[0..3]->fC conversion. | |
HcalChannelCoder (const float fOffset[16], const float fSlope[16]) | |
int | index (int fCapId, int Range) |
Private Attributes | |
double | mOffset [4][4] |
double | mSlope [4][4] |
Container for ADC<->fQ conversion constants for HCAL QIE $Author: ratnikov
Container for ADC<->fQ conversion constants for HCAL QIE $Author: ratnikov
Definition at line 14 of file HcalChannelCoder.h.
HcalChannelCoder::HcalChannelCoder | ( | const float | fOffset[16], |
const float | fSlope[16] | ||
) |
Definition at line 13 of file HcalChannelCoder.cc.
int HcalChannelCoder::adc | ( | const QieShape & | fShape, |
double | fCharge, | ||
int | fCapId | ||
) | const |
fC + capid[0..3] -> ADC conversion
Definition at line 30 of file HcalChannelCoder.cc.
References newFWLiteAna::bin, QieShape::binSize(), QieShape::linearization(), mOffset, and mSlope.
{ int adc = -1; //nothing found yet // search for the range for (int range = 0; range < 4; range++) { double qieCharge = (fCharge - mOffset [fCapId][range]) * mSlope [fCapId][range]; double qieChargeMax = fShape.linearization (32*range+31) + 0.5 * fShape.binSize (32*range+31); if (range == 3 && qieCharge > qieChargeMax) adc = 127; // overflow if (qieCharge > qieChargeMax) continue; // next range for (int bin = 32*range; bin < 32*(range+1); bin++) { if (qieCharge < fShape.linearization (bin) + 0.5 * fShape.binSize (bin)) { adc = bin; break; } } if (adc >= 0) break; // found } if (adc < 0) adc = 0; // underflow // std::cout << "HcalChannelCoder::adc-> " << fCharge << '/' << fCapId // << " result: " << adc << std::endl; return adc; }
double HcalChannelCoder::charge | ( | const QieShape & | fShape, |
int | fAdc, | ||
int | fCapId | ||
) | const |
ADC[0..127]+capid[0..3]->fC conversion.
Definition at line 22 of file HcalChannelCoder.cc.
References QieShape::linearization(), mOffset, and mSlope.
{ int range = (fAdc >> 6) & 0x3; double charge = fShape.linearization (fAdc) / mSlope [fCapId][range] + mOffset [fCapId][range]; // std::cout << "HcalChannelCoder::charge-> " << fAdc << '/' << fCapId // << " result: " << charge << std::endl; return charge; }
int HcalChannelCoder::index | ( | int | fCapId, |
int | Range | ||
) | [inline] |
Definition at line 21 of file HcalChannelCoder.h.
Referenced by HcalChannelCoder().
{return fCapId*4+Range;}
double HcalChannelCoder::mOffset[4][4] [private] |
Definition at line 23 of file HcalChannelCoder.h.
Referenced by adc(), charge(), and HcalChannelCoder().
double HcalChannelCoder::mSlope[4][4] [private] |
Definition at line 24 of file HcalChannelCoder.h.
Referenced by adc(), charge(), and HcalChannelCoder().