IOMC
EventVertexGenerators
src
PassThroughEvtVtxGenerator.cc
Go to the documentation of this file.
1
2
/*
3
*/
4
5
#include "
IOMC/EventVertexGenerators/interface/PassThroughEvtVtxGenerator.h
"
6
7
#include "
FWCore/Framework/interface/Event.h
"
8
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
9
10
#include "
SimDataFormats/GeneratorProducts/interface/HepMCProduct.h
"
11
#include "
SimDataFormats/GeneratorProducts/interface/HepMCProduct.h
"
12
13
#include "
FWCore/ServiceRegistry/interface/Service.h
"
14
#include "
FWCore/Utilities/interface/RandomNumberGenerator.h
"
15
16
#include "
FWCore/Utilities/interface/Exception.h
"
17
18
#include "
DataFormats/Provenance/interface/Provenance.h
"
19
#include "
FWCore/Utilities/interface/EDMException.h
"
20
21
//#include "HepMC/GenEvent.h"
22
// #include "CLHEP/Vector/ThreeVector.h"
23
// #include "HepMC/SimpleVector.h"
24
25
using namespace
edm
;
26
using namespace
CLHEP
;
27
//using namespace HepMC;
28
29
PassThroughEvtVtxGenerator::PassThroughEvtVtxGenerator
(
const
ParameterSet
&
pset
) :
BaseEvtVtxGenerator
(
pset
) {
30
Service<RandomNumberGenerator>
rng;
31
if
(!rng.
isAvailable
()) {
32
throw
cms::Exception
(
"Configuration"
)
33
<<
"The PassThroughEvtVtxGenerator requires the RandomNumberGeneratorService\n"
34
"which is not present in the configuration file. \n"
35
"You must add the service\n"
36
"in the configuration file or remove the modules that require it."
;
37
}
38
sourceToken
= consumes<edm::HepMCProduct>(
pset
.getParameter<
edm::InputTag
>(
"src"
));
39
}
40
41
PassThroughEvtVtxGenerator::~PassThroughEvtVtxGenerator
() {}
42
43
HepMC::FourVector
PassThroughEvtVtxGenerator::newVertex
(CLHEP::HepRandomEngine*)
const
{
44
return
HepMC::FourVector(0., 0., 0., 0);
45
}
46
47
void
PassThroughEvtVtxGenerator::produce
(
Event
& evt,
const
EventSetup
&) {
48
edm::Service<edm::RandomNumberGenerator>
rng;
49
50
Handle<HepMCProduct>
HepUnsmearedMCEvt;
51
52
evt.
getByToken
(
sourceToken
, HepUnsmearedMCEvt);
53
54
// Copy the HepMC::GenEvent
55
HepMC::GenEvent
* genevt =
new
HepMC::GenEvent
(*HepUnsmearedMCEvt->
GetEvent
());
56
std::unique_ptr<edm::HepMCProduct> HepMCEvt(
new
edm::HepMCProduct
(genevt));
57
58
evt.
put
(
std::move
(HepMCEvt));
59
60
return
;
61
}
edm
HLT enums.
Definition:
AlignableModifier.h:19
RandomNumberGenerator.h
PassThroughEvtVtxGenerator.h
edm::Handle
Definition:
AssociativeIterator.h:50
edm::Service::isAvailable
bool isAvailable() const
Definition:
Service.h:40
HepMC::GenEvent
Definition:
hepmc_rootio.cc:9
EDMException.h
Service.h
Provenance.h
PassThroughEvtVtxGenerator::PassThroughEvtVtxGenerator
PassThroughEvtVtxGenerator(const edm::ParameterSet &)
Definition:
PassThroughEvtVtxGenerator.cc:29
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:539
PassThroughEvtVtxGenerator::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
PassThroughEvtVtxGenerator.cc:47
CLHEP
Definition:
CocoaGlobals.h:27
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
edm::Service
Definition:
Service.h:30
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:133
edm::EventSetup
Definition:
EventSetup.h:58
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition:
HepMCProduct.h:37
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Exception
Definition:
hltDiff.cc:245
PassThroughEvtVtxGenerator::~PassThroughEvtVtxGenerator
~PassThroughEvtVtxGenerator() override
Definition:
PassThroughEvtVtxGenerator.cc:41
Exception.h
PassThroughEvtVtxGenerator::sourceToken
edm::EDGetTokenT< edm::HepMCProduct > sourceToken
Definition:
PassThroughEvtVtxGenerator.h:34
edm::HepMCProduct
Definition:
HepMCProduct.h:21
ParameterSet.h
HepMCProduct.h
PassThroughEvtVtxGenerator::newVertex
HepMC::FourVector newVertex(CLHEP::HepRandomEngine *) const override
Definition:
PassThroughEvtVtxGenerator.cc:43
edm::Event
Definition:
Event.h:73
BaseEvtVtxGenerator
Definition:
BaseEvtVtxGenerator.h:23
edm::InputTag
Definition:
InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
Generated for CMSSW Reference Manual by
1.8.16