sddsemitproc

**description:**`sddsemitproc`analyzes quadrupole scan emittance measurement data. It accepts a file containing the transport matrix for each data point and measured beam sizes. Because`sddsemitproc`uses the matrix rather than a thin-lens model, it can analyze data from arbitrarily complex scans, involving, for example, multiple thick-lens quadrupoles.The matrix data can be prepared using

`elegant`. For example, the`vary_element`command can be used to vary one or more quadrupoles. In addition, the beam size data may be prepared using`elegant`, to allow simulation of emittance measurements.`sddsemitproc`will perform error analysis using a Monte Carlo technique. A user-specified number of random error sets are generated and added to all measurements. Analysis is performed for each error set. Statistics over all the error sets provide most likely values and error bars.The beam parameters computed by

`sddsemitproc`pertain to the beginning of whatever system is simulated in`elegant`.**examples:**`elegant quadScan.ele sddscollapse quadScan.fin -pipe=out`

| sddsxref -pipe=in quadScan.data -take=SigmaX,SigmaY

| sddsemitproc -pipe=in emitResults.sdds**synopsis:**`sddsemitproc [`*inputfile*] [*outputfile*] [-pipe=[input][,output]] [-sigmaData=*xName*,*yName*] [-errorData=*xName*,*yName*| -errorLevel=*valueInm*,[{gaussian,*nSigmas*| uniform}]] [-nErrorSets=*number*] [-seed=integer] [-limitMode=resolution | zero[,reject] [-deviationLimit=*xLevelm*,*yLevelm*] [-resolution=*xResolutionm*,*yResolutionm*] [-verbosity=*level*]**files:***inputfile*-- An SDDS file containing one or more pages with columns named`R`

*ij*, where*ij*is 11, 12, 33, and 34. These give elements of the horizontal and vertical transport matrices from the beginning of a system to the observation point. The sigma matrix inferred will be that for the beginning of the system. Typically, one starts with the`final`file from the`run_setup`command in`elegant`, and collapses it using`sddscollapse`. Each page of*inputfile*corresponds to a different emittance measurement.In addition to this data,

*inputfile*must also contain columns giving the rms beam sizes in x and y. The user supplies the names of the columns using the`-sigmaData`

option; otherwise, they default to`Sx`

and`Sy`

. These columns may be from`elegant`(e.g.,`Sx`

and`Sy`

), if one wants to simulate an emittance measurement. Note that the theory behind the emittance measurement is strictly correct only for true RMS beamsize measurements. Use of FWHM or some other measure will give unreliable results.*outputfile*-- A file containing one page for each page of*inputfile*. The parameters of*outputfile*give the measured geometric rms emittance, sigma matrix, and Twiss parameters of the beam in the horizontal and vertical planes. If error sets were requested (using`-nErrorSets`

), then there are also parameters giving the error bars (``sigma's'') of the measured values.

**switches:**`-sigmaData=`-- Supplies the names of the columns in*xName*,*yName**inputfile*from which the x and y rms beam sizes are to be taken. Default values are`Sx`and`Sy`, which are the data provided by`elegant`.`-errorLevel=`-- Supplies the standard deviation of random errors to be added to the measured beam sizes for Monte Carlo error analysis.*valueInm*,[gaussian,*nSigmas*| uniform]`-errorData=`-- May be used to supply the names of columns in the input file that contain the error level for each measurement. This is an option instead of using*xName*,*yName*`-errorLevel`, which allows varying the measurement error for each point.`-nErrorSets=`-- The number of sets of random errors to generate and add to the measurements. Each error set is used to perturb the original measurement data. The results are analyzed separately for each error set, then combined to give means and error bars.*number*`-seed=integer`-- Seed for the random number generator. Recommend a large, positive, odd integer less than . If no seed is given or if the given seed is negative, then a seed is generated from the system clock.`-resolution=`-- The resolution of the beam size measurements, in meters. These values are subtracted in quadrature from the measured beam sizes to obtain the true beam sizes.*xResolutionm*,*yResolutionm*`-limitMode=resolution | zero[,reject]`-- If measured or perturbed beam sizes are less than the resolution or less than zero, then errors will result. One can use this option to limit minimum beam size values or reject points. In general, if one has to do this the measurement is probably bad.`-deviationLimit=`-- Specifies the maximum deviation, in meters, from the fit that data points may have and still be included. An initial fit is performed for each randomized set or the raw data, as appropriate. Outliers are then removed and the fit is repeated.*xLevelm*,*yLevelm*`-verbosity=`-- Higher values of*level**level*result in more informational printouts as the program runs.

**author:**M. Borland, ANL/APS.