function [ field, pol ] = NaFeCuAs_ZF_MuSR_Sim_Driver( numMC )
%NAFECUAS_ZF_SIM Summary of this function goes here
%   Detailed explanation goes here

%Input Parsing
p = inputParser;

%Parsing conditions
addRequired(p, 'numMC', @(x) validateattributes( x, ...
    {'numeric'}, {'nonempty','scalar','positive','integer'} ) );

%Parsing Input
parse(p, numMC);

%Assigning inputs
numMC = p.Results.numMC;

%Delete parser
clear p

impCon = [0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.6,0.7,0.8,0.9];

muonX = 0.2:0.05:0.50;
muonY = 0.2:0.05:0.50;
muonZ = 0.1:0.02:0.3;


%QC1
muonX = 0.5;

%QC2
%muonX = 0.25;

%LaserT
%muonX = 0.3:0.05:0.40

%Geiger
%muonX = 0.45:0.05:0.50;

% saveFolder = ...
%     'D:\Documents\MuSR_Research\M1570_NaFe1-xCuxAs\Dipolar_Field_Simulation\ZF_Polarization_NaFeCuAs\Results_160615\Data';


numX = length(muonX);
numY = length(muonY);
numZ = length(muonZ);

pol = cell(numX,numY,numZ,length(impCon));
field = cell(numX,numY,numZ,length(impCon));

for x = 1:numX
    for y = 1:numY
        for z = 1:numZ
            muonLoc = [muonX(x), muonY(y), muonZ(z)];
            
            tStart = tic;

            for j = 1:length(impCon)
                
                [ field{x,y,z,j}, pol{x,y,z,j} ] = ...
                    NaFeCuAs_ZF_MuSR_Sim(muonLoc, impCon(j), numMC);
                
                fprintf('Finished Muon Position (%.2f,%.2f,%.2f) with concentration %.2f.\n',...
                    muonX(x), muonY(y), muonZ(z), impCon(j));
                
            end
            
            %Saving    
            saveFullName = sprintf('Data\\MuonPos(%.2f,%.2f,%.2f)_Data.mat',...
                muonX(x),muonY(y),muonZ(z));
            save(saveFullName, 'field','pol');
            
            tEnd = toc(tStart);
            fprintf('Finished Muon Position (%.2f,%.2f,%.2f) in %.5f seconds.\n', tEnd);
        end
    end
end

end %End of NaFeCuAs_ZF_MuSR_Sim_Driver.m

