14 unsigned index (
unsigned fRange,
unsigned fCapId) {
return fCapId * 4 + fRange;}
15 unsigned range (
unsigned fIndex) {
return fIndex % 4;}
16 unsigned capId (
unsigned fIndex) {
return fIndex / 4;}
20 unsigned range = fShape.
range (fAdc);
26 for (
unsigned range = 0; range < 4; range++) {
27 float qieCharge = fCharge *
slope (fCapId, range) +
offset (fCapId, range);
28 unsigned minBin = 32*range;
29 float qieChargeMax = fShape.
highEdge (minBin + 31);
30 if (qieCharge <= qieChargeMax) {
31 for (
unsigned bin = minBin;
bin <= minBin + 31;
bin++) {
38 else if (range == 3) {
54 if (fCapId < 4U && fRange < 4U) {
58 std::cerr <<
"CastorQIECoder::setOffset-> Wrong parameters capid/range: " << fCapId <<
'/' << fRange << std::endl;
63 if (fCapId < 4U && fRange < 4U) {
67 std::cerr <<
"CastorQIECoder::setSlope-> Wrong parameters capid/range: " << fCapId <<
'/' << fRange << std::endl;
void setSlope(unsigned fCapId, unsigned fRange, float fValue)
unsigned range(unsigned fAdc) const
float highEdge(unsigned fAdc) const
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
void setOffset(unsigned fCapId, unsigned fRange, float fValue)
float center(unsigned fAdc) const
float offset(unsigned fCapId, unsigned fRange) const
unsigned adc(const CastorQIEShape &fShape, float fCharge, unsigned fCapId) const
fC + capid [0..3] -> ADC conversion
float slope(unsigned fCapId, unsigned fRange) const