Message: Re: Angle distribution from direction cosines Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: Angle distribution from direction cosines 

Keywords: angle
Forum: Particles
Re: Question 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 <<G4endl;
		}

		   else
		   {
			   if(pz >= 0)
			   {
				phi = -(180- (-(asin(py/S))*(180/3.1459))); //in gradi
				//G4cout << "Phi= " << phi << "  Pz= " << pz << "  Py= " << py <<G4endl;
			   }
			   else
			   {
				phi = (asin(py/S))*(180/3.1459); //in gradi
				//G4cout << "Phi= " << phi << "  Pz= " << pz << "  Py= " << py <<G4endl;
			   }

		   }   

Another idea could be to give a look to our wiki pages:

http://geant4lns.wikispaces.com

in the "Discussion-Frag/MOBIDIC experiment" section click on progress on Monte Carlo simulation. in that slides you can find useful picture for the carthesia-spherical conversion.

All the Best, Pablo Cirrone

(for the Catania Geant4 Group)

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

 Add Message Add Message
to: "Re: Angle distribution from direction cosines"

 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 ]