CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/GeneratorInterface/Core/src/RNDMEngineAccess.cc

Go to the documentation of this file.
00001 #include "FWCore/ServiceRegistry/interface/Service.h"
00002 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00003 #include "FWCore/Utilities/interface/Exception.h"
00004 
00005 #include "GeneratorInterface/Core/interface/RNDMEngineAccess.h"
00006 
00007 using namespace gen;
00008 
00009 CLHEP::HepRandomEngine& gen::getEngineReference()
00010 {
00011    edm::Service<edm::RandomNumberGenerator> rng;
00012    if(!rng.isAvailable()) {
00013     throw cms::Exception("Configuration")
00014        << "The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
00015           "which appears to be absent.  Please add that service to your configuration\n"
00016           "or remove the modules that require it." << std::endl;
00017    }
00018 
00019 // The Service has already instantiated an engine.  Make contact with it.
00020    return rng->getEngine();
00021 }