How to correctly simulate Particle Discrimination?

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_11
_Operating System:_linux
_Compiler/Version:_visual studio
_CMake Version:_23?

—Hi everyone! I am simulating a △E-E scope to discriminate particles. I’m using a Si detector as the △E detector and a CLYC as the E detector, then using different kinds of charged particles and neutron to hit them from one direction. And I collect the energy loss on Si and CLYC. Physics List I use is QBBC. There is one thing I am confused that a large amount of charged particles don’t lose any energy on both detectors, especially neutron. Is there something wrong in my simulation or it just because of running to many events(2,000,000)?


The third column represents the time it takes from Si to CLYC in ns.

We need more information… what is the energy of your particles? What is the size of your detector? Its possible that most of your particles do not deposit much energy in the detector, but we don’t know anything about your set up

Oh, my bad :joy:. Si detector is φ40mm \times 0.3mm and CLYC is φ45mm \times 46mm. And about the energy of the particles, I use 100 MeV for proton, deutron, triton and neutron, 200MeV for the nucleus of 6Li, 250 for 8Be nucleus … and last about 700 for 16O nucleus. I thought about using lower energy for the heavy ions , but that would cause segmentation fault easily. Also I’ve tried some lower energy for the light ones as proton and neutron.

Why would using lower energy cause a segmentation fault?

And there is another problem. When I am drawing a △E vs E histogram, I only use the data for one particle, but there shows another band. For example ,here is the figure using only 16O(700MeV),
image, I don’t figure out why there is a band upper. Can anyone give me some hints?

I’m sorry I don’t figure it out. Take 16O for example. When I use 500MeV, here it comes:

segmentation fault. And if I change the energy to 600MeV, that will be:

I am confused… :upside_down_face:

I think it would help if you could make the code available somewhere like GitHub as there’s not enough info here to really see what’s going on. It would also be worthwhile building the application in Debug mode and running through gdb to get a better trace on the origin of the segfault.

Here is the address. Many Thanks!! :grin:

Hello @GerryJarvis,

thank you for giving access to the code… but we are still unable to reproduce the error ourselves. I ran the code with one of the macros without a problem! Which is the macro file that is giving you problems? Are you running MT?

Have you tried to use a debugger yourself? AS @bmorgan already said… gdb is exellent at helping you deal with segfaults when compiled with debugging symbols.


Hello pico ,thank you for helping me. I just use the gpsO.mac for 500MeV 16O and then the segfault comes. I’m not running MT(multiplier tube,right?). And I didn’t use the gdb yet and I will give a try in a day or two. Since it’s not the biggest problem for me now , I still work on the problem with the figure with two bands :joy: :joy:.

Well… the plot thickens…

I ran your application with gdb using

gdb -ex="run" -ex="set confirm off" -ex="set pagination off" -ex="catch throw" -ex="bt" -ex="q" --args <APLUCATION> and get no segmentation faults… tricky…

as for the double band. There must be a reaction you are producing. I have not look into the physics of your problem but I’m guessing a reaction is happening. On a dE-E plot the most differentiating aspect is their change. Some simple debugging should give you the intruding ion.

Why using lower energy would give you more segfaults?

Now I’ve found the stupid problem :sweat_smile:

I have made a list to store the system time when the particle is in the detector since I want to get the exact time it hit the detector. In this way the first one in the list will be what I want. However if the energy of the particle is too low to reach each detector, the timelist should be empty. Then comes the bug.
I’m speechless…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.