CMS 3D CMS Logo

RandomEngineStateProducer Class Reference

Description: Gets the state of the random number engines from the related service and stores it in the event. More...

#include <IOMC/RandomEngine/src/RandomEngineStateProducer.h>

Inheritance diagram for RandomEngineStateProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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 &)


Detailed Description

Description: Gets the state of the random number engines from the related service and stores it in the event.

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.


Constructor & Destructor Documentation

RandomEngineStateProducer::RandomEngineStateProducer ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 20 of file RandomEngineStateProducer.cc.

00021 {
00022   //register your products
00023   produces<std::vector<RandomEngineState> >();
00024 }

RandomEngineStateProducer::~RandomEngineStateProducer (  ) 

Definition at line 27 of file RandomEngineStateProducer.cc.

00028 {
00029 }


Member Function Documentation

void RandomEngineStateProducer::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 63 of file RandomEngineStateProducer.cc.

00064 {
00065 }

void RandomEngineStateProducer::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 69 of file RandomEngineStateProducer.cc.

00070 {
00071 }

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 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:37 2009 for CMSSW by  doxygen 1.5.4