Commissioning of the CMS experiment and the cosmic run at four Tesla