FairRoot/PandaRoot
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 
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 
35 }
36 
38  return unif(innerGenerator);
39 }
40 
42  return unif(innerGenerator);
43 }
TLorentzVector s
Definition: Pnd2DStar.C:50