1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include <string>
#include <CLHEP/Random/RandomEngine.h>
#include <ThePEG/Interface/ClassDocumentation.h>
#include <ThePEG/Interface/InterfacedBase.h>
#include <ThePEG/Interface/Parameter.h>
#include <ThePEG/Utilities/ClassTraits.h>
#include <ThePEG/Repository/StandardRandom.h>
#include "GeneratorInterface/Herwig7Interface/interface/RandomEngineGlue.h"
#include "FWCore/Utilities/interface/EDMException.h"
using namespace ThePEG;
RandomEngineGlue::RandomEngineGlue() : randomEngine(nullptr) {}
RandomEngineGlue::~RandomEngineGlue() {}
void RandomEngineGlue::flush() {
RandomGenerator::flush();
gaussSaved = false;
}
void RandomEngineGlue::fill() {
if (randomEngine == nullptr) {
throw edm::Exception(edm::errors::LogicError) << "The PEG code attempted to a generate random number while\n"
<< "the engine pointer was null. This might mean that the code\n"
<< "was tried to generate a random number outside the event and\n"
<< "beginLuminosityBlock methods, which is not allowed.\n";
}
nextNumber = theNumbers.begin();
for (RndVector::iterator it = nextNumber; it != theNumbers.end(); ++it)
*it = randomEngine->flat();
}
void RandomEngineGlue::setSeed(long seed) {
// we ignore this, CMSSW overrides the seed from ThePEG
}
void RandomEngineGlue::doinit() noexcept(false) {
RandomGenerator::doinit();
std::shared_ptr<Proxy> proxy = Proxy::find(proxyID);
if (!proxy)
throw InitException();
proxy->instance = this;
randomEngine = proxy->getRandomEngine();
flush();
}
ClassDescription<RandomEngineGlue> RandomEngineGlue::initRandomEngineGlue;
void RandomEngineGlue::Init() {
typedef Proxy::ProxyID ProxyID;
static ClassDocumentation<RandomEngineGlue> documentation("Interface to the CMSSW RandomNumberEngine.");
static Parameter<RandomEngineGlue, ProxyID> interfaceProxyID(
"ProxyID", "The ProxyID.", &RandomEngineGlue::proxyID, ProxyID(), ProxyID(), ProxyID(), false, false, false);
interfaceProxyID.rank(11);
}
|