I need some guidance in order to access the secondary particle information produced by my simulation. In particular, I would like to plot the energy of the secondary photons in a histogram. I have managed to get my hands on the mgdraw.f script, but I am not sure how it should be modified in order to produce a file containing the secondary particle information I would like to plot, using for example the USERDUMP card. A comprehensive tutorial on this specific user routine application would be enlightening!
If you really need a customized scoring, opposite to built-in USRTRACK and USRYIELD options that already provide an energy histogram, you may want to start from the mgdraw example I posted yesterday and inspect the content of the relevant genstk.inc file, where the secondary photon energy is stored in the
TKI array (and its identity in
apologies for the delayed reply and thank you for providing the modified mgdraw.f file.
I successfully compiled the mgdraw.f user routine creating a .exe file which I provided as an input at flair’s run tab before starting the simulation. I have also defined a USRDUMP card, but while browsing through the ‘files’ and ‘data’ folders I am unable to find a “genstk.inc” file (or any file with .inc extension) and therefore I can’t get my hands on the array you are referring to.
Where does FLUKA generate the .inc files?
the .inc files are located in the include subdirectory where FLUKA is installed (by default it is /usr/local/fluka).
The include files are not generated for a specific simulation, but they contain the declaration (and explanation) of the FLUKA variables accessible with user routines.
another question/update. After downloading and compiling the customized mgdraw.f file @ceruttif provided I seem to be unable to produce a file with a _fort.72 extension neither do the relevant genstk.inc files include the desired secondary information (I am looking for the mass of the secondary photons and their x, y & z positions).
I am also attaching screenshots revealing the geometry of my simulations, I would be happy to forward the .inp and .flair files in private for further discussion.
Hi @nnikolop , my mgdraw generates a _fort.72 file with the content I asked for if a photonuclear reaction takes place:
Likely, this is not your case: you talk about secondary photons, which are generated by other processes, such as electron bremsstrahlung. In this regard, my routine - that was addressing another problem - is not meant as ready for use, rather as an example to be customized by you. You see for instance in the USDRAW entry header that ICODE is equal to 208 (and not 101) in case of bremsstrahlung by electrons and positrons (i.e. EMF particles). Also, JTRACK refers to the parent particle, which in your case may be 3 (electron) and not 7 (photon). As for the variables listed in the mentioned genstk.inc file, you need to print them in mgdraw, as I do for the ones I’m interested in, in order to read their value in the produced _fort.72 file. As @horvathd pointed out
the genstk.inc file is not an output file and remains unchanged, I referred you to it because you find there the variable names to be used in mgdraw according to your specific needs.
User routine customization is an advanced user practice. For the photon spectrum purposes you declared, I’d reiterate my suggestion to use USRTRACK over a region or USRYIELD/USRBDX on a region boundary, which are exactly meant for this and just consist of an input card to be properly filled, opposite to an event-by-event file to be generated by user’s coding according to the FLUKA tracking logic and structure.