CMS 3D CMS Logo

RandomEngineGlue.cc
Go to the documentation of this file.
1 #include <string>
2 
3 #include <CLHEP/Random/RandomEngine.h>
4 
5 #include <ThePEG/Interface/ClassDocumentation.h>
6 #include <ThePEG/Interface/InterfacedBase.h>
7 #include <ThePEG/Interface/Parameter.h>
8 #include <ThePEG/Utilities/ClassTraits.h>
9 
10 #include <ThePEG/Repository/StandardRandom.h>
11 
13 
15 
16 using namespace ThePEG;
17 
20 {
21 }
22 
24 {
25 }
26 
28 {
29  RandomGenerator::flush();
30  gaussSaved = false;
31 }
32 
34 {
35  if(randomEngine == nullptr) {
37  << "The PEG code attempted to a generate random number while\n"
38  << "the engine pointer was null. This might mean that the code\n"
39  << "was tried to generate a random number outside the event and\n"
40  << "beginLuminosityBlock methods, which is not allowed.\n";
41  }
42  nextNumber = theNumbers.begin();
43  for(RndVector::iterator it = nextNumber; it != theNumbers.end(); ++it)
44  *it = randomEngine->flat();
45 }
46 
48 {
49  // we ignore this, CMSSW overrides the seed from ThePEG
50 }
51 
53 {
54  RandomGenerator::doinit();
55 
56  boost::shared_ptr<Proxy> proxy = Proxy::find(proxyID);
57  if (!proxy)
58  throw InitException();
59 
60  proxy->instance = this;
61  randomEngine = proxy->getRandomEngine();
62  flush();
63 }
64 
65 ClassDescription<RandomEngineGlue> RandomEngineGlue::initRandomEngineGlue;
66 
68  typedef Proxy::ProxyID ProxyID;
69 
70  static ClassDocumentation<RandomEngineGlue> documentation
71  ("Interface to the CMSSW RandomNumberEngine.");
72  static Parameter<RandomEngineGlue, ProxyID> interfaceProxyID
73  ("ProxyID", "The ProxyID.",
74  &RandomEngineGlue::proxyID, ProxyID(),
75  ProxyID(), ProxyID(), false, false, false);
76 
77  interfaceProxyID.rank(11);
78 }
CLHEP::HepRandomEngine * randomEngine
Definition: Dummies.cc:7
#define noexcept
#define nullptr
void setSeed(long seed) override
void doinit() noexcept(false) override
static boost::shared_ptr< Proxy > find(ProxyID id)
Definition: Proxy.h:46
unsigned long ProxyID
Definition: Proxy.h:16
CLHEP::HepRandomEngine * randomEngine
static ClassDescription< RandomEngineGlue > initRandomEngineGlue