ATLAS Offline Software
Loading...
Searching...
No Matches
LArAutoCorr Class Reference

#include <LArAutoCorr.h>

Collaboration diagram for LArAutoCorr:

Public Member Functions

 LArAutoCorr ()
 ~LArAutoCorr ()
void correl_zero ()
void set_min (const short min)
void set_max (const short max)
int get_nentries () const
double get_mean () const
double get_rms () const
const short & get_min () const
const short & get_max () const
void add (const std::vector< short > &samples, size_t maxnsamples)
const std::vector< double > & get_cov (int m_normalize, int m_phys)
 LArAutoCorr ()
 ~LArAutoCorr ()
void correl_zero ()
void set_min (const short min)
void set_max (const short max)
int get_nentries () const
double get_mean () const
double get_rms () const
const short & get_min () const
const short & get_max () const
void add (const std::vector< short > &samples, size_t maxnsamples)
const std::vector< double > & get_cov (int normalize, int phys)

Private Attributes

short m_min
short m_max
std::vector< double > m_sum
std::vector< double > m_matrix
std::vector< double > m_cov
std::vector< double > m_cov_temp
int m_nped

Detailed Description

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

Constructor & Destructor Documentation

◆ LArAutoCorr() [1/2]

LArAutoCorr::LArAutoCorr ( )
inline

◆ ~LArAutoCorr() [1/2]

LArAutoCorr::~LArAutoCorr ( )
inline

Definition at line 60 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

60{}

◆ LArAutoCorr() [2/2]

LArAutoCorr::LArAutoCorr ( )
inline

Definition at line 52 of file LArRawEvent/LArRawEvent/LArAutoCorr.h.

53 {
54 m_min = -1;
55 m_max = -1;
56 m_nped = 0;
57 }

◆ ~LArAutoCorr() [2/2]

LArAutoCorr::~LArAutoCorr ( )
inline

Definition at line 60 of file LArRawEvent/LArRawEvent/LArAutoCorr.h.

60{}

Member Function Documentation

◆ add() [1/2]

void LArAutoCorr::add ( const std::vector< short > & samples,
size_t maxnsamples )

Definition at line 222 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

224{
225 unsigned int nsamples = std::min(samples.size(),maxnsamples);
226 int k=0;
227
228 if(m_sum.size()<nsamples)
229 {
230
231 m_cov.resize(nsamples - 1);
232 m_cov_temp.resize((nsamples*(nsamples+1))/2);
233 m_sum.resize(nsamples);
234 m_matrix.resize((nsamples*(nsamples+1))/2);
235 }
236
237 for(unsigned int i=0; i<nsamples; i++)
238 {
239 for(unsigned int j=i; j<nsamples; j++,k++)
240 m_matrix[k] += ((double)(samples[j]*samples[i]));
241
242 m_sum[i] += ((double) samples[i]);
243 }
244 m_nped++;
245}

◆ add() [2/2]

void LArAutoCorr::add ( const std::vector< short > & samples,
size_t maxnsamples )

◆ correl_zero() [1/2]

void LArAutoCorr::correl_zero ( )

Definition at line 248 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

250{
251 int j =0;
252 int nsamples = m_sum.size();
253 for(int l=0; l<nsamples; l++)
254 {
255 for(int k=l; k<nsamples; k++,j++)
256 m_matrix[j] = 0;
257 m_sum[l]=0;
258 }
259 m_nped=0;
260}
l
Printing final latex table to .tex output file.

◆ correl_zero() [2/2]

void LArAutoCorr::correl_zero ( )

◆ get_cov() [1/2]

const std::vector< double > & LArAutoCorr::get_cov ( int m_normalize,
int m_phys )

Definition at line 149 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

