Dear FLUKA community
I’m interested in scoring the energy deposition in more than one detector (or region) at a time, but obtaining this information event-by-event, in order to apply the smearing of the data outside FLUKA (and not repeat the simulation every time).
Up to this moment, I’ve learned that there are two different ways to obtain the energy deposition event-by-event:
1) With the MGDRAW subroutine. I declared TRULL, set it =0 at the beginning, and then saved the “spot” energy depositions with the RULL variable in the ENDRAW entry. Afterwards, in the main part of MGDRAW, I save also the DTRACK(J) for the energy deposition events along the track.
I mainly included, as a test, in MGDRAW main body:
TRULL = 0.
IF (MREG.EQ.2) THEN
DO J = 1,MTRACK
TRULL = TRULL + DTRACK(J)
ENDDO
ENDIF
and in the ENDRAW entry:
ENTRY ENDRAW ( ICODE, MREG, RULL, XSCO, YSCO, ZSCO )
IF (MREG.EQ.2) THEN
TRULL = TRULL + RULL
END IF
RETURN
and, at the end of the event, I basically save and update TRULL=0 for the next event:
ENTRY EEDRAW ( ICODE )
IF ( .NOT. LFCOPE ) THEN
LFCOPE = .TRUE.
OPEN ( UNIT = 46, FILE = “F01_EnDep.tab”, STATUS = ‘UNKNOWN’)
ENDIF
IF ( TRULL.GT.0 ) THEN
WRITE(46,*) TRULL
END IF
TRULL = 0.
RETURN
With this approach, I only get the energy depositions from the ENDRAW entry, which I checked by commenting this part of the code and obtaining zero as a result (thus not collectiong the DTRACK(J) part). Is there something wrong with this approach? Why I’m not collecting anything with DTRACK(J)?
2) Using the DETECT card. With this I got the energy deposition correctly (further compared with Geant4), but I wanted to intervene in order to get the information event-by-event. For this, I found a previous post: Gaussian Energy Broadening
There, it is indicated to use the usreou.f subroutine to intervene at the end of each event, and that the energy deposited as scored by the DETECT card is stored in ACCUMP and ACCUMN (which is the difference?). It is also further explained how to perform the smearing, but I would like to do it outside FLUKA, so I tried to save the ACCUMP and ACCUMN for each event. I did it as follows (probably wrong way):
OPEN ( UNIT = 46, FILE = "F01_EnDep.tab", STATUS = 'UNKNOWN')
IF (MREG.EQ.2) THEN
IF (ACCUMP(NDTCM2) .NE. ZERZER.AND.ACCUMN(NDTCM2).NE.ZERZER) THEN
WRITE(46,*) MREG, ACCUMP(NDTCM2), ACCUMN(NDTCM2)
ENDIF
ENDIF
I tried to score the region as well, because I do not know how to separate the energy depositions if I have (as is my case) four DETECT cards in the input file. Nevertheless, all I got was a list of zeros.
Is there any easiest or recommended way to obtain the energy deposition event-by-event in the regions of interest? Any information would be greatly appreciated.
I attach the files, in case you need to take a look.
Thank you all in advance!
10-2020-Clearance-Box.inp (7.6 KB) mgdraw.f (4.1 KB) usreou.f (2.4 KB)