Cal. Penal Code § 1610
(c) A person confined under this section shall have the right to judicial review of his or her confinement in a jail under this section in a manner similar to that which is prescribed in Article 5 (commencing with Section 5275) of Chapter 2 of Part 1 of Division 5 of the Welfare and Institutions Code and to an explanation of rights in the manner prescribed in Section 5325 of the Welfare and Institutions Code.
Nothing in this section shall prevent hospitalization pursuant to the provisions of Section 5150, 5250, 5350, or 5353 of the Welfare and Institutions Code.