151{
152 int nsamples = m_sum.size();
153 int k =0;
154 if (m_nped==0) return m_cov;
155 for(int i=0;i<nsamples;i++){
156 for(int j=i;j<nsamples;j++,k++)
157 m_cov_temp[k]= (double)((m_matrix[k]/(m_nped)) - ((m_sum[i]*m_sum[j])/(m_nped*m_nped)));
158 }
159
160 //MGV normalize covariance elements if required
161 if (m_normalize == 1 && m_phys == 0 ){
162 k=0;
163 int si,sj;
164 si=0;
165 for(int i=0;i<nsamples;i++){
166 sj=si;
167 for(int j=i;j<nsamples;j++,k++) {
168 if (m_sum[i]!=.0 && m_sum[j]!=.0)
169 m_cov_temp[k]= m_cov_temp[k]/(double)sqrt((m_matrix[si]/(m_nped)-(m_sum[i]*m_sum[i])/(m_nped*m_nped))*(m_matrix[sj]/(m_nped)-(m_sum[j]*m_sum[j])/(m_nped*m_nped)));
170 sj+=nsamples-j;
171 }
172 si+=nsamples-i;
173 }
174 }
175 //MGV
176
177 if (m_phys==0) {
178 double sum;
179 int s;
180 for(int diag =1;diag<nsamples;diag++)
181 {
182 sum =0;
183 s = 0;
184 for(int i=0; i < nsamples-diag;i++)
185 {
186 sum += m_cov_temp[s + diag];
187 s += nsamples - i;
188 }
189 sum = sum/(nsamples-diag);
190 m_cov[diag-1]= sum;
191 }
192 return m_cov;
193 }
194 else
195 return m_cov_temp;
196}

◆ get_cov() [2/2]

const std::vector< double > & LArAutoCorr::get_cov ( int normalize,
int phys )

◆ get_max() [1/2]

const short & LArAutoCorr::get_max ( ) const

Definition at line 126 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

128{
129 return m_max;
130}

◆ get_max() [2/2]

const short & LArAutoCorr::get_max ( ) const

◆ get_mean() [1/2]

double LArAutoCorr::get_mean ( ) const

Definition at line 134 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

136{
137 double mean = 0;
138
139 int nsamples = m_sum.size();
140 for(int i=0; i<nsamples; i++)
141 mean += m_sum[i];
142 mean /= ((double)(nsamples*m_nped));
143
144 return mean;
145}
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() [2/2]

double LArAutoCorr::get_mean ( ) const

◆ get_min() [1/2]

const short & LArAutoCorr::get_min ( ) const

Definition at line 119 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

121{
122 return m_min;
123}

◆ get_min() [2/2]

const short & LArAutoCorr::get_min ( ) const

◆ get_nentries() [1/2]

int LArAutoCorr::get_nentries ( ) const

Definition at line 111 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

113{
114 return m_nped;
115}

◆ get_nentries() [2/2]

int LArAutoCorr::get_nentries ( ) const

◆ get_rms() [1/2]

double LArAutoCorr::get_rms ( ) const

Definition at line 199 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

201{
202 double x=0, y=0;
203 int k = 0;
204 int nsamples = m_sum.size();
205
206 for(int i=0; i<nsamples; i++)
207 {
208 x += m_sum[i];
209 y += m_matrix[k];
210 k += nsamples - i;// Index of diagonal element
211 }
212
213 x/= (double) (nsamples*m_nped);
214 y/=(double) (nsamples*m_nped);
215
216 double noise = sqrt(y- x*x);
217
218 return noise;
219}
#define y
#define x

◆ get_rms() [2/2]

double LArAutoCorr::get_rms ( ) const

◆ set_max() [1/2]

void LArAutoCorr::set_max ( const short max)

Definition at line 104 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

106{
107 m_max = max;
108}
#define max(a, b)
Definition cfImp.cxx:41

◆ set_max() [2/2]

void LArAutoCorr::set_max ( const short max)

◆ set_min() [1/2]

void LArAutoCorr::set_min ( const short min)

Definition at line 97 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

99{
100 m_min = min;
101}
#define min(a, b)
Definition cfImp.cxx:40

◆ set_min() [2/2]

void LArAutoCorr::set_min ( const short min)

Member Data Documentation

◆ m_cov

std::vector< double > LArAutoCorr::m_cov
private

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

◆ m_cov_temp

std::vector< double > LArAutoCorr::m_cov_temp
private

Definition at line 44 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

◆ m_matrix

std::vector< double > LArAutoCorr::m_matrix
private

Definition at line 40 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

◆ m_max

short LArAutoCorr::m_max
private

Definition at line 34 of file LArCalibUtils/LArCalibUtils/LArAutoCorr.h.

◆ m_min

short LArAutoCorr::m_min
private

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

◆ m_nped

int LArAutoCorr::m_nped
private

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

◆ m_sum

std::vector< double > LArAutoCorr::m_sum
private

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


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