I’m trying to simulate a xenon chamber. To generate my particles I use the following command:
/gps/particle ion
/gps/ion 54 135 0
In order to verify that the generated spectrum is the right one I retrieve the primary gamma information in a histogram. When I compare the result obtained with the theoretical data (from Janis), the spectra are not the same. I have low energy peaks.
I have already seen the following topic: Weird decay spectrum
But this solution does not work (second figure).
The graph is even less faithful to the theory. My code is the following:
G4String Nom =particule -> GetParticleName();
G4int id = 1;
const std::vector<const G4Track*>* secondary
= step->GetSecondaryInCurrentStep();
for (size_t lp=0; lp<(*secondary).size(); lp++) {
G4double charge = (*secondary)[lp]->GetDefinition()->GetPDGCharge();
if (step->GetTrack()->GetParentID()==1 && step->GetTrack()->GetCurrentStepNumber()==1 ){
if (charge != 0.) { id = 6;} else if ((*secondary)[lp]->GetDefinition() == G4Gamma::Definition() ) { id = 7;
// G4cout<<Nom<<particule->GetPDGCharge()<<G4endl;
}
// G4double energy = (*secondary)[lp]->GetKineticEnergy(); (uncommented for first histo)
G4double energy =step->GetPreStepPoint()->GetKineticEnergy(); (uncommented for second histo)
analysisManager->FillH1(id,energy);
}}
How can I fix it ?
Thank you !