Module simpa.acc

Record Class PhaseSpaceEllipse

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

    Constructors
    Constructor
    Description
    PhaseSpaceEllipse(double em, double alpha, double beta, double pos, double angle)
    Creates an instance of a PhaseSpaceEllipse record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the value of the alpha record component.
    double
    Returns the value of the angle record component.
    double
    Returns the value of the beta record component.
    Fits a phase space ellipse to the list of phase space coordinates.
     
    double
    em()
    Returns the value of the em 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.
    getTwissParameters(String phaseSpaceFile)
    Calculates the phase space ellipse parameters from phase space coordinates file,then print it to the stdout.
    final int
    Returns a hash code value for this object.
    double
    pos()
    Returns the value of the pos record component.
    printTwiss(String phaseSpaceFile)
    Prints those Twiss parameters which can be calculated from a phase space file.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PhaseSpaceEllipse

      public PhaseSpaceEllipse(double em, double alpha, double beta, double pos, double angle)
      Creates an instance of a PhaseSpaceEllipse record class.
      Parameters:
      em - the value for the em record component
      alpha - the value for the alpha record component
      beta - the value for the beta record component
      pos - the value for the pos record component
      angle - the value for the angle record component
  • Method Details

    • copy

      public PhaseSpaceEllipse copy()
      Returns:
      Deep copy of this ellipse.
    • getEllipse

      public FitEllipse getEllipse()
      Returns:
      The ellipse fit belonging to this instance.
    • getEllipse

      public 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.
      Parameters:
      em - Emittance [mm mrad]
      alpha - Twiss parameter alpha
      beta - 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

      public static TwissParameters getTwissParameters(String phaseSpaceFile) throws IOException
      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

      public static TwissParameters printTwiss(String phaseSpaceFile) throws IOException
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • em

      public double em()
      Returns the value of the em record component.
      Returns:
      the value of the em record component
    • alpha

      public double alpha()
      Returns the value of the alpha record component.
      Returns:
      the value of the alpha record component
    • beta

      public double beta()
      Returns the value of the beta record component.
      Returns:
      the value of the beta record component
    • pos

      public double pos()
      Returns the value of the pos record component.
      Returns:
      the value of the pos record component
    • angle

      public double angle()
      Returns the value of the angle record component.
      Returns:
      the value of the angle record component