21 #include <Pythia8/Pythia.h>
24 struct FrameworkRndmEngine :
public Pythia8::RndmEngine {
28 double flat()
override {
29 return std::uniform_real_distribution<double>(0.0, 1.0)(
rng);
38 m_pythia8(std::make_unique<
Pythia8::Pythia>(
"",
false)) {
40 m_pythia8->settings.flag(
"Print:quiet",
true);
47 m_pythia8->settings.mode(
"Beams:frameType", 1);
58 using namespace Acts::UnitLiterals;
60 SimParticleContainer::sequence_type generated;
61 std::vector<SimParticle::Vector4> vertexPositions;
64 std::lock_guard<std::mutex> lock(m_pythia8Mutex);
66 #if PYTHIA_VERSION_INTEGER >= 8310
67 m_pythia8->rndm.rndmEnginePtr(std::make_shared<FrameworkRndmEngine>(rng));
69 FrameworkRndmEngine rndmEngine(rng);
70 m_pythia8->rndm.rndmEnginePtr(&rndmEngine);
77 if (
m_cfg.printShortEventListing) {
78 m_pythia8->process.list();
80 if (
m_cfg.printLongEventListing) {
81 m_pythia8->event.list();
85 for (
int ip = 0; ip < m_pythia8->event.size(); ++ip) {
86 const auto& genParticle = m_pythia8->event[ip];
89 if (genParticle.statusHepMC() == 4) {
93 if (not genParticle.isFinal()) {
96 if (not genParticle.isVisible()) {
102 genParticle.xProd() * 1_mm, genParticle.yProd() * 1_mm,
103 genParticle.zProd() * 1_mm, genParticle.tProd() * 1_mm);
108 particleId.setParticle(1
u + generated.size());
110 if (genParticle.hasVertex()) {
113 auto it = std::find_if(
114 vertexPositions.begin(), vertexPositions.end(),
116 if (
it == vertexPositions.end()) {
118 vertexPositions.emplace_back(
pos4);
119 particleId.setVertexSecondary(vertexPositions.size());
122 particleId.setVertexSecondary(
129 const auto charge = genParticle.charge() * 1_e;
130 const auto mass = genParticle.m0() * 1_GeV;
134 particle.
setDirection(genParticle.px(), genParticle.py(), genParticle.pz());
136 std::hypot(genParticle.px(), genParticle.py(), genParticle.pz()) *
139 generated.push_back(
std::move(particle));
143 out.insert(generated.begin(), generated.end());