gov.sns.tools.beam
Class Twiss

java.lang.Object
  |
  +--gov.sns.tools.beam.Twiss
All Implemented Interfaces:
java.io.Serializable

public class Twiss
extends java.lang.Object
implements java.io.Serializable

Convenience class for dealing with Courant-Snyder (or Twiss) parameters. These parameters represent an ellipse in phase space given by gamma*x^2 + 2*alpha*x*x' + beta*x'^2 = emitt Recall that these parameters are related by the fact beta*gamma - alpha^2 = 1

See Also:
Serialized Form

Constructor Summary
Twiss()
          Creates a new, uninitialized, instance of Twiss
Twiss(double dblAlpha, double dblBeta, double dblEmitt)
          Creates a new instance of Twiss initialized to the given Twiss parameters.
 
Method Summary
 double[] computeEigenvalues()
          Compute and return the eigenvalues of the Twiss matrix.
 R2[] computeEigenvectors()
          Compute and return the eigenvectors of the Twiss matrix.
 double computeRotation()
          Compute the phase space ellipse's rotation from upright.
 double[] computeSemiAxes()
          Computes and returns the semi-axes of the phase space ellipse represented by the Twiss parameters.
 double[][] correlationMatrix()
          Return the correlation matrix associated with these Twiss parameters.
 double getAlpha()
          Return the alpha Twiss parameter
 double getBeta()
          Return the beta Twiss parameter
 double getEmittance()
          Return the beam emittance
 double getEnvelopeRadius()
          Return the envelope radius extent
 double getEnvelopeSlope()
          Return the envelope slope
 double getGamma()
          Return the gamma Twiss parameter
 void printOn(java.io.PrintWriter pw)
          Print out contents of the Twiss object.
 void setEnvelope(double dblEnvRad, double dblEnvSlp, double dblEmitt)
          Set the values of the Twiss parameters from the corresponding phase space envelope values.
 void setTwiss(double dblAlpha, double dblBeta, double dblEmitt)
          Sets the values of the Twiss parameters directly.
 double[][] twissMatrix()
          Return the Twiss matrix associated with these Twiss parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Twiss

public Twiss()
Creates a new, uninitialized, instance of Twiss


Twiss

public Twiss(double dblAlpha,
             double dblBeta,
             double dblEmitt)
Creates a new instance of Twiss initialized to the given Twiss parameters.

Parameters:
dblAlpha - coefficient of 2*x*x'
dblBeta - coefficient of x'^2
dblEmitt - magnitude^2 of the ellipse (beam emittance)
Method Detail

setTwiss

public void setTwiss(double dblAlpha,
                     double dblBeta,
                     double dblEmitt)
Sets the values of the Twiss parameters directly.

Parameters:
dblEmitt - beam emittance

setEnvelope

public void setEnvelope(double dblEnvRad,
                        double dblEnvSlp,
                        double dblEmitt)
Set the values of the Twiss parameters from the corresponding phase space envelope values.

Parameters:
dblEnvRad - envelope radius
dblEnvSlp - envelope slope
dblEmitt - beam emittance

getAlpha

public double getAlpha()
Return the alpha Twiss parameter


getBeta

public double getBeta()
Return the beta Twiss parameter


getGamma

public double getGamma()
Return the gamma Twiss parameter


getEnvelopeRadius

public double getEnvelopeRadius()
Return the envelope radius extent


getEnvelopeSlope

public double getEnvelopeSlope()
Return the envelope slope


getEmittance

public double getEmittance()
Return the beam emittance


twissMatrix

public double[][] twissMatrix()
Return the Twiss matrix associated with these Twiss parameters. This matrix has the form S = | gamma alpha | | alpha beta | so that the equation of the phase space ellipse is given by (x,x')*S*(x,x') = emittance

Returns:
2x2 Twiss matrix

correlationMatrix

public double[][] correlationMatrix()
Return the correlation matrix associated with these Twiss parameters.

Returns:
2x2 phase space correlation matrix

computeRotation

public double computeRotation()
Compute the phase space ellipse's rotation from upright.

Returns:
phase space rotation (radians)

computeSemiAxes

public double[] computeSemiAxes()
Computes and returns the semi-axes of the phase space ellipse represented by the Twiss parameters. NOTE: Since the ellipse may be rotated these values do not necessarily correspond to any particular values of x, and x' in the phase plane.

Returns:
two-dimension array of semi-axes (a,b)

computeEigenvalues

public double[] computeEigenvalues()
Compute and return the eigenvalues of the Twiss matrix. This matrix has the form | gamma alpha | | alpha beta |

Returns:
eigenvalues of the above matrix

computeEigenvectors

public R2[] computeEigenvectors()
Compute and return the eigenvectors of the Twiss matrix. This matrix has the form | gamma alpha | | alpha beta |

Returns:
two-element array of eigenvectors of the above matrix

printOn

public void printOn(java.io.PrintWriter pw)
Print out contents of the Twiss object.

Parameters:
pw - PrintWriter object to receive contents