Jpp - the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JTools
JQuantile.cc
Go to the documentation of this file.
1
2
#include <string>
3
#include <iostream>
4
#include <iomanip>
5
6
#include "TRandom.h"
7
8
#include "
JTools/JQuantile.hh
"
9
10
#include "
Jeep/JParser.hh
"
11
#include "
Jeep/JMessage.hh
"
12
13
14
/**
15
* \file
16
*
17
* Example program to test JTOOLS::JQuantile calculation.
18
* \author mdejong
19
*/
20
int
main
(
int
argc,
char
**argv)
21
{
22
using namespace
std;
23
using namespace
JPP;
24
25
int
numberOfEvents;
26
double
x;
27
double
sigma;
28
UInt_t seed;
29
int
debug
;
30
31
try
{
32
33
JParser<>
zap(
"Example program to test quantile calculation."
);
34
35
zap[
'n'
] =
make_field
(numberOfEvents);
36
zap[
'x'
] =
make_field
(x) = 0.0;
37
zap[
's'
] =
make_field
(sigma) = 1.0;
38
zap[
'S'
] =
make_field
(seed) = 0;
39
zap[
'd'
] =
make_field
(
debug
) = 3;
40
41
zap(argc, argv);
42
}
43
catch
(
const
exception &error) {
44
FATAL
(error.what() << endl);
45
}
46
47
if
(numberOfEvents < 2) {
48
FATAL
(
"Fatal error: number of events "
<< numberOfEvents << endl);
49
}
50
51
gRandom->SetSeed(seed);
52
53
JQuantile quantile;
54
55
for
(
int
i = 0; i != numberOfEvents; ++i) {
56
quantile.put(gRandom->Gaus(x, sigma));
57
}
58
59
NOTICE
(
"quantity "
<<
CENTER
(10) <<
"calculated"
<<
" | "
<<
CENTER
(10) <<
"true"
<< endl);
60
NOTICE
(
"mean "
<<
FIXED
(10,3) << quantile.getMean() <<
" | "
<<
FIXED
(10,3) << x << endl);
61
NOTICE
(
"RMS "
<<
FIXED
(10,3) << quantile.getSTDev() <<
" | "
<<
FIXED
(10,3) << sigma << endl);
62
}
63
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
FIXED
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:446
CENTER
Auxiliary data structure for alignment of data.
Definition:
JManip.hh:366
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
NOTICE
#define NOTICE(A)
Definition:
JMessage.hh:64
debug
int debug
debug level
Definition:
JSirene.cc:63
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JQuantile.hh
Generated by
1.8.5