I modeled a simple scintillation problem with a photosensor attached to a NaI crystal surrounded by a PTFE layer and an aluminum casing. A 662 keV gamma source is firing at it. I am using primitive scorers and managed to count optical photons reaching the photosensor; however, the number of counts I get is the sum over all events. I need one number of counts per event, in order to generate an histogram i.e. an energy spectrum. What is the most computationally efficient way to do so? I suppose I should write the number of counts in the output csv after each event, but I don’t know how to do so.
Here is the relevant bit of my macro:
Here is the output file. It has a single line but what I need is one line per event.
Not sure if relevant but I am using Gears.
Thanks!