Jpp  15.0.1-rc.1-highQE
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JQuantile.cc File Reference

Example program to test JTOOLS::JQuantile calculation. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TRandom.h"
#include "JTools/JQuantile.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JTOOLS::JQuantile calculation.

Author
mdejong

Definition in file JQuantile.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file JQuantile.cc.

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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
Auxiliary data structure for alignment of data.
Definition: JManip.hh:366
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
#define NOTICE(A)
Definition: JMessage.hh:64
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67