Module simpa.acc

Class OrbitCalculator

java.lang.Object
simpa.acc.api.utils.OrbitCalculator

public class OrbitCalculator extends Object
For calculating an orbit from a trajectory file by placing planes along the reference orbit and calculating the intersections of the planes with the trajectory. At each plane an ellipse is fitted to the intersection points, and the center of the ellipse is the orbit point. The trajectory file must have at least 6 complete turns, otherwise the ellipse fit will fail. The trajectory file is produced by a TrajectoryObserver, so it must be added to the tracker ParticleTrackerTask before starting a tracking.
Author:
lbojtar
  • Constructor Details

    • OrbitCalculator

      public OrbitCalculator(ReferenceOrbit refOrbit, String trajectoryFile, double maxAperture)
      Calculates the closed orbit based on ellipse fits along the design orbit.
      Parameters:
      refOrbit - The reference orbit.
      trajectoryFile - File containing a trajectory at least 6 machine turns, otherwise the wit will fail. This data is used for orbit calculation by fitting ellipses to the intersection of the trajectory disks placed along the design orbit.
      maxAperture - Maximum aperture of the machine given in meters (typically a few cm). To calculate the optics this class places disks along the design orbit and calculate the intersections with the trajectory. The disk diameter should be big enough to cover the aperture, but should not be too big to intersect more than once the orbit of the machine.
  • Method Details

    • writeToFile

      public void writeToFile(String fileName)
      Writes the orbit into a file at each point of the reference orbit. The layout of the file: columns 1: X coordinate of the calculated orbit in the global coordinate system. columns 2: Y coordinate of the calculated orbit in the global coordinate system. columns 3: Z coordinate of the calculated orbit in the global coordinate system. columns 4: Longitudinal position in the sequence [m] columns 5: Horizontal coordinate of the calculated orbit in the local coordinate system. columns 6: Vertical coordinate of the calculated orbit in the local coordinate system.
      Parameters:
      fileName - - The output file name.
    • getRelativeOrbit

      public Map<Double,org.apache.commons.math3.geometry.euclidean.twod.Vector2D> getRelativeOrbit()
      Get the relative orbit compared to the reference orbit. The number of orbit points is the same as the number of points in the reference orbit.
      Returns:
      - A Map with the longitudinal position as a key and a Vector2D object containing the H and V positions, respectively.
    • getOrbitInGlobalFrame

      public Map<Double,org.apache.commons.math3.geometry.euclidean.threed.Vector3D> getOrbitInGlobalFrame()
      Gets the orbit in the global frame
      Returns:
      A Map with the longitudinal position as a key and a Vector3D object.
    • writeOrbitAtBPMPositons

      public void writeOrbitAtBPMPositons(Sequence seq, String fileName, boolean horizontal)
      Write the orbit positions to a file at each BPM in the sequence.
      Parameters:
      seq - - The sequence. It should contain beam position monitors.
      fileName - -Output file name.
    • getHorOrbitAtBPMPositons

      public HashMap<String,Double> getHorOrbitAtBPMPositons(Sequence seq)
      Get the relative (to the reference given in the constructor) orbit at the Horizontal BPM's.
      Parameters:
      seq - - - The sequence containing beam position monitors.
      Returns:
      - A HashMap with the BPM name as a key and the orbit value in [m].
    • getVertOrbitAtBPMPositons

      public HashMap<String,Double> getVertOrbitAtBPMPositons(Sequence seq)
      Get the relative (to the reference given in the constructor) orbit at the Vertical BPM's.
      Parameters:
      seq - - - The sequence containing beam position monitors.
      Returns:
      - A HashMap with the BPM name as a key and the orbit value in [m].