calculate headroom