Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: completed draft!!

...

Dark runs are used to simply make pedestals (aka "darks") for the XTCAV camera and other diagnostics. These runs without any electrons going through the accelerator. We take the average of a series of dark run images to get the general pixel values of the camera background. We can then subtract this "average image" from the lasing on and off runs to get a closer approximation of the actual energy of the electron bunches.

...


Lasing Off Runs

Lasing off runs provide a reference an estimate of what the electron beam would have looked like if it did not lose any energy to generate x-rays. To provide this reference, a "lasing off" run is generated that has electons but no x-rays. The electrons are "kicked" so that they cannot generate x-rays (lase) as they travel through the undulator. These electron bunches are captured on the XTCAV camera. The standard analysis clusters together these lasing off images into an ( automatically or manually chosen)number of groups. Each cluster of lasing off images is averaged to reduce noise, and then compared to "lasing on" bunches (next step, below). Clustering and subsequent matching to lasing on bunches is done by comparing the electron current as a function of time (projection of the XTCAV image onto the x-axis, the time axis), which is physically expected to be invariant, whether lasing occurred or not.

...

Code Block
languagepy
titlepsana
from xtcav2.LasingOnCharacterization import LasingOnCharacterization
XTCAVRetrieval = LasingOnCharacterization() 


for evt in ds.events():
	XTCAVRetrieval.processEvent(evt)
	t, power = XTCAVRetrieval.xRayPower()

 

Theory

...

(work in progress)

The LCLS X-band Transverse deflecting mode CAVity (XTCAV) diagnostic system is shown in Fig. 1. There are two key elements to the system: the XTCAV and the final dipole magnet.

As shown in Fig. 1, immediately after the undulator is the XTCAV. This generates an effective RF (11.424 GHz) electromag- netic force pointing in the horizontal direction with an amplitude varying sinusoidally in time. Then, as illustrated in Fig. 2a, the electron bunch travels through the cavity with this RF wave at roughly the speed of light. The bunch time of arrival is set so its center coincides with when the amplitude of the RF field is zero. Then the net deflection of the bunch will also be zero.

However, the bunch has a finite length, some-thousand times shorter than the wavelength of the RF. As shown in Fig. 2a, the head sees a small, positive electric field while trailing electrons see a small, negative transverse electric field. The effect is a linearly-varying force for different slices of the bunch. The head (tail) gets a transverse momentum kick to the left (right), shearing the bunch into a horizontal streak.

& Implementation

The current XTCAV code implements two reconstruction methods – that is, ways to compare the lasing on and lasing off XTCAV images to compute the final power-vs-time profile. These methods are:

  1. The "energy loss" method, also known as "COM" for center of mass, which is the way the method is actually implemented. This method computes the FEL power directly from the energy lost by the electrons, using a simple conservation of energy argument:

         P(t) = (<Eoff>(t) - <Eon>(t)) x I(t)

    Here, <Eoff>(t) is the average energy of the electrons in the lasing off shot, <Eon>(t) is the average energy in the on shot, and I(t) is the beam current. Practically, the current is just the projection of the XTCAV camera intensity on the time axis. The average energies are determined by taking the center of mass of the XTCAV image (hence, COM) in time – ie, just the average electron energy vs. time. The difference between the off and on shots (energy loss) gives the final power.

  2. The "energy spread" method, also known as "RMS" for root-mean-square method. This method computes the increased spread of the electron energies in the lasing on shot, which is predicted by FEL theory:

        P(t) = [ σ2on (t) - σ2off (t) ] x I2/3(t)

    You will notice that in the lasing on shots (e.g. in the early figures in this article), the electrons are more spread out after lasing. This lets us compute the power they lost to lasing through the associated FEL physics model. The RMS, denoted σ here, is simply the RMS deviation of the electron energies at each point in time. The 2/3 exponent on the beam current is a small correction due to these formulas scaling with the FEL efficiency (Pierce) parameter ρ which has a 1/3-power dependence on several slice properties of the beam. Beam current is one of them and is known by this measurement.
     
