X-ray tube simulation

Hi, I’m trying to make a simulation to measure the dose due to the x-ray tube for different settings, currently in the air. I don’t understand what I’m doing wrong in the code or if there is an error in the post-simulation analysis. For completeness I enclose all the files. Thanks for the help.

PhotonSpectrum_edit.inp (2.0 KB)
mysource_ng1.f (19.0 KB)
spectrum01.txt (4.4 KB)

Dear @andrea.apollon,

Could you please provide some info about the problem you are referring to?
Are you getting an error message? Is there a crash?

The results obtained do not correspond to the experimental ones I carried out to verify correct functioning.

Dear @andrea.apollon,

Not knowing either the type of difference that you see or the details of the experiments you ran, it is very difficult to comment on your problem.

My goal is to simulate an x-ray tube to measure the dose due to this at 1 meter for different tube settings. I tried to simulate the tube but the results obtained do not correspond to the experimental ones. So my doubt is whether I did something wrong in the macro or whether I’m doing something wrong in the post processing for calculating the dose.

It is difficult to say.
What I can tell you is that nothing caught my attention as evidently wrong. It’s true that your simulation setup is very simplified, if this simplification is too much, because experimental details are relevant, and what the effects are, I am not able to say.

Okay thank you very much. just one last thing. To calculate the dose after extracting the simulated dose at 1 meter I multiply this by the normalization coefficient, which I calculated as the ratio between the experimental spectrum divided by the spectrum obtained with FLUKA such that the two spectra are almost identical. Once normalized I multiplied by the number of primary particles used in the simulation. Is the procedure correct?

Furthermore, this is the graph of the photon fluence as a function of depth but it doesn’t convince me.
Screenshot from 2023-10-02 11-51-09

No, the number of primary particles used in the simulation has no role in the normalization, and has no physical meaning.
FLUKA results are automatically normalized to one photon. You should multiply by the number of real photons.