function [SecondSetsMetrics,SecondSets,IDs,ParentsIDs]=get2lev(PotSetsHierarchy,PotSetsMetrics,PotSets,PotNodesMetrics,PotNodes);
% Get the second level of the rules tree

dimension=size(PotNodes,1);

[FirstSetsMetrics,FirstSets,firstIDs]=get1lev(PotSetsHierarchy,PotSetsMetrics,PotSets,PotNodesMetrics,PotNodes);
IDs=[];
ParentsIDs=[];
for i=1:size(firstIDs,2),
	if (firstIDs(i)<0),
		[NoUse,flag] = max(PotSetsHierarchy(:,1)==firstIDs(i));
		IDs=[IDs PotSetsHierarchy(flag,2:3)];
		ParentsIDs=[ParentsIDs firstIDs(i)];
	end;
end;

for i=1:size(IDs,2),
	if IDs(i)<0,
		SecondSets(:,i)=PotSets(:,-IDs(i));
		SecondSetsMetrics(:,:,i)=PotSetsMetrics(:,:,-IDs(i));
	else
		SecondSets(:,i)=PotNodes(:,IDs(i));
		SecondSetsMetrics(:,:,i)=PotNodesMetrics(:,:,IDs(i));
	end
end
	
