23 throw std::invalid_argument(
"Missing output particles collection");
26 throw std::invalid_argument(
"No generators are configured");
29 throw std::invalid_argument(
"Missing random numbers service");
36 return "EventGenerator";
41 return {0
u, SIZE_MAX};
48 auto rng =
m_cfg.randomNumbers->spawnGenerator(ctx);
50 size_t nPrimaryVertices = 0;
51 for (
size_t iGenerate = 0; iGenerate <
m_cfg.generators.size(); ++iGenerate) {
52 auto& generate =
m_cfg.generators[iGenerate];
55 for (
size_t n = (*generate.multiplicity)(
rng); 0 <
n; --
n) {
56 nPrimaryVertices += 1;
59 auto vertexPosition = (*generate.vertex)(
rng);
61 auto vertexParticles = (*generate.particles)(
rng);
63 ACTS_VERBOSE(
"Generate vertex at " << vertexPosition.transpose());
71 .setVertexPrimary(nPrimaryVertices);
73 const auto pos4 = (vertexPosition +
particle.fourPosition()).eval();
78 for (
auto& vertexParticle : vertexParticles) {
79 updateParticleInPlace(vertexParticle);
83 <<
" primary_vertex=" << nPrimaryVertices
84 <<
" n_particles=" << vertexParticles.size());
86 particles.merge(
std::move(vertexParticles));
91 <<
" n_primary_vertices=" << nPrimaryVertices
92 <<
" n_particles=" << particles.size());
95 m_outputParticles(ctx,
std::move(particles));