Counting issue with tracking

_Geant4 Version:_geant4-v11.2.0
_Operating System:_win11
_Compiler/Version:_Visual Studio Version 17.3.5
_CMake Version:_cmake-3.28.1

Hello everyone, I need help with something. I use tracking to count the number of particles passing through a given volume. In my case I created a HPGe detector and defined the scoringVolume inner core of the detector.

I believe the efficiency values do not match actual experiments. I send 50k particles at 1200 keV, it counts 38-40k which is 80% efficiency (should be 2%). I send out 50k particles at 100keV and counts 110k particles.

I don’t know the problem. Maybe counting the same particle twice? Can you help me with this please?

Sounds like you’re either getting secondaries, or you’re getting the lower energy primaries scattering out and back into the detector volume. Try running a job with just a few events, of course!, with /tracking/verbose 2, so you can follow what’s going on in detail. There are different analysis solutions depending on what the situation is.

If you’re getting secondaries, but you only want to count primaries, then you can test for track->GetParentID() == 0. That special value identifies primaries, and excludes secondaries.

If you’re getting scattering out of the detector volume then back into it, it’s a bit more complicated. If I were doing it with an SD, I would two new data members: std::set<G4int> tracks and G4int eventID. If the current event doesn’t match eventID, then tracks.clear(). After that, tracks.insert(track->GetTrackID()). At the end of the event, tracks.size() will tell you how many tracks there were.

1 Like

Thank you for you quick response sir. :pray:

I applied the GetParentID() == 0 and the efficiency drop significantly from 80% to 10% (which it should be 2%). Here is result for tracking/verbose/2:

I do not know to read it can you help me with this please?

First question: there are particle = e- and gamma, I only sending gamma particle in code how can it be possible and will it effect the number of particles detected with my scoringVolume?

Second question: in gamma particles there are several steps I see, is this what you meant when you say they scattering out of the detector volume then back into it? (I want only count in geCrystalSolid)

Thank you for your valuable time.

Hi @saimegemenyucel

In addition to @mkelsey , if you strictly looking for tracks of gamma you can kill all secondaries other then gamma particle produced anywhere in geometry defined.
if (aTrack->GetDefinition() != G4Gamma::Gamma()) {
status = fKill;
More details how to eliminate secondaries can be find here.


1 Like