California Penal Code
(a) In any criminal action, after the filing of any complaint or other accusatory pleading and before a plea, finding, or verdict of guilty, no judge shall read or consider any written report of any law enforcement officer or witness to any offense, any information reflecting the arrest or conviction record of a defendant, or any affidavit or representation of any kind, verbal or written, without the defendant’s consent given in open court, except as provided in the rules of evidence applicable at the trial, or as provided in affidavits in connection with the issuance of a warrant or the hearing of any law and motion matter, or in any application for an order fixing or changing bail, or a petition for a writ.
(b) This section does not preclude a judge, who is not the preliminary hearing or trial judge in the case, from considering any information about the defendant for the purpose of that judge adopting a pre-trial sentencing position or approving or disapproving a guilty plea entered pursuant to Section 1192.5, if all of the following occur:
(1) The defendant is represented by counsel, unless he or she expressly waives the right to counsel.
(2) Any information provided to the judge for either of those purposes is also provided to the district attorney and to the defense counsel at least five days prior to any hearing or conference held for the purpose of considering a proposed guilty plea or proposed sentence.
(3) At any hearing or conference held for either of those purposes, defense counsel or the district attorney is allowed to provide information, either on or off the record, to supplement or rebut the information provided pursuant to paragraph (2).