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  theEvent(0)
26 {
27  //register your products
28  produces<edm::HepMCProduct>();
29 
30  //now do what ever other initialization is needed
31 }
32 
33 
35 {
36  // no need to cleanup theEvent since it's done in HepMCProduct
37 }
38 
39 // ------------ method called to produce the event ------------
41 {
42  // create the event
43  theEvent = new HepMC::GenEvent();
44 
45  // create a primary vertex
46  HepMC::GenVertex * theVtx = new HepMC::GenVertex(HepMC::FourVector(0.,0.,0.));
47 
48  // add a particle to the vertex; this is needed to avoid crashes in OscarProducer. Use a
49  // electron neutrino, with zero energy and mass
50  HepMC::GenParticle * theParticle = new HepMC::GenParticle(HepMC::FourVector(0.,0.,0.,0.),12,1);
51 
52  theVtx->add_particle_out(theParticle);
53 
54  // add the vertex to the event
55  theEvent->add_vertex(theVtx);
56 
57  // set the event number
58  theEvent->set_event_number(event());
59  // set the signal process id
60  theEvent->set_signal_process_id(20);
61 
62  // create an empty output collection
63  std::auto_ptr<edm::HepMCProduct> theOutput(new edm::HepMCProduct());
64  theOutput->addHepMCData(theEvent);
65 
66  // put the output to the event
67  iEvent.put(theOutput);
68 
69  return true;
70 }
71 
72 //define this as a plug-in
73 
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:85
~LaserAlignmentSource()
destructor