Get secondaries

Hi G4ers,

I am simulating neutrons in Boron Nitride which sometimes results in a 10B(n,α)7Li. I want to get the alpha particles so I can calculate their deposited energy, however when I use:
step->GetTrack()->GetParticleDefinition()->GetParticleName();
In my SteppingAction, after a run I can find tracks of neutrons, gamma’s, Li7, B10, B11 but no alpha particles. I can see that neutrons that created the Li7 always produce 3 or 5 secondaries, so there are more particles created but why can’t I get their tracks?

I am using the QGSP_BERT_HP physicslist and have already tried to set the production cuts to zero without success. Any suggestions?

So you see the secondaries in the SteppingAction, but you don’t see them tracked? For the alpha (in fact, for all ions), G4 uses the “proton” production cut, not separate cuts for each type. So if you set the proton cut to zero, that should ensure that all those secondaries (in particular, the alpha) are tracked.

Yes exactly, I can only see the number of secondaries and apparently only track some of those secondaries (Like Li7). Good to know about the proton cuts, however, it is already set to 0 so the alpha’s should be produced. In my stepping action I have coded the following:

G4StepPoint* preStepPoint = step->GetPreStepPoint();
const G4VProcess* CurrentProcess=preStepPoint->GetProcessDefinedStep();

if (CurrentProcess != nullptr) {

    G4int numberofsecondaries = step->GetNumberOfSecondariesInCurrentStep();
    auto particletype = step->GetTrack()->GetParticleDefinition()->GetParticleName();
    auto preprocess = step->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
    auto postprocess = step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();

    G4cout << particletype << " -- pretype: " << preprocess << ", posttype: " << postprocess << ", secondaries: "
           << numberofsecondaries << G4endl;

Which outputs like this with a neutron capture:
neutron – pretype: Transportation, posttype: neutronInelastic, secondaries: 5
Li7 – pretype: ionIoni, posttype: RadioactiveDecayBase, secondaries: 0

And then nothing and a new event is created.

Ok… So I found out the source of my mistake. I didn’t track the secondaries at all. I was confused by the output type of the GetSecondaryInCurrentStep() but I found out how to handle it and managed to get the secondaries and their energies.

auto secondary = step->GetSecondaryInCurrentStep();
size_t size_secondary = (*secondary).size();

if (size_secondary){
     for (size_t i=0; i<(size_secondary);i++){
     auto secstep = (*secondary)[i];

     G4String secondaryName = secstep->GetDefinition()->GetParticleName();
     auto secondaryID = secstep->GetTrackID();
     auto secEkin = G4BestUnit(secstep->GetKineticEnergy(), "Energy");
     }
}

Sorry for my stupidity. I was distracted by the fact that the Li7 did show up as a track in my earlier code. This is still unclear to me because it is created as a secondary particle (with Ekin > 0) as well as a ‘primary’ particle (with Ekin = 0) with poststeppointprocess RadioactiveDecayBase. It seems that this is the boron which decays to Li7 but why is it created as a secondary particle as well?

1 Like