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

#include <LArPedestal.h>

Collaboration diagram for LArPedestal:

Public Member Functions

 LArPedestal ()
 
 ~LArPedestal ()
 
void zero ()
 
void set_min (const short min)
 
void set_max (const short max)
 
int get_nentries () const
 
double get_sum () const
 
double get_sum (const unsigned isample) const
 
double get_mean () const
 
double get_mean (const unsigned isample) const
 
double get_mean (const unsigned isample_min, const unsigned isample_max) const
 
double get_rms () const
 
double get_rms (const unsigned isample) const
 
double get_rms (const unsigned isample_min, const unsigned isample_max) const
 
unsigned get_nsamples () const
 
const short & get_min () const
 
const short & get_max () const
 
void add (const std::vector< short > &samples)
 
 LArPedestal ()
 
 ~LArPedestal ()
 
void zero ()
 
void set_min (const short min)
 
void set_max (const short max)
 
int get_nentries () const
 
double get_sum () const
 
double get_sum (const unsigned isample) const
 
double get_mean () const
 
double get_mean (const unsigned isample) const
 
double get_mean (const unsigned isample_min, const unsigned isample_max) const
 
double get_rms () const
 
double get_rms (const unsigned isample) const
 
double get_rms (const unsigned isample_min, const unsigned isample_max) const
 
unsigned get_nsamples () const
 
const short & get_min () const
 
const short & get_max () const
 
void add (const std::vector< short > &samples)
 

Private Attributes

short m_min
 
short m_max
 
std::vector< uint32_t > m_sum
 
std::vector< uint64_t > m_sumSquares
 
uint32_t m_nped
 

Detailed Description

Definition at line 26 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

Constructor & Destructor Documentation

◆ LArPedestal() [1/2]

LArPedestal::LArPedestal ( )

Definition at line 23 of file LArCalibUtils/src/LArPedestal.cxx.

25 {
26  m_min = -1;
27  m_max = -1;
28  m_nped = 0;
29 }

◆ ~LArPedestal() [1/2]

LArPedestal::~LArPedestal ( )
default

◆ LArPedestal() [2/2]

LArPedestal::LArPedestal ( )

◆ ~LArPedestal() [2/2]

LArPedestal::~LArPedestal ( )

Member Function Documentation

◆ add() [1/2]

void LArPedestal::add ( const std::vector< short > &  samples)

Definition at line 170 of file LArCalibUtils/src/LArPedestal.cxx.

172 {
173  const size_t nsamples = samples.size();
174 
175  if(m_sum.size()<nsamples) {
176  m_sum.resize(nsamples);
177  m_sumSquares.resize(nsamples);
178  }
179 
180  for(size_t i=0; i<nsamples; i++) {
181  m_sum[i] += samples[i];
182  m_sumSquares[i] += (samples[i]*samples[i]);
183  }
184  m_nped++;
185 }

◆ add() [2/2]

void LArPedestal::add ( const std::vector< short > &  samples)

◆ get_max() [1/2]

const short& LArPedestal::get_max ( ) const
inline

Definition at line 93 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

◆ get_max() [2/2]

const short& LArPedestal::get_max ( ) const
inline

Definition at line 95 of file LArRawEvent/LArRawEvent/LArPedestal.h.

◆ get_mean() [1/6]

double LArPedestal::get_mean ( ) const

◆ get_mean() [2/6]

double LArPedestal::get_mean ( ) const

Definition at line 102 of file LArCalibUtils/src/LArPedestal.cxx.

104 {
105  const int nsamples = m_sum.size();
106  if (nsamples==0 || m_nped==0) return 0;
107  uint32_t imean = 0;
108  for(int i=0; i<nsamples; i++)
109  imean += m_sum[i];
110 
111  return double(imean)/(nsamples*m_nped);
112 
113 
114 }

◆ get_mean() [3/6]

double LArPedestal::get_mean ( const unsigned  isample) const

Definition at line 89 of file LArCalibUtils/src/LArPedestal.cxx.

