Jpp
debug
the software that should make you happy
software
JTools
JWeight.hh
Go to the documentation of this file.
1
#ifndef __JTOOLS__JWEIGHT__
2
#define __JTOOLS__JWEIGHT__
3
4
#include <cmath>
5
6
#include "
JLang/JTitle.hh
"
7
8
9
/**
10
* \author mdejong
11
*/
12
13
namespace
JTOOLS
{}
14
namespace
JPP
{
using namespace
JTOOLS
; }
15
16
namespace
JTOOLS
{
17
18
using
JLANG::JTitle
;
19
20
/**
21
* Weight calculator.
22
*/
23
class
JWeight
:
24
public
JTitle
25
{
26
public
:
27
/**
28
* Constructor.
29
*
30
* \param title title
31
*/
32
JWeight
(
const
JTitle
&
title
=
""
) :
33
JTitle
(
title
)
34
{
35
reset
();
36
}
37
38
39
/**
40
* Reset.
41
*/
42
void
reset
()
43
{
44
tot
= 0.0;
45
err
= 0.0;
46
num
= 0;
47
}
48
49
50
/**
51
* Put weight.
52
*
53
* \param w weight
54
*/
55
void
put
(
const
double
w
)
56
{
57
tot
+=
w
;
58
err
+=
w
*
w
;
59
num
+= 1;
60
}
61
62
63
/**
64
* Get total count.
65
*
66
* \return count
67
*/
68
long
long
int
getCount
()
const
69
{
70
return
num
;
71
}
72
73
74
/**
75
* Get total weight.
76
*
77
* \return weight
78
*/
79
double
getTotal
()
const
80
{
81
return
tot
;
82
}
83
84
85
/**
86
* Get total error.
87
*
88
* \return error
89
*/
90
double
getError
()
const
91
{
92
return
sqrt(
err
);
93
}
94
95
protected
:
96
double
tot
;
97
double
err
;
98
long
long
int
num
;
99
};
100
}
101
102
#endif
JTitle.hh
JLANG::JTitle
Auxiliary class for title.
Definition:
JTitle.hh:19
JLANG::JTitle::title
std::string title
Definition:
JTitle.hh:73
JTOOLS::JWeight
Weight calculator.
Definition:
JWeight.hh:25
JTOOLS::JWeight::getError
double getError() const
Get total error.
Definition:
JWeight.hh:90
JTOOLS::JWeight::put
void put(const double w)
Put weight.
Definition:
JWeight.hh:55
JTOOLS::JWeight::getCount
long long int getCount() const
Get total count.
Definition:
JWeight.hh:68
JTOOLS::JWeight::err
double err
Definition:
JWeight.hh:97
JTOOLS::JWeight::num
long long int num
Definition:
JWeight.hh:98
JTOOLS::JWeight::tot
double tot
Definition:
JWeight.hh:96
JTOOLS::JWeight::reset
void reset()
Reset.
Definition:
JWeight.hh:42
JTOOLS::JWeight::getTotal
double getTotal() const
Get total weight.
Definition:
JWeight.hh:79
JTOOLS::JWeight::JWeight
JWeight(const JTitle &title="")
Constructor.
Definition:
JWeight.hh:32
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition:
JAAnetToolkit.hh:43
JTOOLS
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
Definition:
JAbstractCollection.hh:11
JTOOLS::w
data_type w[N+1][M+1]
Definition:
JPolint.hh:867
Generated by
1.9.1