I would like to know how to access information about the nucleus name of a particular interaction (from a G4Step). I know I can access the material via G4Step::GetPreStepPoint()->GetMaterial() but when it is a compound material I don’t know how to access the nucleus.
I want to do this in order to compute the quenching factor in my analysis process, which depends on the nucleus of interaction.
const auto process = step->GetPostStepPoint()->GetProcessDefinedStep();
if (process->GetProcessName() == "hadElastic") {
// https://apc.u-paris.fr/~franco/g4doxy/html/classG4HadronicProcess.html
auto hadronicProcess = dynamic_cast<const G4HadronicProcess*>(process);
G4Nucleus nucleus = *(hadronicProcess->GetTargetNucleus());
auto name = nucleus.GetIsotope()->GetName();
}