From ce646cfa6b9e5c0d46c1f678d39b15a434716412 Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Sat, 20 Aug 2011 15:56:50 -0400 Subject: Convenience gun generator when all inputs are constant. --- generator/vertex.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'generator/vertex.py') diff --git a/generator/vertex.py b/generator/vertex.py index 3998e6e..139d675 100644 --- a/generator/vertex.py +++ b/generator/vertex.py @@ -69,3 +69,12 @@ def pi0_gun(pi0_position, pi0_direction, pi0_total_energy, start_id=0): Subtrack(particle_name='gamma', position=ev_position, direction=gamma2_dir, start_time=0.0, total_energy=gamma2_e)] yield ev + + +def constant_particle_gun(particle_name, position, direction, total_energy, + start_id=0): + '''Convenience wrapper around particle gun that assumes all + arguments are constants, rather than generators.''' + return particle_gun(constant(particle_name), constant(position), + constant(direction), constant(total_energy), + start_id=start_id) -- cgit