19 #include <HepMC3/GenEvent.h>
20 #include <HepMC3/ReaderAscii.h>
25 int main(
int argc,
char** argv) {
41 std::cout <<
"Preparing reader " <<
std::flush;
42 HepMC3::ReaderAscii
reader(
"test.hepmc3");
43 if (simReader.
status(reader)) {
44 std::cout <<
"successful" << std::endl;
46 std::cout <<
"failed" << std::endl;
49 HepMC3::GenEvent genevt;
52 if (simReader.
readEvent(reader, genevt)) {
53 std::cout <<
"successful" << std::endl;
55 std::cout <<
"failed" << std::endl;
57 std::cout << std::endl;
59 using namespace ActsExamples::HepMC3Event;
60 std::cout <<
"Event data:" << std::endl;
61 std::cout <<
"Units: ";
63 std::cout <<
"[GEV], ";
65 std::cout <<
"[MeV], ";
68 std::cout <<
"[mm]" << std::endl;
70 std::cout <<
"[cm]" << std::endl;
73 std::cout <<
"Event position: " << evtPos(0) <<
", " << evtPos(1) <<
", "
74 << evtPos(2) << std::endl;
75 std::cout <<
"Event time: " <<
eventTime(genevt) << std::endl;
77 std::cout <<
"Beam particles: ";
78 std::vector<ActsExamples::SimParticle> beam =
beams(genevt);
80 std::cout <<
"none" << std::endl;
82 for (
auto& pbeam : beam) {
83 std::cout << Acts::findName(static_cast<Acts::PdgParticle>(pbeam.pdg()))
87 std::cout << std::endl;
90 std::cout << std::endl <<
"Vertices: ";
91 std::vector<std::unique_ptr<ActsExamples::SimVertex>>
vertices =
94 std::cout <<
"none" << std::endl;
96 std::cout << std::endl;
100 static_cast<Acts::PdgParticle>(
particle.pdg()))
107 static_cast<Acts::PdgParticle>(
particle.pdg()))
111 std::cout <<
"\t@(" <<
vertex->time() <<
", " <<
vertex->position()(0)
112 <<
", " <<
vertex->position()(1) <<
", "
113 <<
vertex->position()(2) <<
")" << std::endl;
115 std::cout << std::endl;
118 std::cout <<
"Total particle record:" << std::endl;
119 std::vector<ActsExamples::SimParticle>
particles =
122 std::cout << Acts::findName(static_cast<Acts::PdgParticle>(
particle.pdg()))
124 <<
"\tID:" <<
particle.particleId() <<
", momentum: ("
125 <<
particle.fourMomentum()(0) <<
", "
126 <<
particle.fourMomentum()(1) <<
", "
131 std::cout << std::endl <<
"Initial to final state: ";
132 std::vector<ActsExamples::SimParticle> fState =
finalState(genevt);
133 for (
auto& pbeam : beam) {
134 std::cout << Acts::findName(static_cast<Acts::PdgParticle>(pbeam.pdg()))
139 for (
auto&
fs : fState) {
140 std::cout << Acts::findName(static_cast<Acts::PdgParticle>(
fs.pdg()))
144 std::cout << std::endl;