Magnetic ordering and electronic structure of the ternary iron arsenide BaFe2As2