I've not been to SF but have have been to Ca many times (as well as the rest of north America. Its pretty much the same as everywhere else in the world in the respect of good and bad areas. As the post above says generally keep out of known bad areas and if you find your way into one by mistake then make your way out ASAP.
Hotel staff will normally guide you on where not to go.
If the area looks really bad and the hotel is as bad then don't stay there, Hotels are numerous and usually can acomodate without reservations.
Enjoy the trip.
Misaligned holes in flat pack garden furniture
To go through chemo therapy or choose not to?