- description: elegant2genesis analyzes particle output data from elegant and prepares a “beamfile” for input to GENESIS[8], a 3-D time-dependent FEL code by S. Reiche. The beamfile contains slice analysis of the particle data, and may be useful in other applications as well.
- synopsis:
elegant2genesis inputfile outputfile [-pipe=[in][,out]] [-textOutput] [-totalCharge=coulombs | -chargeParameter=name] [-wavelength=meters | -slices=integer] [-steer] [-removePTails=deltaLimit=value[,fit][,beamOutput=filename]] [-reverseOrder] [-localFit]

- files:
- inputfile — A particle output file from elegant or any other program that uses the same column names and units.
- outputfile — Contains the slice analysis, suitable for use with SDDS-compliant GENESIS. The
columns are as follows:
- s, t — Location of slice in the bunch, in meters or seconds, respectively. s is defined so that the head of the bunch is a larger values, contrary to elegant’s convention.
- gamma — The average value of γ for the slice.
- dgamma — The standard deviation of γ for the slice.
- xemit, yemit — The normalized slice emittances in the horizontal and vertical plane, respectively.
- xrms, yrms — The slice rms beam sizes.
- xavg, yavg — The slice centroid positions.
- pxavg, pyavg — The slice centroids for x and y slopes.
- alphax, alphay — The slice values of the Twiss parameter α.
- current — The slice current.
- wakez — Defined for convenience to be 0. See GENESIS manual for the meaning.
- N — The number of particles in the slice.

- switches:
- -pipe[in][,out] — The standard SDDS toolkit pipe option.
- -textOutput — Requests text output instead of SDDS output, which may be useful for input to non-SDDS-complaint versions of GENESIS.
- -totalCharge=coulombs — Gives the total charge of the beam in Coulombs.
- -chargeParameter=name — Gives the name of a parameter in inputfile where the total charge in the beam is given.
- -wavelength=meters — This option is misnamed. It is actually the slice length in meters.
- -slices=integer — The number of analysis slices to use.
- -steer — If given, then the transverse centroids for the bulk beam are all set to zero. The relative centroid offsets of the slices are, of course, unchanged.
- -removePTails=deltaLimit=value[,fit][,beamOutput={\em filename}\verb]— — Remvoes the momentum tails from the beam. deltaLimit is the maximum absolute value of (p -⟨p⟩)∕⟨p⟩ that will be accepted. If fit is given, then a linear fit to p as a function of t is performed, and removal is based on the residuals from that fit. If beamOutput is given, then the filtered beam data is written to the named file for review.
- -reverseOrder — By default, the data for the head of the beam comes first. This option causes elegant to put the data for the tail of the beam first.
- -localFit — If given, then for each slice a local linear fit is used to remove any momentum chirp prior to compute the momentum spread. This produces a momentum spread that is more independent of the number of slices. Should not be used if the FEL cooperation length is greater than the slice length.

- author: R. Soliday, M. Borland, ANL/APS.