16 #include "HepMC3/ReaderAscii.h"
17 #include "HepPID/ParticleName.hh"
25 std::cout <<
"Preparing reader " << std::flush;
26 HepMC3::ReaderAscii
reader(
"test.hepmc3");
27 if (simReader.
status(reader)) {
28 std::cout <<
"succesful" << std::endl;
30 std::cout <<
"failed" << std::endl;
33 std::shared_ptr<HepMC3::GenEvent> genevt(
new HepMC3::GenEvent());
35 std::cout <<
"Reading event " << std::flush;
36 if (simReader.
readEvent(reader, genevt)) {
37 std::cout <<
"succesful" << std::endl;
39 std::cout <<
"failed" << std::endl;
41 std::cout << std::endl;
45 std::cout <<
"Event data:" << std::endl;
46 std::cout <<
"Units: ";
48 std::cout <<
"[GEV], ";
50 std::cout <<
"[MeV], ";
52 std::cout <<
"[mm]" << std::endl;
54 std::cout <<
"[cm]" << std::endl;
56 std::cout <<
"Event position: " << evtPos(0) <<
", " << evtPos(1) <<
", "
57 << evtPos(2) << std::endl;
58 std::cout <<
"Event time: " << simEvent.
eventTime(genevt) << std::endl;
60 std::cout <<
"Beam particles: ";
61 std::vector<std::unique_ptr<ActsExamples::SimParticle>>
beam =
62 simEvent.
beams(genevt);
64 std::cout <<
"none" << std::endl;
66 for (
auto& pbeam : beam)
67 std::cout << HepPID::particleName(pbeam->pdg()) <<
" ";
68 std::cout << std::endl;
71 std::cout << std::endl <<
"Vertices: ";
72 std::vector<std::unique_ptr<ActsExamples::SimVertex>> vertices =
75 std::cout <<
"none" << std::endl;
77 std::cout << std::endl;
78 for (
auto& vertex : vertices) {
79 for (
auto&
particle : vertex->incoming)
80 std::cout << HepPID::particleName(
particle.pdg()) <<
" ";
82 for (
auto&
particle : vertex->outgoing)
83 std::cout << HepPID::particleName(
particle.pdg()) <<
" ";
84 std::cout <<
"\t@(" << vertex->time() <<
", " << vertex->position()(0)
85 <<
", " << vertex->position()(1) <<
", "
86 << vertex->position()(2) <<
")" << std::endl;
88 std::cout << std::endl;
91 std::cout <<
"Total particle record:" << std::endl;
92 std::vector<std::unique_ptr<ActsExamples::SimParticle>> particles =
95 std::cout << HepPID::particleName(
particle->pdg())
96 <<
"\tID:" <<
particle->particleId() <<
", momentum: ("
99 <<
"), mass: " <<
particle->mass() << std::endl;
101 std::cout << std::endl <<
"Initial to final state: ";
102 std::vector<std::unique_ptr<ActsExamples::SimParticle>> fState =
104 for (
auto& pbeam : beam)
105 std::cout << HepPID::particleName(pbeam->pdg()) <<
" ";
107 for (
auto&
fs : fState)
108 std::cout << HepPID::particleName(
fs->pdg()) <<
" ";
109 std::cout << std::endl;