Module simpa.acc

Class OpticsMultivariateFunction

java.lang.Object
simpa.acc.api.match.SimpaMultivariateFunction
simpa.acc.api.match.OpticsMultivariateFunction
All Implemented Interfaces:
org.apache.commons.math3.analysis.MultivariateFunction

public class OpticsMultivariateFunction extends SimpaMultivariateFunction
Objective function used for matching. The optimizer using this class to calculate the residual to be minimized.
  • Constructor Details

    • OpticsMultivariateFunction

      public OpticsMultivariateFunction(Sequence sequence, Map<String,Double> scalings, List<MatchingVariable> variables, List<MatchingTarget> targets, double stepSize, boolean backward, double diskRadius)
      Constructor for the objective function used for optics matching. The matching is performed by tracking two beam in a transfer line with some momentum deviation.
      Parameters:
      sequence - The sequence to be used.
      scalings - The scaling map containing the file names of binary field maps as keys and scaling factors as values.
      variables - The list of variables to be optimized.
      targets - The list of matching targets. The number of targets and variables can be different.
      stepSize - Step size used for the tracking in [m].
      backward - Set true if the tracking is backward ( toward negative S)
      diskRadius - Disk radius for the observers in[m].
  • Method Details

    • setBeams

      public void setBeams(EllipseBeam b0, EllipseBeam b1)
      Set the two beams to be tracked for optics calculation in a transfer line.
      Parameters:
      b0 - Ellipse beam with nominal momentum.
      b1 - Ellipse beam with some momentum deviation to calculate the dispersion.
    • setParticles

      public void setParticles(Particle p0, Particle p1)
      Set the two particles to be tracked for optics calculation in a ring.
      Parameters:
      p0 - Particle with nominal momentum.
      p1 - Particle with some momentum deviation to calculate the dispersion.
    • value

      public double value(double[] point)
      Calculates the objective function value from the array of values for each variables. In case the target value is a lower or upper limit it has no effect on the objective function value until it reaches the limit. If the limit is reached the objective function changes in a stepwise manner to a large value.
      Specified by:
      value in interface org.apache.commons.math3.analysis.MultivariateFunction
      Specified by:
      value in class SimpaMultivariateFunction
    • getOptics

      public Optics getOptics()
      This method is typically called after the optimization, but can be called at also during the optimization to check what kind of optics the optimization is evaluating at any step. Can be useful to debugging also.
      Returns:
      The optics.
    • getResidualSum

      public double getResidualSum(Optics optics)
      Calculate the residual and prints info
      Parameters:
      optics - The optics containing
      Returns: