Dear Fluka experts,
I simulated a beam of photons hitting an object, and I wanted to print information about the current particle and the corresponding parent particle.I successfully printed the information of the current particle using USDRAW, but the information about the parent particle was not saved successfully. All the printed data was almost 0 (there were only two non-0 data in all the data, I don’t know why).
I consulted the manual and this post:
" One common application is the following: after an interaction which has produced sencondaries, let USDRAW
copy some properties of the interacting particle into the TRACKR
user variables. When STUPRF
is called next to load the secondaries into stack, by default it copies the TRACKR
user variables to the stack ones. In this way, information about the parent can be still carried by its daughters (and possibly by further descendants). This technique is sometimes referred to as “latching”."
My understanding is: for the current particle, I print the information first and then save the information in TRACKR’s user variables. If the interaction produces secondary particles, STUPRF copies the user variables to the corresponding stack.When secondary particles start to transfer, the user variables in the stack are then copied into TRACKR’s user variables, and now I can get and print out information about the current particle and the parent particle of the previous cycle. Then I re-copy the information of the current particle as the parent particle to TRACKR.
ENTRY USDRAW ( ICODE, MREG, XSCO, YSCO, ZSCO )
IF ( .NOT. LFCOPE ) THEN
MRGNAM='DETUP'
CALL GEON2R ( MRGNAM, NUPSTR, IERR )
LFCOPE = .TRUE.
WRITE ( 89, * ) '#Information about particles in region', MRGNAM
WRITE ( 89, * ) '#NCASE,ICODE,JTRACK,LTRACK, XSCO, YSCO, ZSCO,ETRACK'
WRITE ( 88, * ) '#Information about parent particles in region', MRGNAM
WRITE ( 88, * ) '#NCASE,ICODE,JTRACK,LTRACK, XSCO, YSCO, ZSCO,ETRACK'
END IF
IF ( MREG .EQ. NUPSTR ) THEN
* current particles attributes
WRITE ( 89, * ) NCASE,ICODE,JTRACK,LTRACK, XSCO, YSCO, ZSCO,ETRACK
* the number of secondary particles and the corresponding particle ID
WRITE ( 89, * ) NP, (KPART(I),I=1,NP)
* parent particles attributes
WRITE ( 88, * ) ISPUSR(1),ISPUSR(2),ISPUSR(3),ISPUSR(4),SPAUSR(1),SPAUSR(2),SPAUSR(3),SPAUSR(4)
* Storing information about parent particles for secondary particles
ISPUSR(1) = NCASE
ISPUSR(2) = ICODE
ISPUSR(3) = JTRACK
ISPUSR(4) = LTRACK
SPAUSR(1) = XSCO
SPAUSR(2) = YSCO
SPAUSR(3) = ZSCO
SPAUSR(4) = ETRACK
END IF
RETURN
mymgdraw_usdraw01.f (11.9 KB)
This is my USDRAW,I don’t know what causes it. Can someone help me analyze it?
Thanks