java.lang.Object
java.lang.Record
simpa.acc.api.track.PhaseSpaceEllipse
public record PhaseSpaceEllipse(double em, double alpha, double beta, double pos, double angle)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionPhaseSpaceEllipse(double em, double alpha, double beta, double pos, double angle) Creates an instance of aPhaseSpaceEllipserecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoublealpha()Returns the value of thealpharecord component.doubleangle()Returns the value of theanglerecord component.doublebeta()Returns the value of thebetarecord component.static PhaseSpaceEllipsecalculatePhaseSpaceEllipse(double lpos, List<PhaseSpaceCoordinates> phsc, PhaseSpacePlane plane) Fits a phase space ellipse to the list of phase space coordinates.copy()doubleem()Returns the value of theemrecord component.final booleanIndicates whether some other object is "equal to" this one.static FitEllipsegetEllipse(double em, double alpha, double beta, double pos, double angle) Constructs an ellipse with the given Twiss parameters.The Ellipse can be used to sample points on it.static TwissParametersgetTwissParameters(String phaseSpaceFile) Calculates the phase space ellipse parameters from phase space coordinates file,then print it to the stdout.final inthashCode()Returns a hash code value for this object.doublepos()Returns the value of theposrecord component.static TwissParametersprintTwiss(String phaseSpaceFile) Prints those Twiss parameters which can be calculated from a phase space file.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PhaseSpaceEllipse
public PhaseSpaceEllipse(double em, double alpha, double beta, double pos, double angle) Creates an instance of aPhaseSpaceEllipserecord class.- Parameters:
em- the value for theemrecord componentalpha- the value for thealpharecord componentbeta- the value for thebetarecord componentpos- the value for theposrecord componentangle- the value for theanglerecord component
-
-
Method Details
-
copy
- Returns:
- Deep copy of this ellipse.
-
getEllipse
- Returns:
- The ellipse fit belonging to this instance.
-
getEllipse
Constructs an ellipse with the given Twiss parameters.The Ellipse can be used to sample points on it.- Parameters:
em- Emittance [mm mrad]alpha- Twiss parameter alphabeta- Twiss parameter beta [m]pos- x coordinate of the ellipse center [m]angle- y coordinate of the ellipse center [m]- Returns:
- The ellipse fit.
-
calculatePhaseSpaceEllipse
public static PhaseSpaceEllipse calculatePhaseSpaceEllipse(double lpos, List<PhaseSpaceCoordinates> phsc, PhaseSpacePlane plane) Fits a phase space ellipse to the list of phase space coordinates. At least 6 points must be in the list.- Parameters:
phsc- A list of phase space coordinates.plane- The phase space plane to get information from about the phase space.- Returns:
- The ellipse fit found at the index.
-
getTwissParameters
Calculates the phase space ellipse parameters from phase space coordinates file,then print it to the stdout. This is a subset of Twiss parameters, only those which can be calculated from a single phase space file. It does not contain the dispersion and the phase advances. The input file should contain the phase space coordinates at a some longitudinal position.- Parameters:
phaseSpaceFile- Input file containing the phase space coordinates for at least 6 machine turns. In case of a transfer line the file should contain the phase space coordinates of at least 6 particles. The initial phase space coordinates at the beginning of the transfer line should be on an ellipse, otherwise the fit might fail.- Returns:
- Those Twiss parameters which can be calculated from a phase space file.
- Throws:
IOException- When the file can't be read.
-
printTwiss
Prints those Twiss parameters which can be calculated from a phase space file. These are the parameters of the horizontal and vertical phase space ellipses.- Parameters:
phaseSpaceFile- Input file containing the phase space coordinates for at least 6 machine turns. In case of a transfer line the file should contain the phase space coordinates of at least 6 particles. The initial phase space coordinates at the beginning of the transfer line should be on an ellipse, otherwise the fit will fail.- Returns:
- The TwissParameters
- Throws:
IOException
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
em
public double em()Returns the value of theemrecord component.- Returns:
- the value of the
emrecord component
-
alpha
public double alpha()Returns the value of thealpharecord component.- Returns:
- the value of the
alpharecord component
-
beta
public double beta()Returns the value of thebetarecord component.- Returns:
- the value of the
betarecord component
-
pos
public double pos()Returns the value of theposrecord component.- Returns:
- the value of the
posrecord component
-
angle
public double angle()Returns the value of theanglerecord component.- Returns:
- the value of the
anglerecord component
-