compute sections based on bars