Dose vs Kinetic Energy plot

Hello, I have a file in which I’ve various particles with their different energy which I’m going to throw on the detector by reading that file in the primary generator action class . And then I’ll measure the dose using stepping action class. At first I printed the dose corresponding to the kinetic energy in the event class . But I observed that I cannot obtain my graph using this method , because the nature of graph is first increasing then decreasing. So I tried to obtained it in the stepping action class. This time I added the dose as well as prestep kinetic energy. But again failed to obtain the result .It would be great if you can help me out with this query.


I’d be happy to try and help but first could you provide a bit more information? What particles are you generating? What is their energy range from lowest to highest? Are all these particles generated simultaneously by the primary generator action? What do you mean by “the graph goes up then down.” What is the thickness of your detector? What’s the material?

If I understand what you’re trying to accomplish, you can either do this in the stepping action or the event action. It will probably be easier to do this in the event action, assuming you’ve set up a sensitive detector class?

Best wishes,


Thank you for your reply… Now I’ll be more elaborative
I have a file file.txt (1.2 KB)

As you can see this file contains 106 rows. First column is Z(atomic number) , Second Column is A(mass no.) , Third column is Energy(in MeV).

I’m gonna read it line by line in the PrimaryGenratorAction Class and going to set the particle energy one by one in Particle Gun .
I’ve used a detector which is sphere of radius 30*cm and it contains water as the material . Is it necessary to Use Sensitive Detector ??
I’ve been doing this in B1 example only By making small small changes.

My Target is to obtain the plot as shown in the image Screenshot from 2021-02-18 08-15-53

For this I tried to obtain the dose in the event class by adding the energy deposit which I get from stepping action class. Is it correct ??
What about the kinetic energy . How am I suppose to get that ?

I can’t use the particle gun energy since it will give the same total energy. What should I do?