function data_vars_plot()

global allData;
global dvar;
define_data_var();

idx=find(allData.selected==1);

if (~isempty(allData.selection))
fprintf('Selection: %s \n %d events.\n',allData.selection,length(idx));
end

if (~(isempty(allData.beamInfo)))

for iplot=1:9

if (iplot==1)
  var=dvar.RESEAU_POS;
elseif (iplot==2)
var=dvar.DETECT_SPOS;
elseif (iplot==3)
var=dvar.DETECT_XPOS;
elseif (iplot==4)
var=dvar.DETECT_ZPOS;
elseif (iplot==5)
var=dvar.DETECT_RS1;
elseif (iplot==6)
var=dvar.DETECT_RS2;
elseif (iplot==7)
var=dvar.LPM;
elseif (iplot==8)
var=dvar.XBPM;
elseif (iplot==9)
var=dvar.QICT1;
else
  warning_sp([ 'The var ' var ' is unknown at iplot=' num2str(iplot) ]);
end %if


subplot(3,3,iplot)

varidx=mod(var,1000);
vartype=floor(var/1000)*1000;

switch vartype
    case dvar.BEAMINFO
        vals=allData.beamInfo(idx,varidx);
    otherwise
        warning_sp([ 'The vartype ' vartype ' is unknown.' ]);
        error('end');
end %switch

hist(vals,20)
xlabel(get_var_name(var))
end % for each subplot

subplot(3,3,2)
title({allData.selection})

end % if the data are not empty

end %function
