CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions

RandomEngineStateProducer Class Reference

#include <RandomEngineStateProducer.h>

Inheritance diagram for RandomEngineStateProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 RandomEngineStateProducer (edm::ParameterSet const &pset)
 ~RandomEngineStateProducer ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock &lb, edm::EventSetup const &es)
virtual void produce (edm::Event &ev, edm::EventSetup const &es)

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 and puts the product in the Event and LuminosityBlock. The cache is filled at the beginning of processing for eac event or lumi by a call from the InputSource to the service. This module gets called later.

Author:
W. David Dagenhart, created October 4, 2006 (originally in FWCore/Services)

Definition at line 28 of file RandomEngineStateProducer.h.


Constructor & Destructor Documentation

RandomEngineStateProducer::RandomEngineStateProducer ( edm::ParameterSet const &  pset) [explicit]

Definition at line 13 of file RandomEngineStateProducer.cc.

                                                                                {
  produces<edm::RandomEngineStates, edm::InLumi>("beginLumi");
  produces<edm::RandomEngineStates>();
}
RandomEngineStateProducer::~RandomEngineStateProducer ( )

Definition at line 18 of file RandomEngineStateProducer.cc.

                                                      {
}

Member Function Documentation

void RandomEngineStateProducer::beginLuminosityBlock ( edm::LuminosityBlock lb,
edm::EventSetup const &  es 
) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 32 of file RandomEngineStateProducer.cc.

References edm::Service< T >::isAvailable(), and edm::LuminosityBlock::put().

                                                                                               {
  edm::Service<edm::RandomNumberGenerator> randomService;
  if (randomService.isAvailable()) {
    std::auto_ptr<edm::RandomEngineStates> states(new edm::RandomEngineStates);
    states->setRandomEngineStates(randomService->getLumiCache());
    lb.put(states, "beginLumi");
  }
}
void RandomEngineStateProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDProducer.

Definition at line 42 of file RandomEngineStateProducer.cc.

References edm::ConfigurationDescriptions::add().

                                                                                      {
  edm::ParameterSetDescription desc;
  descriptions.add("randomEngineStateProducer", desc);
}
void RandomEngineStateProducer::produce ( edm::Event ev,
edm::EventSetup const &  es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 22 of file RandomEngineStateProducer.cc.

References edm::Service< T >::isAvailable(), and edm::Event::put().

                                                                        {
  edm::Service<edm::RandomNumberGenerator> randomService;
  if (randomService.isAvailable()) {
    std::auto_ptr<edm::RandomEngineStates> states(new edm::RandomEngineStates);
    states->setRandomEngineStates(randomService->getEventCache());
    ev.put(states);
  }
}