Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
getPoisson.cc File Reference

Auxiliary program to print random a number according Poisson statistics or the Poisson probability. More...

#include <iostream>
#include <iomanip>
#include "TRandom3.h"
#include "JMath/JMathSupportkit.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

Auxiliary program to print random a number according Poisson statistics or the Poisson probability.

Author
mdejong

Definition in file getPoisson.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 18 of file getPoisson.cc.

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}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#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
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const int n
Definition JPolint.hh:791
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488