ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LArAccumulatedCalibDigit Class Reference

Data class for calibration ADC samples preprocessed by the DSP. More...

#include <LArAccumulatedCalibDigit.h>

Collaboration diagram for LArAccumulatedCalibDigit:

Public Member Functions

 LArAccumulatedCalibDigit (HWIdentifier &channel_value, CaloGain::CaloGain gain_value, const std::vector< uint64_t > &sampleSum_value, const std::vector< uint64_t > &sample2Sum_value, uint32_t nTrigger_value, uint32_t DAC_value=0, uint16_t delay_value=0, uint16_t isPulsed_value=false, uint16_t nStep_value=0, uint16_t iStep_value=0)
 Constructor (initialize everything) More...
 
 LArAccumulatedCalibDigit (HWIdentifier &channel_value, CaloGain::CaloGain gain_value, uint32_t nsamples=7, uint32_t DAC_value=0, uint16_t delay_value=0, uint16_t isPulsed_value=false, uint16_t nStep_value=0, uint16_t iStep_value=0)
 Constructor (initialize for later accumulation) More...
 
virtual ~LArAccumulatedCalibDigit ()
 Destructor. More...
 
 LArAccumulatedCalibDigit ()
 default constructor for persistency More...
 
const HWIdentifierhardwareID () const
 Return HWIdentifier. More...
 
const HWIdentifierchannelID () const
 Return channel ID. More...
 
CaloGain::CaloGain gain () const
 return gain value More...
 
size_t nsamples () const
 return number of samples More...
 
const std::vector< uint64_t > & sampleSum () const
 return a reference to a stl vector containing the sample-sums More...
 
const std::vector< uint64_t > & sample2Sum () const
 return a reference to a stl vector containing the sum of the squares of the sample
More...
 
unsigned nTriggers () const
 return the number of triggers More...
 
int DAC () const
 return the number of samples More...
 
int delay () const
 return the setting of the delay More...
 
bool isPulsed () const
 Tell if this channel was pulsed. More...
 
bool isPulsed (int n) const
 Tell if calib line n was pulsed for this channel (n=1,2,3,4) More...
 
uint16_t getIsPulsedInt () const
 get the four bit int that tells which lines pulsed More...
 
std::vector< float > mean () const
 Calculates and returns the Mean value of each ADC sample. More...
 
std::vector< float > RMS () const
 Calculates and returns the RMS value of each ADC sample. More...
 
float mean (const size_t i) const
 Calculates and returns the Mean value for one ADC sample. More...
 
float RMS (const size_t i) const
 Calculates and returns the RMS value for one ADC sample. More...
 
uint16_t nSteps () const
 
uint16_t stepIndex () const
 
void setSampleSum (const std::vector< uint64_t > &sampleSum)
 Set the sampleSum. More...
 
void setSample2Sum (const std::vector< uint64_t > &sample2Sum)
 Set the sample2Sum. More...
 
bool setAddDigit (const std::vector< short > &samples)
 Sum up with another (individual) LArCalibDigit. More...
 
bool setAddSubStep (const std::vector< uint64_t > &sampleSum, const std::vector< uint64_t > &sample2Sum, const uint32_t nTriggerPerStep)
 Sum up with another substep. More...
 

Private Attributes

HWIdentifier m_hardwareID
 Online Identifier. More...
 
CaloGain::CaloGain m_gain
 gain More...
 
std::vector< uint64_t > m_sampleSum
 vector of sample sums More...
 
std::vector< uint64_t > m_sample2Sum
 vector of sample square sums More...
 
uint32_t m_nTriggers
 number of samples More...
 
uint32_t m_DAC
 DAC-Value. More...
 
uint16_t m_delayPulsed
 Delay-Value and isPulsed boolean encoded in this variable. More...
 
uint16_t m_nStep
 
uint16_t m_iStep
 

Detailed Description

Data class for calibration ADC samples preprocessed by the DSP.

Author
Sandrine Laplace
Isabelle Wingerter-Seez

Definition at line 42 of file LArAccumulatedCalibDigit.h.

Constructor & Destructor Documentation

