CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
HcalChannelCoder Class Reference

#include <HcalChannelCoder.h>

Public Member Functions

int adc (const QieShape &fShape, double fCharge, int fCapId) const
 fC + capid[0..3] -> ADC conversion More...
 
double charge (const QieShape &fShape, int fAdc, int fCapId) const
 ADC[0..127]+capid[0..3]->fC conversion. More...
 
 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]
 

Detailed Description

Container for ADC<->fQ conversion constants for HCAL QIE $Author: ratnikov

Date:
2006/04/13 22:40:40
Revision:
1.3

Container for ADC<->fQ conversion constants for HCAL QIE $Author: ratnikov

Revision:
1.3

Definition at line 14 of file HcalChannelCoder.h.

Constructor & Destructor Documentation

HcalChannelCoder::HcalChannelCoder ( const float  fOffset[16],
const float  fSlope[16] 
)

Definition at line 13 of file HcalChannelCoder.cc.

References index(), mOffset, and mSlope.

13  { // [CapId][Range]
14  for (int range = 0; range < 4; range++) {
15  for (int capId = 0; capId < 4; capId++) {
16  mOffset [capId][range] = fOffset [index (capId, range)];
17  mSlope [capId][range] = fSlope [index (capId, range)];
18  }
19  }
20 }
double mOffset[4][4]
int index(int fCapId, int Range)
double mSlope[4][4]

Member Function Documentation

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.

30  {
31 
32  int adc = -1; //nothing found yet
33  // search for the range
34  for (int range = 0; range < 4; range++) {
35  double qieCharge = (fCharge - mOffset [fCapId][range]) * mSlope [fCapId][range];
36  double qieChargeMax = fShape.linearization (32*range+31) + 0.5 * fShape.binSize (32*range+31);
37  if (range == 3 && qieCharge > qieChargeMax) adc = 127; // overflow
38  if (qieCharge > qieChargeMax) continue; // next range
39  for (int bin = 32*range; bin < 32*(range+1); bin++) {
40  if (qieCharge < fShape.linearization (bin) + 0.5 * fShape.binSize (bin)) {
41  adc = bin;
42  break;
43  }
44  }
45  if (adc >= 0) break; // found
46  }
47  if (adc < 0) adc = 0; // underflow
48 
49 // std::cout << "HcalChannelCoder::adc-> " << fCharge << '/' << fCapId
50 // << " result: " << adc << std::endl;
51  return adc;
52 }
int adc(const QieShape &fShape, double fCharge, int fCapId) const
fC + capid[0..3] -&gt; ADC conversion
double binSize(int fAdc) const
Definition: QieShape.h:17
double mOffset[4][4]
double mSlope[4][4]
double linearization(int fAdc) const
Definition: QieShape.h:15
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.

22  {
23  int range = (fAdc >> 6) & 0x3;
24  double charge = fShape.linearization (fAdc) / mSlope [fCapId][range] + mOffset [fCapId][range];
25 // std::cout << "HcalChannelCoder::charge-> " << fAdc << '/' << fCapId
26 // << " result: " << charge << std::endl;
27  return charge;
28 }
double charge(const QieShape &fShape, int fAdc, int fCapId) const
ADC[0..127]+capid[0..3]-&gt;fC conversion.
double mOffset[4][4]
double mSlope[4][4]
double linearization(int fAdc) const
Definition: QieShape.h:15
int HcalChannelCoder::index ( int  fCapId,
int  Range 
)
inline

Definition at line 21 of file HcalChannelCoder.h.

Referenced by BeautifulSoup.PageElement::_invert(), and HcalChannelCoder().

21 {return fCapId*4+Range;}
PixelRecoRange< float > Range

Member Data Documentation

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().