function plot_foreground_and_backgroundevents(ae,drop)

close all

fore=ae;
fore(:,drop)=[];
[l,i]=sort(fore(3,:),'ascend')
fore=fore(8:end,i);

back=ae(8:end,drop);

clrfore=colormap(jet(size(fore,2)));
clrback=colormap(jet(size(back,2)));

figure(1), hold on, title('foreground'), xlabel('time'), ylabel('imem')
for f=1:size(fore,2)
    st_f=movingwindowsmooth(fore(:,f),10);
    plot(st_f,'color',clrfore(f,:))
end

figure(2), hold on, title('background'), xlabel('time'), ylabel('imem')
for b=1:size(back,2)
    st_b=movingwindowsmooth(back(:,b),10);
    plot(st_b,'color',clrback(b,:))
end