ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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

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

◆ ~LArAutoCorr() [1/2]

LArAutoCorr::~LArAutoCorr ( )
inline

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

◆ LArAutoCorr() [2/2]

LArAutoCorr::LArAutoCorr ( )
inline

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

◆ ~LArAutoCorr() [2/2]

LArAutoCorr::~LArAutoCorr ( )
inline

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

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 }

◆ 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 }

◆ get_mean() [2/2]

double LArAutoCorr::get_mean ( ) const

◆ get_min() [1/2]

const short& LArAutoCorr::get_min ( ) const

◆ get_min() [2/2]

const short & LArAutoCorr::get_min ( ) const

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

121 {
122  return m_min;
123 }

◆ get_nentries() [1/2]

int LArAutoCorr::get_nentries ( ) const

◆ get_nentries() [2/2]

int LArAutoCorr::get_nentries ( ) const

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

113 {
114  return m_nped;
115 }

◆ 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 }

◆ get_rms() [2/2]

double LArAutoCorr::get_rms ( ) const

◆ set_max() [1/2]

void LArAutoCorr::set_max ( const short  max)

◆ set_max() [2/2]

void LArAutoCorr::set_max ( const short  max)

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

106 {
107  m_max = max;
108 }

◆ set_min() [1/2]

void LArAutoCorr::set_min ( const short  min)

◆ set_min() [2/2]

void LArAutoCorr::set_min ( const short  min)

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

99 {
100  m_min = min;
101 }

Member Data Documentation

◆ m_cov

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

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

◆ m_cov_temp

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

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

◆ m_matrix

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

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

◆ m_max

short LArAutoCorr::m_max
private

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

◆ m_min

short LArAutoCorr::m_min
private

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

◆ m_nped

int LArAutoCorr::m_nped
private

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

◆ m_sum

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

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


The documentation for this class was generated from the following files:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
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
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
LArAutoCorr::m_cov_temp
std::vector< double > m_cov_temp
Definition: LArCalibUtils/LArCalibUtils/LArAutoCorr.h:56
x
#define x
LArAutoCorr::m_sum
std::vector< double > m_sum
Definition: LArCalibUtils/LArCalibUtils/LArAutoCorr.h:49
LArAutoCorr::m_cov
std::vector< double > m_cov
Definition: LArCalibUtils/LArCalibUtils/LArAutoCorr.h:55
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
min
#define min(a, b)
Definition: cfImp.cxx:40
LArAutoCorr::m_max
short m_max
Definition: LArCalibUtils/LArCalibUtils/LArAutoCorr.h:46
ReadOfcFromCool.nsamples
nsamples
Definition: ReadOfcFromCool.py:115
LArAutoCorr::m_matrix
std::vector< double > m_matrix
Definition: LArCalibUtils/LArCalibUtils/LArAutoCorr.h:52
y
#define y
LArAutoCorr::m_min
short m_min
Definition: LArCalibUtils/LArCalibUtils/LArAutoCorr.h:43
LArAutoCorr::m_nped
int m_nped
Definition: LArCalibUtils/LArCalibUtils/LArAutoCorr.h:59
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
fitman.k
k
Definition: fitman.py:528