CMS 3D CMS Logo

LaserAlignmentProducer.cc
Go to the documentation of this file.
1 
11 // system include files
13 
14 // user include files
17 
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 
31  // no need to cleanup theEvent since it's done in HepMCProduct
32 }
33 
34 // ------------ method called to produce the event ------------
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 
void produce(edm::Event &, const edm::EventSetup &) override
produce the HepMCProduct
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int iEvent
Definition: GenABIO.cc:224
~LaserAlignmentProducer() override
destructor
LaserAlignmentProducer(const edm::ParameterSet &)
constructor
def move(src, dest)
Definition: eostools.py:511