Optiacl photon count

I am able to produce optical photon when a gamma hits the crystal. I able to print the location of the interaction also. I am also getting a time distribution when optical photon reached to photocathode coupled to crystal.

I want to find out how many optical photons created at the interacting point in a given event. How can I do that?


Sorry for the late reply.
If you are still wondering, can you try outputting the distributions (positions, timing, energy) and making a histogram? This shall automatically provide the number of optical photon counts.

Or, if it has to be included in the simulation itself. For every event initialize a counter(event action class), extract the particle name in stepping action/sensitive detector classes, and check if it is your detector’s first step(predefined function). If this is fulfilled, increment a counter.

Also, may you go through the OpNovice2 example, as it also counts the optical photons across different processes.

Let me know if it works.