% lookmcsub.m
clear
home

global Nfile J F S A E r z
global mua mus g n1 n2
global mcflag radius waist xs ys zs
global NR NZ dr dz Nphotons


getmcsub('mcOUT0.dat');
% Reads the impulse response recorded in mcOUT0.dat
% by mcsub.c, after being called by callmcsub.c.

%% Show fluence
% Plots Fzr(z,rr), a 2D map of fluence rate with rr = -r:+r.
% Overflow bins at rr = 1 and NR, and at z = NZ.

Fzr = zeros(NZ,2*NR);
Fzr(:,NR+[1:NR]) = F;
Fzr(:,[NR:-1:1]) = F;
rr               = zeros(2*NR,1);
rr(NR+[1:NR])    = r;
rr(NR:-1:1)      = -r;

figure(1);clf
imagesc(rr,z,log10(Fzr))
colorbar
set(gca,'fontsize',14)
xlabel('r [cm]')
ylabel('z [cm]')
title('log_{10}(relative fluence rate [W/cm^2 per W delivered])')

