I am trying to track all the generated particles in the simulation but only in certain cell_ids and material_ids.
It seems that for now, when you set tracks=True in the run, it saves all the tracks without any filtering option.
Could anyone please point me in the right direction where I can modify to save tracks in certain cells and materials?
I believe this could reduce the tracks.h5 file size drastically (depending on the situation of course).
I wanted to follow up on this thread to see if anyone could offer some guidance.
I’m currently working on a project that involves modifying the source code.
My aim is to record the tracks that pass through a specific material_id or cell_id.
The ultimate goal is to trace these tracks back to their origins, which I believe would be valuable for characterizing neutron detector properties.
As mentioned by Shimwell earlier, recording all tracks, as currently available, results in a large output that is both time-consuming to generate and process.
Therefore, I’m looking to implement a more targeted approach.
Could anyone advise me on which part of the source code I should modify to achieve this functionality?
Any pointers or insights would be greatly appreciated.
For source code modifications this is the file that would need changing.
You could alternatively filter tracks from the larger track file with this example
tracks_in_zirconium_material = tracks.filter(state_filter=lambda s:s['material_id'] == 82)
# writing a separate vtk file for the tracks that go through the zirconium material
tracks_in_zirconium_material.write_to_vtk('tracks_in_zirconium_material.vtp')
tracks_in_water_material = tracks.filter(state_filter=lambda s:s['material_id'] == 42)
# writing a separate vtk file for the tracks that go through the water material
tracks_in_water_material.write_to_vtk('tracks_in_water_material.vtp')
print(f'{len(tracks_in_water_material)} tracks in water and {len(tracks_in_zirconium_material)}')