Instruction:

%%%Produce errors%%%%%
1. elegant step2.ele

%%%Tune, chromaticity and closed orbit correction%%%
2. elegant elettra.ele 

%%%Make element list for beta-beating and coupling correction%%%%
3. ./makeElementListFile -listFile elements.sdds


%%%Beta-beating correction%%%%
4. ./runCorrection -workDir ##/with_skew_quads -correctionMode beta -measLatticeParamFile step3.param -outputFile result.beta.param

%%%Coupling correction%%%%
5. ./runCorrection -workDir ##/with_skew_quads -correctionMode coupling -measLatticeParamFile "step3.param result.beta.param" -outputFile result.coupling.param


The corrected lattice ca be defined by:

-lattice
-step3.param 
-result.beta.param 
-result.coupling.param

plot DA of corrected/ ideal and uncorrected lattice
sddsplot -graph=line,vary -unsup=y -groupby=names -sep=names \
  -column=x,y -legend=spec=Original bare.aper \
  -column=x,y -legend=spec=Corrected corrected.aper \
  -column=x,y -legend=spec=UnCorrected Uncorrected.aper

plot twiss parameters of corrected/ideal and uncorrected lattice:

sddsplot -graph=line,vary -unsup=y -groupby=names -sep=names \
  -column=s,etax -legend=spec=Original desired.twi \
  -column=s,etax -legend=spec=Corrected achieved.twi \
  -column=s,etax -legend=spec=UnCorrected measured.twi


sddsplot -graph=line,vary -unsup=y -groupby=names -sep=names \
  -column=s,betax -legend=spec=Original desired.twi \
  -column=s,betax -legend=spec=Corrected achieved.twi \
  -column=s,betax -legend=spec=UnCorrected measured.twi
  
sddsplot -graph=line,vary -unsup=y -groupby=names -sep=names \
  -column=s,betay -legend=spec=Original desired.twi \
  -column=s,betay -legend=spec=Corrected achieved.twi \
  -column=s,betay -legend=spec=UnCorrected measured.twi