◆ LArAccumulatedCalibDigit() [1/3]

LArAccumulatedCalibDigit::LArAccumulatedCalibDigit ( HWIdentifier channel_value,
CaloGain::CaloGain  gain_value,
const std::vector< uint64_t > &  sampleSum_value,
const std::vector< uint64_t > &  sample2Sum_value,
uint32_t  nTrigger_value,
uint32_t  DAC_value = 0,
uint16_t  delay_value = 0,
uint16_t  isPulsed_value = false,
uint16_t  nStep_value = 0,
uint16_t  iStep_value = 0 
)
inline

Constructor (initialize everything)

Definition at line 77 of file LArAccumulatedCalibDigit.h.

81  :
82  m_hardwareID(channel_value), m_gain(gain_value), m_sampleSum(sampleSum_value), m_sample2Sum(sample2Sum_value),
83  m_nTriggers(nTrigger_value), m_DAC(DAC_value),
84  m_delayPulsed((delay_value & 0xFFF) | (isPulsed_value<<12)),
85  m_nStep(nStep_value), m_iStep(iStep_value)
86  {};

◆ LArAccumulatedCalibDigit() [2/3]

LArAccumulatedCalibDigit::LArAccumulatedCalibDigit ( HWIdentifier channel_value,
CaloGain::CaloGain  gain_value,
uint32_t  nsamples = 7,
uint32_t  DAC_value = 0,
uint16_t  delay_value = 0,
uint16_t  isPulsed_value = false,
uint16_t  nStep_value = 0,
uint16_t  iStep_value = 0 
)
inline

Constructor (initialize for later accumulation)

Definition at line 89 of file LArAccumulatedCalibDigit.h.

91  :
92  m_hardwareID(channel_value), m_gain(gain_value),
93  m_nTriggers(0), m_DAC(DAC_value),
94  m_delayPulsed((delay_value & 0xFFF) | (isPulsed_value<<12)),
95  m_nStep(nStep_value), m_iStep(iStep_value)
96  {
97  m_sampleSum.resize(nsamples);
98  m_sample2Sum.resize(nsamples);
99  };

◆ ~LArAccumulatedCalibDigit()

LArAccumulatedCalibDigit::~LArAccumulatedCalibDigit ( )
virtualdefault

Destructor.

◆ LArAccumulatedCalibDigit() [3/3]

LArAccumulatedCalibDigit::LArAccumulatedCalibDigit ( )
inline

default constructor for persistency

Definition at line 105 of file LArAccumulatedCalibDigit.h.

105  :
107  m_DAC(0), m_delayPulsed(0), m_nStep(0), m_iStep(0)
108  {};

Member Function Documentation

◆ channelID()

const HWIdentifier& LArAccumulatedCalibDigit::channelID ( ) const
inline

Return channel ID.

Definition at line 114 of file LArAccumulatedCalibDigit.h.

114 { return m_hardwareID; }

◆ DAC()

int LArAccumulatedCalibDigit::DAC ( ) const
inline

return the number of samples

return the setting of the DAC

Definition at line 135 of file LArAccumulatedCalibDigit.h.

135 {return static_cast<int>(m_DAC);}

◆ delay()

int LArAccumulatedCalibDigit::delay ( ) const
inline

return the setting of the delay

Definition at line 138 of file LArAccumulatedCalibDigit.h.

138 {return static_cast<int>(m_delayPulsed & 0xFFF);}

◆ gain()

CaloGain::CaloGain LArAccumulatedCalibDigit::gain ( ) const
inline

return gain value

Definition at line 117 of file LArAccumulatedCalibDigit.h.

117 { return m_gain; }

◆ getIsPulsedInt()

uint16_t LArAccumulatedCalibDigit::getIsPulsedInt ( ) const
inline

get the four bit int that tells which lines pulsed

Definition at line 153 of file LArAccumulatedCalibDigit.h.

153 { return (m_delayPulsed >> 12);}

◆ hardwareID()

const HWIdentifier& LArAccumulatedCalibDigit::hardwareID ( ) const
inline

Return HWIdentifier.

