Problems implementing mgdraw

Dear FLUKA experts,
I am very thankful for your reply but I am sorry I am here again to disturb you all as I am facing a problem in the scoring of energy of the beam before a step and after the step, the position of the beam before and after a step. I tried to make a code but in the output the beginning energy is not correct also I am not able to score the energy after the step. I am not sure where I am doing wrong. I will be really thankful to you for your help. There is another problem.
mgdraw-1025.f (11.3 KB)
wk1025-mgdraw.flair (4.4 KB)
wk1025-mgdraw.inp (3.0 KB)


I suggest you to have a look at the forum thread here. They explain how to obtain the values for the energy of the particle at the start and end of the step, and the same logic can be followed for the position of the particle.

Some relevant point I will highlight:

  • use the entry MGDRAW in mgdraw.f to print the information of any particle at the start and end of the step
  • have a look at since you are saving the particle information there described
  • as described in the thread, be aware of the fact that the photons don’t lose energy along the step. This changes the logic needed to save their energy at the start and end of the step


Respected Giuseppe Mazzola,
I am sorry to disturb you again. I had already read the thread you cited and following that thread I tried to modify the mine mgdraw routing but the values are not correct and I am not sure where I am doing wrong. I will be thankful to you if you point out the mistakes.
Thank you

In the uploaded version of your routine:

  • you use undefined variables (SamePari, TLocalEdep, TContiEdep), spoiling any intended logic;
  • you compare a real value with an integer one;
  • you do not initialize CEdep and LEdep.

I’d strongly encourage you to consider to exploit available built-in scoring cards, rather than to embark on more complex coding challenges.

A post was split to a new topic: X-ray photon fluence from backscattering on lead