The Discovery Prelim. Prior to the sentencing hearing a probation report is usually prepared which contains a recommendation to the judge on the appropriate sentence. Although the recommendation is not binding on the court, it is an important element.
Lawyers argue about the proper term based on the facts of the particular case.
The final decision is within the judge's broad discretion. Jails are run by the counties within which they are located. Prisons are run by the state within which they are located. A defendant may be sentenced to probation instead of prison. However, he may be ordered to do some local custody time as a term of probation.