CMS 3D CMS Logo

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

#include <HcalQIECoder.h>

Public Member Functions

unsigned adc (const HcalQIEShape &fShape, float fCharge, unsigned fCapId) const
 fC + capid [0..3] -> ADC conversion More...
 
float charge (const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
 ADC [0..127] + capid [0..3] -> fC conversion. More...
 
 HcalQIECoder (unsigned long fId=0)
 
float offset (unsigned fCapId, unsigned fRange) const
 
uint32_t rawId () const
 
void setOffset (unsigned fCapId, unsigned fRange, float fValue)
 
void setSlope (unsigned fCapId, unsigned fRange, float fValue)
 
float slope (unsigned fCapId, unsigned fRange) const
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

uint32_t mId
 
float mOffset00
 
float mOffset01
 
float mOffset02
 
float mOffset03
 
float mOffset10
 
float mOffset11
 
float mOffset12
 
float mOffset13
 
float mOffset20
 
float mOffset21
 
float mOffset22
 
float mOffset23
 
float mOffset30
 
float mOffset31
 
float mOffset32
 
float mOffset33
 
float mSlope00
 
float mSlope01
 
float mSlope02
 
float mSlope03
 
float mSlope10
 
float mSlope11
 
float mSlope12
 
float mSlope13
 
float mSlope20
 
float mSlope21
 
float mSlope22
 
float mSlope23
 
float mSlope30
 
float mSlope31
 
float mSlope32
 
float mSlope33
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Author
Fedor Ratnikov (UMd) POOL object to store calibration mode QIE coder parameters for one channel $Id
Fedor Ratnikov (UMd) POOL object to store QIE coder parameters for one channel $Author: ratnikov
Date
2008/03/05 10:38:03
Revision
1.9

Definition at line 20 of file HcalQIECoder.h.

Constructor & Destructor Documentation

◆ HcalQIECoder()

HcalQIECoder::HcalQIECoder ( unsigned long  fId = 0)
inline

Definition at line 22 of file HcalQIECoder.h.

22 : mId(fId) {}
uint32_t mId
Definition: HcalQIECoder.h:39

Member Function Documentation

◆ adc()

unsigned HcalQIECoder::adc ( const HcalQIEShape fShape,
float  fCharge,
unsigned  fCapId 
) const

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

Definition at line 25 of file HcalQIECoder.cc.

References newFWLiteAna::bin, HcalQIEShape::highEdge(), cms::cuda::allocator::maxBin, cms::cuda::allocator::minBin, HcalQIEShape::nbins(), offset(), isotrackApplyRegressor::range, and slope().

Referenced by HcalCoderDb::fC2adc_().

25  {
26  // search for the range
27  for (unsigned range = 0; range < 4; range++) {
28  float qieCharge = fCharge * slope(fCapId, range) + offset(fCapId, range);
29  unsigned nbin = fShape.nbins(); // it's just 64 = 2*32 ! (for QIE10)
30  unsigned minBin = nbin * range;
31  unsigned maxBin = minBin + nbin - 1;
32  float qieChargeMax = fShape.highEdge(maxBin);
33  if (qieCharge <= qieChargeMax) {
34  for (unsigned bin = minBin; bin <= maxBin; bin++) {
35  if (qieCharge < fShape.highEdge(bin)) {
36  return bin;
37  }
38  }
39  return minBin; // underflow
40  } else if (range == 3) {
41  return (4 * nbin - 1); // overflow
42  }
43  }
44  return 0; //should never get here
45 }
constexpr unsigned int maxBin
float offset(unsigned fCapId, unsigned fRange) const
Definition: HcalQIECoder.cc:47
float slope(unsigned fCapId, unsigned fRange) const
Definition: HcalQIECoder.cc:49
float highEdge(unsigned fAdc) const
Definition: HcalQIEShape.cc:46
unsigned nbins() const
Definition: HcalQIEShape.h:33
constexpr unsigned int minBin

◆ charge()

float HcalQIECoder::charge ( const HcalQIEShape fShape,
unsigned  fAdc,
unsigned  fCapId 
) const

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

Definition at line 20 of file HcalQIECoder.cc.

References HcalQIEShape::center(), offset(), HcalQIEShape::range(), isotrackApplyRegressor::range, and slope().

Referenced by HcalCoderDb::adc2fC_(), HcalDbService::convertPedestals(), HcalDbService::convertPedestalWidths(), getLinearizedADC(), HcalPedestalAnalysis::per2CapsHists(), and HcaluLUTTPGCoder::update().

20  {
21  unsigned range = fShape.range(fAdc);
22  return (fShape.center(fAdc) - offset(fCapId, range)) / slope(fCapId, range);
23 }
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
float offset(unsigned fCapId, unsigned fRange) const
Definition: HcalQIECoder.cc:47
float slope(unsigned fCapId, unsigned fRange) const
Definition: HcalQIECoder.cc:49
float center(unsigned fAdc) const
Definition: HcalQIEShape.cc:36

◆ offset()

float HcalQIECoder::offset ( unsigned  fCapId,
unsigned  fRange 
) const

Definition at line 47 of file HcalQIECoder.cc.

References mOffset00.

Referenced by adc(), and charge().

47 { return *((&mOffset00) + index(fRange, fCapId)); }
float mOffset00
Definition: HcalQIECoder.h:40

◆ rawId()

uint32_t HcalQIECoder::rawId ( ) const
inline

Definition at line 36 of file HcalQIECoder.h.

References mId.

Referenced by HcalDbService::getHcalShape().

36 { return mId; }
uint32_t mId
Definition: HcalQIECoder.h:39

◆ serialize()

template<class Archive >
void HcalQIECoder::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setOffset()

void HcalQIECoder::setOffset ( unsigned  fCapId,
unsigned  fRange,
float  fValue 
)

Definition at line 51 of file HcalQIECoder.cc.

References DMR_cfg::cerr, mOffset00, and mitigatedMETSequence_cff::U.

51  {
52  if (fCapId < 4U && fRange < 4U) { // fCapId >= 0 and fRange >= 0, since fCapId and fRange are unsigned
53  *((&mOffset00) + index(fRange, fCapId)) = fValue;
54  } else {
55  std::cerr << "HcalQIECoder::setOffset-> Wrong parameters capid/range: " << fCapId << '/' << fRange << std::endl;
56  }
57 }
float mOffset00
Definition: HcalQIECoder.h:40

◆ setSlope()

void HcalQIECoder::setSlope ( unsigned  fCapId,
unsigned  fRange,
float  fValue 
)

Definition at line 59 of file HcalQIECoder.cc.

References DMR_cfg::cerr, mSlope00, and mitigatedMETSequence_cff::U.

59  {
60  if (fCapId < 4U && fRange < 4U) { // fCapId >= 0 and fRange >= 0, since fCapId and fRange are unsigned
61  *((&mSlope00) + index(fRange, fCapId)) = fValue;
62  } else {
63  std::cerr << "HcalQIECoder::setSlope-> Wrong parameters capid/range: " << fCapId << '/' << fRange << std::endl;
64  }
65 }
float mSlope00
Definition: HcalQIECoder.h:56

◆ slope()

float HcalQIECoder::slope ( unsigned  fCapId,
unsigned  fRange 
) const

Definition at line 49 of file HcalQIECoder.cc.

References mSlope00.

Referenced by adc(), and charge().

49 { return *((&mSlope00) + index(fRange, fCapId)); }
float mSlope00
Definition: HcalQIECoder.h:56

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 73 of file HcalQIECoder.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 73 of file HcalQIECoder.h.

Member Data Documentation

◆ mId

uint32_t HcalQIECoder::mId
private

Definition at line 39 of file HcalQIECoder.h.

Referenced by rawId().

◆ mOffset00

float HcalQIECoder::mOffset00
private

Definition at line 40 of file HcalQIECoder.h.

Referenced by offset(), and setOffset().

◆ mOffset01

float HcalQIECoder::mOffset01
private

Definition at line 41 of file HcalQIECoder.h.

◆ mOffset02

float HcalQIECoder::mOffset02
private

Definition at line 42 of file HcalQIECoder.h.

◆ mOffset03

float HcalQIECoder::mOffset03
private

Definition at line 43 of file HcalQIECoder.h.

◆ mOffset10

float HcalQIECoder::mOffset10
private

Definition at line 44 of file HcalQIECoder.h.

◆ mOffset11

float HcalQIECoder::mOffset11
private

Definition at line 45 of file HcalQIECoder.h.

◆ mOffset12

float HcalQIECoder::mOffset12
private

Definition at line 46 of file HcalQIECoder.h.

◆ mOffset13

float HcalQIECoder::mOffset13
private

Definition at line 47 of file HcalQIECoder.h.

◆ mOffset20

float HcalQIECoder::mOffset20
private

Definition at line 48 of file HcalQIECoder.h.

◆ mOffset21

float HcalQIECoder::mOffset21
private

Definition at line 49 of file HcalQIECoder.h.

◆ mOffset22

float HcalQIECoder::mOffset22
private

Definition at line 50 of file HcalQIECoder.h.

◆ mOffset23

float HcalQIECoder::mOffset23
private

Definition at line 51 of file HcalQIECoder.h.

◆ mOffset30

float HcalQIECoder::mOffset30
private

Definition at line 52 of file HcalQIECoder.h.

◆ mOffset31

float HcalQIECoder::mOffset31
private

Definition at line 53 of file HcalQIECoder.h.

◆ mOffset32

float HcalQIECoder::mOffset32
private

Definition at line 54 of file HcalQIECoder.h.

◆ mOffset33

float HcalQIECoder::mOffset33
private

Definition at line 55 of file HcalQIECoder.h.

◆ mSlope00

float HcalQIECoder::mSlope00
private

Definition at line 56 of file HcalQIECoder.h.

Referenced by setSlope(), and slope().

◆ mSlope01

float HcalQIECoder::mSlope01
private

Definition at line 57 of file HcalQIECoder.h.

◆ mSlope02

float HcalQIECoder::mSlope02
private

Definition at line 58 of file HcalQIECoder.h.

◆ mSlope03

float HcalQIECoder::mSlope03
private

Definition at line 59 of file HcalQIECoder.h.

◆ mSlope10

float HcalQIECoder::mSlope10
private

Definition at line 60 of file HcalQIECoder.h.

◆ mSlope11

float HcalQIECoder::mSlope11
private

Definition at line 61 of file HcalQIECoder.h.

◆ mSlope12

float HcalQIECoder::mSlope12
private

Definition at line 62 of file HcalQIECoder.h.

◆ mSlope13

float HcalQIECoder::mSlope13
private

Definition at line 63 of file HcalQIECoder.h.

◆ mSlope20

float HcalQIECoder::mSlope20
private

Definition at line 64 of file HcalQIECoder.h.

◆ mSlope21

float HcalQIECoder::mSlope21
private

Definition at line 65 of file HcalQIECoder.h.

◆ mSlope22

float HcalQIECoder::mSlope22
private

Definition at line 66 of file HcalQIECoder.h.

◆ mSlope23

float HcalQIECoder::mSlope23
private

Definition at line 67 of file HcalQIECoder.h.

◆ mSlope30

float HcalQIECoder::mSlope30
private

Definition at line 68 of file HcalQIECoder.h.

◆ mSlope31

float HcalQIECoder::mSlope31
private

Definition at line 69 of file HcalQIECoder.h.

◆ mSlope32

float HcalQIECoder::mSlope32
private

Definition at line 70 of file HcalQIECoder.h.

◆ mSlope33

float HcalQIECoder::mSlope33
private

Definition at line 71 of file HcalQIECoder.h.