CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 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 ( )

Definition at line 11 of file HcalQIEShape.cc.

12  :nbins_(0)
13 {
14 }
unsigned int nbins_
Definition: HcalQIEShape.h:36
HcalQIEShape::~HcalQIEShape ( )

Definition at line 16 of file HcalQIEShape.cc.

16 {}

Member Function Documentation

float HcalQIEShape::center ( unsigned  fAdc) const

Definition at line 37 of file HcalQIEShape.cc.

References mValues, and nbins_.

Referenced by HcalQIECoder::charge().

37  {
38  if (fAdc < 4*nbins_) {
39  if (fAdc % nbins_ == nbins_-1) return 0.5 * (3 * mValues [fAdc] - mValues [fAdc - 1]); // extrapolate
40  else return 0.5 * (mValues [fAdc] + mValues [fAdc + 1]); // interpolate
41  }
42  return 0.;
43 }
unsigned int nbins_
Definition: HcalQIEShape.h:36
std::vector< float > mValues
Definition: HcalQIEShape.h:35
void HcalQIEShape::expand ( )
private

Definition at line 18 of file HcalQIEShape.cc.

References i, cmsHarvester::index, mValues, nbins_, range(), and pileupReCalc_HLTpaths::scale.

Referenced by setLowEdges().

18  {
19  int scale = 1;
20  for (unsigned range = 1; range < 4; range++) {
21  int factor = nbins_ == 32 ? 5 : 8; // QIE8/QIE10 -> 5/8
22  scale *= factor;
23  unsigned index = range * nbins_;
24  mValues [index] = mValues [index - 2]; // link to previous range
25  for (unsigned i = 1; i < nbins_; i++) {
26  mValues [index + i] = mValues [index + i - 1] + scale * (mValues [i] - mValues [i - 1]);
27  }
28  }
29  mValues [nbins_*4] = 2 * mValues [nbins_*4-1] - mValues [nbins_*4-2]; // extrapolate
30 }
int i
Definition: DBlmapReader.cc:9
unsigned int nbins_
Definition: HcalQIEShape.h:36
std::vector< float > mValues
Definition: HcalQIEShape.h:35
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
float HcalQIEShape::highEdge ( unsigned  fAdc) const

Definition at line 45 of file HcalQIEShape.cc.

References mValues, and nbins_.

Referenced by HcalQIECoder::adc().

45  {
46  if (fAdc < 4*nbins_) return mValues [fAdc+1];
47  return 0.;
48 }
unsigned int nbins_
Definition: HcalQIEShape.h:36
std::vector< float > mValues
Definition: HcalQIEShape.h:35
unsigned HcalQIEShape::local ( unsigned  fAdc) const
inline

Definition at line 26 of file HcalQIEShape.h.

References nbins_, and tmp.

26  {
27  unsigned tmp = nbins_ == 32 ? (fAdc & 0x1f) : (fAdc & 0x3f) ;
28  return tmp;
29  }
unsigned int nbins_
Definition: HcalQIEShape.h:36
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
float HcalQIEShape::lowEdge ( unsigned  fAdc) const

Definition at line 32 of file HcalQIEShape.cc.

References mValues, and nbins_.

32  {
33  if (fAdc < 4*nbins_) return mValues [fAdc];
34  return 0.;
35 }
unsigned int nbins_
Definition: HcalQIEShape.h:36
std::vector< float > mValues
Definition: HcalQIEShape.h:35
unsigned HcalQIEShape::range ( unsigned  fAdc) const
inline

Definition at line 25 of file HcalQIEShape.h.

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

25 {return (fAdc >> 5) & 0x3;}
bool HcalQIEShape::setLowEdge ( float  fValue,
unsigned  fAdc 
)
private

Definition at line 50 of file HcalQIEShape.cc.

References mValues, and nbins_.

Referenced by setLowEdges().

50  {
51  if (fAdc >= nbins_) return false;
52  mValues [fAdc] = fValue;
53  return true;
54 }
unsigned int nbins_
Definition: HcalQIEShape.h:36
std::vector< float > mValues
Definition: HcalQIEShape.h:35
bool HcalQIEShape::setLowEdges ( unsigned int  nVals,
const float *  fValue 
)

Definition at line 56 of file HcalQIEShape.cc.

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

Referenced by HcalQIEData::setupShape().

56  {
57  nbins_=nbins;
58  mValues.clear();
59  mValues.resize(4*nbins_+1);
60  bool result = true;
61  for (unsigned int adc = 0; adc < nbins_; adc++) result = result && setLowEdge (fValue [adc], adc);
62  expand ();
63  return result;
64 }
int adc(sample_type sample)
get the ADC sample (12 bits)
bool setLowEdge(float fValue, unsigned fAdc)
Definition: HcalQIEShape.cc:50
tuple result
Definition: query.py:137
unsigned int nbins_
Definition: HcalQIEShape.h:36
std::vector< float > mValues
Definition: HcalQIEShape.h:35

Member Data Documentation

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

Definition at line 35 of file HcalQIEShape.h.

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

unsigned int HcalQIEShape::nbins_
private

Definition at line 36 of file HcalQIEShape.h.

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