
close all
clear classes
goo = beamPath;

goo.seedWaist(.1e-3,1.3,532e-9);


z1 = [2.5 4 9 10 12 14 16]*0.0254 + 1.076;
x1 = [460 353 211 300 440 599 800]/2*1e-6;
y1 = [428 320 224 275 396  525 692]/2*1e-6;

z2 = [4 5 6 7 8 9]*0.0254 + 1.4955
x2 = [400 323 245 202 199 224]/2*1e-6
y2 =  [432 357 273 208 196 210]/2*1e-6

goox = goo.fitBeamWidth(z1,x1);
gooy = goo.fitBeamWidth(z1,y1);

goox.addComponent(component.flatMirror(1,'ROC75'));

goox.addComponent(component.flatMirror(1.076,'PBS'));
goox.addComponent(component.dielectric(inf,inf,0.025,1.5,1.1522,'AOM1'));
goox.addComponent(component.flatMirror(1.2538, 'MG1'))
goox.addComponent(component.dielectric(inf,inf,0.025,1.5,1.3656,'AOM2'))
goox.addComponent(component.lens(0.1,1.4955,'lens1'));
goox.addComponent(component.dielectric(inf,inf,0.025,1.5,1.5715,'EOM'));
goox.addComponent(component.lens(100e-3,1.7622,'lens2'));
goox.addComponent(component.lens(50e-3,2.0974,'lens3'));


% plot the results
zplot = 0.9:.01:2.2;
% goo.components
% goo.plotSummary(zplot);

clf
hold on
plot(z1, x1,'ko')
goox.plotBeamWidth(zplot,'b')
goox.plotBeams(zplot,.7e-3,'b')
goox.plotComponents()
plot(z1,y1,'kx')
plot(z2,x2,'co')
plot(z2,y2,'cx')
hold off

grid on
axis tight
xlabel('Distance from SHG [m]','FontSize',12)
ylabel('Beam radius [m]','FontSize',12)
set(gca,'FontSize',12)

