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) {}
unsigned int nbins_
Definition: HcalQIEShape.h:40

◆ ~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.

References mValues, and nbins_.

Referenced by HcalQIECoder::charge().

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 }
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39

◆ expand()

void HcalQIEShape::expand ( )
private

Definition at line 15 of file HcalQIEShape.cc.

References mps_fire::i, mValues, nbins_, hltL1SingleMuFiltered5_cfi::overlap, range(), and l1tEGammaCrystalsEmulatorProducer_cfi::scale.

Referenced by setLowEdges().

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 }
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39

◆ highEdge()

float HcalQIEShape::highEdge ( unsigned  fAdc) const

Definition at line 46 of file HcalQIEShape.cc.

References mValues, and nbins_.

Referenced by HcalQIECoder::adc().

46  {
47  if (fAdc < 4 * nbins_)
48  return mValues[fAdc + 1];
49  return 0.;
50 }
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39

◆ local()

unsigned HcalQIEShape::local ( unsigned  fAdc) const
inline

Definition at line 29 of file HcalQIEShape.h.

References nbins_, and createJobs::tmp.

29  {
30  unsigned tmp = nbins_ == 32 ? (fAdc & 0x1f) : (fAdc & 0x3f);
31  return tmp;
32  }
unsigned int nbins_
Definition: HcalQIEShape.h:40
tmp
align.sh
Definition: createJobs.py:716

◆ lowEdge()

float HcalQIEShape::lowEdge ( unsigned  fAdc) const

Definition at line 30 of file HcalQIEShape.cc.

References mValues, and nbins_.

30  {
31  if (fAdc < 4 * nbins_)
32  return mValues[fAdc];
33  return 0.;
34 }
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39

◆ nbins()

unsigned HcalQIEShape::nbins ( ) const
inline

Definition at line 33 of file HcalQIEShape.h.

References nbins_.

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

33 { return nbins_; }
unsigned int nbins_
Definition: HcalQIEShape.h:40

◆ range()

unsigned HcalQIEShape::range ( unsigned  fAdc) const
inline

Definition at line 25 of file HcalQIEShape.h.

References nbins_.

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

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

◆ setLowEdge()

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

Definition at line 52 of file HcalQIEShape.cc.

References mValues, and nbins_.

Referenced by setLowEdges().

52  {
53  if (fAdc >= nbins_)
54  return false;
55  mValues[fAdc] = fValue;
56  return true;
57 }
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39

◆ setLowEdges()

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

Definition at line 59 of file HcalQIEShape.cc.

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

Referenced by HcalQIEData::setupShape().

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 }
bool setLowEdge(float fValue, unsigned fAdc)
Definition: HcalQIEShape.cc:52
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39
unsigned nbins() const
Definition: HcalQIEShape.h:33
uint16_t *__restrict__ uint16_t const *__restrict__ adc

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