| Summary: | G4VParticleChange object in G4SteppingManager does report the number of secondaries | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | novikova |
| Component: | track | Assignee: | kurasige |
| Status: | RESOLVED INVALID | ||
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 4.1 | ||
| Hardware: | All | ||
| OS: | All | ||
Dear Elena,
G4VParticleChange class is not provided for users, but it is used for
information exchange between processes and tracking/stepping manager.
G4SteppingManager take out all secondaries from processes and put them into its
secondary container (to get the pointer to this container, use
G4SteppingManager::GetfSecondary() method). So, you always get "zero" from
number of secondaries in ParticleChange.
If you want to see secondaries from an individual process, you scan over all
secondaries in G4SteppingManager secondary container and you can use
G4Track::GetCreatorProcess.
Best Regards,
Hisaya
|
In my SteppingAction:public G4UserSteppingAction class, I have the following code: void SteppingAction:: UserSteppingAction( G4Step const* pStepData) { .... G4String processName = ' '; G4VProcess const* processStep = pStepData->GetPostStepPoint()->GetProcessDefinedStep(); if(processStep) { processName = processStep->GetProcessName(); if (processName == "LowEnCompton") { G4VParticleChange *pch = fpSteppingManager->GetfParticleChange(); G4int nOfSecondaries = pch->numberOfSecondaries(); G4Track const* secondary = temp->GetSecondary(0); ..... } etc. The values of nOfSecondaries should never be zero, because Compton scattering always produces an electron. Indeed, when I check the pointer to the first secondary in the list of secondaries (G4Track const* secondary) - it is a valid non-zero pointer, and the secondary particle described there is an electron, as it should be. However, the value returned by G4VParticleChange::numberOfSecondaries() method is a dead zero. Here is what I was trying to accomplish in my SteppingAction class: for each particle species and each process, I wanted to get the number of secondaries through G4VParticleChange::numberOfSecondaries() as shown in the code snippet above, and then I wanted to access every secondary via G4VParticleChange::GetSecondary(index). I sure can go around the fact that G4VParticleChange::numberOfSecondaries() does not work as I expected, but it would be nice to know whether *** I am doing something wrong or this is a bug? *** Thanks, -- Elena.