ATLAS Offline Software
Loading...
Searching...
No Matches
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 ( )

◆ ~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}
std::vector< uint64_t > m_sumSquares

◆ 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 81 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

81{ return m_max; }

◆ get_max() [2/2]

const short & LArPedestal::get_max ( ) const
inline

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

83{ return m_max; }

◆ get_mean() [1/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}
setEventNumber uint32_t

◆ get_mean() [2/6]

double LArPedestal::get_mean ( ) const

◆ 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}
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="")

◆ 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}
int imax(int i, int j)

◆ 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 78 of file LArCalibUtils/LArCalibUtils/LArPedestal.h.

78{ return m_min; }

◆ get_min() [2/2]

const short & LArPedestal::get_min ( ) const
inline

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

80{ return m_min; }

◆ get_nentries() [1/2]

int LArPedestal::get_nentries ( ) const
inline

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

58{ return m_nped; }

◆ get_nentries() [2/2]

int LArPedestal::get_nentries ( ) const
inline

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

58{ return m_nped; }

◆ get_nsamples() [1/2]

unsigned LArPedestal::get_nsamples ( ) const
inline

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

75{ return m_sum.size();}

◆ get_nsamples() [2/2]

unsigned LArPedestal::get_nsamples ( ) const
inline

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

77{ return m_sum.size();}

◆ 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}
static Double_t ss
#define y
#define x

◆ 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

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}

◆ get_sum() [4/4]

double LArPedestal::get_sum ( const unsigned isample) const

◆ set_max() [1/2]

void LArPedestal::set_max ( const short max)

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

46{
47 m_max = max;
48}
#define max(a, b)
Definition cfImp.cxx:41

◆ set_max() [2/2]

void LArPedestal::set_max ( const short max)

◆ set_min() [1/2]

void LArPedestal::set_min ( const short min)

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

39{
40 m_min = min;
41}
#define min(a, b)
Definition cfImp.cxx:40

◆ set_min() [2/2]

void LArPedestal::set_min ( const short min)

◆ 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}
l
Printing final latex table to .tex output file.

◆ zero() [2/2]

void LArPedestal::zero ( )

Member Data Documentation

◆ m_max

short LArPedestal::m_max
private

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

◆ m_min

short LArPedestal::m_min
private

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

◆ m_nped

uint32_t LArPedestal::m_nped
private

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

◆ m_sum

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

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

◆ m_sumSquares

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

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


The documentation for this class was generated from the following files: