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
ConstructorsConstructorDescriptionTrajectoryData
(double x, double y, double z, double px, double py, double pz, double t, double eKinEv, double[][] potentialsWithDerivatives) Creates an instance of aTrajectoryData
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(StringBuilder sb) Appends this trajectory data to the given StringBuilder.double
eKinEv()
Returns the value of theeKinEv
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.double[][]
Returns the value of thepotentialsWithDerivatives
record component.double
px()
Returns the value of thepx
record component.double
py()
Returns the value of thepy
record component.double
pz()
Returns the value of thepz
record component.static Map
<String, List<TrajectoryData>> readBeamTrajectoryFile
(String beamTrajFile) Reds the global trajectory of the particles from the beamTrajFilestatic List
<TrajectoryData> readParticleTrajectoryFile
(String trajectoryFileName) Reads a trajectory data of a single particle from a file.double
t()
Returns the value of thet
record component.final String
toString()
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 thex
record component.double
y()
Returns the value of they
record component.double
z()
Returns the value of thez
record component.
-
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 aTrajectoryData
record class.- Parameters:
x
- the value for thex
record componenty
- the value for they
record componentz
- the value for thez
record componentpx
- the value for thepx
record componentpy
- the value for thepy
record componentpz
- the value for thepz
record componentt
- the value for thet
record componenteKinEv
- the value for theeKinEv
record componentpotentialsWithDerivatives
- the value for thepotentialsWithDerivatives
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
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
Appends this trajectory data to the given StringBuilder.- Parameters:
sb
- The String builder to append to.
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
x
public double x()Returns the value of thex
record component.- Returns:
- the value of the
x
record component
-
y
public double y()Returns the value of they
record component.- Returns:
- the value of the
y
record component
-
z
public double z()Returns the value of thez
record component.- Returns:
- the value of the
z
record component
-
px
public double px()Returns the value of thepx
record component.- Returns:
- the value of the
px
record component
-
py
public double py()Returns the value of thepy
record component.- Returns:
- the value of the
py
record component
-
pz
public double pz()Returns the value of thepz
record component.- Returns:
- the value of the
pz
record component
-
t
public double t()Returns the value of thet
record component.- Returns:
- the value of the
t
record component
-
eKinEv
public double eKinEv()Returns the value of theeKinEv
record component.- Returns:
- the value of the
eKinEv
record component
-
potentialsWithDerivatives
public double[][] potentialsWithDerivatives()Returns the value of thepotentialsWithDerivatives
record component.- Returns:
- the value of the
potentialsWithDerivatives
record component
-