Carbon analysis using energetic ion beams