21 throw std::invalid_argument(
"Missing output particles collection");
24 throw std::invalid_argument(
"No generators are configured");
27 throw std::invalid_argument(
"Missing random numbers service");
32 return "EventGenerator";
37 return {0
u, SIZE_MAX};
44 auto rng = m_cfg.randomNumbers->spawnGenerator(ctx);
46 size_t nPrimaryVertices = 0;
47 for (
size_t iGenerate = 0; iGenerate < m_cfg.generators.size(); ++iGenerate) {
48 auto& generate = m_cfg.generators[iGenerate];
51 for (
size_t n = generate.multiplicity(rng); 0 <
n; --
n) {
52 nPrimaryVertices += 1;
55 auto vertexPosition = generate.vertex(rng);
57 auto vertexParticles = generate.particles(rng);
65 .setVertexPrimary(nPrimaryVertices);
67 const auto pos4 = (vertexPosition +
particle.position4()).eval();
71 for (
auto& vertexParticle : vertexParticles) {
72 updateParticleInPlace(vertexParticle);
76 <<
" primary_vertex=" << nPrimaryVertices
77 <<
" n_particles=" << vertexParticles.size());
79 particles.merge(std::move(vertexParticles));
84 <<
" n_primary_vertices=" << nPrimaryVertices
85 <<
" n_particles=" << particles.size());
88 ctx.
eventStore.
add(m_cfg.outputParticles, std::move(particles));