CMS 3D CMS Logo

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

#include <CastorQIEShape.h>

Public Member Functions

 CastorQIEShape ()
 
float center (unsigned fAdc) const
 
float highEdge (unsigned fAdc) const
 
unsigned local (unsigned fAdc) const
 
float lowEdge (unsigned fAdc) const
 
unsigned range (unsigned fAdc) const
 
bool setLowEdges (const float fValue[32])
 
 ~CastorQIEShape ()
 

Private Member Functions

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

Private Attributes

float mValues [129]
 

Detailed Description

Definition at line 14 of file CastorQIEShape.h.

Constructor & Destructor Documentation

CastorQIEShape::CastorQIEShape ( )

Definition at line 15 of file CastorQIEShape.cc.

References expand(), mps_fire::i, and mValues.

16 {
17  for (int i = 0; i < 32; i++) mValues [i] = binMin [i];
18  expand ();
19 }
float mValues[129]
CastorQIEShape::~CastorQIEShape ( )

Definition at line 21 of file CastorQIEShape.cc.

21 {}

Member Function Documentation

float CastorQIEShape::center ( unsigned  fAdc) const

Definition at line 41 of file CastorQIEShape.cc.

References mValues.

Referenced by CastorQIECoder::charge().

41  {
42  if (fAdc < 128) {
43  if (fAdc % 32 == 31) return 0.5 * (3 * mValues [fAdc] - mValues [fAdc - 1]); // extrapolate
44  else return 0.5 * (mValues [fAdc] + mValues [fAdc + 1]); // interpolate
45  }
46  return 0.;
47 }
float mValues[129]
void CastorQIEShape::expand ( )
private

Definition at line 23 of file CastorQIEShape.cc.

References mps_fire::i, mValues, range(), and Scenarios_cff::scale.

Referenced by CastorQIEShape(), local(), and setLowEdges().

23  {
24  int scale = 1;
25  for (unsigned range = 1; range < 4; range++) {
26  scale = scale * 5;
27  unsigned index = range * 32;
28  mValues [index] = mValues [index - 2]; // link to previous range
29  for (unsigned i = 1; i < 32; i++) {
30  mValues [index + i] = mValues [index + i - 1] + scale * (mValues [i] - mValues [i - 1]);
31  }
32  }
33  mValues [128] = 2 * mValues [127] - mValues [126]; // extrapolate
34 }
unsigned range(unsigned fAdc) const
float mValues[129]
float CastorQIEShape::highEdge ( unsigned  fAdc) const

Definition at line 49 of file CastorQIEShape.cc.

References mValues.

Referenced by CastorQIECoder::adc().

49  {
50  if (fAdc >= 128 ) return 0;
51  if (fAdc == 127 ) return mValues [fAdc+1];
52  if (fAdc % 32 == 31) return mValues [fAdc+3];
53  return mValues [fAdc+1];
54 }
float mValues[129]
unsigned CastorQIEShape::local ( unsigned  fAdc) const
inline

Definition at line 23 of file CastorQIEShape.h.

References expand(), and setLowEdge().

23 {return fAdc & 0x1f;}
float CastorQIEShape::lowEdge ( unsigned  fAdc) const

Definition at line 36 of file CastorQIEShape.cc.

References mValues.

Referenced by CastorDbASCIIIO::dumpObject().

36  {
37  if (fAdc < 128) return mValues [fAdc];
38  return 0.;
39 }
float mValues[129]
unsigned CastorQIEShape::range ( unsigned  fAdc) const
inline

Definition at line 22 of file CastorQIEShape.h.

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

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

Definition at line 56 of file CastorQIEShape.cc.

References mValues.

Referenced by local(), and setLowEdges().

56  {
57  if (fAdc >= 32) return false;
58  mValues [fAdc] = fValue;
59  return true;
60 }
float mValues[129]
bool CastorQIEShape::setLowEdges ( const float  fValue[32])

Definition at line 62 of file CastorQIEShape.cc.

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

62  {
63  bool result = true;
64  for (int adc = 0; adc < 32; adc++) result = result && setLowEdge (fValue [adc], adc);
65  expand ();
66  return result;
67 }
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
bool setLowEdge(float fValue, unsigned fAdc)

Member Data Documentation

float CastorQIEShape::mValues[129]
private

Definition at line 28 of file CastorQIEShape.h.

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