CMS 3D CMS Logo

HcalChannelCoder Class Reference

Container for ADC<->fQ conversion constants for HCAL QIE $Author: ratnikov
Date
2006/04/13 22:40:40
Revision
1.3
. More...

#include <CalibFormats/HcalObjects/interface/HcalChannelCoder.h>

List of all members.

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]


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 capId(), index(), mOffset, mSlope, and range.

00013                                                                                      { // [CapId][Range]
00014   for (int range = 0; range < 4; range++) {
00015     for (int capId = 0; capId < 4; capId++) {
00016       mOffset [capId][range] = fOffset [index (capId, range)];
00017       mSlope [capId][range] = fSlope [index (capId, range)];
00018     }
00019   }
00020 }


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 QieShape::binSize(), QieShape::linearization(), mOffset, mSlope, and range.

00030                                                                                    {
00031 
00032   int adc = -1; //nothing found yet
00033   // search for the range
00034   for (int range = 0; range < 4; range++) {
00035     double qieCharge = (fCharge - mOffset [fCapId][range]) * mSlope [fCapId][range];
00036     double qieChargeMax = fShape.linearization (32*range+31) + 0.5 * fShape.binSize (32*range+31);
00037     if (range == 3 && qieCharge > qieChargeMax) adc = 127; // overflow
00038     if (qieCharge > qieChargeMax) continue; // next range
00039     for (int bin = 32*range; bin < 32*(range+1); bin++) {
00040       if (qieCharge < fShape.linearization (bin) + 0.5 * fShape.binSize (bin)) {
00041         adc = bin;
00042         break;
00043       }
00044     }
00045     if (adc >= 0) break; // found
00046   }
00047   if (adc < 0) adc = 0; // underflow
00048 
00049 //   std::cout << "HcalChannelCoder::adc-> " << fCharge << '/' << fCapId 
00050 //          << " result: " << adc << std::endl;
00051   return adc;
00052 }

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, mSlope, and range.

00022                                                                                    {
00023   int range = (fAdc >> 6) & 0x3;
00024   double charge = fShape.linearization (fAdc) / mSlope [fCapId][range] + mOffset [fCapId][range];
00025 //   std::cout << "HcalChannelCoder::charge-> " << fAdc << '/' << fCapId 
00026 //          << " result: " << charge << std::endl;
00027   return charge;
00028 }

int HcalChannelCoder::index ( int  fCapId,
int  Range 
) [inline]

Definition at line 21 of file HcalChannelCoder.h.

Referenced by HcalChannelCoder().

00021 {return fCapId*4+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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:23:30 2009 for CMSSW by  doxygen 1.5.4