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:_Geant4v11.2.0
_Operating System:_Windows 11
_Compiler/Version:_VS 2019
_CMake Version:_CMake 3.28
Hello all,
My work consists of calculating the absorbded dose within a 10 mm3 voxel, which is located within a 30x30x15cm3 phantom of water.
Now, I want to limit the neutron that enter the voxel by its energy, i.e. stop all neutrons with energy >=0.5eV in the front of the voxel, for that I’m using the following condition in the SteppingAction:
G4String preVname = step->GetPreStepPoint()->GetPhysicalVolume()->GetName();
G4StepPoint* postStepPoint = step->GetPostStepPoint();
if (preVname == "Phantom" && postStepPoint->GetStepStatus() == fGeomBoundary)
{
if (particleType == G4Neutron::NeutronDefinition() && step->GetTrack()->GetKineticEnergy() >= 0.5*eV)
{
step->GetTrack()->SetTrackStatus(fStopAndKill);
}
//else
// {
// //G4cout << "The neutron energy of ID : " << eventID << " is: " << En << G4endl;
// Count++;
// }
}
// collect energy deposited in this step
G4double edepStep = step->GetTotalEnergyDeposit();
if (volume == fScoringVolume)
fEventAction->AddEdep(edepStep);
Is it correct this condition?
N.B. The simulation become more slow after adding this condition, however a part of neutrons are killed.
Thanks in advance.