function hard=hard_targetv2(lidar)
%create laser pulse shape Note:10ns time division for 3m range gate seperation
dt=(lidar.ranges(2) - lidar.ranges(1)) / .3;
t=[-150:dt:150];
sig=180/2/sqrt(2);
nearly=ceil(72/(lidar.ranges(2) - lidar.ranges(1)));
R=exp(-(t'/sig).^2); % gaussian temporal shape with full width of 180ns at 1/e^2
[na,nr]=size(lidar.SNR);
SNR=lidar.SNR;
SNRdb=lidar.SNRdb;
RWS=lidar.RWS;
Beta=lidar.Beta;
hard.xh=[];
hard.yh=[];
hard.zh=[];
hard.lath=[];
hard.lonh=[];
hard.hh=[];
hard.rwsmean=[];
hard.radial=[];
hard.azimuth=[];


ihard=1;
for ja=1:na

    P=lidar.SNR(ja,:)';
    for j=1:5
        %         B=imfilter(P,R,'replicate','conv');
        %         BB=imfilter(P./B,R,'replicate','conv');
        B=ConvolutionDft( P,R,2 );
        BB=ConvolutionDft(P./B,R,2);

        pp=P.*BB;
        P=pp;
    end
    [locs pks]=peakseek(P,10,2);
    if ~isempty(locs)
        for ji=1:length(locs)
            % first look at meanRWS in small window

            % fix window for NaN'ing RWS around buildings (extended to end of
            % range)

            minp=locs(ji)-nearly/2;
            if minp<1
                minp=1;
            end
            maxp=locs(1)+lidar.gatelengthinpts/2;
            if maxp>nr
                maxp=nr;
            end

            rwsmean=mean((lidar.RWS(ja,[minp:maxp])))

            hard.xh(ihard)=lidar.xd(ja,locs(1));
            hard.yh(ihard)=lidar.yd(ja,locs(1));
            hard.zh(ihard)=lidar.zd(ja,locs(1));
            hard.lath(ihard)=lidar.lat(ja,locs(1));
            hard.lonh(ihard)=lidar.lon(ja,locs(1));
            hard.hh(ihard)=lidar.h(ja,locs(1));
            hard.rwsmean(ihard)=rwsmean;
            hard.radial(ihard)=minp;
            hard.azimuth(ihard)=ja;
            ihard=ihard+1;

        end

    end
end
return