test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LaserAlignmentProducer.cc
Go to the documentation of this file.
1 
10 // system include files
12 
13 // user include files
16 
18 
19 //
20 // constructors and destructor
21 //
23  EDProducer(),
24  theEvent(0)
25 {
26  //register your products
27  produces<edm::HepMCProduct>("unsmeared");
28 
29  //now do what ever other initialization is needed
30 }
31 
32 
34 {
35  // no need to cleanup theEvent since it's done in HepMCProduct
36 }
37 
38 // ------------ method called to produce the event ------------
40 {
41  // create the event
42  theEvent = new HepMC::GenEvent();
43 
44  // create a primary vertex
45  HepMC::GenVertex * theVtx = new HepMC::GenVertex(HepMC::FourVector(0.,0.,0.));
46 
47  // add a particle to the vertex; this is needed to avoid crashes in OscarProducer. Use a
48  // electron neutrino, with zero energy and mass
49  HepMC::GenParticle * theParticle = new HepMC::GenParticle(HepMC::FourVector(0.,0.,0.,0.),12,1);
50 
51  theVtx->add_particle_out(theParticle);
52 
53  // add the vertex to the event
54  theEvent->add_vertex(theVtx);
55 
56  // set the event number
57  theEvent->set_event_number(iEvent.id().event());
58  // set the signal process id
59  theEvent->set_signal_process_id(20);
60 
61  // create an empty output collection
62  std::auto_ptr<edm::HepMCProduct> theOutput(new edm::HepMCProduct());
63  theOutput->addHepMCData(theEvent);
64 
65  // put the output to the event
66  iEvent.put(theOutput);
67 }
68 
69 //define this as a plug-in
70 
EventNumber_t event() const
Definition: EventID.h:41
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
virtual void produce(edm::Event &, const edm::EventSetup &)
produce the HepMCProduct
edm::EventID id() const
Definition: EventBase.h:59
LaserAlignmentProducer(const edm::ParameterSet &)
constructor