Jpp
18.0.0-rc.3
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JMath
getPoisson.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
4
#include "TRandom3.h"
5
6
#include "
JMath/JMathSupportkit.hh
"
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
*/
18
int
main
(
int
argc,
char
**argv)
19
{
20
using namespace
std;
21
using namespace
JPP;
22
23
double
value;
24
int
n
;
25
UInt_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
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JMathSupportkit.hh
Auxiliary methods for mathematics.
JTOOLS::n
const int n
Definition:
JPolint.hh:697
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JMATH::poisson
double poisson(const size_t n, const double mu)
Poisson probability density distribition.
Definition:
JMath/JMathSupportkit.hh:248
SCIENTIFIC
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:484
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
Generated by
1.8.5