diff options
-rw-r--r-- | chroma/generator/vertex.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chroma/generator/vertex.py b/chroma/generator/vertex.py index 513a961..e8f4139 100644 --- a/chroma/generator/vertex.py +++ b/chroma/generator/vertex.py @@ -76,8 +76,13 @@ def pi0_gun(pos_iter, dir_iter, ke_iter, t0_iter=constant(0.0), start_id=0, gamm def constant_particle_gun(particle_name, pos, dir, ke, t0=0.0, start_id=0): '''Convenience wrapper around particle gun that assumes all arguments are constants, rather than generators.''' + if (dir == 0.0).all(): + dir_gen = isotropic() + else: + dir_gen = constant(dir) + if particle_name == 'pi0': - return pi0_gun(constant(pos), constant(dir), constant(ke), + return pi0_gun(constant(pos), dir_gen, constant(ke), constant(t0), start_id=start_id) else: - return particle_gun(constant(particle_name), constant(pos), constant(dir), constant(ke), constant(t0), start_id=start_id) + return particle_gun(constant(particle_name), constant(pos), dir_gen, constant(ke), constant(t0), start_id=start_id) |