ATLAS Offline Software
Trigger
TrigT1
TrigT1CaloCalibConditions
src
L1CaloPedestalCumul.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1CaloCalibConditions/L1CaloPedestalCumul.h
"
6
7
#include <iostream>
8
9
L1CaloPedestalCumul::L1CaloPedestalCumul
() {
10
m_min
= 0;
11
m_max
= 0;
12
m_nped
= 0;
13
}
14
15
L1CaloPedestalCumul::~L1CaloPedestalCumul
() {
16
}
17
18
double
L1CaloPedestalCumul::get_sum
(
const
unsigned
isample)
const
{
19
if
(isample>=
m_sum
.size())
20
return
0;
21
22
double
sum
= 0;
23
sum
=
m_sum
[isample];
24
25
return
sum
;
26
}
27
28
double
L1CaloPedestalCumul::get_sum
()
const
{
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
}
36
37
double
L1CaloPedestalCumul::get_mean
(
const
unsigned
isample)
const
{
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
}
47
48
double
L1CaloPedestalCumul::get_mean
()
const
{
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
}
58
59
double
L1CaloPedestalCumul::get_rms
(
const
unsigned
isample)
const
{
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
}
79
80
double
L1CaloPedestalCumul::get_rms
()
const
{
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
}
98
99
void
L1CaloPedestalCumul::add
(
const
std::vector<int>& samples) {
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
}
114
115
void
L1CaloPedestalCumul::clear
() {
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
}
125
126
L1CaloPedestalCumul::m_matrix
std::vector< double > m_matrix
Definition:
L1CaloPedestalCumul.h:32
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
L1CaloPedestalCumul::clear
void clear()
Definition:
L1CaloPedestalCumul.cxx:115
L1CaloPedestalCumul::~L1CaloPedestalCumul
~L1CaloPedestalCumul()
Definition:
L1CaloPedestalCumul.cxx:15
L1CaloPedestalCumul::get_mean
double get_mean() const
Definition:
L1CaloPedestalCumul.cxx:48
UploadAMITag.l
list l
Definition:
UploadAMITag.larcaf.py:158
L1CaloPedestalCumul::m_nped
int m_nped
Definition:
L1CaloPedestalCumul.h:34
x
#define x
L1CaloPedestalCumul::m_sum
std::vector< double > m_sum
Definition:
L1CaloPedestalCumul.h:30
convertTimingResiduals.sum
sum
Definition:
convertTimingResiduals.py:55
L1CaloPedestalCumul::add
void add(const std::vector< int > &samples)
Definition:
L1CaloPedestalCumul.cxx:99
lumiFormat.i
int i
Definition:
lumiFormat.py:85
L1CaloPedestalCumul::m_min
short m_min
Definition:
L1CaloPedestalCumul.h:26
L1CaloPedestalCumul::L1CaloPedestalCumul
L1CaloPedestalCumul()
Definition:
L1CaloPedestalCumul.cxx:9
xAOD::double
double
Definition:
CompositeParticle_v1.cxx:159
L1CaloPedestalCumul::get_sum
double get_sum() const
Definition:
L1CaloPedestalCumul.cxx:28
ReadOfcFromCool.nsamples
nsamples
Definition:
ReadOfcFromCool.py:115
L1CaloPedestalCumul.h
y
#define y
L1CaloPedestalCumul::m_max
short m_max
Definition:
L1CaloPedestalCumul.h:28
L1CaloPedestalCumul::get_rms
double get_rms() const
Definition:
L1CaloPedestalCumul.cxx:80
WriteCellNoiseToCool.noise
noise
Definition:
WriteCellNoiseToCool.py:380
fitman.k
k
Definition:
fitman.py:528
Generated on Thu Nov 7 2024 21:18:49 for ATLAS Offline Software by
1.8.18