We present a comprehensive study of the current-induced spin-orbit torques in
perpendicularly magnetized Ta/CoFeB/MgO layers. The samples were annealed in
steps up to 300 degrees C and characterized using x-ray absorption
spectroscopy, transmission electron microscopy, resistivity, and Hall effect
measurements. By performing adiabatic harmonic Hall voltage measurements, we
show that the transverse (field-like) and longitudinal (antidamping-like)
spin-orbit torques are composed of constant and magnetization-dependent
contributions, both of which vary strongly with annealing. Such variations
correlate with changes of the saturation magnetization and magnetic anisotropy
and are assigned to chemical and structural modifications of the layers. The
relative variation of the constant and anisotropic torque terms as a function
of annealing temperature is opposite for the field-like and antidamping
torques. Measurements of the switching probability using sub-{\mu}s current
pulses show that the critical current increases with the magnetic anisotropy of
the layers, whereas the switching efficiency, measured as the ratio of magnetic
anisotropy energy and pulse energy, decreases. The optimal annealing
temperature to achieve maximum magnetic anisotropy, saturation magnetization,
and switching efficiency is determined to be between 240 degrees and 270
degrees C