What is the best way to get x ray spectrum
Do you mean within a specific area? you could use a scoring mesh to measure flux, then use filters to split it into energy bins. I’m not too experienced on geant4, but that’s worked for me so far.
It is my first example.
I don’t know which classes i need to use for this topic
Command based scoring requires you initialize a scoring manager in your main(), then you can define the size, position, etc in a macro file. It’s summarized in this tutorial https://www.slac.stanford.edu/xorg/geant4/SLACTutorial14/Scoring1.pdf