CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

 RandomEngineStateProducer (edm::ParameterSet const &pset)
 
 ~RandomEngineStateProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (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)
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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.

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

Definition at line 18 of file RandomEngineStateProducer.cc.

18  {
19 }

Member Function Documentation

void RandomEngineStateProducer::beginLuminosityBlock ( edm::LuminosityBlock lb,
edm::EventSetup const &  es 
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 32 of file RandomEngineStateProducer.cc.

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

32  {
34  if (randomService.isAvailable()) {
35  std::auto_ptr<edm::RandomEngineStates> states(new edm::RandomEngineStates);
36  states->setRandomEngineStates(randomService->getLumiCache());
37  lb.put(states, "beginLumi");
38  }
39 }
virtual std::vector< RandomEngineState > const & getLumiCache() const =0
bool isAvailable() const
Definition: Service.h:47
void put(std::auto_ptr< PROD > product)
Put a new product.
void RandomEngineStateProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 42 of file RandomEngineStateProducer.cc.

References edm::ConfigurationDescriptions::add().

42  {
44  descriptions.add("randomEngineStateProducer", desc);
45 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void RandomEngineStateProducer::produce ( edm::Event ev,
edm::EventSetup const &  es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 22 of file RandomEngineStateProducer.cc.

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

22  {
24  if (randomService.isAvailable()) {
25  std::auto_ptr<edm::RandomEngineStates> states(new edm::RandomEngineStates);
26  states->setRandomEngineStates(randomService->getEventCache());
27  ev.put(states);
28  }
29 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool isAvailable() const
Definition: Service.h:47
virtual std::vector< RandomEngineState > const & getEventCache() const =0