How to create a mgdraw routine

Dear Giuseppe Mazzola,
In the continuation of the following post (Study of the internal structure of an object using radiation - #8 by muneeb.wajid.r)
After reading some course slides of FLUKA I got to know that mgdraw is more suitable for my kind of work. Therefore, I modified the mgdraw script and used BXDRAW to find the particle type, position of the beam, and direction of the beam and the energy deposited by beam. I have some questions.

  1. I got 5 output files from 5 cycles. I will use root for further analysis but how will I handle 5 outputs? do I need to make a single file from 5 files or need to study all 5 one by one.
  2. For the output results I find that there is no change in ZSCO and it remains same (mostly). Is there anything wrong I am doing?
  3. All the values are very small is it also wrong?
  4. Am I doing correct to find the energy deposition within the material by beam?
  5. Finally, I also want to know the beam shower outside is there any special parameter about this in mgdraw?
  6. I also want to find the angle using and I am not sure how to find that. Like I got the direction using CXTRACK, CYTRACK, and CZTRACK how can I find this?
  7. Lastly, I used unit 99 but it did not create the fort.99 file for me.
    The input files are attached herewith the email.
    I would be very thankful to you for the explanation of the above questions.
    X-Ray_mgdraw.f (10.1 KB)
    mgdraw.flair (3.0 KB)
    mgdraw.inp (2.0 KB)
    BXDRAW_data.txt (2.7 MB)

Dear user,

as you probably know, mgdraw is a more advanced technique used to dump information for event-by-event scoring (an event being a full primary history) and, additionally, it requires knowledge of fortran coding together with the FLUKA environment. For this purpose, I suggest you have a look at the lessons in the FLUKA advanced course, particularly one and two

Looking at your mgdraw, I can see that you are dumping the information of each cyle in a file of unit 99 with name equal to the variable FILNAM, as written in the OPEN statment. This explain why you didn’t get a fort.99 but a *FILNAM ( = BXDRAW_data) file for each cycle. It is on you if you want to merge the results together or keeping a single file.

Finally, be aware of what is the purpose of BXDRAW (look at these slides) and what you are dumping in the file (look at the variables in the in the first link I have posted).

Here a brief summary:

  • BXDRAW is called every time a particle crosses any border in your geometry.
  • The variables XSCO, YSCO, ZSCO that you are saving correspond to the particle coordinates of the crossing point from the region TARGET to region AIR (as expressed in you logic in mgdraw). This explains your point 2.
  • CXTRACK, CYTRACK, and CZTRACK are the direction cosine of the transported particle.
  • ETRACK-AM(JTRACK) corresponds to the kinetic energy of the particle being transported, not to the energy deposited by the particle in the material and its unit of measurement (as it is always in FLUKA) is GeV.

For the beam shower, what you can see from mgdraw result is that only photons are exiting the target region to go in the air region and you are scoring their energy and position, so you have already information on the beam particles reaching the air region.

Please, have a look at the slides to help clarify more carefully your doubts.


2 posts were split to a new topic: How to convert cosines to angles and how to merge text files

4 posts were split to a new topic: Problems implementing mgdraw