  Hessian PDF reweighting, or "profiling", has become a widely used way to
study the impact of a new data set on parton distribution functions (PDFs) with
Hessian error sets. The available implementations of this method have resorted
to a perfectly quadratic approximation of the initial $\chi^2$ function before
inclusion of the new data. We demonstrate how one can take into account the
first non-quadratic components of the original fit in the reweighting, provided
that the necessary information is available. We then apply this method to the
CMS measurement of dijet pseudorapidity spectra in proton-proton (pp) and
proton-lead (pPb) collisions at 5.02 TeV. The measured pp dijet spectra
disagree with next-to-leading order (NLO) theory calculations using the CT14
NLO PDFs, but upon reweighting the CT14 PDFs, these can be brought to a much
better agreement. We show that the needed proton-PDF modifications also have a
significant impact on the predictions for the pPb dijet distributions. Taking
the ratio of the individual spectra, the proton-PDF uncertainties effectively
cancel, giving a clean probe of the PDF nuclear modifications. We show that
these data can be used to further constrain the EPPS16 nuclear PDFs and
strongly support gluon nuclear shadowing at small $x$ and antishadowing at
around $x \approx 0.1$.
