I will try to answer this as best I can because it can be quite confusing. I am more familiar with my home state NJ rather than CA.
Federal criminal matters are handled by the US district attorney who has assistant prosecutors. US Marshalls enforce court activities. Federal police activities which provide information and arrest criminals are numerous but usually FBI. These are all agents of the US Department of Justice and part of the federal executive branch. The US Attorney General under the President is their boss.
State criminal matters are handled by the State Attorney General and usually each county has its own chief prosecutor. Assistant prosecutors help them. County Sheriffs enforce some police activities and state troopers others. Law enforcement is divided up into state, county and local police. Most state law enforcement is the responsibility of the executive branch and is under the Governor.
Courts are independent of the executive branch but have the authority to hear criminal cases, issue indictments, hear bail applications, decide on convictions, and incarcerate.
Correction officers are part of law enforcement and are attached to federal and/or state jails. In most states correction officers would be part of DOJ.