Module simpa.core

Record Class TrajectoryData

java.lang.Object
java.lang.Record
simpa.core.api.track.TrajectoryData

public record TrajectoryData(double x, double y, double z, double px, double py, double pz, double t, double eKinEv, double[][] potentialsWithDerivatives) extends Record
Trajectory Observer registers the trajectory of a particle with this data. It represents the GLOBAL position and momentum of a particle at a given time step. The potentials with derivatives is null unless the TrajectoryObserver is created with the debug option.
Author:
lbojtar
  • Constructor Summary

    Constructors
    Constructor
    Description
    TrajectoryData(double x, double y, double z, double px, double py, double pz, double t, double eKinEv, double[][] potentialsWithDerivatives)
    Creates an instance of a TrajectoryData record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Appends this trajectory data to the given StringBuilder.
    double
    Returns the value of the eKinEv record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double[][]
    Returns the value of the potentialsWithDerivatives record component.
    double
    px()
    Returns the value of the px record component.
    double
    py()
    Returns the value of the py record component.
    double
    pz()
    Returns the value of the pz record component.
    Reds the global trajectory of the particles from the beamTrajFile
    readParticleTrajectoryFile(String trajectoryFileName)
    Reads a trajectory data of a single particle from a file.
    double
    t()
    Returns the value of the t record component.
    final String
    Returns a string representation of this record class.
    void
    write(BufferedWriter outputStream)
    Writes this trajectory data to the given output stream.
    double
    x()
    Returns the value of the x record component.
    double
    y()
    Returns the value of the y record component.
    double
    z()
    Returns the value of the z record component.

    Methods inherited from class java.lang.Object

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

    • TrajectoryData

      public TrajectoryData(double x, double y, double z, double px, double py, double pz, double t, double eKinEv, double[][] potentialsWithDerivatives)
      Creates an instance of a TrajectoryData record class.
      Parameters:
      x - the value for the x record component
      y - the value for the y record component
      z - the value for the z record component
      px - the value for the px record component
      py - the value for the py record component
      pz - the value for the pz record component
      t - the value for the t record component
      eKinEv - the value for the eKinEv record component
      potentialsWithDerivatives - the value for the potentialsWithDerivatives record component
  • Method Details

    • readParticleTrajectoryFile

      public static List<TrajectoryData> readParticleTrajectoryFile(String trajectoryFileName) throws IOException
      Reads a trajectory data of a single particle from a file.
      Parameters:
      trajectoryFileName - Trajectory file name.
      Returns:
      List of trajectory data, for each step.
      Throws:
      IOException
    • readBeamTrajectoryFile

      public static Map<String,List<TrajectoryData>> readBeamTrajectoryFile(String beamTrajFile) throws IOException
      Reds the global trajectory of the particles from the beamTrajFile
      Parameters:
      beamTrajFile - The file name
      Returns:
      Map of particle name and trajectory data
      Throws:
      IOException - If the file is not found or not readable
    • write

      public void write(BufferedWriter outputStream)
      Writes this trajectory data to the given output stream.
      Parameters:
      outputStream - The BufferedWriter into which the string representation of the date will be written with a new line carater at the end.
    • append

      public void append(StringBuilder sb)
      Appends this trajectory data to the given StringBuilder.
      Parameters:
      sb - The String builder to append to.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • x

      public double x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public double y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • z

      public double z()
      Returns the value of the z record component.
      Returns:
      the value of the z record component
    • px

      public double px()
      Returns the value of the px record component.
      Returns:
      the value of the px record component
    • py

      public double py()
      Returns the value of the py record component.
      Returns:
      the value of the py record component
    • pz

      public double pz()
      Returns the value of the pz record component.
      Returns:
      the value of the pz record component
    • t

      public double t()
      Returns the value of the t record component.
      Returns:
      the value of the t record component
    • eKinEv

      public double eKinEv()
      Returns the value of the eKinEv record component.
      Returns:
      the value of the eKinEv record component
    • potentialsWithDerivatives

      public double[][] potentialsWithDerivatives()
      Returns the value of the potentialsWithDerivatives record component.
      Returns:
      the value of the potentialsWithDerivatives record component