public class TraceXalUnitConverter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double |
traceToXalDimension |
static double |
xalToTraceDimension |
Modifier and Type | Method and Description |
---|---|
static double |
calcSigmaTraceFromTrace(double beta,
double emit)
calculate 1-sigma in trace3d unit from beta and emittance of trace3d unit
|
static double |
calcSigmaTraceFromXal(double beta,
double emit)
calculate 1-sigma in trace3d unit from beta and emittance of trace3d unit
|
static double |
calcSigmaXalFromTrace(double beta,
double emit)
calculate 1-sigma in xal unit from beta and emittance of xal unit
|
static double |
calcSigmaXalFromXal(double beta,
double emit)
calculate 1-sigma in xal unit from beta and emittance of xal unit
|
PhaseVector |
centroidFromXal(CovarianceMatrix matCorrel)
Compute and return the beam centroid coordinates from the correlation
matrix in homogeneous coordinates.
|
CovarianceMatrix |
correlationMatrixFromT3d(Twiss t3dX,
Twiss t3dY,
Twiss t3dZ)
Builds a correlation matrix from Twiss parameters in the three phase
planes.
|
CovarianceMatrix |
correlationMatrixFromT3d(Twiss t3dX,
Twiss t3dY,
Twiss t3dZ,
PhaseVector centroid)
Builds a correlation matrix from Twiss parameters in the three phase
planes.
|
static TraceXalUnitConverter |
newConverter(double f,
double ER,
double W)
Creates a new TraceXalUnitConverter object configured to the specified machine and
beam species parameters.
|
void |
setKineticEnergy(double W)
Change the current beam kinetic energy.
|
void |
setRestEnergy(double ER)
Change the current particle species rest energy.
|
void |
setRfFrequency(double f)
Change the RF frequency parameter used for longitudinal calculations.
|
PhaseVector |
traceToXalCoordinates(PhaseVector vecCoords)
Converts phase vector values in Trace3D units to values in units used by XAL (MKS).
|
double |
traceToXalDispersion(double dT3d,
PhaseIndex index)
Convert the dispersion from XAL units to Trace3D units.
|
Twiss |
traceToXalLongitudinal(Twiss t3dTwiss)
Converts Twiss parameters in Trace3D units to XAL (MKS) units for the longitudinal
phase planes.
|
Twiss |
traceToXalTransverse(Twiss t3dTwiss)
Converts Twiss parameter in Trace3D units to XAL (MKS) units for the transverse phase
planes.
|
Twiss[] |
twissParametersFromXal(CovarianceMatrix mat)
Computes and return the Twiss parameters for each plane that correspond to
the given correlation matrix.
|
PhaseVector |
xalToTraceCoordinates(PhaseVector vecCoords)
Converts phase vector values in XAL (MKS) units to values in units used by Trace3D.
|
double |
xalToTraceDispersion(double dXal,
PhaseIndex index)
Convert the dispersion from XAL units to Trace3D units.
|
Twiss |
xalToTraceLongitudinal(Twiss twissXal)
Converts Twiss parameters in XAL (MKS) units to Trace3D units for the longitudinal
phase planes.
|
Twiss |
xalToTraceTransverse(Twiss twissXal)
Converts Twiss parameter in XAL (MKS) units to Trace3D units for the transverse phase
planes.
|
public static final double xalToTraceDimension
public static final double traceToXalDimension
public static TraceXalUnitConverter newConverter(double f, double ER, double W)
f
- machine electromagnetic frequency in HzER
- the rest energy of the beam particle species in eVW
- the kinetic energy of the beam in eVpublic void setRfFrequency(double f)
f
- new RF frequency in Hzpublic void setKineticEnergy(double W)
W
- new beam energy in eVpublic void setRestEnergy(double ER)
ER
- new rest energy in eVpublic PhaseVector traceToXalCoordinates(PhaseVector vecCoords)
Converts phase vector values in Trace3D units to values in units used by XAL (MKS).
Specifically, the argument vecCoord
is assumed to be in the form
vecPhase=(x,x',y,y',dPhi,dW,1) x in mm x' in mrad y in mm y' in mrad dPhi in degrees dW in keVThe output vector in in the following form along with the units:
returned=(x,x',y,y',z,z',1) x in meters x' in radians y in meters y' in radians z in meters z' in radians
vecCoord
- coordinate phase vector in Trace3D unitspublic PhaseVector xalToTraceCoordinates(PhaseVector vecCoords)
Converts phase vector values in XAL (MKS) units to values in units used by Trace3D.
Specifically, the argument vecCoords
is assumed to be in the form
vecCoords=(x,x',y,y',z,z',1) x in meters x' in radians y in meters y' in radians z in meters z' in radiansThe output vector in in the following form along with the units:
returned=(x,x',y,y',dPhi,dW,1) x in mm x' in mrad y in mm y' in mrad dPhi in degrees dW in keV
vecCoord
- coordinate phase vector in MKS unitspublic Twiss traceToXalTransverse(Twiss t3dTwiss)
Converts Twiss parameter in Trace3D units to XAL (MKS) units for the transverse phase planes. Method takes the set of Twiss parameters as a Twiss object argument and returns a new object containing the same Twiss in the different units. The method is none destructive.
Trace3D | XAL | |
---|---|---|
alpha | unitless | unitless (no conversion) |
beta | m/rad | m/rad |
emittance | eff. (5xRMS) mm-mrad | RMS m-rad |
t3dTwiss
- Twiss parameters in Trace3D unitspublic Twiss traceToXalLongitudinal(Twiss t3dTwiss)
Converts Twiss parameters in Trace3D units to XAL (MKS) units for the longitudinal phase planes. Method takes the set of Twiss parameters as a Twiss object argument and returns a new object containing the same Twiss in the different units. The method is non destructive.
Trace3D | XAL | |
---|---|---|
alpha | unitless | (-1)unitless (phase lag is positive) |
beta | deg/keV | m/rad |
emittance | eff. (5xRMS) deg-keV | RMS m-rad |
t3dTwiss
- Trace3D twiss parameterspublic Twiss xalToTraceTransverse(Twiss twissXal)
Converts Twiss parameter in XAL (MKS) units to Trace3D units for the transverse phase planes. Method takes the set of Twiss parameters as a Twiss object argument and returns a new object containing the same Twiss in the different units. The method is none destructive.
Trace3D | XAL | |
---|---|---|
alpha | unitless | unitless (no conversion) |
beta | m/rad | m/rad |
emittance | eff. (5xRMS) mm-mrad | RMS m-rad |
twissXal
- Twiss parameters in XAL (MKS) unitspublic Twiss xalToTraceLongitudinal(Twiss twissXal)
Converts Twiss parameters in XAL (MKS) units to Trace3D units for the longitudinal phase planes. Method takes the set of Twiss parameters as a Twiss object argument and returns a new object containing the same Twiss in the different units. The method is none destructive.
Trace3D | XAL | |
---|---|---|
alpha | unitless | (-1)unitless (phase lag is positive) |
beta | deg/keV | m/rad |
emittance | eff. (5xRMS) deg-keV | RMS m-rad |
twissXal
- Trace3D twiss parameterspublic double xalToTraceDispersion(double dXal, PhaseIndex index)
dXal
- dispersion as z' (radians)index
- phase plane indexpublic double traceToXalDispersion(double dT3d, PhaseIndex index)
dT3d
- dispersion as dp/p0 (radians)index
- phase plane indexpublic CovarianceMatrix correlationMatrixFromT3d(Twiss t3dX, Twiss t3dY, Twiss t3dZ)
Builds a correlation matrix from Twiss parameters in the three phase planes. The Twiss parameters are assumed to be in the units used by Trace3D. The beam is also assumed to be centered (on axis), thus the correlation matrix equals the covariance matrix (usually denoted sigma).
NOTE: The returned matrix is in homogeneous coordinates of the block diagonal form
| Rxx 0 0 0 | | 0 Ryy 0 0 | | 0 0 Rzz 0 | | 0 0 0 1 |where Rii are 2x2 symmetric blocks corresponding to each phase plane. Clearly the phase planes are uncoupled.
The covariance matrix is the second central moment of the beam distribution defined by
sigma = <( z-<z> )2> = <zzT>-<z><z>T = <zzT>since since the centroid <z>=0.
t3dX
- Twiss parameters describing the beam ellipse in the x planet3dY
- Twiss parameters describing the beam ellipse in the y planet3dZ
- Twiss parameters describing the beam ellipse in the z planetraceToXalLongitudinal(xal.tools.beam.Twiss)
,
traceToXalTransverse(xal.tools.beam.Twiss)
public CovarianceMatrix correlationMatrixFromT3d(Twiss t3dX, Twiss t3dY, Twiss t3dZ, PhaseVector centroid)
Builds a correlation matrix from Twiss parameters in the three phase
planes. The Twiss parameters are assumed to be in the units used by
Trace3D. The correlation matrix also has the mean values corresponding
to the mean value vector <z> provided in the argument. The mean value vector
centroid
is also assumed to be in the units used by Trace3D.
It is also assumed to have the form
centroid = <z> = (<x>, <x'>, <y>, <y'>, <dPhi>, <dW>, 1)
The correlation matrix is computed by first computing the covariance matrix (usually denoted sigma in the literature) from the Twiss parameters then adjusting the value according to the effects of being "off center". This is done by adding the tensor product of the mean value vector <z>.
To see this not that the correlation matrix is the second moment of the beam distribution defined by
<zzT>Thus, denoting sigma the covariance matrix we have
sigma = <( z-<z> )2> = <zzT>-<z><z>Tor
<zzT> = sigma + <z><z>T
NOTE: The returned matrix is in homogeneous coordinates of the block diagonal form
| Rxx 0 0 0 | | 0 Ryy 0 0 | + <z><z>T | 0 0 Rzz 0 | | 0 0 0 1 |where Rii are 2x2 symmetric blocks corresponding to each phase plane and <z> is the vector of mean values in the phase plane, e.g., <z>=(<x>, <x'>, <y>, <y'>, <z>, <z'>).
t3dX
- Twiss parameters describing the beam ellipse in the x planet3dY
- Twiss parameters describing the beam ellipse in the y planet3dZ
- Twiss parameters describing the beam ellipse in the z planecentroid
- phase position of the beam centroidtraceToXalLongitudinal(xal.tools.beam.Twiss)
,
traceToXalTransverse(xal.tools.beam.Twiss)
public PhaseVector centroidFromXal(CovarianceMatrix matCorrel)
matCorrel
- correlation matrix <zzT> in MKS unitsxalToTraceCoordinates(xal.tools.beam.PhaseVector)
public Twiss[] twissParametersFromXal(CovarianceMatrix mat)
NOTE: This method ignores any coupling between phase planes and any offsets of the beam centroid from the beam axis.
TODO - Make the method consider the general case of coupling between phase planes and return the Twiss parameters as projections that one would observe in experiments.
matCorrel
- correlation matrix <zzT> in MKS unitspublic static double calcSigmaXalFromTrace(double beta, double emit)
public static double calcSigmaTraceFromTrace(double beta, double emit)
public static double calcSigmaXalFromXal(double beta, double emit)
public static double calcSigmaTraceFromXal(double beta, double emit)