The issue of the defendant's fitness may be determined in the first instance by the court or by a jury. The defense or the State may demand a jury or the court on its own motion may order a jury. However, when the issue is raised after trial has begun or after conviction but before sentencing, or when the issue is to be redetermined under Section 104-20 or 104-27, the issue shall be determined by the court.
725 ILCS 5/104-12