Definition at line 111 of file LArAccumulatedCalibDigit.h.

111 {return m_hardwareID; }

◆ isPulsed() [1/2]

bool LArAccumulatedCalibDigit::isPulsed ( ) const
inline

Tell if this channel was pulsed.

Definition at line 141 of file LArAccumulatedCalibDigit.h.

141 {return static_cast<bool>(m_delayPulsed & 0xF000);}

◆ isPulsed() [2/2]

bool LArAccumulatedCalibDigit::isPulsed ( int  n) const
inline

Tell if calib line n was pulsed for this channel (n=1,2,3,4)

Definition at line 144 of file LArAccumulatedCalibDigit.h.

144  {
145  if(n==1) return static_cast<bool>(m_delayPulsed & 0x1000);
146  if(n==2) return static_cast<bool>(m_delayPulsed & 0x2000);
147  if(n==3) return static_cast<bool>(m_delayPulsed & 0x4000);
148  if(n==4) return static_cast<bool>(m_delayPulsed & 0x8000);
149  return false;//WRITE ERROR MESSAGE
150  }

◆ mean() [1/2]

std::vector< float > LArAccumulatedCalibDigit::mean ( ) const

Calculates and returns the Mean value of each ADC sample.

Definition at line 36 of file LArAccumulatedCalibDigit.cxx.

36  {
37 
38  const size_t nS=m_sampleSum.size();
39  std::vector<float> mean;
40  if (m_nTriggers==0)
41  return mean;
42  else {
43  mean.resize(nS,0.0);
44  for (size_t i=0;i<nS;++i)
45  mean[i]=((double)m_sampleSum[i])/((double)m_nTriggers);
46  return mean;
47  }
48 }

◆ mean() [2/2]

float LArAccumulatedCalibDigit::mean ( const size_t  i) const

Calculates and returns the Mean value for one ADC sample.

Definition at line 15 of file LArAccumulatedCalibDigit.cxx.

15  {
16 
17  if (i<m_sampleSum.size() && i<m_sample2Sum.size() && m_nTriggers>0)
18  return ((double)m_sampleSum[i])/((double)m_nTriggers);
19  else
20  return 0.0;
21 }

◆ nsamples()

size_t LArAccumulatedCalibDigit::nsamples ( ) const
inline

return number of samples

Definition at line 120 of file LArAccumulatedCalibDigit.h.

120 { return m_sampleSum.size(); }

◆ nSteps()

uint16_t LArAccumulatedCalibDigit::nSteps ( ) const
inline

Definition at line 168 of file LArAccumulatedCalibDigit.h.

168 { return m_nStep;}

◆ nTriggers()

unsigned LArAccumulatedCalibDigit::nTriggers ( ) const
inline

return the number of triggers

Definition at line 129 of file LArAccumulatedCalibDigit.h.

129 {return m_nTriggers;}

◆ RMS() [1/2]

std::vector< float > LArAccumulatedCalibDigit::RMS ( ) const

Calculates and returns the RMS value of each ADC sample.

Definition at line 50 of file LArAccumulatedCalibDigit.cxx.

50  {
51  std::vector<float> rms;
52  const size_t nS=m_sampleSum.size();
53  if (m_sample2Sum.size()!=nS || m_nTriggers==0)
54  return rms;// ERROR, return emtpy vector
55 
56  double mean=0;
57  double rms2=0;
58  rms.resize(nS,0.0);
59 
60  for (size_t i=0;i<nS;++i) {
63  if (rms2<=0.0) //W.L 2010-12-07 protect against FPE due to rounding error
64  rms[i]=0.0;
65  else
66  rms[i]=sqrt(rms2);
67  }
68  return rms;
69 }

◆ RMS() [2/2]

float LArAccumulatedCalibDigit::RMS ( const size_t  i) const

Calculates and returns the RMS value for one ADC sample.

Definition at line 23 of file LArAccumulatedCalibDigit.cxx.