91 {
92  if (isample>=m_sum.size() || m_nped==0)
93  return 0;
94  double mean = 0;
95  mean = m_sum[isample];
96  mean /= ((double) m_nped);
97 
98  return mean;
99 }

◆ get_mean() [4/6]

double LArPedestal::get_mean ( const unsigned  isample) const

◆ get_mean() [5/6]

double LArPedestal::get_mean ( const unsigned  isample_min,
const unsigned  isample_max 
) const

Definition at line 73 of file LArCalibUtils/src/LArPedestal.cxx.

75 {
76  unsigned imin=0;
77  unsigned imax=m_sum.size()-1;
78 
79  if (isample_min > 0 && isample_min < m_sum.size()) imin=isample_min;
80  if (isample_max > 0 && isample_max < m_sum.size()) imax=isample_max;
81  double mean = 0;
82  for(unsigned int i=0; i<=imax; ++i) mean += m_sum[i];
83  mean /= ((imax-imin+1)*(double) m_nped);
84 
85  return mean;
86 }

◆ get_mean() [6/6]

double LArPedestal::get_mean ( const unsigned  isample_min,
const unsigned  isample_max 
) const

◆ get_min() [1/2]

const short& LArPedestal::get_min ( ) const
inline

Definition at line 90 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

◆ get_min() [2/2]

const short& LArPedestal::get_min ( ) const
inline

Definition at line 92 of file LArRawEvent/LArRawEvent/LArPedestal.h.

◆ get_nentries() [1/2]

int LArPedestal::get_nentries ( ) const
inline

Definition at line 70 of file LArRawEvent/LArRawEvent/LArPedestal.h.

77 { return m_sum.size();}

◆ get_nentries() [2/2]

int LArPedestal::get_nentries ( ) const
inline

Definition at line 70 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

75 { return m_sum.size();}

◆ get_nsamples() [1/2]

unsigned LArPedestal::get_nsamples ( ) const
inline

Definition at line 87 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

◆ get_nsamples() [2/2]

unsigned LArPedestal::get_nsamples ( ) const
inline

Definition at line 89 of file LArRawEvent/LArRawEvent/LArPedestal.h.

◆ get_rms() [1/6]

double LArPedestal::get_rms ( ) const

Definition at line 151 of file LArCalibUtils/src/LArPedestal.cxx.

153 {
154  const int nsamples = m_sum.size();
155  if (nsamples==0 || m_nped==0) return 0;
156  uint64_t x=0, y=0;
157  for(int i=0; i<nsamples; i++) {
158  x+=m_sum[i];
159  y+=m_sumSquares[i];
160  }
161 
162  const double mean=double(x)/(nsamples*m_nped);
163  const double ss=double(y)/(nsamples*m_nped);
164  return sqrt(ss-mean*mean);
165  //double noise=y-x*x
166  //return sqrt(noise/(m_nped*m_nped*nsamples*nsamples));
167 }

◆ get_rms() [2/6]

double LArPedestal::get_rms ( ) const

◆ get_rms() [3/6]

double LArPedestal::get_rms ( const unsigned  isample) const

Definition at line 139 of file LArCalibUtils/src/LArPedestal.cxx.

141 {
142  if (isample>=m_sum.size() || m_nped==0)
143  return 0;
144  //const int nsamples = m_sum.size();
145  const double x = m_sum[isample]/double(m_nped);
146  const double y = m_sumSquares[isample]/double(m_nped);
147  return sqrt(y-x*x);
148 }

◆ get_rms() [4/6]

double LArPedestal::get_rms ( const unsigned  isample) const

◆ get_rms() [5/6]

double LArPedestal::get_rms ( const unsigned  isample_min,
const unsigned  isample_max 
) const

Definition at line 117 of file LArCalibUtils/src/LArPedestal.cxx.

