# Average energy from spectrum

Dear Fluka experts,
I’ve created an energy spectrum with USRTRACK for beta and bremsstrahlung radiation, as shown in the picture. I plotted the DX*Y quantity because as I understand, I will obtain the integrated fluence. I would like to obtain the average energy of both the radiations from this spectrum, with the relative error on the average. I’ve tried to get the average energy with a weighted mean on the fluence from the sum.lis file, but I’m missing how to obtain the average error (since I have errors for the fluences). Is it possible to take both these information directly from Fluka? If not, what is the easiest way to do it? Best regards,
Leonardo

Dear @leonardo.delpi,

Plotting the DX*Y you obtained the differential fluence, not the integrated one, but in the *_sum.lis you could consult the integrated fluence.

FLUKA outputs the differential fluence, as requested, but does not provide directly the average value as you wish it using the USRTRACK card, but using the USRBIN card with a per REGION scoring, where you would use the same region as for the USRTRACK card. The output of the USRBIN card will have the average error computed automatically.

You can nevertheless retrieve the error yourself. The errors are based on Monte Carlo statistics, meaning they follow a 1/sqrt(N) law, where N is the number of particles that have participated to the scoring (in each DX bin in your case). To retrieve the average error, you would have to:

E_{rel, tot} = \left( \sum E_{rel, i} ^{-2} \right)^{-1/2}

Best,
Daniel

Dear Daniel, thank you very much for the response.
I still have some doubts. If DXY is the differential fluence, what is the difference between plotting Y or plotting DXY in a USRTRACK plot?
Can you also suggest me a program to acces the data from the sum.lis file? Usually I’ve used excel for the tab.lis file, but it seems like that it cannot properly divide the cells from the sum.lis file.
Thank you again,
Leonardo

Dear @leonardo.delpi,

I apologize for the misunderstanding. Indeed, Y is the differencial fluence in GeV^{-1} \cdot cm^{-2}, while DX*Y is the integral fluence over the bin energy range in cm^{-2}.

It is up to you what program you prefer to read the data files. Personally, I use coding scripts rather than programs, for example python with the pandas library.

Best,
Daniel

Dear Daniel,
thank you very much for your suggestion, I’ll soon try it.
Have a nice day,
Leonardo