23  {
24 
25  if (i<m_sampleSum.size() && i<m_sample2Sum.size() && m_nTriggers>0) {
26  const double mean=((double)m_sampleSum[i])/((double)m_nTriggers);
27  const double rms2=((double)m_sample2Sum[i])/((double)m_nTriggers)-mean*mean;
28  if (rms2<=0.0) return 0.0; //W.L 2010-12-07 protect against FPE due to rounding error
29  return sqrt(rms2);
30  }
31  else
32  return 0.0;
33 }

◆ sample2Sum()

const std::vector< uint64_t >& LArAccumulatedCalibDigit::sample2Sum ( ) const
inline

return a reference to a stl vector containing the sum of the squares of the sample

Definition at line 126 of file LArAccumulatedCalibDigit.h.

126 { return m_sample2Sum; }

◆ sampleSum()

const std::vector< uint64_t >& LArAccumulatedCalibDigit::sampleSum ( ) const
inline

return a reference to a stl vector containing the sample-sums

Definition at line 123 of file LArAccumulatedCalibDigit.h.

123 { return m_sampleSum; }

◆ setAddDigit()

bool LArAccumulatedCalibDigit::setAddDigit ( const std::vector< short > &  samples)

Sum up with another (individual) LArCalibDigit.

Definition at line 82 of file LArAccumulatedCalibDigit.cxx.

82  {
83  const size_t nS=samples.size();
84  if (m_sampleSum.empty() && m_sample2Sum.empty()) {
85  m_sampleSum.resize(nS,0);
86  m_sample2Sum.resize(nS,0);
87  }
88  else
89  if (m_sampleSum.size() != nS || m_sample2Sum.size() != nS) {
90  return false; //ERROR, number of samples doesn't match!
91  }
92 
93  for(size_t i=0;i<nS;++i) {
94  const uint64_t s2=samples[i]*samples[i];
96  return false; //ERROR, overflow!
97  }
99  return false; //ERROR, overflow!
100  }
101 
102  m_sampleSum[i]+=samples[i];
103  m_sample2Sum[i]+=s2;
104  ++m_nTriggers;
105  }
106  return true;
107 }

◆ setAddSubStep()

bool LArAccumulatedCalibDigit::setAddSubStep ( const std::vector< uint64_t > &  sampleSum,
const std::vector< uint64_t > &  sample2Sum,
const uint32_t  nTriggerPerStep 
)

Sum up with another substep.

Definition at line 112 of file LArAccumulatedCalibDigit.cxx.

113  {
114 
115 
116  const size_t nS=sampleSum.size();
117 
118  if (m_sampleSum.empty() && m_sample2Sum.empty()) {
119  m_sampleSum.resize(nS,0);
120  m_sample2Sum.resize(nS,0);
121  }
122  else
123  if (m_sampleSum.size() != nS || m_sample2Sum.size() != nS || sample2Sum.size() != nS) {
124  return false; //ERROR, number of samples doesn't match!
125  }
126 
127  for(size_t is=0; is<nS; is++) {
129  return false; //ERROR, overflow!
130  }
132  return false; //ERROR, overflow!
133  }
134 
135  m_sampleSum[is] += sampleSum[is];
136  m_sample2Sum[is] += sample2Sum[is];
137  }
138 
139  m_nTriggers += nTriggerPerStep;
140  return true;
141 }

◆ setSample2Sum()

void LArAccumulatedCalibDigit::setSample2Sum ( const std::vector< uint64_t > &  sample2Sum)

Set the sample2Sum.

Definition at line 77 of file LArAccumulatedCalibDigit.cxx.

77  {
79 }

◆ setSampleSum()

void LArAccumulatedCalibDigit::setSampleSum ( const std::vector< uint64_t > &  sampleSum)

Set the sampleSum.

Definition at line 73 of file LArAccumulatedCalibDigit.cxx.

73  {
75 }

◆ stepIndex()

uint16_t LArAccumulatedCalibDigit::stepIndex ( ) const
inline

Definition at line 170 of file LArAccumulatedCalibDigit.h.

170 {return m_iStep;}

Member Data Documentation

◆ m_DAC

uint32_t LArAccumulatedCalibDigit::m_DAC
private

DAC-Value.

