dE/dx by particles

Hello, is there a way to get a plot of dE/dx of particles moving through matter?

I did that recording for each step of the particle traversing a volume, the step length and the energy deposition in that step.

Hello, @pfranchini can you write here a piece of code?


see $G4INSTALL/examples/extended/electromagnetic/TestEm0

method to extract dEdx from a step will not work due to fluctuations of energy loss.