HepMC3 event record library
testPrintBug.cc
1 //
2 // Thanks to Bob McElrath and Frank Siegert for this test
3 // andrii.verbytskyi@mpp.mpg.gov, Nov. 2018
4 
5 #include <fstream>
6 
7 #include "HepMC3/GenEvent.h"
8 #include "HepMC3/GenParticle.h"
9 #include "HepMC3/GenVertex.h"
10 #include "HepMC3/Print.h"
11 using namespace HepMC3;
12 int main()
13 {
14  GenEvent p_event(Units::GEV, Units::MM);
15  for(int i=0; i<10; i++)
16  {
17  FourVector vector(1.0,1.0,1.0,1.0);
18  GenVertexPtr vertex=std::make_shared<GenVertex>();
19  vertex->set_position(vector);
20  vertex->set_id(i);
21  for(int j=0; j<3; j++)
22  {
23  GenParticlePtr particle = std::make_shared<GenParticle>(vector,1,2);
24  vertex->add_particle_in(particle);
25  }
26  for(int j=0; j<3; j++)
27  {
28  GenParticlePtr particle = std::make_shared<GenParticle>(vector,1,2);
29  vertex->add_particle_out(particle);
30  }
31  p_event.add_vertex(vertex);
32  }
33  Print::listing(p_event);
34  // cleanup
35  p_event.clear();
36  return 0;
37 }
Definition of class GenParticle.
Definition of class GenVertex.
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
Definition: Print.cc:51
Stores event-related information.
Definition: GenEvent.h:42
Generic 4-vector.
Definition: FourVector.h:34
int main(int argc, char **argv)
Definition of class GenEvent.