FairRoot/PandaRoot
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
pgenerators
chigen
ChiGenRandomEngine.cxx
Go to the documentation of this file.
1
/*
2
* @author Alexey Luchinsky
3
* @author Stanislav Poslavsky (stvlpos (at) mail.ru)
4
*/
5
6
#include "
ChiGenRandomEngine.h
"
7
8
#include <stdexcept>
9
#include <boost/random/mersenne_twister.hpp>
10
#include <boost/random/uniform_real_distribution.hpp>
11
12
namespace
{
16
boost::random::uniform_real_distribution<double> unif;
20
boost::random::mt19937_64 innerGenerator;
21
22
bool
instance_created =
false
;
23
}
24
25
chigen::ChiGenRandomEngine::ChiGenRandomEngine
(
long
s
) {
26
if
(instance_created)
27
throw
std::runtime_error(std::string(
"ChiGenRandomEngine should be only one per session."
));
28
instance_created =
true
;
29
seed
=
s
;
30
innerGenerator = boost::random::mt19937_64(
seed
);
31
unif = boost::random::uniform_real_distribution<double>(0, 1);
32
}
33
34
chigen::ChiGenRandomEngine::~ChiGenRandomEngine
() {
35
}
36
37
double
chigen::ChiGenRandomEngine::random
() {
38
return
unif(innerGenerator);
39
}
40
41
double
chigen::ChiGenRandomEngine::flat
() {
42
return
unif(innerGenerator);
43
}
s
TLorentzVector s
Definition:
Pnd2DStar.C:50
chigen::ChiGenRandomEngine::random
virtual double random()
Definition:
ChiGenRandomEngine.cxx:37
chigen::ChiGenRandomEngine::ChiGenRandomEngine
ChiGenRandomEngine(long seed=1L)
Definition:
ChiGenRandomEngine.cxx:25
chigen::ChiGenRandomEngine::~ChiGenRandomEngine
~ChiGenRandomEngine()
Definition:
ChiGenRandomEngine.cxx:34
ChiGenRandomEngine.h
chigen::ChiGenRandomEngine::seed
long seed
Definition:
ChiGenRandomEngine.h:52
chigen::ChiGenRandomEngine::flat
virtual double flat()
Definition:
ChiGenRandomEngine.cxx:41
Generated on Wed Apr 3 2019 08:43:49 for FairRoot/PandaRoot by
1.8.5