Message: Re: Initial angle of secondary particles Not Logged In (login)

## Re: Initial angle of secondary particles

Forum: Event and Track Management
Re: 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* 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: Outline Depth: Add message:

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