Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
getPoisson.cc
Go to the documentation of this file.
1#include <iostream>
2#include <iomanip>
3
4#include "TRandom3.h"
5
7
8#include "Jeep/JParser.hh"
9#include "Jeep/JMessage.hh"
10
11
12/**
13 * \file
14 *
15 * Auxiliary program to print random a number according Poisson statistics or the Poisson probability.
16 * \author mdejong
17 */
18int main(int argc, char**argv)
19{
20 using namespace std;
21 using namespace JPP;
22
23 double value;
24 int n;
25 ULong_t seed;
26 int debug;
27
28 try {
29
30 JParser<> zap("Auxiliary program to print a random number according Poisson statistics or the Poisson probability."\
31 "\nIf the number of events is less than zero, the random number is printed, else the probability.");
32
33 zap['e'] = make_field(value, "expectation value");
34 zap['n'] = make_field(n, "number of events") = -1;
35 zap['S'] = make_field(seed) = 0;
36 zap['d'] = make_field(debug) = 3;
37
38 zap(argc, argv);
39 }
40 catch(const exception &error) {
41 FATAL(error.what() << endl);
42 }
43
44 if (n < 0) {
45
46 gRandom->SetSeed(seed);
47
48 cout << gRandom->Poisson(value) << endl;
49
50 } else {
51
52 cout << SCIENTIFIC(12,5) << poisson(n, value) << endl;
53 }
54}
Auxiliary methods for mathematics.
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
int main(int argc, char **argv)
Definition getPoisson.cc:18
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488