Class Twiss
- All Implemented Interfaces:
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
- Since:
- Nov 12, 2002
- Version:
- Sep 25, 2014
- Author:
- Christopher K. Allen
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration of the Courant-Snyder parameters used. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
Compute and return the eigenvalues of the Twiss matrix.R2[]
Compute and return the eigenvectors of the Twiss matrix.double
Compute the phase space ellipse's rotation from upright.double[]
Computes and returns the semi-axes of the phase space ellipse represented by the Twiss parameters.double[][]
Return the correlation matrix associated with these Twiss parameters.static Twiss
createFromCovarianceMatrix
(double[][] arrCov) Create a new set ofTwiss
parameters from the given covariance matrix.static Twiss
createFromEquivalentBeam
(double dblEnvRad, double dblEnvSlp, double dblEmit) Creates a newTwiss
object given the parameters of the equivalent uniform beam.static Twiss
createFromMoments
(double dblMmtSigX, double dblMmtCov, double dblMmtSigXp) Creates a newTwiss
object initialized by the given set of central, second-order moments of the beam in whatever phase plane.double
getAlpha()
Return the alpha Twiss parameterdouble
getBeta()
Return the beta Twiss parameterdouble
Return the beam emittancedouble
Return the envelope radius extentdouble
Return the envelope slopedouble
getGamma()
Return the gamma Twiss parametervoid
printOn
(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.toString()
Get the Twiss parameters as a stringdouble[][]
Return the Twiss matrix associated with these Twiss parameters.
-
Constructor Details
-
Twiss
public Twiss()Creates a new, uninitialized, instance of Twiss -
Twiss
Copy constructor: creates a deep copy of the argument.- Parameters:
twiss
- twiss object to be copied.
-
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'^2dblEmitt
- magnitude^2 of the ellipse (beam emittance)
-
-
Method Details
-
createFromMoments
Creates a newTwiss
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 as- Parameters:
dblMmtSigX
- the second moment <x2>dblMmtCov
- the second moment <xx'>dblMmtSigXp
- the second moment <x'2>- Returns:
- the Courant-Snyder parameters (α=-<xx'>/ε, β=<x2>/ε, ε)
- Since:
- Aug 29, 2012
-
createFromCovarianceMatrix
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> |
- Parameters:
arrCov
- symmetric matrix array of second-order moments- Returns:
- Courant-Snyder parameters corresponding to the given covariance matrix
- Since:
- Aug 29, 2012
-
createFromEquivalentBeam
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).NOTE
· We do not scale the emittance! It is common practice to multiply the RMS emittance by 4 for 2D beams and other values for 3D beams with various distributions. We assume the same second moments which yield the same RMS emittance. Specially, the emittance of the returned object IS THE RMS EMITTANCE.
- Parameters:
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!- Returns:
- Courant-Snyder parameters corresponding to the given equivalent uniform beam parameters
- Since:
- Aug 29, 2012
-
setTwiss
public void setTwiss(double dblAlpha, double dblBeta, double dblEmitt) Sets the values of the Twiss parameters directly.- Parameters:
dblAlpha
- alpha parameter (phase plane coupling)dblBeta
- beta parameter (the envelope magnitude)dblEmitt
- beam emittance (phase space area)
-
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 radiusdblEnvSlp
- envelope slopedblEmitt
- 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 -
getEmittance
public double getEmittance()Return the beam emittance -
getEnvelopeRadius
public double getEnvelopeRadius()Return the envelope radius extent -
getEnvelopeSlope
public double getEnvelopeSlope()Return the envelope slope -
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
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
Print out contents of the Twiss object.- Parameters:
pw
- PrintWriter object to receive contents
-
toString
Get the Twiss parameters as a string
-