  Central exclusive and semiexclusive production of $\pi^+\pi^-$ pairs is
measured with the CMS detector in proton-proton collisions at the LHC at
center-of-mass energies of 5.02 and 13 TeV. The theoretical description of
these nonperturbative processes, which have not yet been measured in detail at
the LHC, poses a significant challenge to models. The two pions are measured
and identified in the CMS silicon tracker based on specific energy loss,
whereas the absence of other particles is ensured by calorimeter information.
The total and differential cross sections of exclusive and semiexclusive
central $\pi^+\pi^-$ production are measured as functions of invariant mass,
transverse momentum, and rapidity of the $\pi^+\pi^-$ system in the fiducial
region defined as transverse momentum $p_\mathrm{T}(\pi)$ $>$ 0.2 GeV and
pseudorapidity $|\eta(\pi)|$ $<$ 2.4. The production cross sections for the
four resonant channels f$_0(500)$, $\rho^0(770)$, f$_0(980)$, and f$_2(1270)$
are extracted using a simple model. These results represent the first
measurement of this process at the LHC collision energies of 5.02 and 13 TeV.
