  The production of the X(3872) is studied in pp collisions at sqrt(s) = 7 TeV,
using decays to J/psi pi pi, where the J/psi decays to two muons. The data were
recorded by the CMS experiment and correspond to an integrated luminosity of
4.8 inverse femtobarns. The measurements are performed in a kinematic range in
which the X(3872) candidates have a transverse momentum 10 < pt < 50 GeV and
rapidity abs(y) < 1.2. The ratio of the X(3872) and psi(2S) cross sections
times their branching fractions into J/psi pi pi is measured as a function of
pt. In addition, the fraction of X(3872) originating from B decays is
determined. From these measurements the prompt X(3872) differential cross
section times branching fraction as a function of pt is extracted. The pi pi
mass spectrum of the J/psi pi pi system in the X(3872) decays is also
investigated.
