Measuring of secondary particles by already secondary neutrons

Dear all,

In my simulation I am shooting protons of different energies at an aluminium shielding slab (volume in white), which produces a whole range of secondary particles (including neutrons), which are detected by a water cube sensitive detector (volume in blue), as showed in the following image:


I am interested in measuring the energy deposited only by the neutrons and their secondaries in the water cube.

So far, I have been able to measure the total energy deposition in the water cube (with no particle discrimination), as well as the energy deposited only by neutrons. Unfortunately, I have not been able to measure the secondary particles created by the neutrons within the water cube.

This is the code that I’m using under ProcessHits:

CubeHit* newHit = new CubeHit();
//
// Total energy deposit (no particle restrictions)
//
G4double edep = step->GetTotalEnergyDeposit();
if ( edep==0. ) return false;
// Add values
newHit->AddTotalEdep(edep);
//
//Energy deposited by neutrons
//
if ( step->GetTrack()->GetDefinition()==G4Neutron::Neutron() ) {
G4double neutronEdep = step->GetTotalEnergyDeposit();
if ( neutronEdep==0. ) return false;
// Add values
newHit->AddNeutronEdep(neutronEdep);
// Fill histogram
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH1(1, neutronEdep/keV);
}
// Add hit in the collection
fHitsCollection->insert(newHit);
// Add hits properties in the histogram
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH1(0, edep/MeV);
return false;

Any help with this matter would be greatly appreciated.

Thank you in advance!

1 Like

To collect the secondaries, you need to know what they are. You can find that out in your setpping action (or SD) here by querying the step inside your “if neutron” block, instead of abandoning things if neutronEdep is zero.

That can give you a list of all the true tracks the neutron created, with their kinetic energies (KE). If your detector is big enough, you could assume those secondaries are fully absorbed and just include their KE in your energy total.

If you actually want to wait for those secondaries to see if they deposit energy, then you need to store the neutron’s track ID in a local (data member) buffer. On subsequent calls into ProcessHits, you check to see if the new track’s ParentID() was the neutron, and if so you accumulate the Edep appropriately.

Another idea could be to create to create a G4UserTrackInformation class that keeps a flag for every neutron that enters your water volume and then it is copied to every secondary (and their secondaries, …) produced in the water volume.