Module simpa.acc

Class AccFieldFactory

java.lang.Object
simpa.acc.api.create.AccFieldFactory

public class AccFieldFactory extends Object
Factory methods for expanding groups of accelerator elements with solid harmonic expansion.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    shExpandAllGroups(Sequence sequence, int lmax, SphereCovering cover, Double relativeError, boolean writeStatFile, int pass1Lmax)
    Expands all the groups in the sequence one by one.
    void
    shExpandGroup(Sequence sequence, String groupName, int lmax, SphereCovering cover, Double relativeError, boolean writeStatFile, int pass1Lmax)
    Expands the potentials for the given accelerator element group of the machine inside the beam region with solid harmonics balls of a given maximum degree and writes the resulting binary field map file to the disk.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AccFieldFactory

      public AccFieldFactory()
  • Method Details

    • shExpandGroup

      public void shExpandGroup(Sequence sequence, String groupName, int lmax, SphereCovering cover, Double relativeError, boolean writeStatFile, int pass1Lmax) throws IOException
      Expands the potentials for the given accelerator element group of the machine inside the beam region with solid harmonics balls of a given maximum degree and writes the resulting binary field map file to the disk. The beam region is given by the balls in the cover object.
      Parameters:
      sequence - The sequence to be used for the expansion. The sequence must contain the group given in the groupName parameter.
      groupName - The name of the group to be expanded. All the elements in the group must have the same field type. It can be null, in this case all the groups will be expanded into a single field map.
      lmax - Maximum degree (LMAX) of the balls in the lattice. The actual LMAX can be smaller than that if the given relativeError can be achived with a smaller LMAX, but can not be bigger than this parameter even the actual relative error is bigger than the given relativeError parameter.
      cover - A cover object which describes the locations of the cover balls.
      relativeError - Relative limit for spherical harmonics coefficients. Coefficients smaller than the value determined by this limit considered zero and dropped. If null the value of the SHFieldFactory.DEFAULT_RELATIVE_ERROR will be taken.
      writeStatFile - If true, then write statistics about the distribution of maximum degrees in the field map.
      pass1Lmax - Maximum degree for the first pass of the SH expansion. A good value is lmax/3 for example. The optimal value depends on the number and type of elements in the sequence. For example, if the group contains only a quadrupole, the field decreases quicly so most of the balls far from the quad has small coefficients, so choose a small value to not waste calculation to expand those balls to unneded high orders.
      Throws:
      IOException - when something goes wrong reading or writing a file.
    • shExpandAllGroups

      public void shExpandAllGroups(Sequence sequence, int lmax, SphereCovering cover, Double relativeError, boolean writeStatFile, int pass1Lmax) throws IOException
      Expands all the groups in the sequence one by one. For each group a field map will be created with the group name.
      Parameters:
      sequence - The sequence to be used for the expansion. The sequence must contain the group given in the groupName parameter.
      lmax - Maximum degree (LMAX) of the balls in the lattice. The actual LMAX can be smaller than that if the given relativeError can be achived with a smaller LMAX, but can not be bigger than this parameter even the actual relative error is bigger than the given relativeError parameter.
      cover - A cover object which describes the locations of the cover balls.
      relativeError - Relative limit for spherical harmonics coefficients. Coefficients smaller than the value determined by this limit considered zero and dropped. If null the value of the SHFieldFactory.DEFAULT_RELATIVE_ERROR will be taken.
      writeStatFile - If true, then write statistics about the distribution of maximum degrees in the field map.
      pass1Lmax - Maximum degree for the first pass of the SH expansion. A good value is lmax/3 for example. The optimal value depends on the number and type of elements in the sequence. For example, if the group contains only a quadrupole, the field decreases quicly so most of the balls far from the quad has small coefficients, so choose a small value to not waste calculation to expand those balls to unneded high orders.
      Throws:
      IOException - when something goes wrong reading or writing a file.