Dear FLUKA experts,
I’m running a simple simulation of a high energy neutron beam and am trying to convert mgdraw output into a tree of sorts where each event is a node that points to its parent and to its children which are also events. However, my exogenous code doesn’t seem to work properly. The mgdraw output is dictated by the usrdraw routine:
! Write out the event attributes, type, parent, position, region
WRITE(72,*) ICODE, JTRACK, MREG, LTRACK, ETRACK, XSCO, YSCO, ZSCO,
& CXTRCK, CYTRCK, CZTRCK
! Write out how many product particles were produced and their respective codes
WRITE(72,*) NP, (KPART(I),I=1,NP)
! Write out fragments produce (pieces of nuclei) A followed by Z
WRITE(72,*) NPHEAV, (IBHEAV(KHEAVY(I)), ICHEAV(KHEAVY(I)), I=1,NPHEAV)
! Write out the Residual A and Z (if there is one)
WRITE(72,*) ICRES, IBRES
! Write out the parent attributes
WRITE(72,*) (ISPUSR(I),I=1,4), (SPAUSR(I),I=1,7)
! ICODE, JTRACK, MREG, LTRACK, ETRACK, XSCO, YSCO, ZSCO, CXTRCK, CYTRCK, CZTRCK
! Integer values
ISPUSR(1) = ICODE
ISPUSR(2) = JTRACK
ISPUSR(3) = MREG
ISPUSR(4) = LTRACK
! Float values
SPAUSR(1) = ETRACK
SPAUSR(2) = XSCO
SPAUSR(3) = YSCO
SPAUSR(4) = ZSCO
SPAUSR(5) = CXTRCK
SPAUSR(6) = CYTRCK
SPAUSR(7) = CZTRCK
RETURN
and my pseudocode for turning the output file into a tree is something like the following:
- Load in entries from the list linearly— these are events characterized by 5 lines of data. Separate the data into their appropriate variable names.
- Go linearly through the new list of “pseudo-events” (python dictionaries). If the event has a parent (ISPUSR(4) = parent LTRACK is not 0), find its parent in the events already loaded in***. Add the current event as a child to the found parent.
- Repeat step 2 for all subsequent events.
Now for the base case, the first event, I set the parent to None and continue.
*** This may be my flawed assumption— do the events print to the output file in parent-child order?
Otherwise, please respond with any advice. It would be greatly appreciated.
Thank you,
Regan