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 #include "HepMC3/PrintStreams.h"
12 using namespace HepMC3;
13 int main()
14 {
15  GenEvent p_event(Units::GEV, Units::MM);
16  for(int i=0; i<10; i++)
17  {
18  FourVector vector(1.0,1.0,1.0,1.0);
19  GenVertexPtr vertex=std::make_shared<GenVertex>();
20  vertex->set_position(vector);
21  vertex->set_id(i);
22  for(int j=0; j<3; j++)
23  {
24  GenParticlePtr particle = std::make_shared<GenParticle>(vector,1,2);
25  vertex->add_particle_in(particle);
26  }
27  for(int j=0; j<3; j++)
28  {
29  GenParticlePtr particle = std::make_shared<GenParticle>(vector,1,2);
30  vertex->add_particle_out(particle);
31  }
32  p_event.add_vertex(vertex);
33  }
34  Print::listing(p_event);
35  //
36  Print::content(p_event);
37  std::cout<<p_event;
38  // cleanup
39  p_event.clear();
40  return 0;
41 }
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:50
Stores event-related information.
Definition: GenEvent.h:41
Generic 4-vector.
Definition: FourVector.h:35
int main(int argc, char **argv)
Definition of class GenEvent.
Implementation of ostreams for the objects.
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.
Definition: Print.cc:17