Package xal.model.alg

Class EnvelopeTrackerBase

java.lang.Object
xal.model.alg.Tracker
xal.model.alg.EnvelopeTrackerBase
All Implemented Interfaces:
Remote, IAlgorithm, IArchive, IContextAware
Direct Known Subclasses:
EnvelopeBacktracker, EnvelopeTracker, EnvTrackerAdapt

public abstract class EnvelopeTrackerBase extends Tracker

Abstract Base Class for Algorithms Propagating RMS Envelopes

This class adds functionality beyond the base class Tracker specific to tracker algorithms designed for RMS envelope beam probes, that is, probes which carry the RMS statistical properties as their beam state.

Since:
Feb 10, 2009
Author:
Christopher K. Allen
  • Field Details

    • TBL_LBL_ENVBASETRACKER

      public static final String TBL_LBL_ENVBASETRACKER
      EditContext table name containing basic envelope tracking parameters
      See Also:
    • LABEL_OPTIONS

      public static final String LABEL_OPTIONS
      data node label for EnvelopeTracker settings
      See Also:
    • ATTR_SCHEFF

      public static final String ATTR_SCHEFF
      label for use simple tracking (no space charge)
      See Also:
    • ATTR_USESPACECHARGE

      public static final String ATTR_USESPACECHARGE
      label for use simple tracking (no space charge)
      See Also:
    • ATTR_EMITGROWTH

      public static final String ATTR_EMITGROWTH
      label for emittance growth flag
      See Also:
    • ATTR_STEPSIZE

      public static final String ATTR_STEPSIZE
      label for maximum step size *
      See Also:
    • ATTR_USEDCBEAM

      public static final String ATTR_USEDCBEAM
      label for use DC Beam *
      See Also:
  • Constructor Details

    • EnvelopeTrackerBase

      protected EnvelopeTrackerBase(String strType, int intVersion, Class<? extends IProbe> clsProbeType)

      EnvelopeTrackerBase Constructor

      This should be used by child classes to pass up their class properties.

      Parameters:
      strType - string type identifier of the class
      intVersion - version number of class implementation
      clsProbeType - the class type of valid probe
    • EnvelopeTrackerBase

      protected EnvelopeTrackerBase(EnvelopeTrackerBase sourceTracker)
      Copy constructor for EnvelopeTracker
      Parameters:
      sourceTracker - Tracker that is being copied
  • Method Details

    • setStepSize

      public void setStepSize(double step)
      Set maximum step size allowed between space charge kicks
      Parameters:
      step - the new maximum step size for space charge calculations
    • setUseSpacecharge

      public void setUseSpacecharge(boolean tf)

      Method to toggle the flag to use/not use space charge calculations.

      Parameters:
      tf - the truth flag
    • setUseDCBeam

      public void setUseDCBeam(boolean tf)

      Method to toggle the flag to use/not the DC beam space charge kicks.

      Parameters:
      tf - the truth flag
    • setEmittanceGrowth

      public void setEmittanceGrowth(boolean bolEmitGrowth)

      Set the emittance growth flag. If set true then the algorithm will simulate emittance growth through RF gaps.

      NOTE: (CKA)
      · If set, the dynamics will no longer be consistent since the response matrix and betatron phases will not reproduce the current Twiss parameters.

      Parameters:
      bolEmitGrowth - set true to simulation emittance growth
      See Also:
    • setEmitGrowthModel

      public void setEmitGrowthModel(EnvelopeTrackerBase.EmitGrowthModel enmModel)

      Set the emittance growth mechanism

      Set the current mechanism for simulation emittance growth from RF accelerating gaps. We can either use the same model as Trace3D or the generalized technique described in C.K. Allen et. al. (see references below). This applies primarily to the longitudinal situation since the transverse cases show very good agreement.

      Since longitudinal emittance growth mechanism is not well documented in the Trace3D manual, it is somewhat unclear how the effect is being modeled. However, it does appear to create a result that tracks the IMPACT simulation better than the CKA method (at least for one case). At this point it is unclear whether there is an error in the analysis of C.K. Allen, or Trace3D is simply more accurate.

      NOTES: (CKA)
      · This flag only has an effect when the setEmittanceGrowth() feature is set to true.

      References
      [1] M. Weiss, "Bunching of Intense Proton Beams with Six-Dimensional Matching to the Linac Acceptance", CERN/MPS/LI report 73-2, Geneva, Switzerland (1978).
      [2] K.R. Crandall and D.P. Rusthoi, "Trace 3-D Documentation", LANL Report LA-UR-97-887 (1997), Appendix F.
      [3] C.K. Allen, H. Sako, M. Ikegami, and G. Shen, "Emittance Growth Due to Phase Spread for Proton Beams in Radio Frequency Accelerating Gaps", (in preparation).

      Parameters:
      enmModel - use the Trace3D method or the C.K. Allen et. al. method
    • getStepSize

      public double getStepSize()

      Returns the maximum element subsection length (in meters) that the probe may be advanced before applying a space charge kick when space charge is present.

      Returns:
      Maximum space charge integration step size.
    • getUseSpacecharge

      public boolean getUseSpacecharge()
      Returns the flag determining whether or not space charge effects are being considered during the propagation.
      Returns:
      true if space charge forces are used, false otherwise
    • getUseDCBeam

      public boolean getUseDCBeam()
      Returns the flag determining whether or not space charge kick for DC beam is being considered
      Returns:
      true if space charge forces for DC beam is used, false otherwise
    • getSpaceChargeFlag

      @Deprecated public boolean getSpaceChargeFlag()
      Deprecated.
    • getEmittanceGrowth

      public boolean getEmittanceGrowth()
      Return the emittance growth flag.
      Returns:
      true if we are simulating emittance growth, false otherwise
      See Also:
    • getEmittanceGrowthFlag

      @Deprecated public boolean getEmittanceGrowthFlag()
      Deprecated.
    • getEmitGrowthModel

      public EnvelopeTrackerBase.EmitGrowthModel getEmitGrowthModel()

      Return the emittance growth model

      Get the current mechanism for simulating emittance growth from RF accelerating gaps. We are either using the that of Trace3D or the generalized technique described in C.K. Allen et. al. (see references below). This applies primarily to the longitudinal situation since the transverse cases show very good agreement.

      Since longitudinal emittance growth mechanism is not well documented in the Trace3D manual, it is somewhat unclear how the effect is being modeled. However, it does appear to create a result that tracks the IMPACT simulation better than the CKA method (at least for one case). At this point it is unclear whether there is an error in the analysis of C.K. Allen, or Trace3D is simply more accurate.

      NOTES: (CKA)
      · This flag only has an effect when the setEmittanceGrowth() feature is set to true.

      References
      [1] M. Weiss, "Bunching of Intense Proton Beams with Six-Dimensional Matching to the Linac Acceptance", CERN/MPS/LI report 73-2, Geneva, Switzerland (1978).
      [2] K.R. Crandall and D.P. Rusthoi, "Trace 3-D Documentation", LANL Report LA-UR-97-887 (1997), Appendix F.
      [3] C.K. Allen, H. Sako, M. Ikegami, and G. Shen, "Emittance Growth Due to Phase Spread for Proton Beams in Radio Frequency Accelerating Gaps", (in preparation).

      Returns:
      enumeration code for particular emittance growth mechanism
    • load

      public void load(String strPrimKeyVal, EditContext ecTableData) throws DataFormatException
      Load the parameters of this IAlgorithm object from the table data in the given EditContext. Here we load only the parameters specific to the base class. It is expected that Subclasses should override this method to recover the data particular to there own operation.
      Specified by:
      load in interface IContextAware
      Overrides:
      load in class Tracker
      Parameters:
      strPrimKeyVal - primary key value specifying the name of the data record
      ecTableData - EditContext containing table data
      Throws:
      DataFormatException - bad data format - error in reading
      See Also:
    • load

      public void load(DataAdaptor daptArchive)
      Load the parameters of the algorithm from a data source exposing the IArchive interface. The superclass load method is called first, then the properties particular to EnvTrackerAdapt are loaded.
      Specified by:
      load in interface IArchive
      Overrides:
      load in class Tracker
      Parameters:
      daptArchive - data source containing algorithm configuration
      See Also:
    • save

      public void save(DataAdaptor daptArchive)
      Save the state and settings of this algorithm to a data source exposing the DataAdaptor interface. Subclasses should override this method to store the data particular to there own operation.
      Specified by:
      save in interface IArchive
      Overrides:
      save in class Tracker
      Parameters:
      daptArchive - data source to receive algorithm configuration
      See Also:
    • modTransferMatrixForEmitGrowth

      protected PhaseMatrix modTransferMatrixForEmitGrowth(double dphi, PhaseMatrix matPhi) throws ModelException

      Method to modify the transfer matrix when we are simulating emittance growth. Currently, the method only considers the case of propagation through an IdealRfGap element. If the IElement argument is any other type of element, nothing is done.

      The argument matPhi is the original transfer matrix for (normal) propagation through the elem element.

      NOTES: (H. SAKO)
      · Increase emittance using same (nonlinear) procedure on the second moments as in Trace3D.

      (C.K. Allen)
      · The <x'|x> transfer matrix element is modified by the formula

        <x'|x> = <x'|x>Ftφ)

      where Δφ is the longitudial phase spread and Ftφ) is an approximation to <sin(φ)>.

      · Originally, the <z'|z> transfer matrix element is modified by the formula

        <z'|z> = <z'|z>(1 - Δφ2/12)

      This approximation is given in the Trace3D manualThis formula is accurate only for <<. Even then, the results are questionable. For a more in depth treatment of longitudinal emittance growth see the reference below.
      · The two-term expansion for Fzφ) (see compLongFourierTransform(double)) is given as

        Fzφ) ≈ 1 - 3Δφ2/14

      which does not correspond to the Trace3D manual. So I do not know where they got the number.

      Reference
      C.K. Allen, Hiroyuki Sako, et. al., "Emittance Growth Due to Phase Spread for Proton Beams in a Radio Frequency Accelerating Gap" (in preparation).

      Parameters:
      dphi - effective phase spread Δφ
      matPhi - transfer matrix Φ for conserved normalized emittance
      Returns:
      Transfer matrix Φ after modifying focusing term
      Throws:
      ModelException - unsupport/unknown emittance growth model
      See Also:
    • compScheffMatrix

      protected PhaseMatrix compScheffMatrix(double dblLen, EnvelopeProbe probe, IElement elem) throws ModelException

      Method to compute the space charge transfer matrix for the given length, probe and modeling element.

      The correlation matrix of the probe is used to determine the space charge transfer matrix. The transfer matrix of the elem is computed for half the distance provided, the correlation matrix is advanced this half step, and the space charge matrix is computed there. Thus, the space charge matrix is always computed at the center of the distance dblLen.

      NOTE:

      This half-step business maintains consistency with the Trace3D algorithm. Once inside the element you are essentially doing leap-frog integration, which may or may not be more accurate then integration at full steps. The final algorithms are both second-order accurate, simply by the way the final transfer matrix is computed.

      Parameters:
      dblLen - incremental path length over which space charge is applied
      probe - EnvelopeProbe containing correlation matrix
      elem - IElement where probe is currently located
      Returns:
      space-charge transfer matrix for incremental distance
      Throws:
      ModelException - could not compute the transfer map for given element
      See Also:
    • compEmitGrowthFunction

      protected double compEmitGrowthFunction(EnvelopeTrackerBase.PhasePlane plane, double phiS, double dphi) throws ModelException

      Emittance Growth Function for Phase Spread in RF Gap

      Calculation of the emittance growth function describing the emittance growth due to finite phase spread in an RF gap. (Note that the growth function differs for each density distribution and for each phase plane.) The particular phase plane is identified by the argument plane, which is currently either transverse or longitudinal. The density distribution is specified by the emittance growth model (see setEmitGrowthModel(EmitGrowthModel)). We currently assume the beam bunch to be axially symmetric. We denote the growth function in the transverse plane as Gt(φsφ) and the growth function in the longitudinal plane as Gz(φsφ).

      The emittance growth calculation was originally described by M. Weiss for then implemented in Trace3d. C.K. Allen, et. al. generalized the results for arbitrary distributions and the longitudinal case (see references below).

      The emittance growth function Gt(φsφ) for the transverse plane is defined as

        Gt(φsφ) ≡ Stφ) - sin2 φs Ttφ)

      where φs is the synchronous particle phase, Δφ is the effective phase spread, and functions Stφ) and Ttφ) are given by

        Stφ) ≡ ½[1 - Ft(2Δφ)]

      and

        Ttφ) ≡ Ft2φ) - Ft(2Δφ)

      respectively. There are analogous formulas for the longitudinal emittance growth function Gz(φsφ) where the transverse Fourier transform Ft is replaced by the longitudinal Fourier transform Fz. (See the methods compTransFourierTransform(double) and compLongFourierTransform(double).)

      The before gap and after gap transverse RMS emittances, εt,i and εt,f, respectively, are related by the following formula:

        εt,f2 = η2εt,i2 + Δεt,f2

      where η is the momentum compaction due to acceleration

      ηβiγi/βfγf

      and Δεt,f is the emittance increase term

        Δεt,f2 ≡ Δ<x'f2> <xf2>2.

      where

        Δ<x'f2> ≡ kt2 Gt(φsφ) <xi2>.

      and where x'f and xi represent the after-gap divergence angle and before-gap position for either transverse phase plane, respectively. Once again there are analogous formulas for the before and after gap longitudinal plane emittances εz,i and εz,f, respectively, with Gt(φsφ) replaced by Gz(φsφ) and x(f,i) replaced by z(f,i).

      NOTES: CKA
      · Since we are modeling the RF gap as a thin lens, only the momentum (divergence angle) is modified, <x2>, <y2>, and <z2> remain unaffected. Thus, <xf2> = <xi2> and <zf2> = <zi2> and may be computed as such in the above.

      References
      [1] M. Weiss, "Bunching of Intense Proton Beams with Six-Dimensional Matching to the Linac Acceptance", CERN/MPS/LI report 73-2, Geneva, Switzerland (1978).
      [2] K.R. Crandall and D.P. Rusthoi, "Trace 3-D Documentation", LANL Report LA-UR-97-887 (1997), Appendix F.
      [3] C.K. Allen, H. Sako, M. Ikegami, and G. Shen, "Emittance Growth Due to Phase Spread for Proton Beams in Radio Frequency Accelerating Gaps", (in preparation).

      Parameters:
      plane - Compute the emittance growth function for this phase plane
      phiS - the synchronous particle phase φs in radians
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of the emittance growth function Gt(φsφ) or Gz(φsφ)
      Throws:
      ModelException - unknown/unsupported emittance growth model, or unknown/unsupported phase plane
      Since:
      Feb 19, 2009
      See Also:
    • compTransFourierTransform

      protected double compTransFourierTransform(double dphi) throws ModelException

      Transverse Emittance Growth Fourier Transform

      Java method for evaluating the Fourier-Bessel transform needed to compute transverse emittance growth due to finite longitudinal phase spread. The technique for computing emittance growth due to phase spread is described in C.K. Allen, et. al., "Emittance Growth Due to Phase Spread for Proton Beams in Radio Frequency Accelerating Gaps." This work is a generalization of that covered in the Trace3D users' manual, Appendix G, which is in turn based upon the work of M. Weiss (see references below).

      When considering only one (transverse) phase plane beams the transform Ftφ) evaluated here is given as follows:

        Ftφ) ≡ (2/f1) ∫J0φs) f(s2)s ds,

      where f is the density distribution, Jn(s) is the nth-order cylindrical Bessel function of the first kind, Δφ is the effective phase spread of the equivalent uniform beam, s is the transform variable. and fk is the number

        fk ≡ ∫ f(s)sk ds.

      Both integrals are taken from 0 to ∞.

      When considering three spatial dimensions the transform Ftφ) evaluated here is given as follows:

        Ftφ) ≡ (2/f3/2) ∫[j0φs) + j2φs)] f(s2)s4 ds,

      where f is the density distribution, jn(s) is the nth-order spherical Bessel function of the first kind, Δφ is the effective phase spread of the equivalent uniform beam, and s is the transform variable. Again, both integrals are taken from 0 to ∞.

      NOTES: (CKA)
      · This method actually falls out of the calculation for <x2sin φ(z)>. The assumption that x and z are uncorrelated yields the result

        <x2sin φ(z)> = <x2> sin φs Ftφ)

      where Ft() = <sin(Δφ)> is this method, sin φs is the synchronous particle phase, and Δφ is the effective phase spread of the distribution.
      · The value of <sin2 φ)(z)> can also be computed from this method. The formula is

        <sin2 φ(z)> = Stφ) + sin2 φs Ft(2Δφ)

      where

        Stφ) ≡ ½[1 - Ft(2Δφ)]

      has analogy with sin2 Δφ

      References
      [1] M. Weiss, "Bunching of Intense Proton Beams with Six-Dimensional Matching to the Linac Acceptance", CERN/MPS/LI report 73-2, Geneva, Switzerland (1978).
      [2] K.R. Crandall and D.P. Rusthoi, "Trace 3-D Documentation", LANL Report LA-UR-97-887 (1997), Appendix F.
      [3] C.K. Allen, H. Sako, M. Ikegami, and G. Shen, "Emittance Growth Due to Phase Spread for Proton Beams in Radio Frequency Accelerating Gaps", (in preparation).

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Ftφ) for the uniform distribution.
      Throws:
      ModelException - unsupported/unknown emittance growth model
      Since:
      Feb 17, 2009
      See Also:
    • compLongFourierTransform

      protected double compLongFourierTransform(double dphi) throws ModelException

      Longitudinal Fourier Transform for Uniform Distribution

      Java method for evaluating the Fourier-Bessel transform needed to compute longitudinal emittance growth due to finite longitudinal phase spread in RF accelerating gaps. For information on this effect see due to phase spread is described in C.K. Allen, et. al., "Emittance Growth Due to Phase Spread for Proton Beams in Radio Frequency Accelerating Gaps." This work is a generalization of that covered in the Trace3D users' manual, Appendix G for the longitudinal direction. M. Weiss treated the transverse direction (see references below).

      When considering only one (uncorrelated) phase plane beams the transform Fzφ) evaluated here is given as follows:

        Fzφ) ≡ (2/f1) ∫ [J0φs) - J2φs)] f(s2)s3 ds,

      where f is the density distribution, Jn(s) is the nth-order cylindrical Bessel function of the first kind, Δφ is the effective phase spread of the equivalent uniform beam, s is the transform variable. and fk is the number

        fk ≡ ∫ f(s)sk ds.

      Both integrals are taken from 0 to ∞.

      When considering three spatial dimensions the transform Fzφ) evaluated here is given as follows:

        Fzφ) ≡ (2/f3/2) ∫[j0φs) - 2j2φs)] f(s2)s4 ds,
                  = Ftφ) - (2/f3/2) ∫j2φs)] f(s2)s4 ds,

      where f is the density distribution, jn(s) is the nth-order spherical Bessel function of the first kind, Δφ is the effective phase spread of the equivalent uniform beam, and s is the transform variable. The number fk is as before.

      NOTES: (CKA)
      · This method falls out of the computation for <x2sin φ(z)>. At least when considering the longitudinal phase plane independently, it can be shown that

        <z2sin φ(z)> = <z2> sin φs Fzφ)

      where Fz() = <sin(Δφ)> is this method, sin φs is the synchronous particle phase, and Δφ is the effective phase spread of the distribution.
      · The technique for computing longitudinal emittance growth is not covered in the Trace3D manual. A two-term power series expansion for this function is simply stated, but no development is presented.
      · The result returned by this method has a different power series expansion about Δφ = 0 than that presented in the Trace3D manual.

      References
      [1] M. Weiss, "Bunching of Intense Proton Beams with Six-Dimensional Matching to the Linac Acceptance", CERN/MPS/LI report 73-2, Geneva, Switzerland (1978).
      [2] K.R. Crandall and D.P. Rusthoi, "Trace 3-D Documentation", LANL Report LA-UR-97-887 (1997), Appendix F.
      [3] C.K. Allen, H. Sako, M. Ikegami, and G. Shen, "Emittance Growth Due to Phase Spread for Proton Beams in Radio Frequency Accelerating Gaps", (in preparation).

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Fzφ) for the uniform distribution.
      Throws:
      ModelException - unsupported/unknown emittance growth model
      Since:
      Feb 17, 2009
      See Also:
    • fourierTransTrace3d

      protected double fourierTransTrace3d(double dphi)

      Transverse Fourier Transform given by Trace3D

      This method returns the longitudinal Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we return the exact same value as Trace3D. It considers a uniform beam in three spatial dimensions.

      The method computes the kluge of <sin(φ)>. In this calculation we assume that the transverse and longitudinal phase planes are uncorrelated and that the beam distribution is a uniform ellipsoid (that's why the sinc() function pops up). Pretty restrictive - Sacherer's theorem does not apply here.

      This quantity is used when computing the transverse emittance increase in an RF gap due to a finite phase spread in the beam.

      NOTES: (CKA)
      · This method is used to approximate <x2sin(φ)>, which is at least third order in the phase coordinates.
      · The assumption that x and z are not correlated yields the result

        <x2sin(φ)> = <x2> f()

      where f() ≡ <sin()is this method, and is the "phase spread" of the distribution. The phase spread is defined

        = <(φ - φs)2>1/2

      where φs is the synchronous particle phase.

      See K.R. Crandall and D.P. Rusthoi,

      • "Trace 3-D Documentation", LANL Report LA-UR-97-887 (1997), Appendix F.
      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Ftφ) given by Trace3D which is the value of <sin(φ)> = f(dp).
      Since:
      Feb 17, 2009
      See Also:
    • fourierLongTrace3d

      protected double fourierLongTrace3d(double dphi)

      Longitudinal Fourier Transform given by Trace3D

      This method returns the longitudinal Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we return the exact same value as Trace3D. It considers a uniform beam in three spatial dimensions.

      The returned value (which is not derived or explained in the Trace3D manual) is

        Fzφ) = 1 - Δφ2/12

      This value is taken from the Trace3D code. The manual actually quotes it as 1 + Δφ2/12.

      NOTES: (CKA)

      References
      [1] M. Weiss, "Bunching of Intense Proton Beams with Six-Dimensional Matching to the Linac Acceptance", CERN/MPS/LI report 73-2, Geneva, Switzerland (1978).
      [2] K.R. Crandall and D.P. Rusthoi, "Trace 3-D Documentation", LANL Report LA-UR-97-887 (1997), Appendix F.
      [3] C.K. Allen, H. Sako, M. Ikegami, and G. Shen, "Emittance Growth Due to Phase Spread for Proton Beams in Radio Frequency Accelerating Gaps", (in preparation).

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Fzφ) given by Trace3D.
      Since:
      Feb 17, 2009
      See Also:
    • fourierLong3dUniform

      protected double fourierLong3dUniform(double dphi)

      Longitudinal Fourier Transform for 3D Uniform Distribution

      This method return the longitudinal Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we consider the case when the beam is uniformly distributed over three spatial dimensions. For this distribution f(s), we find that

        Fzφ) = 15 j2φ)/Δφ2 - 15 j3φ)/Δφ

      For small arguments we avoid any numerically singular behavior at Δφ = 0 by Taylor expanding. We have

        Fzφ) ≈ 1 - x2/7 + x4/168 - x6/8316 + 5x8/3459456 + O(x17/2)

      Currently we are expanding to sixth order.

      NOTES: (CKA)

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Fzφ) for the 3D uniform distribution.
      Since:
      Feb 17, 2009
      See Also:
    • fourierTrans3dUniform

      protected double fourierTrans3dUniform(double dphi)

      Transverse Fourier Transform for 3D Uniform Distribution

      This method return the transverse Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we consider the case when the beam is uniformly distributed over three spatial dimensions. For this distribution f(s), we find that

        Ftφ) = 15 j2φ)/Δφ2

      For small arguments we avoid any numerically singular behavior at Δφ = 0 by Taylor expanding. We have

        Ftφ) ≈ 1 - x2/14 + x4/504 - x6/33264 + x8/3459456 + O(x17/2)

      Currently we are expanding to sixth order.

      NOTES: (CKA)

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Ftφ) for the uniform distribution.
      Since:
      Feb 17, 2009
      See Also:
    • fourierTrans3dGaussian

      protected double fourierTrans3dGaussian(double dphi)

      Transverse Fourier Transform for 3D Gaussian Distribution

      This method return the transverse Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we consider the case when the beam has a Gaussian distribution over three spatial dimensions. For this distribution f(s), we find that

        Ftφ) = eφˆ2/10

      There is no need for a small argument expansion since the above expression is numerically stable.

      NOTES: (CKA)

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Ftφ) for the Gaussian distribution.
      Since:
      Feb 17, 2009
      See Also:
    • fourierLong3dGaussian

      protected double fourierLong3dGaussian(double dphi)

      Longitudinal Fourier Transform for 3D Gaussian Distribution

      This method return the longitudinal Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we consider the case when the beam has a Gaussian distribution over the three spatial dimensions. For this distribution f(s), we find that

        Fzφ) = (1 - Δφ2/5) eφˆ2/10

      There is no need for a small argument expansion since the above expression is numerically stable.

      NOTES: (CKA)

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Fzφ) for the 3D Gaussian distribution.
      Since:
      Feb 17, 2009
      See Also:
    • fourierTrans1dUniform

      protected double fourierTrans1dUniform(double dphi)

      Transverse Fourier Transform for Single Phase Plane

      This method return the transverse Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we consider the case when the beam is uniformly distributed in one transverse phase plane. For this distribution f(s), we find that

        Ftφ) = 2 J1φ)/Δφ

      For small arguments we avoid any numerically singular behavior at Δφ = 0 by Taylor expanding. We have

        Ftφ) ≈ 1 - x2/8 + x4/192 - x6/9216 + x8/737280 + O(x9)

      Currently we are expanding to sixth order.

      NOTES: (CKA)

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Ftφ) for the single phase plane uniform distribution.
      Since:
      Feb 25, 2009
      See Also:
    • fourierLong1dUniform

      protected double fourierLong1dUniform(double dphi)

      Longitudinal Fourier Transform for Single Phase Plane

      This method return the longitudinal Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we consider the case when the beam is uniformly distributed in one transverse phase plane. For this distribution f(s), we find that

        Fzφ) = 8 J2φ)/Δφ2 - 8 J3φ)/Δφ

      For small arguments we avoid any numerically singular behavior at Δφ = 0 by Taylor expanding. We have

        Fzφ) ≈ 1 - x2/4 + 5x4/384 - 7x6/23040 + x8/245760 + O(x9)

      Currently we are expanding to sixth order.

      NOTES: (CKA)

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Ftφ) for the single phase plane uniform distribution.
      Since:
      Feb 25, 2009
      See Also:
    • fourierTrans1dGaussian

      protected double fourierTrans1dGaussian(double dphi)

      Transverse Fourier Transform for 2D Gaussian Distribution

      This method return the transverse Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we consider the case when the beam is Gaussian distributed in each (uncorrelated) phase plane. For this distribution f(s), we find that

        Ftφ) = eφˆ2/8

      There is no need for a small argument expansion since the above expression is numerically stable.

      NOTES: (CKA)

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Ftφ) for the Gaussian distribution.
      Since:
      Feb 25, 2009
      See Also:
    • fourierLong1dGaussian

      protected double fourierLong1dGaussian(double dphi)

      Longitudinal Fourier Transform for 2D Gaussian Distribution

      This method return the longitudinal Fourier-Bessel transform needed to compute emittance growth from finite phase spread in an RF accelerating gap. Here we consider the case when the beam is Gaussian distributed in each (uncorrelated) phase plane. For this distribution f(s), we find that

        Fzφ) = (1 - Δφ2/4) eφˆ2/8

      There is no need for a small argument expansion since the above expression is numerically stable.

      NOTES: (CKA)

      Parameters:
      dphi - effective phase spread Δφ (half-width) of equivalent uniform beam in radians
      Returns:
      The value of transform Fzφ) for the Gaussian distribution in single phase plane.
      Since:
      Feb 25, 2009
      See Also:
    • effPhaseSpread

      protected double effPhaseSpread(EnvelopeProbe probe, IdealRfGap elem)

      Effective Phase Spread for Equivalent Uniform Beam

      Compute the longitudinal phase spread of the bunch with respect to the RF in an RF gap element (based on Trace3D RfGap.f) The phase spread is computed assuming a uniform distribution. The returned value is then the effective phase spread for the equivalent uniform beam. (see below).

      In XAL, longitudinal coordinate z is the "phase spread", but in meters. To convert to phase spread in radians we have

        = 2πz/(βλ)

      where λ is the wavelength of the RF. To simplify matters make the definition

        k ≡ 2π/βλ,

      which is the synchronous particle wave number. So, for <2> we get

        <2> = k2<z2>.

      Note then that <2>1/2 is the RMS phase spread.

      I am using the mid-gap value for β, that is, β average. And, thus, k is also the mid-gap wave number.

      We need to multiply <z2> by 5 to get the "(three-dimensional) equivalent uniform beam" longitudinal semi-axis (even though there is no uniform equivalent beam for emittance growth).

      Putting this all together gives the following value for the effective phase phase spread for the equivalent uniform beam, Δφ:

        Δφ = k<5z2>1/2.

      The above is the value returned by this method. Note that Δφ is also referred to as the beam half-length (with respect to the RF phase).

      NOTES: (CKA)

      · Note that the RMS phase spread can also be represented as

        = <[φ(s) - φs]2>1/2

      where φs is the synchronous particle phase.

      Parameters:
      probe - probe containing relativistic data
      elem - the RF gap modeling element creating the bunch phase spread
      Returns:
      phase spread (half width) Δφ ≡ <52>1/2 for this probe (radians)
    • phaseSpread

      protected double phaseSpread(EnvelopeProbe probe, IdealRfGap gap)

      Compute the phase spread of the bunch for a probe (based on Trace3D RfGap.f)

      CKA Notes:

      - This method needs to be optimized now that I understand what it is doing. In XAL, longitudinal coordinate z is the "phase spread", but in meters. To convert to phase spread δφ in radians we have

          δφ = 2πz/(βλ) ,

      where λ is the wavelength of the RF. So, for <δφ2> we get

          <δφ2> = <z2>2πf /(βc) ,

      where f is the RF frequency of the gap and c is the speed of light.

      - For the optional computation phaseSpreadT3d (which apparently is not used) I am not sure what is happening, or why <y'y'> is significant?

      Parameters:
      probe - we are computing the phase spread for this probe at the current IdealRfGap condition
      gap - the RF gap modeling element creating the bunch phase spread
      Returns:
      phase spread (half width) for this probe (radian)
    • correctTransFocusingPhaseSpread

      protected double correctTransFocusingPhaseSpread(EnvelopeProbe probe, IdealRfGap gap)
      Moved from IdealRfGap.
    • correctSigmaPhaseSpread

      protected double[] correctSigmaPhaseSpread(EnvelopeProbe probe, IdealRfGap gap)
      new implementation by sako, 7 Aug 06, to do trans/long simultaneously used in EnvTrackerAdapt, EnvelopeTracker
      Parameters:
      probe - envelope probe object (something with emittance and moments)
      gap - the RF gap modeling element creating the bunch phase spread
    • correctTransSigmaPhaseSpread

      public double correctTransSigmaPhaseSpread(EnvelopeProbe probe, IdealRfGap gap)

      Calculation of emittance increase due to phase spread based on calculations in Trace3d (RfGap.f)

      Used in EnvTrackerAdapt, EnvelopeTracker

      CKA Notes:

      - I think this should go in the Algorithm class. It expects an EnvelopeProbe - element objects should really not be concerned with the type of probe.

      Parameters:
      probe - envelope probe object (something with emittance and moments)
      gap - the RF gap modeling element creating the bunch phase spread
      Returns:
      the change in emittance after going through this element
    • correctLongSigmaPhaseSpread

      public double correctLongSigmaPhaseSpread(EnvelopeProbe probe, IdealRfGap gap)

      Calculation of emittance increase due to phase spread based on calculations in Trace3d (RfGap.f)

      used in EnvTrackerAdapt, EnvelopeTracker

      CKA Notes:

      - I think this should go in the Algorithm class. It expects an EnvelopeProbe - element objects should really not be concerned with the type of probe.

      Parameters:
      probe - envelope-type probe (something with emittance and moments)
      gap - the RF gap modeling element creating the bunch phase spread
      Returns:
      the increase in longitudinal emittance due to finite phase spread