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

Intermediate Class to store pedestal data from the L1CaloPedestalMaker algorithm. More...

#include <L1CaloPedestalCumul.h>

Collaboration diagram for L1CaloPedestalCumul:

Public Member Functions

 L1CaloPedestalCumul ()
 ~L1CaloPedestalCumul ()
void clear ()
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_rms () const
double get_rms (const unsigned isample) const
unsigned get_nsamples () const
const short & get_min () const
const short & get_max () const
void add (const std::vector< int > &samples)

Private Attributes

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

Detailed Description

Intermediate Class to store pedestal data from the L1CaloPedestalMaker algorithm.

Heavily inspired from the LArPedestal class

Author
Damien Prieur damie.nosp@m.n.pr.nosp@m.ieur@.nosp@m.cern.nosp@m..ch

Definition at line 21 of file L1CaloPedestalCumul.h.

Constructor & Destructor Documentation

◆ L1CaloPedestalCumul()

L1CaloPedestalCumul::L1CaloPedestalCumul ( )

Definition at line 9 of file L1CaloPedestalCumul.cxx.

◆ ~L1CaloPedestalCumul()

L1CaloPedestalCumul::~L1CaloPedestalCumul ( )

Definition at line 15 of file L1CaloPedestalCumul.cxx.

15 {
16}

Member Function Documentation

◆ add()

void L1CaloPedestalCumul::add ( const std::vector< int > & samples)

Definition at line 99 of file L1CaloPedestalCumul.cxx.

99 {
100 unsigned int nsamples = samples.size();
101 int k=0;
102
103 if(m_sum.size()<nsamples) {
104 m_sum.resize(nsamples);
105 m_matrix.resize((nsamples*(nsamples+1))/2);
106 }
107
108 for(unsigned i=0; i<nsamples; i++) {
109 for(unsigned j=i; j<nsamples; j++,k++) m_matrix[k] += ((double)(samples[j]*samples[i]));
110 m_sum[i] += ((double) samples[i]);
111 }
112 m_nped++;
113}
std::vector< double > m_matrix
std::vector< double > m_sum

◆ clear()

void L1CaloPedestalCumul::clear ( )

Definition at line 115 of file L1CaloPedestalCumul.cxx.

115 {
116 int nsamples = m_sum.size();
117 int j =0;
118
119 for(int l=0; l<nsamples; l++) {
120 for(int k=l; k<nsamples; k++,j++) m_matrix[j] = 0;
121 m_sum[l]=0;
122 }
123 m_nped=0;
124}
l
Printing final latex table to .tex output file.

◆ get_max()

const short & L1CaloPedestalCumul::get_max ( ) const
inline

Definition at line 74 of file L1CaloPedestalCumul.h.

74{ return m_max; }

◆ get_mean() [1/2]

double L1CaloPedestalCumul::get_mean ( ) const

Definition at line 48 of file L1CaloPedestalCumul.cxx.

48 {
49 if(m_nped==0) return -1;
50 double mean = 0;
51 int nsamples = m_sum.size();
52 for(int i=0; i<nsamples; i++)
53 mean += m_sum[i];
54 mean /= ((double)(nsamples*m_nped));
55
56 return mean;
57}
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 L1CaloPedestalCumul::get_mean ( const unsigned isample) const

Definition at line 37 of file L1CaloPedestalCumul.cxx.

37 {
38 if(m_nped==0) return -1;
39 if (isample>=m_sum.size())
40 return 0;
41 double mean = 0;
42 mean = m_sum[isample];
43 mean /= ((double) m_nped);
44
45 return mean;
46}

◆ get_min()

const short & L1CaloPedestalCumul::get_min ( ) const
inline

Definition at line 71 of file L1CaloPedestalCumul.h.

71{ return m_min; }

◆ get_nentries()

int L1CaloPedestalCumul::get_nentries ( ) const
inline

Definition at line 53 of file L1CaloPedestalCumul.h.

53{ return m_nped; }

◆ get_nsamples()

unsigned L1CaloPedestalCumul::get_nsamples ( ) const
inline

Definition at line 68 of file L1CaloPedestalCumul.h.

68{ return m_sum.size();}

◆ get_rms() [1/2]

double L1CaloPedestalCumul::get_rms ( ) const

Definition at line 80 of file L1CaloPedestalCumul.cxx.

80 {
81 if(m_nped==0) return -1;
82 double x=0, y=0;
83 int k=0;
84 int nsamples = m_sum.size();
85
86 x = get_mean();
87 for(int i=0; i<nsamples; i++)
88 {
89 y += m_matrix[k];
90 k += nsamples - i; // Index of diagonal element
91 }
92 y /= (double) (nsamples*m_nped);
93
94 double noise = sqrt(y - x*x);
95
96 return noise;
97}
#define y
#define x

◆ get_rms() [2/2]

double L1CaloPedestalCumul::get_rms ( const unsigned isample) const

Definition at line 59 of file L1CaloPedestalCumul.cxx.

59 {
60 if(m_nped==0) return -1;
61 if (isample>=m_sum.size())
62 return 0;
63 double x=0, y=0;
64 int k=0;
65 int nsamples = m_sum.size();
66
67 x = m_sum[isample];
68 for(unsigned i=0; i<isample; i++)
69 k += nsamples - i;
70 y = m_matrix[k];
71
72 double noise =(y/((double) m_nped))
73 -((x*x)/((double) (m_nped*m_nped)));
74
75 noise = sqrt(noise);
76
77 return noise;
78}

◆ get_sum() [1/2]

double L1CaloPedestalCumul::get_sum ( ) const

Definition at line 28 of file L1CaloPedestalCumul.cxx.

28 {
29 double sum = 0;
30 int nsamples = m_sum.size();
31 for(int i=0; i<nsamples; i++)
32 sum += m_sum[i];
33
34 return sum;
35}

◆ get_sum() [2/2]

double L1CaloPedestalCumul::get_sum ( const unsigned isample) const

Definition at line 18 of file L1CaloPedestalCumul.cxx.

18 {
19 if (isample>=m_sum.size())
20 return 0;
21
22 double sum = 0;
23 sum = m_sum[isample];
24
25 return sum;
26}

◆ set_max()

void L1CaloPedestalCumul::set_max ( const short max)
inline

Definition at line 50 of file L1CaloPedestalCumul.h.

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

◆ set_min()

void L1CaloPedestalCumul::set_min ( const short min)
inline

Definition at line 47 of file L1CaloPedestalCumul.h.

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

Member Data Documentation

◆ m_matrix

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

Definition at line 32 of file L1CaloPedestalCumul.h.

◆ m_max

short L1CaloPedestalCumul::m_max
private

Definition at line 28 of file L1CaloPedestalCumul.h.

◆ m_min

short L1CaloPedestalCumul::m_min
private

Definition at line 26 of file L1CaloPedestalCumul.h.

◆ m_nped

int L1CaloPedestalCumul::m_nped
private

Definition at line 34 of file L1CaloPedestalCumul.h.

◆ m_sum

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

Definition at line 30 of file L1CaloPedestalCumul.h.


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