CMS 3D CMS Logo

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

#include <HcalQIEShape.h>

Public Member Functions

float center (unsigned fAdc) const
 
 HcalQIEShape ()
 
float highEdge (unsigned fAdc) const
 
unsigned local (unsigned fAdc) const
 
float lowEdge (unsigned fAdc) const
 
unsigned nbins () const
 
unsigned range (unsigned fAdc) const
 
bool setLowEdges (unsigned int nVals, const float *fValue)
 
 ~HcalQIEShape ()
 

Private Member Functions

void expand ()
 
bool setLowEdge (float fValue, unsigned fAdc)
 

Private Attributes

std::vector< float > mValues
 
unsigned int nbins_
 

Detailed Description

Definition at line 17 of file HcalQIEShape.h.

Constructor & Destructor Documentation

◆ HcalQIEShape()

HcalQIEShape::HcalQIEShape ( )

Definition at line 11 of file HcalQIEShape.cc.

11 : nbins_(0) {}

◆ ~HcalQIEShape()

HcalQIEShape::~HcalQIEShape ( )

Definition at line 13 of file HcalQIEShape.cc.

13 {}

Member Function Documentation

◆ center()

float HcalQIEShape::center ( unsigned  fAdc) const

Definition at line 36 of file HcalQIEShape.cc.

36  {
37  if (fAdc < 4 * nbins_) {
38  if (fAdc % nbins_ == nbins_ - 1)
39  return 0.5 * (3 * mValues[fAdc] - mValues[fAdc - 1]); // extrapolate
40  else
41  return 0.5 * (mValues[fAdc] + mValues[fAdc + 1]); // interpolate
42  }
43  return 0.;
44 }

References mValues, and nbins_.

Referenced by HcalQIECoder::charge().

◆ expand()

void HcalQIEShape::expand ( )
private

Definition at line 15 of file HcalQIEShape.cc.

15  {
16  int scale = 1;
17  for (unsigned range = 1; range < 4; range++) {
18  int factor = nbins_ == 32 ? 5 : 8; // QIE8/QIE10 -> 5/8
19  scale *= factor;
20  unsigned index = range * nbins_;
21  unsigned overlap = (nbins_ == 32) ? 2 : 3; // QIE10 -> 3 bin overlap
22  mValues[index] = mValues[index - overlap]; // link to previous range
23  for (unsigned i = 1; i < nbins_; i++) {
24  mValues[index + i] = mValues[index + i - 1] + scale * (mValues[i] - mValues[i - 1]);
25  }
26  }
27  mValues[nbins_ * 4] = 2 * mValues[nbins_ * 4 - 1] - mValues[nbins_ * 4 - 2]; // extrapolate
28 }

References DQMScaleToClient_cfi::factor, mps_fire::i, mValues, nbins_, goodZToMuMu_cfi::overlap, range(), and Scenarios_cff::scale.

Referenced by setLowEdges().

◆ highEdge()

float HcalQIEShape::highEdge ( unsigned  fAdc) const

Definition at line 46 of file HcalQIEShape.cc.

46  {
47  if (fAdc < 4 * nbins_)
48  return mValues[fAdc + 1];
49  return 0.;
50 }

References mValues, and nbins_.

Referenced by HcalQIECoder::adc().

◆ local()

unsigned HcalQIEShape::local ( unsigned  fAdc) const
inline

Definition at line 29 of file HcalQIEShape.h.

29  {
30  unsigned tmp = nbins_ == 32 ? (fAdc & 0x1f) : (fAdc & 0x3f);
31  return tmp;
32  }

References nbins_, and createJobs::tmp.

◆ lowEdge()

float HcalQIEShape::lowEdge ( unsigned  fAdc) const

Definition at line 30 of file HcalQIEShape.cc.

30  {
31  if (fAdc < 4 * nbins_)
32  return mValues[fAdc];
33  return 0.;
34 }

References mValues, and nbins_.

◆ nbins()

unsigned HcalQIEShape::nbins ( ) const
inline

Definition at line 33 of file HcalQIEShape.h.

33 { return nbins_; }

References nbins_.

Referenced by HcalQIECoder::adc(), and setLowEdges().

◆ range()

unsigned HcalQIEShape::range ( unsigned  fAdc) const
inline

Definition at line 25 of file HcalQIEShape.h.

25  {
26  //6 bit mantissa in QIE10, 5 in QIE8
27  return (nbins_ == 32) ? (fAdc >> 5) & 0x3 : (fAdc >> 6) & 0x3;
28  }

References nbins_.

Referenced by HcalQIECoder::charge(), and expand().

◆ setLowEdge()

bool HcalQIEShape::setLowEdge ( float  fValue,
unsigned  fAdc 
)
private

Definition at line 52 of file HcalQIEShape.cc.

52  {
53  if (fAdc >= nbins_)
54  return false;
55  mValues[fAdc] = fValue;
56  return true;
57 }

References mValues, and nbins_.

Referenced by setLowEdges().

◆ setLowEdges()

bool HcalQIEShape::setLowEdges ( unsigned int  nVals,
const float *  fValue 
)

Definition at line 59 of file HcalQIEShape.cc.

59  {
60  nbins_ = nbins;
61  mValues.clear();
62  mValues.resize(4 * nbins_ + 1);
63  bool result = true;
64  for (unsigned int adc = 0; adc < nbins_; adc++)
65  result = result && setLowEdge(fValue[adc], adc);
66  expand();
67  return result;
68 }

References ecalMGPA::adc(), expand(), mValues, nbins(), nbins_, mps_fire::result, and setLowEdge().

Referenced by HcalQIEData::setupShape().

Member Data Documentation

◆ mValues

std::vector<float> HcalQIEShape::mValues
private

Definition at line 39 of file HcalQIEShape.h.

Referenced by center(), expand(), highEdge(), lowEdge(), setLowEdge(), and setLowEdges().

◆ nbins_

unsigned int HcalQIEShape::nbins_
private

Definition at line 40 of file HcalQIEShape.h.

Referenced by center(), expand(), highEdge(), local(), lowEdge(), nbins(), range(), setLowEdge(), and setLowEdges().

ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalMGPASample.h:11
mps_fire.i
i
Definition: mps_fire.py:355
HcalQIEShape::setLowEdge
bool setLowEdge(float fValue, unsigned fAdc)
Definition: HcalQIEShape.cc:52
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
HcalQIEShape::mValues
std::vector< float > mValues
Definition: HcalQIEShape.h:39
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
HcalQIEShape::nbins_
unsigned int nbins_
Definition: HcalQIEShape.h:40
HcalQIEShape::expand
void expand()
Definition: HcalQIEShape.cc:15
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
HcalQIEShape::nbins
unsigned nbins() const
Definition: HcalQIEShape.h:33
goodZToMuMu_cfi.overlap
overlap
Definition: goodZToMuMu_cfi.py:108
HcalQIEShape::range
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:303