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

Definition at line 11 of file HcalQIEShape.cc.

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

Definition at line 16 of file HcalQIEShape.cc.

16 {}

Member Function Documentation

float HcalQIEShape::center ( unsigned  fAdc) const

Definition at line 38 of file HcalQIEShape.cc.

References mValues, and nbins_.

Referenced by HcalQIECoder::charge().

38  {
39  if (fAdc < 4*nbins_) {
40  if (fAdc % nbins_ == nbins_-1) return 0.5 * (3 * mValues [fAdc] - mValues [fAdc - 1]); // extrapolate
41  else 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
void HcalQIEShape::expand ( )
private

Definition at line 18 of file HcalQIEShape.cc.

References mps_fire::i, diffTreeTool::index, mValues, nbins_, muon::overlap(), range(), and Scenarios_cff::scale.

Referenced by nbins(), and 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  unsigned overlap = (nbins_ == 32) ? 2 : 3; // QIE10 -> 3 bin overlap
25  mValues [index] = mValues [index - overlap]; // link to previous range
26  for (unsigned i = 1; i < nbins_; i++) {
27  mValues [index + i] = mValues [index + i - 1] + scale * (mValues [i] - mValues [i - 1]);
28  }
29  }
30  mValues [nbins_*4] = 2 * mValues [nbins_*4-1] - mValues [nbins_*4-2]; // extrapolate
31 }
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39
unsigned range(unsigned fAdc) const
Definition: HcalQIEShape.h:25
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_) return mValues [fAdc+1];
48  return 0.;
49 }
unsigned int nbins_
Definition: HcalQIEShape.h:40
std::vector< float > mValues
Definition: HcalQIEShape.h:39
unsigned HcalQIEShape::local ( unsigned  fAdc) const
inline

Definition at line 29 of file HcalQIEShape.h.

References nbins_, and tmp.

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

Definition at line 33 of file HcalQIEShape.cc.

References mValues, and nbins_.

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

Definition at line 33 of file HcalQIEShape.h.

References expand(), nbins_, and setLowEdge().

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

33 { return nbins_; }
unsigned int nbins_
Definition: HcalQIEShape.h:40
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
bool HcalQIEShape::setLowEdge ( float  fValue,
unsigned  fAdc 
)
private

Definition at line 51 of file HcalQIEShape.cc.

References mValues, and nbins_.

Referenced by nbins(), and setLowEdges().

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

Definition at line 57 of file HcalQIEShape.cc.

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

Referenced by HcalQIEData::setupShape().

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

Member Data Documentation

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

Definition at line 39 of file HcalQIEShape.h.

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

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