{% from 'utils.j2' import vec3 -%}
{% macro source(o) -%}
{% if o.is_voxelized() -%}
/gate/source/addSource {{ o.name }} voxel
{% else -%}
/gate/source/addSource {{ o.name }}
{% endif -%}
{% if o.shape -%}
{{ o.shape.render() }}
{% endif -%}
{% if o.position -%}
# Placement
{% if o.is_voxelized() -%}
/gate/source/{{ o.name }}/setPosition {{ vec3(o.position) }} 
{% else -%}
/gate/source/{{ o.name }}/gps/centre {{ vec3(o.position) }} 
{% endif -%}
{% endif -%}
{{ o.particle.render() }}
{% if o.activity -%}
/gate/source/{{ o.name }}/setActivity {{ o.activity }}
{% endif -%}
{{ o.angle.render() }}
{% endmacro -%}
{% if o -%}
{{ source(o) }}
{%- endif %}