CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/GeneratorInterface/ThePEGInterface/src/RandomEngineGlue.cc

Go to the documentation of this file.
00001 #include <string>
00002 
00003 #include <CLHEP/Random/RandomEngine.h>
00004 
00005 #include <ThePEG/Interface/ClassDocumentation.h>
00006 #include <ThePEG/Interface/InterfacedBase.h>
00007 #include <ThePEG/Interface/Parameter.h>
00008 #include <ThePEG/Utilities/ClassTraits.h>
00009 
00010 #include <ThePEG/Repository/StandardRandom.h>
00011 
00012 #include "GeneratorInterface/Core/interface/RNDMEngineAccess.h"
00013 
00014 #include "GeneratorInterface/ThePEGInterface/interface/RandomEngineGlue.h"
00015 
00016 using namespace ThePEG;
00017 
00018 RandomEngineGlue::RandomEngineGlue() :
00019         randomEngine(&gen::getEngineReference())
00020 {
00021 }
00022 
00023 RandomEngineGlue::~RandomEngineGlue()
00024 {
00025 }
00026 
00027 void RandomEngineGlue::flush()
00028 {
00029         RandomGenerator::flush();
00030         gaussSaved = false;
00031 }
00032 
00033 void RandomEngineGlue::fill()
00034 {
00035         nextNumber = theNumbers.begin();
00036         for(RndVector::iterator it = nextNumber; it != theNumbers.end(); ++it)
00037                 *it = randomEngine->flat();
00038 }
00039 
00040 void RandomEngineGlue::setSeed(long seed)
00041 {
00042         // we ignore this, CMSSW overrides the seed from ThePEG
00043 }
00044 
00045 void RandomEngineGlue::doinit() throw(InitException)
00046 {
00047         RandomGenerator::doinit();
00048 
00049         boost::shared_ptr<Proxy> proxy = Proxy::find(proxyID);
00050         if (!proxy)
00051                 throw InitException();
00052 
00053         proxy->instance = this;
00054         flush();
00055 }
00056 
00057 ClassDescription<RandomEngineGlue> RandomEngineGlue::initRandomEngineGlue;
00058 
00059 void RandomEngineGlue::Init() {
00060         typedef Proxy::ProxyID ProxyID;
00061 
00062         static ClassDocumentation<RandomEngineGlue> documentation
00063                 ("Interface to the CMSSW RandomNumberEngine.");
00064         static Parameter<RandomEngineGlue, ProxyID> interfaceProxyID
00065                 ("ProxyID", "The ProxyID.",
00066                  &RandomEngineGlue::proxyID, ProxyID(),
00067                  ProxyID(), ProxyID(), false, false, false);
00068 
00069         interfaceProxyID.rank(11);
00070 }