Message: Re: Angle distribution from direction cosines Not Logged In (login)

## Re: Angle distribution from direction cosines

Keywords: angle
Forum: Particles
Re: Angle distribution from direction cosines (valentina)
Date: 04 Feb, 2008
From: G.A.P.Cirrone <G.A.P.Cirrone>

 Dear Valentina, perhaps this can be usefull for you. Let's suppose you derive the three direcions of the momentum of your particle: G4double px = particleMomentum.x(); G4double py = particleMomentum.y(); G4double pz = particleMomentum.z(); At this point you are able to calculate the projections of the momentum onto the planes as well as the total momentum and the angle theta (in degrees)that is always positive: ``` G4double rho = sqrt(pow(px,2) + pow(py,2) + pow(pz,2)); G4double S = sqrt(pow(pz,2) + pow(py,2)); G4double R = sqrt(pow(px,2) + pow(pz,2)); theta = acos(px/rho)*(180/3.14159); // in degrees``` Now you must derive the phi angle but its sign depends on the particle directon. For example you could write: ``` if(py >= 0) {``` ``` if(pz >= 0) { phi = 180 - (asin(py/S)*(180/3.14159)); //in gradi } else { phi = (asin(py/S)*(180/3.14159)); //in gradi } //G4cout << "Phi= " << phi << " Pz= " << pz << " Py= " << py <= 0) { phi = -(180- (-(asin(py/S))*(180/3.1459))); //in gradi //G4cout << "Phi= " << phi << " Pz= " << pz << " Py= " << py <

 Inline Depth: Outline Depth: Add message:

 to: "Re: Angle distribution from direction cosines"
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 ]