Measurements of the total and differential cross sections with respect to transverse momentum and rapidity for B+ mesons produced in pp collisions at sqrt(s) = 7 TeV are presented. The data correspond to an integrated luminosity of 5.8 inverse picobarns collected by the CMS experiment operating at the LHC. The exclusive decay B+ to J/psi K+, with the J/psi decaying to an oppositely charged muon pair, is used to detect B+ mesons and to measure the production cross section as a function of the transverse momentum and rapidity of the B. The total cross section for p_t(B) > 5 GeV and |y(B)| < 2.4 is measured to be 28.1 +/- 2.4 +/- 2.0 +/- 3.1 microbarns, where the first uncertainty is statistical, the second is systematic, and the last is from the luminosity measurement.
The differential cross sections for inclusive production of B+ hadrons are measured as a function of the B+ transverse momentum pT[B] and rapidity y[B] in pp collisions at a centre-of-mass energy of 13 TeV, using data collected by the CMS experiment that correspond to an integrated luminosity of 49.4 inverse picobarns. The measurement uses the exclusive decay channel B+ to J/psi K+, with J/psi mesons that decay to a pair of muons. The results show a reasonable agreement with theoretical calculations within the uncertainties.