Problem modeling weighted source

Thanks, Sir.
I tried to get the source spectrum, but it seems to be completely different from the one I posted at the beginning of the topic.

I don’t understand the reasons for this huge difference. I have attached the flair and the source file.
nonho.flair (2.6 KB)
Mockup.f (11.1 KB)

Kind regards,
Lovepreet

Dear Lovepreet,

there are three issues:

  1. You should use a sphere filled with the material VACUUM. This way, the source spectrum is not altered.
  2. When you convert the energy from GeV to MeV in your weight calculation, you need to multiply by 1000 before you raise to the power.
  3. You polynomial can and will return negative value at low energies. You should implement a protection against this. The easiest would be to increase the minimum sampled energy.

Cheers,
David

Thank you, Sir.
I made the corrections, however, if I put vaccum in the target then I have the following error:
image
Mockup.f (11.1 KB)
nonho.flair (2.8 KB)

Best regards,
Lovepreet

Dear Lovepreet,

in this case the conversation of the fitting parameters are incorrect.

I was able to sample this spectrum:
spectrum

with the following user routine and Flair project:
nonho.flair (2.0 KB)
Mockup.f (11.1 KB)

Cheers,
David

Thank you, Sir.

Best regards,
Lovepreet