#include <CastorChannelCoder.h>
Public Member Functions | |
int | adc (const QieShape &fShape, double fCharge, int fCapId) const |
fC + capid[0..3] -> ADC conversion | |
CastorChannelCoder (const float fOffset[16], const float fSlope[16]) | |
double | charge (const QieShape &fShape, int fAdc, int fCapId) const |
ADC[0..127]+capid[0..3]->fC conversion. | |
int | index (int fCapId, int Range) |
Private Attributes | |
double | mOffset [4][4] |
double | mSlope [4][4] |
Container for ADC<->fQ conversion constants for HCAL/Castor QIE
Container for ADC<->fQ conversion constants for HCAL/Castor QIE $Original author: ratnikov
Definition at line 12 of file CastorChannelCoder.h.
CastorChannelCoder::CastorChannelCoder | ( | const float | fOffset[16], |
const float | fSlope[16] | ||
) |
Definition at line 13 of file CastorChannelCoder.cc.
int CastorChannelCoder::adc | ( | const QieShape & | fShape, |
double | fCharge, | ||
int | fCapId | ||
) | const |
fC + capid[0..3] -> ADC conversion
Definition at line 30 of file CastorChannelCoder.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 << "CastorChannelCoder::adc-> " << fCharge << '/' << fCapId // << " result: " << adc << std::endl; return adc; }
double CastorChannelCoder::charge | ( | const QieShape & | fShape, |
int | fAdc, | ||
int | fCapId | ||
) | const |
ADC[0..127]+capid[0..3]->fC conversion.
Definition at line 22 of file CastorChannelCoder.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 << "CastorChannelCoder::charge-> " << fAdc << '/' << fCapId // << " result: " << charge << std::endl; return charge; }
int CastorChannelCoder::index | ( | int | fCapId, |
int | Range | ||
) | [inline] |
Definition at line 19 of file CastorChannelCoder.h.
Referenced by CastorChannelCoder().
{return fCapId*4+Range;}
double CastorChannelCoder::mOffset[4][4] [private] |
Definition at line 21 of file CastorChannelCoder.h.
Referenced by adc(), CastorChannelCoder(), and charge().
double CastorChannelCoder::mSlope[4][4] [private] |
Definition at line 22 of file CastorChannelCoder.h.
Referenced by adc(), CastorChannelCoder(), and charge().