119 {
120  unsigned imin=0;
121  unsigned imax=m_sum.size()-1;
122 
123  if (isample_min > 0 && isample_min < m_sum.size()) imin=isample_min;
124  if (isample_max > 0 && isample_max < m_sum.size()) imax=isample_max;
125  //const int nsamples = m_sum.size();
126  uint64_t x=0, y=0;
127  for(unsigned int i=imin; i<=imax; i++) {
128  x+=m_sum[i];
129  y+=m_sumSquares[i];
130  }
131 
132  const double mean=double(x)/((imax-imin+1)*m_nped);
133  const double ss=double(y)/((imax-imin+1)*m_nped);
134  return sqrt(ss-mean*mean);
135 }

◆ get_rms() [6/6]

double LArPedestal::get_rms ( const unsigned  isample_min,
const unsigned  isample_max 
) const

◆ get_sum() [1/4]

double LArPedestal::get_sum ( ) const

Definition at line 61 of file LArCalibUtils/src/LArPedestal.cxx.

63 {
64  double sum = 0;
65  int nsamples = m_sum.size();
66  for(int i=0; i<nsamples; i++)
67  sum += m_sum[i];
68 
69  return sum;
70 }

◆ get_sum() [2/4]

double LArPedestal::get_sum ( ) const

◆ get_sum() [3/4]

double LArPedestal::get_sum ( const unsigned  isample) const

◆ get_sum() [4/4]

double LArPedestal::get_sum ( const unsigned  isample) const

Definition at line 51 of file LArCalibUtils/src/LArPedestal.cxx.

53 {
54  if (isample>=m_sum.size())
55  return 0;
56 
57  return m_sum[isample];
58 }

◆ set_max() [1/2]

void LArPedestal::set_max ( const short  max)

◆ set_max() [2/2]

void LArPedestal::set_max ( const short  max)

Definition at line 44 of file LArCalibUtils/src/LArPedestal.cxx.

46 {
47  m_max = max;
48 }

◆ set_min() [1/2]

void LArPedestal::set_min ( const short  min)

◆ set_min() [2/2]

void LArPedestal::set_min ( const short  min)

Definition at line 37 of file LArCalibUtils/src/LArPedestal.cxx.

39 {
40  m_min = min;
41 }

◆ zero() [1/2]

void LArPedestal::zero ( )

Definition at line 188 of file LArCalibUtils/src/LArPedestal.cxx.

190 {
191  const int nsamples = m_sum.size();
192  for(int l=0; l<nsamples; l++) {
193  m_sumSquares[l] = 0;
194  m_sum[l]=0;
195  }
196  m_nped=0;
197 }

◆ zero() [2/2]

void LArPedestal::zero ( )

Member Data Documentation

◆ m_max

short LArPedestal::m_max
private

Definition at line 45 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

◆ m_min

short LArPedestal::m_min
private

Definition at line 43 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

◆ m_nped

uint32_t LArPedestal::m_nped
private

Definition at line 51 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

◆ m_sum

std::vector< uint32_t > LArPedestal::m_sum
private

Definition at line 47 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

◆ m_sumSquares

std::vector< uint64_t > LArPedestal::m_sumSquares
private

Definition at line 49 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.


The documentation for this class was generated from the following files:
LArPedestal::m_min
short m_min
Definition: LArCalibUtils/LArCalibUtils/LArPedestal.h:43
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
max
#define max(a, b)
Definition: cfImp.cxx:41
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LArPedestal::m_sum
std::vector< uint32_t > m_sum
Definition: LArCalibUtils/LArCalibUtils/LArPedestal.h:47
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
x
#define x
LArPedestal::m_nped
uint32_t m_nped
Definition: LArCalibUtils/LArCalibUtils/LArPedestal.h:51
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
imax
int imax(int i, int j)
Definition: TileLaserTimingTool.cxx:33
min
#define min(a, b)
Definition: cfImp.cxx:40
LArPedestal::m_sumSquares
std::vector< uint64_t > m_sumSquares
Definition: LArCalibUtils/LArCalibUtils/LArPedestal.h:49
ReadOfcFromCool.nsamples
nsamples
Definition: ReadOfcFromCool.py:115
y
#define y
LArPedestal::m_max
short m_max
Definition: LArCalibUtils/LArCalibUtils/LArPedestal.h:45