Пример #1
0
  /**
   *
   *
   * <h2>Implementation of Abstract Tracker#doPropagation(IProbe, IElement)</h2>
   *
   * <p>This method is essentially the same implementation as the method <code>
   * EnvelopeTracker#doPropagation()</code>, only here the probe object is back-propagated. The
   * method calls <code>Tracker.retractProbe()</code> rather than <code>Tracker.advanceProbe()
   * </code>, and the implemented method <code>EnvelopeBacktracker.retractState()</code> rather than
   * <code>EnvelopeTracker.advanceState</code>.
   *
   * @author Christopher K. Allen
   * @since Feb 9, 2009
   * @see xal.model.alg.Tracker#propagate(xal.model.IProbe, xal.model.IElement)
   * @see xal.model.alg.EnvelopeTracker#doPropagation(IProbe, IElement)
   */
  @Override
  public void doPropagation(IProbe probe, IElement elem) throws ModelException {

    // sako
    double elemPos = this.getElemPosition();
    double elemLen = elem.getLength();
    double propLen = elemLen - elemPos;

    if (propLen < 0) {
      System.err.println("doPropagation, elemPos, elemLen = " + elemPos + " " + elemLen);
      return;
    }

    // Determine the number of integration steps and the step size
    int cntSteps; // number of steps through element
    double dblStep; // step size through element

    if (this.getUseSpacecharge()) cntSteps = (int) Math.max(Math.ceil(propLen / getStepSize()), 1);
    else cntSteps = 1;

    dblStep = elem.getLength() / cntSteps;
    //        dblStep = propLen / cntSteps;

    for (int i = 0; i < cntSteps; i++) {
      this.retractState(probe, elem, dblStep);
      this.retractProbe(probe, elem, dblStep);
    }
  }