CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CastorChannelCoder Class Reference

#include <CastorChannelCoder.h>

Public Member Functions

int adc (const reco::castor::QieShape &fShape, double fCharge, int fCapId) const
 fC + capid[0..3] -> ADC conversion More...
 
 CastorChannelCoder (const float fOffset[16], const float fSlope[16])
 
double charge (const reco::castor::QieShape &fShape, int fAdc, int fCapId) const
 ADC[0..127]+capid[0..3]->fC conversion. More...
 
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/Castor QIE

Container for ADC<->fQ conversion constants for HCAL/Castor QIE $Original author: ratnikov

Definition at line 16 of file CastorChannelCoder.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file CastorChannelCoder.cc.

References index(), mOffset, and mSlope.

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

Member Function Documentation

int CastorChannelCoder::adc ( const reco::castor::QieShape fShape,
double  fCharge,
int  fCapId 
) const

fC + capid[0..3] -> ADC conversion

Definition at line 29 of file CastorChannelCoder.cc.

References stringResolutionProvider_cfi::bin, reco::castor::QieShape::binSize(), reco::castor::QieShape::linearization(), mOffset, and mSlope.

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

ADC[0..127]+capid[0..3]->fC conversion.

Definition at line 21 of file CastorChannelCoder.cc.

References reco::castor::QieShape::linearization(), mOffset, and mSlope.

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

Definition at line 23 of file CastorChannelCoder.h.

Referenced by CastorChannelCoder(), and BeautifulSoup.PageElement::insert().

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

Member Data Documentation

double CastorChannelCoder::mOffset[4][4]
private

Definition at line 25 of file CastorChannelCoder.h.

Referenced by adc(), CastorChannelCoder(), and charge().

double CastorChannelCoder::mSlope[4][4]
private

Definition at line 26 of file CastorChannelCoder.h.

Referenced by adc(), CastorChannelCoder(), and charge().