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 aPhaseSpaceEllipse
record class. -
Method Summary
Modifier and TypeMethodDescriptiondouble
alpha()
Returns the value of thealpha
record component.double
angle()
Returns the value of theangle
record component.double
beta()
Returns the value of thebeta
record component.static PhaseSpaceEllipse
calculatePhaseSpaceEllipse
(double lpos, List<PhaseSpaceCoordinates> phsc, PhaseSpacePlane plane) Fits a phase space ellipse to the list of phase space coordinates.copy()
double
em()
Returns the value of theem
record component.final boolean
Indicates whether some other object is "equal to" this one.static FitEllipse
getEllipse
(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 TwissParameters
getTwissParameters
(String phaseSpaceFile) Calculates the phase space ellipse parameters from phase space coordinates file,then print it to the stdout.final int
hashCode()
Returns a hash code value for this object.double
pos()
Returns the value of thepos
record component.static TwissParameters
printTwiss
(String phaseSpaceFile) Prints those Twiss parameters which can be calculated from a phase space file.final String
toString()
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 aPhaseSpaceEllipse
record class.- Parameters:
em
- the value for theem
record componentalpha
- the value for thealpha
record componentbeta
- the value for thebeta
record componentpos
- the value for thepos
record componentangle
- the value for theangle
record 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 theem
record component.- Returns:
- the value of the
em
record component
-
alpha
public double alpha()Returns the value of thealpha
record component.- Returns:
- the value of the
alpha
record component
-
beta
public double beta()Returns the value of thebeta
record component.- Returns:
- the value of the
beta
record component
-
pos
public double pos()Returns the value of thepos
record component.- Returns:
- the value of the
pos
record component
-
angle
public double angle()Returns the value of theangle
record component.- Returns:
- the value of the
angle
record component
-