Пример #1
0
  /**
   *
   *
   * <h2>Back-propagates the Defining State of the Probe Object</h2>
   *
   * <p>This method uses the same basic algorithm as in <code>EnvelopeTracker#advanceState()</code>,
   * only the probe object is back-propagated. The method utilizes all the space charge mechanisms
   * of the base class <code>EnvelopeTracker</code>.
   *
   * @param ifcElem interface to the beam element
   * @param ifcProbe interface to the probe
   * @param dblLen length of element subsection to retract
   * @throws ModelException bad element transfer matrix/corrupt probe state
   * @author Christopher K. Allen
   * @since Feb 9, 2009
   * @see xal.model.alg.EnvelopeTracker#advanceState(xal.model.IProbe, xal.model.IElement, double)
   */
  protected void retractState(IProbe ifcProbe, IElement ifcElem, double dblLen)
      throws ModelException {

    // Identify probe
    EnvelopeProbe probe = (EnvelopeProbe) ifcProbe;

    // Get initial conditions of probe
    //        R3                  vecPhs0  = probe.getBetatronPhase();
    //        Twiss[]             twiss0   = probe.getCovariance().computeTwiss();
    PhaseMatrix matResp0 = probe.getResponseMatrix();
    PhaseMatrix matTau0 = probe.getCovariance();

    // Remove the emittance growth
    if (this.getEmittanceGrowth()) matTau0 = this.removeEmittanceGrowth(probe, ifcElem, matTau0);

    // Compute the transfer matrix
    // def PhaseMatrix matPhi = compTransferMatrix(dblLen, probe, ifcElem);
    PhaseMatrix matPhi = compTransferMatrix(dblLen, probe, ifcElem);

    // Advance the probe states
    PhaseMatrix matResp1 = matPhi.times(matResp0);
    PhaseMatrix matTau1 = matTau0.conjugateTrans(matPhi);

    // Save the new state variables in the probe
    probe.setResponseMatrix(matResp1);
    probe.setCurrentResponseMatrix(matPhi);
    probe.setCovariance(new CovarianceMatrix(matTau1));
    //        probe.advanceTwiss(matPhi, ifcElem.energyGain(probe, dblLen) );

    // phase update:
    //        Twiss []    twiss1  = probe.getCovariance().computeTwiss();
    //        R3          vecPhs1 = vecPhs0.plus( matPhi.compPhaseAdvance(twiss0, twiss1) );
    //        probe.setBetatronPhase(vecPhs1);

    /** sako treatment of ChargeExchangeFoil */
    treatChargeExchange(probe, ifcElem);
  }