Hello David,
sorry for the delay in the reply but I was looking into the details of your request together with @dcalzola.
Let me start pointing some other threads in the forum that could help in describing the solution I will propose you, in particular this one and a second one.
Regarding your questions, I will try to answer them explaining the solution I propose to you.
Your general approach is correct but unfortunately not sufficient.
mgdraw.f
is the right tool to print interaction by interaction the Compton scattering (and photoelectric effect) happening for the primary photon interacting in the detector region.
As you state, to reach your aim, it is important to correctly identify just the Compton scattering correlated to the primary photon excluding instead any contributions that can be generated by photons created by secondary electrons. This can be done in strupre.f
.
stupre.f
is a routine that gives the possibility to access information of the primary and secondary EMF particles placed in the EMFSTK (the stack for emf particle - LOFLK and ILOFLK that you are using are instead for the main stack of FLUKA) and it can be used to assign user-properties to this kind of particle. With this routine, a logical flag can be created to signal that the primary photon had a Compton scattering and to associate it to the outgoing photon created in the reaction. This process then can be followed for any Compton scatterings happening afterwards until the primary photon is absorbed (or leave the detector region!).
Together with the flag, in the stupre.f
routine we can also define a counter for the Comptons.
I am attaching a combination of the two routines that works for your case:
mgdraw_ed.f (12.4 KB) → it prints the Compton events and photoelectric effect of the primary photon
stupre.f (6.7 KB) → it generates the flag to be associated to the outgoing photon from the primary photon’s Compton scattering and it counts the number of Comptons before the photoelectric effect
Finally let me just state that NCASE is a variable accessible from caslim.inc
and that some of the primaries don’t even enter the detector region or they could enter without interacting or interacting for then leaving.
I hope this can help you.
Cheers,
Giuseppe