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 aTrajectoryDatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(StringBuilder sb) Appends this trajectory data to the given StringBuilder.doubleeKinEv()Returns the value of theeKinEvrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.double[][]Returns the value of thepotentialsWithDerivativesrecord component.doublepx()Returns the value of thepxrecord component.doublepy()Returns the value of thepyrecord component.doublepz()Returns the value of thepzrecord 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.doublet()Returns the value of thetrecord component.final StringtoString()Returns a string representation of this record class.voidwrite(BufferedWriter outputStream) Writes this trajectory data to the given output stream.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.doublez()Returns the value of thezrecord 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 aTrajectoryDatarecord class.- Parameters:
x- the value for thexrecord componenty- the value for theyrecord componentz- the value for thezrecord componentpx- the value for thepxrecord componentpy- the value for thepyrecord componentpz- the value for thepzrecord componentt- the value for thetrecord componenteKinEv- the value for theeKinEvrecord componentpotentialsWithDerivatives- the value for thepotentialsWithDerivativesrecord 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 thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public double y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
z
public double z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-
px
public double px()Returns the value of thepxrecord component.- Returns:
- the value of the
pxrecord component
-
py
public double py()Returns the value of thepyrecord component.- Returns:
- the value of the
pyrecord component
-
pz
public double pz()Returns the value of thepzrecord component.- Returns:
- the value of the
pzrecord component
-
t
public double t()Returns the value of thetrecord component.- Returns:
- the value of the
trecord component
-
eKinEv
public double eKinEv()Returns the value of theeKinEvrecord component.- Returns:
- the value of the
eKinEvrecord component
-
potentialsWithDerivatives
public double[][] potentialsWithDerivatives()Returns the value of thepotentialsWithDerivativesrecord component.- Returns:
- the value of the
potentialsWithDerivativesrecord component
-