StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testPrintBug.cc
1 //
2 // Thanks to Bob McElrath and Frank Siegert for this test
3 //
4 
5 #include <fstream>
6 
7 #include "HepMC/GenEvent.h"
8 #include "HepMC/SimpleVector.h"
9 
10 int main()
11 {
12  HepMC::GenEvent* p_event;
13 
14  p_event = new HepMC::GenEvent();
15  p_event->use_units(HepMC::Units::GEV, HepMC::Units::MM);
16 
17  // define an output stream
18  std::ofstream os( "testPrintBug.out" );
19 
20  for(int i=0; i<10; i++) {
21  HepMC::FourVector vector(1.0,1.0,1.0,1.0);
22  HepMC::GenVertex* vertex = new HepMC::GenVertex(vector,i);
23  for(int j=0; j<3; j++) {
24  HepMC::GenParticle* particle = new HepMC::GenParticle(vector,1,2);
25  vertex->add_particle_in(particle);
26  }
27  for(int j=0; j<3; j++) {
28  HepMC::GenParticle* particle = new HepMC::GenParticle(vector,1,2);
29  vertex->add_particle_out(particle);
30  }
31  p_event->add_vertex(vertex);
32  }
33  p_event->print(os);
34  // cleanup
35  delete p_event;
36  return 0;
37 }
void add_particle_in(GenParticle *inparticle)
add incoming particle
Definition: GenVertex.cc:273
GenVertex contains information about decay vertices.
Definition: GenVertex.h:52
The GenEvent class is the core of HepMC.
Definition: GenEvent.h:155
void add_particle_out(GenParticle *outparticle)
add outgoing particle
Definition: GenVertex.cc:284
bool add_vertex(GenVertex *vtx)
adds to evt and adopts
Definition: GenEvent.cc:334
void print(std::ostream &ostr=std::cout) const
dumps to ostr
Definition: GenEvent.cc:277
FourVector is a simple representation of a physics 4 vector.
Definition: SimpleVector.h:42
void use_units(Units::MomentumUnit, Units::LengthUnit)
Definition: GenEvent.h:856
The GenParticle class contains information about generated particles.
Definition: GenParticle.h:60