11 #include <Pythia8/Pythia.h>
17 struct FrameworkRndmEngine :
public Pythia8::RndmEngine {
22 return std::uniform_real_distribution<double>(0.0, 1.0)(rng);
30 auto gen = std::make_shared<Pythia8Generator>(cfg, lvl);
40 m_pythia8->settings.flag(
"Print:quiet",
true);
47 m_pythia8->settings.mode(
"Beams:frameType", 1);
58 using namespace Acts::UnitLiterals;
61 std::vector<SimVertex> vertices = {
66 std::lock_guard<std::mutex> lock(m_pythia8Mutex);
68 FrameworkRndmEngine rndmEngine(rng);
69 m_pythia8->rndm.rndmEnginePtr(&rndmEngine);
73 for (
int ip = 0; ip < m_pythia8->event.size(); ++ip) {
74 const auto& genParticle = m_pythia8->event[ip];
77 if (genParticle.statusHepMC() == 4) {
81 if (not genParticle.isFinal()) {
84 if (not genParticle.isVisible()) {
90 genParticle.xProd() * 1
_mm, genParticle.yProd() * 1
_mm,
91 genParticle.zProd() * 1
_mm, genParticle.tProd() * 1
_mm);
93 std::vector<SimVertex>::iterator vertex;
94 if (not genParticle.hasVertex()) {
96 vertex = vertices.begin();
100 vertex = std::find_if(
101 vertices.begin(), vertices.end(),
102 [=](
const SimVertex&
v) {
return (
v.position4 == pos4); });
103 if (vertex == vertices.end()) {
105 vertices.emplace_back(pos4);
106 vertex = std::prev(vertices.end());
108 ACTS_VERBOSE(
"created new secondary vertex " << pos4.transpose());
123 genParticle.m0() * 1
_GeV);
126 particle.setDirection(genParticle.px(), genParticle.py(), genParticle.pz());
128 std::hypot(genParticle.px(), genParticle.py(), genParticle.pz()) *
131 vertex->outgoing.push_back(std::move(
particle));