The fragmentation of jets containing a J/psi meson is studied in root s = 5.02 TeV pp data using an integrated luminosity of L = 27.39 pb(-1). The fraction of the jet transverse momentum p(Tjet) carried by the J/psi is measured for prompt J/psi and J/psi coming from b hadron decays, named nonprompt.
Whereas the fragmentation function of nonprompt J/psi is well-modeled by simulations using a Monte Carlo generator, the prompt J/psi are found to be accompanied by a larger level of jet activity. The fraction of J/psi mesons that are produced inside a jet is also reported, and found to be larger in data than in simulation, for both prompt and nonprompt J/psi.