Section 270(5) in Criminal Rules of Practice and Circular Orders, 1990
(5)An Officer or Soldier will remove his head dress while the Judge or Magistrate is present, except when the Officer or Soldier is on duty under the arms with a party or escort inside the Court