37 JParser<> zap(
"Example program to test quantile calculation.");
48 catch(
const exception &error) {
49 FATAL(error.what() << endl);
52 if (numberOfEvents < 2) {
53 FATAL(
"Fatal error: number of events " << numberOfEvents << endl);
56 gRandom->SetSeed(seed);
63 for (
int i = 0; i != numberOfEvents; ++i) {
65 double x = gRandom->Uniform(-1.0e6, +1.0e6);
75 for (
int i = 0; i != 100; ++i) {
77 std::shuffle(buffer.begin(), buffer.end(), g);
79 DEBUG(
"buffer[0] " <<
FIXED(15,6) << buffer[0] << endl);
83 for (
const double x : buffer) {
95 for (
int i = 0; i != numberOfEvents; ++i) {
99 NOTICE(
"quantity " <<
CENTER(10) <<
"calculated" <<
" | " <<
CENTER(10) <<
"true" << endl);
103 ASSERT(numberOfEvents > 0,
"Test number of events.");
110 for (
int i = 0; i != numberOfEvents; ++i) {
111 Q.
put(gRandom->Uniform(0.0, 1.0));
114 for (
const double x : { 0.1, 0.5, 0.9}) {
120 ASSERT(fabs(Q.
getQuantile(
x, JQuantile::forward_t) - (
x )) <= precision,
"Test forward quantile ");
121 ASSERT(fabs(Q.
getQuantile(
x, JQuantile::symmetric_t) - (
x )) <= precision,
"Test symmetric quantile ");
122 ASSERT(fabs(Q.
getQuantile(
x, JQuantile::backward_t) - (1.0 -
x)) <= precision,
"Test backward quantile ");
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for alignment of data.
Auxiliary data structure for floating point format specification.