#!/bin/bash
 
# Transient beam loading benchmark with mbtrack2
 
elegant twiss.ele
 
elegant makeBunch.ele

elegant makeBeam.ele
 
# Track w/ RFmode
mpiexec -n 8 Pelegant track.ele

# Plotting of bunch length and energy spread
sddsplot -layout=1,2 -join=x -col=Pass,Sdelta -col=Pass,St track.w1 -sep=1
# Plot phase space
sddsplot -col=dt,p -graph=dot -split=page -sep=page -same track.w2 -title=@Pass
# Plot energy (delta) and time (dCt) centroid
sddsplot -layout=1,2 -join=x -col=Pass,Cdelta -col=Pass,dCt track.w1 -sep=1
# Plot longitudinal histogram
sddsplot -column=dt,dtFrequency track.h1
# plot passive cavity voltage
sddsplot -col=Pass,V track.rec
