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

Agree Re: Initial angle of secondary particles 

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

Dear Clara,

> I added the code for post
> 9.6, but the angle I get out is always 1.5708. I output the momentum
> calculated to the screen and it was always (0,0,0). If I change the
> line:
> 
>      G4ThreeVector momentum =(*fSecondary)[lp1]->GetVertexMomentumDirection();
> 
> to
> 
>      G4ThreeVector momentum =(*fSecondary)[lp1]->GetMomentumDirection();
> 
> then the angle changes for each new particle as expected. But this might
> not be the right way to do it. Could you please explain to me which
> angle is being calculated with this code?

My instruction was incorrect! You want GetMomentumDirection(). The reason is that VertexMomentumDirection is not set until the SetInitialStep method in G4SteppingManager:

fTrack->SetVertexMomentumDirection( fTrack->GetMomentumDirection() );

So, at the time the secondary is created, during the step of the primary, its G4Track object is not yet completely initialized and methods such as GetVertexMomentumDirection, GetVertexPosition, GetVertexKineticEnergy, as well as GetLogicalVolumeAtVertex, GetTouchableHandle, GetNextTouchableHandle return 0 or NULL. I expected the last three methods to not yet work but it's a matter of taste (convention) why the former G4Track information is not yet filled.

So, we must remember that the 'vertex' info in G4Track is only available during stepping of that track.

Peter

 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 ]