My name is David and I have the following goal:
I have to determine the mean number of Compton scattering events for a given photon primary before it gets absorbed by photoelectric absorption (or drops below the simulation threshold) in a given scintillator.
For that purpose, I took a look at the available scoring cards in FLUKA and came to the conclusion that I have to use the userdump card together with a custom mgdraw routine. So, I have written a first draft of a mgdraw routine using the corresponding USDRAW section for txt-readable output:
- My idea is to log all Compton scattering events of the primary particle (photon) together with the photoelectric events. So I have used the ICODE.EQ.219 flag for Compton scattering and the ICODE.EQ.221 flag for photoelectric absorption.
- To identify, which primary is involved in these events, I plan to use NCASE variable from the SODRAW entry.
- To ensure that the Compton and photoelectric events are caused by the primary and not the secondaries, I tested to log the stack pointer (NPFLKA), the particle generation (Loflk) and the particle identity (ILOFLK). I would have expected that Loflk>1 or NPFLKA>0 would indicate that secondaries are involved…
- As a source, I use the BEAMPos card with the flood option to get an isotropic photon flux within a sphere containing my scintillator.
With my first mgdraw routine draft , I obtained unexpected results, i.e. multiple photoelectric absorption events for the same photon primary or even Compton scattering events after a photoelectric absorption event (both shouldn’t be possible from a physical point of view).
Problem Solving Status
I have the suspicion that these problems are either caused by my rudimentary Fortran coding skills, i.e. bugs, or that I score also secondaries and can’t identify them properly with my approach (no. 3 above).
- Is my general approach correct or do you have maybe an easier way to achieve my goal?
- Is there a problem with my mgdraw routine?
- How do I access/log the particle identity (i.e. a unique identifier for the primary photon) properly? I have the suspicion that my indexing for stack variables is wrong (e.g. Loflk(I))…
- I’ve tested also a second way to check for Compton scattering and photoelectric events by using the LCMPTN and LPHOEL flags from EVTFLG. However, the result is unfortunately the same. So it seems my two methods are identical, aren’t they?
For your convenience, I attach here all input, flair and output files:
input_file.flair (5.6 KB)
input_file.inp (4.2 KB)
mgdraw_ed.f (15.4 KB)
test1001.out (77.5 KB)
test1001_fort.txt (4.0 KB)
In addition, I add here my custom section from the mgdraw routine:
ENTRY USDRAW ( ICODE, MREG, XSCO, YSCO, ZSCO ) IF ( .NOT. LFCOPE ) THEN LFCOPE = .TRUE. IF ( KOMPUT .EQ. 2 ) THEN FILNAM = '/'//CFDRAW(1:8)//' DUMP A' ELSE FILNAM = CFDRAW END IF OPEN ( UNIT = IODRAW, FILE = FILNAM, STATUS = 'NEW', FORM = & 'UNFORMATTED' ) END IF IF(ICODE.EQ.219) THEN * IF(LCMPTN) THEN WRITE(22,*) 'NCASE ',NCASE,'NPFLKA ',NPFLKA,'Jtrack ',Jtrack,'gen ',Loflk(I),'id ',ILOFLK(I),NSTMAX,' Compton scattering' * WRITE(22,*) 'NCASE ',NCASE,'NPFLKA ',NPFLKA,'Jtrack ',Jtrack,'gen ',Loflk(NPFLKA),NSTMAX,' Compton scattering' END IF IF(ICODE.EQ.221) THEN * IF(LPHOEL) THEN WRITE(22,*) 'NCASE ',NCASE,'NPFLKA ',NPFLKA,'Jtrack ',Jtrack,'gen ',Loflk(I),'id ',ILOFLK(I),NSTMAX,' Photoelectric' * WRITE(22,*) 'NCASE ',NCASE,'NPFLKA ',NPFLKA,'Jtrack ',Jtrack,'gen ',Loflk(NPFLKA),NSTMAX,' Photoelectric' END IF RETURN
I performed all simulations with the FLUKA CERN version 4-3.2 together with the FLAIR interface version 3.2-4.1 on Ubuntu 18.04 LTS WSL.
Thank you very much for your support