Alignment
LaserAlignmentSimulation
plugins
LaserAlignmentProducer.cc
Go to the documentation of this file.
1
11
// system include files
12
#include "
FWCore/Framework/interface/Event.h
"
13
14
// user include files
15
#include "
Alignment/LaserAlignmentSimulation/plugins/LaserAlignmentProducer.h
"
16
#include "
FWCore/Framework/interface/MakerMacros.h
"
17
18
#include "
SimDataFormats/GeneratorProducts/interface/HepMCProduct.h
"
19
20
//
21
// constructors and destructor
22
//
23
LaserAlignmentProducer::LaserAlignmentProducer
(
const
edm::ParameterSet
&) : EDProducer(), theEvent(nullptr) {
24
// register your products
25
produces<edm::HepMCProduct>(
"unsmeared"
);
26
27
// now do what ever other initialization is needed
28
}
29
30
LaserAlignmentProducer::~LaserAlignmentProducer
() {
31
// no need to cleanup theEvent since it's done in HepMCProduct
32
}
33
34
// ------------ method called to produce the event ------------
35
void
LaserAlignmentProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
&) {
36
// create the event
37
theEvent
=
new
HepMC::GenEvent
();
38
39
// create a primary vertex
40
HepMC::GenVertex *theVtx =
new
HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
41
42
// add a particle to the vertex; this is needed to avoid crashes in
43
// OscarProducer. Use a electron neutrino, with zero energy and mass
44
HepMC::GenParticle
*theParticle =
new
HepMC::GenParticle
(HepMC::FourVector(0., 0., 0., 0.), 12, 1);
45
46
theVtx->add_particle_out(theParticle);
47
48
// add the vertex to the event
49
theEvent
->add_vertex(theVtx);
50
51
// set the event number
52
theEvent
->set_event_number(
iEvent
.id().event());
53
// set the signal process id
54
theEvent
->set_signal_process_id(20);
55
56
// create an empty output collection
57
auto
theOutput = std::make_unique<edm::HepMCProduct>();
58
theOutput->addHepMCData(
theEvent
);
59
60
// put the output to the event
61
iEvent
.put(
std::move
(theOutput));
62
}
63
64
// define this as a plug-in
65
66
DEFINE_FWK_MODULE
(
LaserAlignmentProducer
);
LaserAlignmentProducer
Definition:
LaserAlignmentProducer.h:27
LaserAlignmentProducer.h
LaserAlignmentProducer::LaserAlignmentProducer
LaserAlignmentProducer(const edm::ParameterSet &)
constructor
Definition:
LaserAlignmentProducer.cc:23
HepMC::GenEvent
Definition:
hepmc_rootio.cc:9
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
LaserAlignmentProducer::~LaserAlignmentProducer
~LaserAlignmentProducer() override
destructor
Definition:
LaserAlignmentProducer.cc:30
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:58
GenParticle.GenParticle
GenParticle
Definition:
GenParticle.py:18
eostools.move
def move(src, dest)
Definition:
eostools.py:511
LaserAlignmentProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
produce the HepMCProduct
Definition:
LaserAlignmentProducer.cc:35
LaserAlignmentProducer::theEvent
HepMC::GenEvent * theEvent
Definition:
LaserAlignmentProducer.h:39
HepMCProduct.h
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16