In practice, the methods used to compute the reconstruction are quite simple. The XTCAV code has a number of image processing steps used to clean up the data before processing that are the truly tricky bit. For details, see the code on github: https://github.com/slaclab/xtcav2
For details on these equations, the accelerator directorate has published an informal note on the theory and operating parameters of the XTCAV: xtcav-users-v0p4.pdf – recommended reading.

Differences from Previous XTCAV code

In June 2018, we pushed an update to the XTCAV code that is referred to at LCLS as "xtcav2". Yes, I know what you are thinking: Chris O'Grady and TJ Lane truly excel in the creative naming department and deserve a raise as a result. In many ways, the user interface should look the same, but there were a lot of improvements under the hood. Many thanks to our talented masters student Clara Meister for tackling that beast!

 

Differences from Previous XTCAV code

  • Changes to the user interface:
    • All parameters should be set during the initialization of `DarkBackgroundReference`, `LasingOffReference`, and `LasingOnCharacterization`.
    • There is no longer a `.Generate()` call. A reference will be created upon initialization of the `DarkBackgroundReference` and `LasingOffReference` classes. The reference will be saved to the psana data directory (default location unless the `calibration_path` parameter is set). If you would like to access the generated reference profiles, you can either load them from the saved file or access the member variable `averaged_profiles` within the `LasingOffReference` class.
    • Some parameters, such as roi_waist_threshold, have been deprecated. The current code automatically chooses this value for you based on the `snr_filter` (see documentation above). Other parameter names have changed so that naming convention is consistent across the entire xtcav package (again, see documentation above). 
  • Changes to analysis:
    • Improved profile clustering algorithm
    • Image is no longer median filtered before analysis
    • Power profile for lasing off image is not averaged between RMS and COM methods
  • Other changes include: improved code readability, integration with psana detector interface, and speed up in processing time.

Detector Resolution

Important Questions (Both Frequently and Infrequently Asked!)

What is the resolution of the XTCAV reconstruction?

(From Tim Maxwell):

Time resolution is around 1.1 fs RMS for soft x-rays, 2.5 fs fwhm (in quadrature, of course). So actually pulse length is probably 4.3 - 9.7 fs FWHM.This also for hard x-rays. This doesn't include the "slippage resolution." That is, if they're when using the full undulator, then by the end the x-rays can have slipped out of the electron slice by ~3 fs for soft x-rays. Obviously not a small number if trying to make (eg) 5 fs pulses. They've (ACR) been advised to not use the full undulator when shorter pulses are more important than number of photons.

How Do I Know When I Can Trust My Results?

GREAT QUESTION. The first, most obvious thing to do is compare the RMS ("energy spread") and COM ("energy loss") reconstruction methods. If these agree (90+% correlation), then you are on a good track... though other validation is desirable. If they disagree, however, you know you are hosed. For now, given what we know, we recommend throwing away any shot for which the two methods do not agree, unless you have some good reason to do otherwise.

If you want to know gross values, such as pulse duration, the timing between two pulses, etc, then if you have reconstruction agreement, you can be quite confident your analysis will work with ~3 fs precision in time and ~10 eV precision in energy, though exact values depend strongly on the XTCAV settings – discuss with ACR if you care! If you are studying the power structure of the pulse, then the honest answer is that we do not know exactly how good the reconstruction is – this is an open research question. We are currently working on ways to experimentally validate existing reconstruction methods and improve them. This is seen as a high priority by LCLS management and is funded through the FEL R&D program (as of time of writing, Oct 2018).

Who Do I Contact for More Help?

On XTCAV physics, parameters, limitations, improvements, etc: Tim Maxwell <tmaxwell@slac.stanford.edu>

On the workings of the XTCAV code in psana: TJ Lane <tjlane@slac.stanford.edu>

Additional Resources