Definition at line 65 of file LArAccumulatedCalibDigit.h.

◆ m_delayPulsed

uint16_t LArAccumulatedCalibDigit::m_delayPulsed
private

Delay-Value and isPulsed boolean encoded in this variable.

Definition at line 68 of file LArAccumulatedCalibDigit.h.

◆ m_gain

CaloGain::CaloGain LArAccumulatedCalibDigit::m_gain
private

gain

Definition at line 50 of file LArAccumulatedCalibDigit.h.

◆ m_hardwareID

HWIdentifier LArAccumulatedCalibDigit::m_hardwareID
private

Online Identifier.

Definition at line 47 of file LArAccumulatedCalibDigit.h.

◆ m_iStep

uint16_t LArAccumulatedCalibDigit::m_iStep
private

Definition at line 72 of file LArAccumulatedCalibDigit.h.

◆ m_nStep

uint16_t LArAccumulatedCalibDigit::m_nStep
private

Definition at line 70 of file LArAccumulatedCalibDigit.h.

◆ m_nTriggers

uint32_t LArAccumulatedCalibDigit::m_nTriggers
private

number of samples

number of trigger step

Definition at line 62 of file LArAccumulatedCalibDigit.h.

◆ m_sample2Sum

std::vector< uint64_t > LArAccumulatedCalibDigit::m_sample2Sum
private

vector of sample square sums

Definition at line 56 of file LArAccumulatedCalibDigit.h.

◆ m_sampleSum

std::vector< uint64_t > LArAccumulatedCalibDigit::m_sampleSum
private

vector of sample sums

Definition at line 53 of file LArAccumulatedCalibDigit.h.


The documentation for this class was generated from the following files:
LArAccumulatedCalibDigit::m_sample2Sum
std::vector< uint64_t > m_sample2Sum
vector of sample square sums
Definition: LArAccumulatedCalibDigit.h:56
LArAccumulatedCalibDigit::m_sampleSum
std::vector< uint64_t > m_sampleSum
vector of sample sums
Definition: LArAccumulatedCalibDigit.h:53
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
LArAccumulatedCalibDigit::nsamples
size_t nsamples() const
return number of samples
Definition: LArAccumulatedCalibDigit.h:120
LArAccumulatedCalibDigit::sampleSum
const std::vector< uint64_t > & sampleSum() const
return a reference to a stl vector containing the sample-sums
Definition: LArAccumulatedCalibDigit.h:123
LArAccumulatedCalibDigit::m_DAC
uint32_t m_DAC
DAC-Value.
Definition: LArAccumulatedCalibDigit.h:65
CaloGain::LARNGAIN
@ LARNGAIN
Definition: CaloGain.h:19
LArAccumulatedCalibDigit::m_iStep
uint16_t m_iStep
Definition: LArAccumulatedCalibDigit.h:72
LArAccumulatedCalibDigit::m_nStep
uint16_t m_nStep
Definition: LArAccumulatedCalibDigit.h:70
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
LArAccumulatedCalibDigit::m_nTriggers
uint32_t m_nTriggers
number of samples
Definition: LArAccumulatedCalibDigit.h:62
LArAccumulatedCalibDigit::m_delayPulsed
uint16_t m_delayPulsed
Delay-Value and isPulsed boolean encoded in this variable.
Definition: LArAccumulatedCalibDigit.h:68
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
LArAccumulatedCalibDigit::m_gain
CaloGain::CaloGain m_gain
gain
Definition: LArAccumulatedCalibDigit.h:50
LArAccumulatedCalibDigit::mean
std::vector< float > mean() const
Calculates and returns the Mean value of each ADC sample.
Definition: LArAccumulatedCalibDigit.cxx:36
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1266
LArAccumulatedCalibDigit::sample2Sum
const std::vector< uint64_t > & sample2Sum() const
return a reference to a stl vector containing the sum of the squares of the sample
Definition: LArAccumulatedCalibDigit.h:126
LArAccumulatedCalibDigit::m_hardwareID
HWIdentifier m_hardwareID
Online Identifier.
Definition: LArAccumulatedCalibDigit.h:47