ATLAS Offline Software
Reconstruction
PanTau
PanTauAlgs
Root
Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PanTauAlgs/HelperFunctions.h
"
6
#include "
PanTauAlgs/TauConstituent.h
"
7
8
std::string
PanTau::HelperFunctions::convertNumberToString
(
double
x
)
const
{
9
std::stringstream tmpStream;
10
tmpStream <<
x
;
11
return
tmpStream.str();
12
}
13
14
15
int
PanTau::HelperFunctions::getBinIndex
(
const
std::vector<double>& binEdges,
double
value
)
const
{
16
int
resBin = -1;
17
for
(
unsigned
int
i
=0;
i
<binEdges.size()-1;
i
++) {
18
double
lowerEdge = binEdges[
i
];
19
double
upperEdge = binEdges[
i
+1];
20
if
(lowerEdge <=
value
&&
value
< upperEdge) resBin =
i
;
21
}
22
if
(resBin == -1) {
23
ATH_MSG_WARNING
(
"Could not find matching bin for value "
<<
value
<<
" in these bin edges:"
);
24
for
(
unsigned
int
i
=0;
i
<binEdges.size();
i
++)
ATH_MSG_WARNING
(
"\tbin edge "
<<
i
<<
": "
<< binEdges[
i
]);
25
}
26
return
resBin;
27
}
28
29
30
double
PanTau::HelperFunctions::stddev
(
double
sumOfSquares,
double
sumOfValues,
int
numConsts)
const
{
31
// calculate standard deviations according to:
32
// sigma^2 = (sum_i x_i^2) / N - ((sum_i x_i)/N)^2 (biased maximum-likelihood estimate)
33
// directly set sigma^2 to 0 in case of N=1, otherwise numerical effects may yield very small negative sigma^2
34
if
(numConsts == 1)
return
0;
35
double
a
= sumOfSquares / (
static_cast<
double
>
(numConsts));
36
double
b
= sumOfValues / (
static_cast<
double
>
(numConsts));
37
double
stdDev =
a
-
b
*
b
;
38
if
(stdDev < 0.) stdDev = 0;
39
return
std::sqrt(stdDev);
40
}
41
HelperFunctions.h
athena.value
value
Definition:
athena.py:124
x
#define x
TauConstituent.h
lumiFormat.i
int i
Definition:
lumiFormat.py:85
PanTau::HelperFunctions::getBinIndex
virtual int getBinIndex(const std::vector< double > &binEdges, double value) const
Definition:
Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx:15
PanTau::HelperFunctions::convertNumberToString
virtual std::string convertNumberToString(double x) const
Definition:
Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx:8
plotBeamSpotMon.b
b
Definition:
plotBeamSpotMon.py:76
a
TList * a
Definition:
liststreamerinfos.cxx:10
PanTau::HelperFunctions::stddev
virtual double stddev(double sumOfSquares, double sumOfValues, int numConsts) const
Definition:
Reconstruction/PanTau/PanTauAlgs/Root/HelperFunctions.cxx:30
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
Generated on Sun Oct 26 2025 21:10:46 for ATLAS Offline Software by
1.8.18