#include #include #include #include "TRandom.h" #include "JTools/JQuantile.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to test JTOOLS::JQuantile calculation. * \author mdejong */ int main(int argc, char **argv) { using namespace std; int numberOfEvents; double x; double sigma; UInt_t seed; int debug; try { JParser<> zap("Example program to test quantile calculation."); zap['n'] = make_field(numberOfEvents); zap['x'] = make_field(x) = 0.0; zap['s'] = make_field(sigma) = 1.0; zap['S'] = make_field(seed) = 0; zap['d'] = make_field(debug) = 3; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } if (numberOfEvents < 2) { FATAL("Fatal error: number of events " << numberOfEvents << endl); } gRandom->SetSeed(seed); JTOOLS::JQuantile quantile; // fill for (int i = 0; i != numberOfEvents; ++i) { quantile.put(gRandom->Gaus(x, sigma)); } NOTICE("quantity " << "calculated" << " | " << " true " << endl); NOTICE("mean " << fixed << showpos << setw(10) << quantile.getMean() << " | " << setw(10) << x << endl); NOTICE("RMS " << fixed << showpos << setw(10) << quantile.getSTDev() << " | " << setw(10) << sigma << endl); }