Class AdaptiveSwimResult

java.lang.Object
cnuphys.adaptiveSwim.AdaptiveSwimResult

public class AdaptiveSwimResult extends Object
  • Constructor Details

    • AdaptiveSwimResult

      public AdaptiveSwimResult(boolean saveTrajectory)
      Create a container for the swim results for default of 6D state vector
      Parameters:
      saveTrajectory - if true, we will save the trajectory
    • AdaptiveSwimResult

      public AdaptiveSwimResult(int dim, boolean saveTrajectory)
      Create a container for the swim results
      Parameters:
      dim - the dimension of the system (probably 6)
      saveTrajectory - if true, we will save the trajectory
  • Method Details

    • hasTrajectory

      public boolean hasTrajectory()
      Does this result hold a trajectory?
      Returns:
      true if there is a trajectory
    • getTrajectory

      public SwimTrajectory getTrajectory()
      Get the trajectory
      Returns:
      the trajectory (might be null
    • getUf

      public double[] getUf()
      Get the final state vector, usually [x, y, x, px/p, py/p, pz/p] where x, y, z are in meters. This final vector is never augmented. To get the augmented, assume the trajectory was created, use getLastTrajectoryPoint.
      Returns:
      the final state vector, always with six elements.
    • getLastTrajectoryPoint

      public double[] getLastTrajectoryPoint()
      Gets the last trajectory point if the trajectory was saved. This should be augmented with pathlength and bdl in indices 6 and 7. Otherwise return the usual six element final state vector.
      Returns:
      last trajectory point
    • setUf

      public void setUf(double[] uf)
      Set the final state vector, usually [x, y, x, px/p, py/p, pz/p] where x, y, z are in meters
      Parameters:
      uf - the final state vector
    • getNStep

      public int getNStep()
      Get the number of steps of the swim
      Returns:
      the number of steps
    • setNStep

      public void setNStep(int nStep)
      Set the number of steps of the swim
      Parameters:
      nStep - the number of steps
    • getFinalS

      public double getFinalS()
      Get the final path length of the swim
      Returns:
      the final path length in meters
    • setFinalS

      public void setFinalS(double finalS)
      Set the final path length of the swim
      Parameters:
      finalS - the final path length in meters
    • setStatus

      public void setStatus(int status)
      Set the status of the swim
      Parameters:
      status - the status of the swim
    • getStatus

      public int getStatus()
      Get the status of the swim
      Returns:
      the status
    • setInitialValues

      public void setInitialValues(int q, double xo, double yo, double zo, double p, double theta, double phi)
      Set the initial values
      Parameters:
      q - The integer charge
      xo - The x coordinate of the vertex in meters
      yo - The y coordinate of the vertex in meters
      zo - The z coordinate of the vertex in meters
      p - The momentum in GeV/c
      theta - The polar angle in degrees
      phi - The azimuthal angle in degrees
    • initialValuesString

      public String initialValuesString()
      A string containing the initial valies
      Returns:
    • setInitialValies

      public void setInitialValies(InitialValues iv)
      Set the initial values
      Parameters:
      iv - the source
    • setTrajectory

      public void setTrajectory(SwimTrajectory traj)
      Used to compare to old swimmer
      Parameters:
      traj - trajectory (probably from old swimmer)
    • getInitialValues

      public InitialValues getInitialValues()
      Get the initial values
      Returns:
      the initial values
    • printOut

      public void printOut(PrintStream ps, String message)
      Print the result to a print stream, such as System.out. Do not print the trajectory.
      Parameters:
      ps - the print stream
      message - a header message
    • printOut

      public void printOut(PrintStream ps, String message, boolean printTrajectory)
      Print the result to a print stream, such as System.out
      Parameters:
      ps - the print stream
      message - a header message
      printTrajectory - if true, will print the trajectory (if there is one)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • finalLocationString

      public String finalLocationString()
      A final location string
      Returns:
      a location string
    • getFinalSector

      public int getFinalSector()
      Get the final sector of the swim
      Returns:
      the final CLAS sector [1..6]
    • getInitialSector

      public int getInitialSector()
      Get the initial sector of the swim
      Returns:
      the final CLAS sector [1..6], or -1 if the initial values were not cached
    • getFinalTheta

      public double getFinalTheta()
      get the final theta in degrees
      Returns:
      the final theta in degrees
    • getFinalRho

      public double getFinalRho()
      get the final rho in meters
      Returns:
      the final rho in meters
    • getFinalPhi

      public double getFinalPhi()
      get the final phi in degrees
      Returns:
      the final phi in degrees
    • finalDeltaZ

      public double finalDeltaZ(double zTarg)
      Used for testing z swim.
      Parameters:
      zTarg - the target z (m)
      Returns:
      the signed difference zFinal - zTarg
    • retrace

      public InitialValues retrace()
      Get the "initial values" that allows a retrace. This is used mostly for testing. Assumes the initial values have been set,
      Returns:
      the "initial values" that allows a retrace.
    • delDifference

      public double delDifference(AdaptiveSwimResult res)
      Get the Euclidean distance between the last point of two results. Used for comparisons.
      Parameters:
      res - the other result
      Returns:
      the Euclidean distance between the last points.