Message: Re: Final step information for parent particle Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Final step information for parent particle 

Forum: Event and Track Management
Re: Question Final step information for parent particle (Cristian Bungau)
Re: None Re: Final step information for parent particle (Tom Roberts)
Re: Question Re: Final step information for parent particle (Cristian Bungau)
Re: None Re: Final step information for parent particle (Tom Roberts)
Re: None Re: Final step information for parent particle (Tom Roberts)
Re: Ok Re: Final step information for parent particle (Cristian Bungau)
Date: 19 May, 2009
From: Gumplinger Peter <Gumplinger Peter>

Hi Cristian,

Yes, the tip:

http://geant4.slac.stanford.edu/Tips/event/1.html

is almost exactly what you want. Instead of attaching a TrackInformation to every track in PreUserTrackingAction, you can attach one only when the particle is a pion decaying in flight. You would do this in UserSteppingAction:

G4Track* theTrack = theStep->GetTrack();
G4StepPoint* pPostPoint = theStep->GetPostStepPoint();
const G4VProcess* pProcess = pPostPoint->GetProcessDefinedStep();
G4String theProcessName = " ";
if (pProcess) theProcessName = pProcess->GetProcessName();
G4Track* theTrack = theStep->GetTrack();
const G4String theParticleName = theTrack->GetDefinition()->GetParticleName();
if(theTrack->GetParentID()==0 && theTrack->GetUserInformation()==0) {
  if(theProcessName == "Decay" && theParticleName=="pi+") {
    if(theTrack->GetKineticEnergy()>0.){
       TrackInformation* anInfo = new TrackInformation(aTrack);
       theTrack->SetUserInformation(anInfo);

etc.

>  Note that UserSteppingAction() does not get called after the final step
> (when the track has been killed);

I am not sure I agree with Tom in this. You can have code in SteppingAction which executes when:

  // If the particle is the primary pion and it is stopped...
  if (theTrack->GetTrackStatus() == fStopAndKill) {
     if (theParticleName == "pi+" && theTrack->GetParentID() == 0 ) {

           // If the track is finished but the pion did not decay,
           // abort the event
           if (theProcessName != "Decay" ) {
              G4cout << "AbortEvent: track is finished but the pion did not decay" << G4endl;
              G4RunManager::GetRunManager()->AbortEvent();
           }
     }
  }

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Question: Re: Final step information for parent particle   (Cristian Bungau - 20 May, 2009)
(_ Ok: Re: Final step information for parent particle   (Cristian Bungau - 20 May, 2009)
 Add Message Add Message
to: "Re: Final step information for parent particle"

 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 ]