CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LaserAlignmentSource.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  const edm::InputSourceDescription& iDescription) :
24  GeneratedInputSource(iConfig, iDescription)
25 {
26  //register your products
27  produces<edm::HepMCProduct>();
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(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  return true;
69 }
70 
71 //define this as a plug-in
72 
HepMC::GenEvent * theEvent
LaserAlignmentSource(const edm::ParameterSet &, const edm::InputSourceDescription &)
constructor
virtual bool produce(edm::Event &)
produce the HepMCProduct
int iEvent
Definition: GenABIO.cc:243
#define DEFINE_FWK_INPUT_SOURCE(type)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
~LaserAlignmentSource()
destructor