Message: Re: How to GetKineticEnergy of secondary particles??? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Disagree Re: How to GetKineticEnergy of secondary particles??? 

Forum: Event and Track Management
Re: None How to GetKineticEnergy of secondary particles??? (Mary Spears)
Date: 28 Feb, 2014
From: Gumplinger Peter <Gumplinger Peter>

Hi Mary,

Sorry, to your dismay you've run into a Geant4 quirk! The method:

const G4TrackVector* secondary = fpSteppingManager->GetSecondary();

which is essentially:

fStep->GetSecondary();

returns ALL secondaries that have been created by the current track since its inception! Please note:

http://www-geant4.kek.jp/lxr/source/track/include/G4Step.hh#L206

In more recent versions of Geant4, you are much better off if you used:

fStep->GetSecondaryInCurrentStep();

see:

http://www-geant4.kek.jp/lxr/source/track/include/G4Step.hh#L204

and see how the implementation differs from GetSecondary():

http://www-geant4.kek.jp/lxr/source/track/src/G4Step.cc#L193

You can also see how other examples use this method:

http://www-geant4.kek.jp/lxr/search?string=GetSecondaryInCurrentStep

This is if you access secondaries from SteppingAction. It is also possible and perhaps more intuitive to collect information about all secondaries at the time they are put on the tracking stack. For this, the user-hook, G4UserStackingAction exists; in particular: ClassifyNewTrack

For an example, see:

http://www-geant4.kek.jp/lxr/source/examples/extended/hadronic/Hadr01/src/StackingAction.cc#L73

> eventaction->GetSecondaryenergy(energy);

Strange that you call a method 'Get' when it sets something.

Peter

 Add Message Add Message
to: "Re: How to GetKineticEnergy of secondary particles???"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]