dwvisser.monte
Class Direction

java.lang.Object
  |
  +--dwvisser.monte.Direction
All Implemented Interfaces:
java.lang.Cloneable

public class Direction
extends java.lang.Object
implements java.lang.Cloneable

Class which provides an abstraction for a direction in 3-dimensional space.

Author:
Dale W. Visser

Constructor Summary
Direction(double theta, double phi)
          Creates new direction, given theta (angle from z-axis) and phi (azimuthal angle from x axis) in radians.
Direction(double _x, double _y, double _z)
          Create a new direction by specifying its x, y, and z components.
 
Method Summary
protected  java.lang.Object clone()
           
static double evaluateLegendre(int _l, int _m, double _x)
          Taken from plgndr, section 6.8 in Numerical Recipes in C.
 double[] get3vector(double amplitude)
           
static Direction getBackwardRandomDirection()
           
static Direction getDirection(Matrix m)
           
 double getPhi()
           
 double getPhiDegrees()
           
static Direction getRandomDirection()
           
static Direction getRandomDirection(double minThetaRad, double maxThetaRad)
          get Random direction between given theta limits
static Direction getRandomDirection(int l)
          Generate a random direction for m=0 using a Legendre polynomial distribution (attenuated by a sin theta solid angle factor).
static Direction getRandomDirection(int l, Direction d)
          Generate a random direction using a Legendre polynomial distribution (attenuated by a sin theta solid angle factor), relative to a z-axis defined by the given direction.
static Direction getRandomDirection(int l, int m)
          Generate a random direction using a Spherical Harmonic distribution (attenuated by a sin theta solid angle factor).
 double getTheta()
           
 double getThetaDegrees()
           
 Matrix getVector()
           
 double getX()
           
 double getY()
           
 double getZ()
           
static void main(java.lang.String[] args)
           
static double normPhi(double _phi)
           
 Direction rotateFrameY(double angRad)
          Return a new Direction object resulting from this object's reference frame being rotated by angRad about the y-axis.
 Direction rotateFrameZ(double angRad)
          Return a new Direction object resulting from this object's reference frame being rotated by angRad about the z-axis.
 Direction rotateY(double angRad)
          return a new Direction object resulting from this object being rotated by angRad about the y-axis
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Direction

public Direction(double theta,
                 double phi)
Creates new direction, given theta (angle from z-axis) and phi (azimuthal angle from x axis) in radians.


Direction

public Direction(double _x,
                 double _y,
                 double _z)
Create a new direction by specifying its x, y, and z components. These will be renormailized.

Method Detail

clone

protected java.lang.Object clone()
Overrides:
clone in class java.lang.Object

rotateY

public Direction rotateY(double angRad)
return a new Direction object resulting from this object being rotated by angRad about the y-axis


rotateFrameY

public Direction rotateFrameY(double angRad)
Return a new Direction object resulting from this object's reference frame being rotated by angRad about the y-axis.


rotateFrameZ

public Direction rotateFrameZ(double angRad)
Return a new Direction object resulting from this object's reference frame being rotated by angRad about the z-axis.


getDirection

public static Direction getDirection(Matrix m)

get3vector

public double[] get3vector(double amplitude)

getPhi

public double getPhi()
Returns:
phi in radians, guaranteed between -pi and pi

getTheta

public double getTheta()

getX

public double getX()

getY

public double getY()

getZ

public double getZ()

getVector

public Matrix getVector()

getBackwardRandomDirection

public static Direction getBackwardRandomDirection()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

normPhi

public static double normPhi(double _phi)

getPhiDegrees

public double getPhiDegrees()

getThetaDegrees

public double getThetaDegrees()

evaluateLegendre

public static double evaluateLegendre(int _l,
                                      int _m,
                                      double _x)
                               throws java.lang.IllegalArgumentException
Taken from plgndr, section 6.8 in Numerical Recipes in C. Decays with angular momentum 'l' are distributed as the square of evaluateLegengre(l,0,cos theta). (Modulated of course by the sin(theta) factor of the phase space available.)

java.lang.IllegalArgumentException

getRandomDirection

public static Direction getRandomDirection(int l,
                                           int m)
Generate a random direction using a Spherical Harmonic distribution (attenuated by a sin theta solid angle factor).


getRandomDirection

public static Direction getRandomDirection(int l)
Generate a random direction for m=0 using a Legendre polynomial distribution (attenuated by a sin theta solid angle factor).


getRandomDirection

public static Direction getRandomDirection()

getRandomDirection

public static Direction getRandomDirection(double minThetaRad,
                                           double maxThetaRad)
get Random direction between given theta limits


getRandomDirection

public static Direction getRandomDirection(int l,
                                           Direction d)
Generate a random direction using a Legendre polynomial distribution (attenuated by a sin theta solid angle factor), relative to a z-axis defined by the given direction.


main

public static void main(java.lang.String[] args)