The transverse momentum spectra of $$\varLambda ^+_c$$ baryons and $$D^0$$ mesons produced in proton–lead (p–Pb) collisions at the center-of-mass energy per nucleon pair $$\sqrt{s_{NN}}=5\,{\text {TeV}}$$ (more exactly 5.02 TeV), $$D^0+{\bar{D}}^0$$ , $$D^++D^-$$ , $$D^+_s+D^-_s$$ , and $$D^{*+}+D^{*-}$$ (exactly $$D^*(2010)^++D^*(2010)^-$$ ) mesons produced in proton–proton (pp) collisions at the center-of-mass energy $$\sqrt{s}=5$$ and 13 TeV, $$\varLambda ^0_b$$ baryons and $${\bar{B}}^0$$ mesons produced in pp collisions at $$\sqrt{s}=7$$ and 8 TeV, as well as $$B^++B^-$$ mesons produced in pp collisions at $$\sqrt{s}=7$$ and 13 TeV measured by the LHCb collaboration in forward (backward) rapidity range are described by two models. The first model is based on the superposition of two Schwinger mechanisms, and the second one is based on the superposition of Tsallis statistics and inverse power law. The experimental data are fitted by the two two-component models. Then, the free parameters which depend on rapidity are extracted and analyzed.