#include #include #include "TRandom3.h" #include "JMath/JMathSupportkit.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to print random a number according Poisson statistics or the Poisson probability. * \author mdejong */ int main(int argc, char**argv) { using namespace std; using namespace JPP; double value; int n; UInt_t seed; int debug; try { JParser<> zap("Auxiliary program to print a random number according Poisson statistics or the Poisson probability."\ "\nIf the number of events is less than zero, the random number is printed, else the probability."); zap['e'] = make_field(value, "expectation value"); zap['n'] = make_field(n, "number of events") = -1; zap['S'] = make_field(seed) = 0; zap['d'] = make_field(debug) = 3; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } if (n < 0) { gRandom->SetSeed(seed); cout << gRandom->Poisson(value) << endl; } else { cout << SCIENTIFIC(12,5) << poisson(n, value) << endl; } }