  This paper reports the measurement of J/psi meson production in proton-proton
(pp) and proton-lead (pPb) collisions at a center-of-mass energy per nucleon
pair of 5.02 TeV by the CMS experiment at the LHC. The data samples used in the
analysis correspond to integrated luminosities of 28 inverse picobarns and 35
inverse nanobarns for pp and pPb collisions, respectively. Prompt and nonprompt
J/psi mesons, the latter produced from the decay of B mesons, are measured in
their dimuon decay channels. Differential cross sections are measured in the
transverse momentum range of 2 < pt < 30 GeV/c, and center-of-mass rapidity
ranges of abs(y[CM]) < 2.4 (pp) and -2.87 < y[CM] < 1.93 (pPb). The nuclear
modification factor, R[pPb], is measured as functions of both pt and y[CM].
Small modifications of the J/psi cross sections are observed in pPb relative to
pp collisions. The ratio of J/psi production cross sections in p-going and
Pb-going directions, R[FB], studied as functions of pt and y[CM], shows a
significant decrease for increasing transverse energy deposited at large
pseudorapidities. These results, which cover a wide kinematic range, provide
new insight on the role of cold nuclear matter effects on prompt and nonprompt
J/psi production.
