Problem 411 - G4VParticleChange object in G4SteppingManager does report the number of secondaries
Summary: G4VParticleChange object in G4SteppingManager does report the number of secon...
Status: RESOLVED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: track (show other problems)
Version: 4.1
Hardware: All All
: P2 normal
Assignee: kurasige
URL:
Depends on:
Blocks:
 
Reported: 2002-09-11 15:29 CEST by novikova
Modified: 2002-09-15 09:02 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description novikova 2002-09-11 15:29:47 CEST
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.
Comment 1 kurasige 2002-09-15 09:02:59 CEST
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