  For years, the standard procedure to measure radial velocities (RVs) of
spectral observations consisted in cross-correlating the spectra with a binary
mask, that is, a simple stellar template that contains information on the
position and strength of stellar absorption lines. The cross-correlation
function (CCF) profiles also provide several indicators of stellar activity. We
present a methodology to first build weighted binary masks and, second, to
compute the CCF of spectral observations with these masks from which we derive
radial velocities and activity indicators. These methods are implemented in a
python code that is publicly available. To build the masks, we selected a large
number of sharp absorption lines based on the profile of the minima present in
high signal-to-noise ratio (S/N) spectrum templates built from observations of
reference stars. We computed the CCFs of observed spectra and derived RVs and
the following three standard activity indicators: full-width-at-half-maximum as
well as contrast and bisector inverse slope.We applied our methodology to
CARMENES high-resolution spectra and obtain RV and activity indicator time
series of more than 300 M dwarf stars observed for the main CARMENES survey.
Compared with the standard CARMENES template matching pipeline, in general we
obtain more precise RVs in the cases where the template used in the standard
pipeline did not have enough S/N. We also show the behaviour of the three
activity indicators for the active star YZ CMi and estimate the absolute RV of
the M dwarfs analysed using the CCF RVs.
