ATTPCROOT
0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtUnpack
GETDecoder2
GETMath2.cxx
Go to the documentation of this file.
1
// =================================================
2
// GETMath Class
3
//
4
// Author:
5
// Genie Jhang ( geniejhang@majimak.com )
6
//
7
// Log:
8
// - 2013. 10. 24
9
// Start writing class
10
// - 2015. 11. 13
11
// Adopted to the new version
12
// =================================================
13
14
#include "
GETMath2.h
"
15
16
#include <Rtypes.h>
17
18
#include <cmath>
19
20
ClassImp
(
GETMath2
)
21
22
GETMath2::GETMath2
()
23
{
24
Reset
();
25
}
26
27
void
GETMath2::Add
(Double_t value)
28
{
35
fMean += (value - fMean) / (Double_t)(fNumValues + 1);
36
37
if
(fNumValues > 0)
38
fRms = fNumValues * fRms / (Double_t)(fNumValues + 1) + pow(value - fMean, 2) / (Double_t)(fNumValues);
39
40
fNumValues++;
41
}
42
43
Double_t
GETMath2::GetMean
()
44
{
45
return
fMean;
46
}
47
Double_t
GETMath2::GetRMS
()
48
{
49
return
sqrt(fRms);
50
}
51
Double_t
GETMath2::GetRMS2
()
52
{
53
return
fRms;
54
}
55
56
void
GETMath2::Set
(Int_t numValues, Double_t
mean
, Double_t rms2)
57
{
58
fNumValues = numValues;
59
fMean =
mean
;
60
fRms = rms2;
61
}
62
63
void
GETMath2::Reset
()
64
{
65
fNumValues = 0;
66
fMean = 0;
67
fRms = 0;
68
}
GETMath2.h
GETMath2::GetMean
Double_t GetMean()
Return the calculated mean value.
Definition:
GETMath2.cxx:43
GETMath2::GetRMS
Double_t GetRMS()
Return the calculated RMS value.
Definition:
GETMath2.cxx:47
ClassImp
ClassImp(GETMath2) GETMath2
Definition:
GETMath2.cxx:20
GETMath2::Set
void Set(Int_t numValues, Double_t mean, Double_t rms2)
Definition:
GETMath2.cxx:56
GETMath2
Definition:
GETMath2.h:29
GETMath2::Reset
void Reset()
Reset all the values.
Definition:
GETMath2.cxx:63
GETMath2::GetRMS2
Double_t GetRMS2()
Return the calculated RMS squared value.
Definition:
GETMath2.cxx:51
GETMath2::Add
void Add(Double_t value)
Definition:
GETMath2.cxx:27
GETMath2::GETMath2
GETMath2()
mean
double mean(const double *a, size_t m)
Definition:
cluster.cxx:26
Generated on Sat Nov 11 2023 15:30:39 for ATTPCROOT by
1.8.18