IOMC
RandomEngine
src
RandomEngineStateProducer.cc
Go to the documentation of this file.
1
2
#include "
IOMC/RandomEngine/src/RandomEngineStateProducer.h
"
3
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/Framework/interface/LuminosityBlock.h
"
6
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
7
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
8
#include "
FWCore/ServiceRegistry/interface/Service.h
"
9
#include "
FWCore/Utilities/interface/RandomNumberGenerator.h
"
10
#include "
SimDataFormats/RandomEngine/interface/RandomEngineStates.h
"
11
12
#include <memory>
13
14
RandomEngineStateProducer::RandomEngineStateProducer
(
edm::ParameterSet
const
&) {
15
produces<edm::RandomEngineStates, edm::Transition::BeginLuminosityBlock>(
"beginLumi"
);
16
produces<edm::RandomEngineStates>();
17
}
18
19
RandomEngineStateProducer::~RandomEngineStateProducer
() {}
20
21
void
RandomEngineStateProducer::produce
(
edm::StreamID
iID,
edm::Event
&
ev
,
edm::EventSetup
const
&)
const
{
22
edm::Service<edm::RandomNumberGenerator>
randomService;
23
if
(randomService.
isAvailable
()) {
24
auto
states = std::make_unique<edm::RandomEngineStates>();
25
states->setRandomEngineStates(randomService->
getEventCache
(
ev
.streamID()));
26
ev
.put(
std::move
(states));
27
}
28
}
29
30
void
RandomEngineStateProducer::globalBeginLuminosityBlockProduce
(
edm::LuminosityBlock
& lb,
31
edm::EventSetup
const
&)
const
{
32
edm::Service<edm::RandomNumberGenerator>
randomService;
33
if
(randomService.
isAvailable
()) {
34
auto
states = std::make_unique<edm::RandomEngineStates>();
35
states->setRandomEngineStates(randomService->
getLumiCache
(lb.
index
()));
36
lb.
put
(
std::move
(states),
"beginLumi"
);
37
}
38
}
39
40
void
RandomEngineStateProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
41
edm::ParameterSetDescription
desc;
42
descriptions.
add
(
"randomEngineStateProducer"
, desc);
43
}
ConfigurationDescriptions.h
edm::StreamID
Definition:
StreamID.h:30
RandomEngineStateProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
RandomEngineStateProducer.cc:40
edm::LuminosityBlock
Definition:
LuminosityBlock.h:50
LuminosityBlock.h
edm::LuminosityBlock::index
LuminosityBlockIndex index() const
Definition:
LuminosityBlock.cc:20
RandomNumberGenerator.h
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
edm::RandomNumberGenerator::getLumiCache
virtual std::vector< RandomEngineState > const & getLumiCache(LuminosityBlockIndex const &) const =0
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
RandomEngineStateProducer.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
Service.h
RandomEngineStateProducer::~RandomEngineStateProducer
~RandomEngineStateProducer() override
Definition:
RandomEngineStateProducer.cc:19
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
edm::RandomNumberGenerator::getEventCache
virtual std::vector< RandomEngineState > const & getEventCache(StreamID const &) const =0
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
edm::Service< edm::RandomNumberGenerator >
RandomEngineStates.h
edm::EventSetup
Definition:
EventSetup.h:57
edm::LuminosityBlock::put
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
LuminosityBlock.h:115
RandomEngineStateProducer::produce
void produce(edm::StreamID iID, edm::Event &ev, edm::EventSetup const &es) const override
Definition:
RandomEngineStateProducer.cc:21
RandomEngineStateProducer::globalBeginLuminosityBlockProduce
void globalBeginLuminosityBlockProduce(edm::LuminosityBlock &, edm::EventSetup const &) const override
Definition:
RandomEngineStateProducer.cc:30
eostools.move
def move(src, dest)
Definition:
eostools.py:511
RandomEngineStateProducer::RandomEngineStateProducer
RandomEngineStateProducer(edm::ParameterSet const &pset)
Definition:
RandomEngineStateProducer.cc:14
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16