I have a question and I appreciate the help.
I’m using, in a macro, the command /gps/energy
I noticed that for energies below 100 Mev, Geant4 calculates according to the given value, for example: 20.5 MeV; 99.2 MeV. But when I put energies above 100 Mev, Geant4 rounds, for example, I put 100.4 MeV but in the output file it shows 100 MeV; if I put 100.8 MeV it rounds up to 101 MeV.
Is it possible to make it use values like 100.4 MeV, 100.8 MeV without rounding or truncating?
What do you mean by “the output file”? If you have verbose output in your text log file, the rounding off is just for printing. You’ll see it in /tracking/verbose, for example.
If you mean that you’re seeing “rounding” in the actual simulation, perhaps you configured GPS to use a binned histogram energy spectrum?
I have verbose output in text file. I was using /tracking/verbose 1. I tested /tracking/verbose 2 and /tracking/verbose 3 and I still see, in the text file, the energy 331 Mev instead of 330.52 Mev.
I’m not using GPS for binned histogram spectrum. I have a macro with multiple fonts, like test31.mac of examples > extended > eventgenerator > exgps.
If you’re just looking at the /tracking/verbose output, that is not meant to be exact, it’s meant to be readable and to fit in 80 columns, so the values are rounded. If you need exact results, then you should be using
G4Analysis and creating an output data file. The examples and documentation provide many places where you can learn how to do this.
Ok, I understand. Thank you!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.