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"
9#include "HepMC3/GenVertex.h"
10#include "HepMC3/Print.h"
11#include "HepMC3/PrintStreams.h"
12using namespace HepMC3;
13int 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 GenEvent.
Definition of class GenParticle.
Definition of class GenVertex.
Implementation of ostreams for the objects.
Definition of static class Print.
Generic 4-vector.
Definition: FourVector.h:36
Stores event-related information.
Definition: GenEvent.h:41
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.
Definition: Print.cc:17
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
Definition: Print.cc:50
HepMC3 main namespace.