#include <IOMC/RandomEngine/src/RandomEngineStateProducer.h>
Public Member Functions | |
RandomEngineStateProducer (const edm::ParameterSet &) | |
~RandomEngineStateProducer () | |
Private Member Functions | |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Implementation: This simply copies from the cache in the service, does a small amount of formatting, and puts the object in the event. The cache is filled at the beginning of processing for each event by a call from the InputSource to the service. This module gets called later.
Definition at line 30 of file RandomEngineStateProducer.h.
RandomEngineStateProducer::RandomEngineStateProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
RandomEngineStateProducer::~RandomEngineStateProducer | ( | ) |
void RandomEngineStateProducer::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
void RandomEngineStateProducer::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 33 of file RandomEngineStateProducer.cc.
References edm::Service< T >::isAvailable(), edm::Event::put(), RandomEngineState::setLabel(), RandomEngineState::setSeed(), and RandomEngineState::setState().
00034 { 00035 std::auto_ptr<std::vector<RandomEngineState> > stateVector(new std::vector<RandomEngineState>); 00036 00037 edm::Service<edm::RandomNumberGenerator> randomService; 00038 if (randomService.isAvailable()) { 00039 00040 const std::vector<std::string>& strings = randomService->getCachedLabels(); 00041 const std::vector<std::vector<uint32_t> >& states = randomService->getCachedStates(); 00042 const std::vector<std::vector<uint32_t> >& seeds = randomService->getCachedSeeds(); 00043 00044 std::vector<std::string>::const_iterator iString = strings.begin(); 00045 std::vector<std::vector<uint32_t> >::const_iterator iState = states.begin(); 00046 std::vector<std::vector<uint32_t> >::const_iterator iSeed = seeds.begin(); 00047 00048 for ( ; iString != strings.end(); ++iString, ++iState, ++iSeed) { 00049 00050 RandomEngineState engineState; 00051 engineState.setLabel(*iString); 00052 engineState.setState(*iState); 00053 engineState.setSeed(*iSeed); 00054 stateVector->push_back(engineState); 00055 } 00056 00057 iEvent.put(stateVector); 00058 } 00059 }