Query the container segment of the current selection

Hi,

is there any possibility to determine the container segment of the current selection in the editor screen?

Thanks,

Tamas