Introduction
XTCAV is a detector that is used to determine the laser-power vs. time of each LCLS shot. Alvaro Sanchez-Gonzalez has written psana-python code to do the rather complex analysis of images from the XTCAV camera to determine these quantities. Some detailed documentation from Tim Maxwell on this device is Here.
Analysis Setup
Two things must be done before XTCAV analysis will function: a "dark run" must be analyzed to get the pedestal values for cameras, and a "no lasing" run must be analyzed to generate sets of "no lasing" images (the latter is quite a complex process). An example of a dark-run analysis is:
#!/usr/bin/env python from xtcav.GenerateDarkBackground import * GDB=GenerateDarkBackground(); GDB.experiment='amoc8114' GDB.runs='85' GDB.maxshots=150 GDB.SetValidityRange(85,109) GDB.Generate();
An example of a non-lasing run is:
#!/usr/bin/env python from xtcav.GenerateLasingOffReference import * GLOC=GenerateLasingOffReference(); GLOC.experiment='amoc8114' GLOC.runs='86' GLOC.maxshots=401 GLOC.nb=1 GLOC.groupsize=5 GLOC.SetValidityRange(86,91) GLOC.Generate();
Once the above has been completed, the user can analyze the lasing-on events.
Example Analysis Script
This script assumes that dark/lasing-off data has been analyzed (see above)
import psana from xtcav.ShotToShotCharacterization import * maxshots=5 #Maximum number of valid shots to process experiment='amoc8114' #Experiment label runs='87' #Runs #Loading the dataset from the "dark" run, this way of working should be compatible with both xtc and hdf5 files dataSource=psana.DataSource("exp=%s:run=%s:idx" % (experiment,runs)) #XTCAV Retrieval (setting the data source is useful to get information such as experiment name) XTCAVRetrieval=ShotToShotCharacterization(); XTCAVRetrieval.SetDataSource(dataSource) for r,run in enumerate(dataSource.runs()): times = run.times() for t in times: evt = run.event(t) if not XTCAVRetrieval.SetCurrentEvent(evt): continue t,power=XTCAVRetrieval.XRayPower() agreement=XTCAVRetrieval.ReconstructionAgreement()