#!/bin/sh  
# \
exec tclsh "$0" "$@"

if ![file exists 79h2CSR4.log] {
    catch {exec elegant 79h2CSR4.ele > 79h2CSR4.log}
}

exec sddsplot -layout=1,3 -split=page -sep=names -groupby=page,names 79h2CSR4.B1.csr \
    -column=s,LinearDensity -column=s,LinearDensityDeriv -column=s,DeltaGamma &
exec sddsplot -layout=1,3 -split=page -sep=names -groupby=page,names 79h2CSR4.B8.csr \
    -column=s,LinearDensity -column=s,LinearDensityDeriv -column=s,DeltaGamma &

# Make 2d histograms of watch point data
eval exec sddscombine [lsort [glob -nocomplain 79h2CSR4.w?]] -pipe=out \
     | sddsprocess -pipe -process=t,ave,%sAve \
     "{-redefine=col,dt,t tAve - 1e12 *,units=ps}" \
     "{-define=col,delta,p pCentral - pCentral /}" \
     | sddshist2d -pipe=in 79h2CSR4.h2d -xparam=200 -yparam=200 -column=t,delta 
exec sddscontour -shade 79h2CSR4.h2d
