I read a lot about the amount of radiation bodies like the Moon and Mars receive, but it's hard to find information about where the radiation is coming from. It seems to me that it's cosmic radiation plus whatever is being radiating from the Sun. Would it be useful to build a habitat somewhere that's in perpetual shadow (e.g. deep crater), or to seek shelter in the shadow of a crater wall or mountain during a solar storm. Mostly I'm thinking about a habitat design for Mars, where the habitat will always be out of view of the sun. Sunlight could light the habitat via something like huge Mylar mirrors, that would not reflect much harmful radiation. But I'd like to know if the applies to the Moon.
Besides solar energetic particle (SEP) events, it's mostly (almost isotropic) galactic cosmic rays (GCR). GCRs may cause secondary radiation by interaction with the atmosphere or with rock. The smaller the solid angle of the visible sky, the smaller the mean galactic radiation dose. On Mars you get additional shielding by the atmosphere, hence dependence of the atmospheric pressure. More detail in this paper. Shieldings from SEP events should be rich in protons, e.g. water or food, or you need to go deeper into underground, as soon as a SEP event is detected. GCRs are partially shielded by the heliosphere. Hence solar maxima protect partially from GCRs, but SEP events get more likely during solar maxima. Since GCRs are unpredictable, and SEP events can be detected, for solar maxima, protection strategies resultng in an overall reduced radiation dose can be elaborated.