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
γx2 + 2αxx' + βx'2 = ε
where α, β, γ, and ε are the Courant-Snyder parameters and (x,x') are
coordinates on the horizontal phase plane. (There are analogous equations for the other phase planes.)
Recall that the Courant-Snyder parameters are not independent but related by the
fact
βγ - α2 = 1
Modifier and Type | Class and Description |
---|---|
static class |
Twiss.PROP
Enumeration of the Courant-Snyder parameters used.
|
Constructor and Description |
---|
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.
|
Twiss(Twiss twiss)
Copy constructor: creates a deep copy of the argument.
|
Modifier and Type | Method and Description |
---|---|
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.
|
static Twiss |
createFromCovarianceMatrix(double[][] arrCov)
Create a new set of
Twiss parameters from the given covariance matrix. |
static Twiss |
createFromEquivalentBeam(double dblEnvRad,
double dblEnvSlp,
double dblEmit)
Creates a new
Twiss object given the parameters of the equivalent
uniform beam. |
static Twiss |
createFromMoments(double dblMmtSigX,
double dblMmtCov,
double dblMmtSigXp)
Creates a new
Twiss object initialized by the given set of
central, second-order moments of the beam in whatever phase plane. |
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.
|
java.lang.String |
toString()
Get the twiss parameters as a string
|
double[][] |
twissMatrix()
Return the Twiss matrix associated with these Twiss parameters.
|
public Twiss()
public Twiss(Twiss twiss)
twiss
- twiss object to be copied.public Twiss(double dblAlpha, double dblBeta, double dblEmitt)
dblAlpha
- coefficient of 2*x*x'dblBeta
- coefficient of x'^2dblEmitt
- magnitude^2 of the ellipse (beam emittance)public static Twiss createFromMoments(double dblMmtSigX, double dblMmtCov, double dblMmtSigXp)
Twiss
object initialized by the given set of
central, second-order moments of the beam in whatever phase plane. Note that the
RMS emittance ε is given by
[<x2><x'2> - <xx'>2]1/2For example,
in the horizontal phase plane the parameters are given asdblMmtSigX
- the second moment <x2>dblMmtCov
- the second moment <xx'>dblMmtSigXp
- the second moment <x'2>public static Twiss createFromCovarianceMatrix(double[][] arrCov)
Create a new set of Twiss
parameters from the given covariance matrix.
The covariance matrix is simply the second-order moments packaged up as a symmetric
matrix. The form of this matrix σ is
σ ≅ | <x2> <xx'> | | <xx'> <x'2> |
arrCov
- symmetric matrix array of second-order momentspublic static Twiss createFromEquivalentBeam(double dblEnvRad, double dblEnvSlp, double dblEmit)
Creates a new Twiss
object given the parameters of the equivalent
uniform beam. This is the uniform beam that has the same second-moments as the
beam under study. Because of the uniform charge distribution it can be modeled
as a KV (Kapchinsky-Vladimirsky) beam having a distinct envelope size (radius) and a
distinct envelope slope (this value is related to the divergence angle).
dblEnvRad
- envelope size X of the uniform beamdblEnvSlp
- slope divergence angle X' of the uniform beamdblEmit
- emittance of the beam - This value is not scaled!public void setTwiss(double dblAlpha, double dblBeta, double dblEmitt)
dblAlpha
- alpha parameter (phase plane coupling)dblBeta
- beta parameter (the envelope magnitude)dblEmitt
- beam emittance (phase space area)public void setEnvelope(double dblEnvRad, double dblEnvSlp, double dblEmitt)
dblEnvRad
- envelope radiusdblEnvSlp
- envelope slopedblEmitt
- beam emittancepublic double getAlpha()
public double getBeta()
public double getGamma()
public double getEmittance()
public double getEnvelopeRadius()
public double getEnvelopeSlope()
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
public double[][] correlationMatrix()
public double computeRotation()
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.
public double[] computeEigenvalues()
Compute and return the eigenvalues of the Twiss matrix. This matrix has the form | gamma alpha | | alpha beta |
public R2[] computeEigenvectors()
Compute and return the eigenvectors of the Twiss matrix. This matrix has the form | gamma alpha | | alpha beta |
public void printOn(java.io.PrintWriter pw)
pw
- PrintWriter object to receive contentspublic java.lang.String toString()
toString
in class java.lang.Object