src
SimCalorimetry
CaloSimAlgos
src
CaloValidationStatistics.cc
Go to the documentation of this file.
1
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
2
#include "
SimCalorimetry/CaloSimAlgos/interface/CaloValidationStatistics.h
"
3
#include <cmath>
4
#include <iostream>
5
6
CaloValidationStatistics::CaloValidationStatistics
(
std::string
name
,
float
expectedMean
,
float
expectedRMS)
7
: name_(
name
),
8
expectedMean_(
expectedMean
),
9
expectedRMS_(expectedRMS),
10
sum_(0.),
11
sumOfSquares_(0.),
12
weightedSum_(0.),
13
sumOfWeights_(0.),
14
n_(0) {}
15
16
CaloValidationStatistics::~CaloValidationStatistics
() {
edm::LogInfo
(
"CaloValidationStatistics"
) << *
this
; }
17
18
void
CaloValidationStatistics::addEntry
(
float
value
,
float
weight
) {
19
sum_
+=
value
;
20
sumOfSquares_
+= (
value
*
value
);
21
weightedSum_
+=
value
*
weight
;
22
sumOfWeights_
+=
weight
;
23
++
n_
;
24
}
25
26
float
CaloValidationStatistics::mean
()
const
{
return
sum_
/
n_
; }
27
28
float
CaloValidationStatistics::RMS
()
const
{
29
float
numerator
=
n_
*
sumOfSquares_
-
sum_
*
sum_
;
30
int
denominator
=
n_
* (
n_
- 1);
31
return
std::sqrt
(
numerator
/
denominator
);
32
}
33
34
float
CaloValidationStatistics::weightedMean
()
const
{
return
weightedSum_
/
sumOfWeights_
; }
35
36
std::ostream &
operator<<
(std::ostream &
os
,
const
CaloValidationStatistics
&
stat
) {
37
os
<<
"OVAL "
<<
stat
.name() <<
" entries:"
<<
stat
.nEntries();
38
if
(
stat
.nEntries() > 0) {
39
os
<<
" Mean: "
<<
stat
.mean() <<
" (expect "
<<
stat
.expectedMean() <<
")"
;
40
}
41
if
(
stat
.nEntries() > 1) {
42
os
<<
" RMS: "
<<
stat
.RMS() <<
" (expect "
<<
stat
.expectedRMS() <<
")"
;
43
}
44
return
os
;
45
}
bTagMiniDQMDeepCSV.denominator
denominator
Definition:
bTagMiniDQMDeepCSV.py:26
CaloValidationStatistics::n_
int n_
Definition:
CaloValidationStatistics.h:42
CaloValidationStatistics::sum_
float sum_
Definition:
CaloValidationStatistics.h:38
stat
MessageLogger.h
CaloValidationStatistics::RMS
float RMS() const
Definition:
CaloValidationStatistics.cc:28
CaloValidationStatistics::weightedMean
float weightedMean() const
Definition:
CaloValidationStatistics.cc:34
CaloValidationStatistics::mean
float mean() const
Definition:
CaloValidationStatistics.cc:26
weight
Definition:
weight.py:1
CaloValidationStatistics::sumOfSquares_
float sumOfSquares_
Definition:
CaloValidationStatistics.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
bTagMiniDQMDeepCSV.numerator
numerator
Definition:
bTagMiniDQMDeepCSV.py:22
operator<<
std::ostream & operator<<(std::ostream &os, const CaloValidationStatistics &stat)
Definition:
CaloValidationStatistics.cc:36
CaloValidationStatistics::sumOfWeights_
float sumOfWeights_
Definition:
CaloValidationStatistics.h:41
mergeVDriftHistosByStation.name
name
Definition:
mergeVDriftHistosByStation.py:78
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:23
CaloValidationStatistics::~CaloValidationStatistics
~CaloValidationStatistics()
prints to LogInfo upon destruction
Definition:
CaloValidationStatistics.cc:16
l1tGTMenu_BTagSeeds_cff.os
os
Definition:
l1tGTMenu_BTagSeeds_cff.py:34
value
Definition:
value.py:1
relativeConstraints.value
value
Definition:
relativeConstraints.py:53
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:131
PedestalClient_cfi.expectedMean
expectedMean
Definition:
PedestalClient_cfi.py:8
CaloValidationStatistics::addEntry
void addEntry(float value, float weight=1.)
Definition:
CaloValidationStatistics.cc:18
CaloValidationStatistics::CaloValidationStatistics
CaloValidationStatistics(std::string name, float expectedMean, float expectedRMS)
Definition:
CaloValidationStatistics.cc:6
CaloValidationStatistics::weightedSum_
float weightedSum_
Definition:
CaloValidationStatistics.h:40
CaloValidationStatistics.h
mps_merge.weight
weight
Definition:
mps_merge.py:88
CaloValidationStatistics
Definition:
CaloValidationStatistics.h:12
Generated for CMSSW Reference Manual by
1.8.14