|Trajectory of a gamma ray|
Photons deposit their energy in matter by transferring it to charged particles. The gamma photon shown above was produced at point A, during a collision with a particle originating from an accelerator. After a certain distance travelled without any interaction, the gamma arrives at point B and its energy goes into the creation of an electron/positron pair. The presence of a very strong magnetic field causes the two oppositely-charged particles to spin in opposite directions and gradually lose their energy before coming to a complete stop. This chain of events can be seen very clearly in a 'bubble chamber' picture. Less energetic photons produced by radioactive decays transfer also their energy to charged particles.