In addition to just curving the beam,it is also necessary to focus it. Because protons are electrically charged a particle beam diverges if left on its own.
Focussing the beam allows its width and height to be constrained so that it stays inside the vacuum chamber. This is achieved by quadrupole magnets, which act on the beam of charged particles exactly the same way as a lens would act on a beam of light
Let´s imagine that the positive particles (protons in LHC) come from the right.
The first quadrupole takes control of the beam width while the second one does the same with the beam height.
The two quadrupoles working together keep the protons tightly bunched so that the greatest number of collisions occur.
The ones that focuses in the horizontal plane are called a QF and the ones that focuses in the vertical plane are called QD.
The lattice of the machine contains alternatively both QF and QD in the arcs, therefore the overall effect is to keep the beam focussed.
The focusing effect of the quadrupoles will make protons oscillate around the perfect centre of the vacuum tube. The number of oscillations in one turn of the machine is called the Q or the tune.
There´s a total of 858 quadrupole magnets.
But there a lots of protons, and everyone has a slightly different energy and is following a slightly different path. So different tunes are needed. The change in focusing with energy is called the chromaticity, and sextupole magnets are used to that task.
Other magnetic multipolesact to help in beam focussing and counteracting other interacctions that each beam suffers (gravitational interactions over protons, electromagnetic interactions among bunches, electron clouds from de pipe wall, etc).
See more about the diferents types of magnets in LHC.
The next image shows the basic multipolar magnetic cell (FODO), 110 m long, in LHC.
There are, in addition, eight sets of so called "inner triplet" magnets in the LHC. Their job is to focus the particle beams into the four areas where particles will collide. The size of bunches passes fromm 0,2 mm to 16 micrometers at the Interaction Points (IP):