Energy distribution of pulses created in an NaI detector

Hello Geant4 users,

I am trying to simulate a NaI detector and get deposited energy spectrum of neutron induced gamma of the in the detector.

My model is a very simple model of a sphere of pure carbon (2.37/cc of density) of 22.9 cm of radius. My source is an 14MeV isotropic monoenergetic neutron source in the middle of the sphere.

image

I am only interested by gamma signal. I would like to know what I have to count in the scoring volume to simulate the proper response of my NaI detector. For the time being, in my SteppingAction.cc, I increase the total deposited energy (edep) every step and use an inline function in my EventAction.cc to fill a .csv.

But there are a lot of other interactions in my 3.67g/cc NaI detector, which depose energy, in addition of Compton, Photoelectric and Pair production process from neutron induced gamma. Do I have yo discriminate gamma, e-, e+ from other particles ? How to select only induced gamma signal ?

Do you know if there is an easy way to simulate energy distribution of pulses created in an NaI detector equivalent to a tally f8 with mcnp?

Thank you for your help !

The attached code (lines 38-48) check that the current particle is just leaving the carbon, and kill it if it is not a gamma.
I have tested the code in example Hadr06 with the attached macro.

SteppingAction.cc.txt (2.3 KB)
geovari.mac.txt (425 Bytes)

See
https://geant4-userdoc.web.cern.ch/UsersGuides/FAQ/html/tracksAndSteps.html

Thank you very much, with your help and your SteppingAction.cc file, I finally managed to get only gamma entering my NaI detector.

I use in my SteppingAction.cc :

if (PrimaryName != "gamma")
    {
        if (  (volumeName == "carbon") && (step->IsLastStepInVolume() == 1) )
        {
            G4Track* track = (G4Track*)atrack;
            track->SetKineticEnergy(0.0);
            track->SetTrackStatus(fStopAndKill);
        };
    };