Message: Re: Initial angle of secondary particles Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Initial angle of secondary particles 

Forum: Event and Track Management
Re: Question Initial angle of secondary particles (Clara)
Date: 11 Sep, 2013
From: Gumplinger Peter <Gumplinger Peter>

Dear Clara,

What you want to do is even a little more complicated in the general case where your primary is not along the x-axis, or you can't assume that it is still along the x-axis when it produces a secondary.

Instead of coding based on the 'first step' (e.g. theTrack->GetCurrentStepNumber() == 1) you can find out the angle of any secondary when it is generated during a step of the primary, as follows:

prior 9.6:

G4TrackVector* fSecondary=fpSteppingManager->GetfSecondary();
G4int tN2ndariesTot = fpSteppingManager->GetfN2ndariesAtRestDoIt()
  + fpSteppingManager->GetfN2ndariesAlongStepDoIt()
  + fpSteppingManager->GetfN2ndariesPostStepDoIt();

for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
    lp1<(*fSecondary).size(); lp1++){

     G4ThreeVector momentum =(*fSecondary)[lp1]->GetVertexMomentumDirection();
     G4double angle = std::acos(momentum * theTrack->GetMomentumDirection());
}

since 9.6:

const std::vector<const G4Track*>* fSecondary=theStep->GetSecondaryInCurrentStep();

for(size_t lp1=0;
    lp1<(*fSecondary).size(); lp1++){

     G4ThreeVector momentum =(*fSecondary)[lp1]->GetVertexMomentumDirection();
     G4double angle = std::acos(momentum * theTrack->GetMomentumDirection());
}

Cheers, Peter

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

1 Question: Re: Initial angle of secondary particles   (Clara - 16 Sep, 2013)
(_ Agree: Re: Initial angle of secondary particles   (Gumplinger Peter - 16 Sep, 2013)
 Add Message Add Message
to: "Re: Initial angle 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 ]