D-meson production in p-Pb collisions at $\sqrt{s_{\rm NN}}=5.02$ TeV and in pp collisions at $\sqrt{s}=7$ TeV

The production cross sections of the prompt charmed mesons D$^0$, D$^+$, D$^{*+}$ and D$_s$ were measured at mid-rapidity in p-Pb collisions at a centre-of-mass energy per nucleon pair $\sqrt{s_{\rm NN}}=5.02$ TeV with the ALICE detector at the LHC. D mesons were reconstructed from their decays D$^0\rightarrow{\rm K}^-\pi^+$, D$^+\rightarrow{\rm K}^-\pi^+\pi^+$, D$^{*+}\rightarrow D^0\pi^+$, D$_s^+\rightarrow\phi\pi^+\rightarrow{\rm K}^-{\rm K}^+\pi^+$, and their charge conjugates. The $p_{\rm T}$-differential production cross sections were measured at mid-rapidity in the interval $1<p_{\rm T}<24$ GeV/$c$ for D$^0$, D$^+$ and D$^{*+}$ mesons and in $2<p_{\rm T}<12$ GeV/$c$ for D$_s$ mesons, using an analysis method based on the selection of decay topologies displaced from the interaction vertex. The production cross sections of the D$^0$, D$^+$ and D$^{*+}$ mesons were also measured in three $p_{\rm T}$ intervals as a function of the rapidity $y_{\rm cms}$ in the centre-of-mass system in $-1.26<y_{\rm cms}<0.34$. In addition, the prompt D$^0$ cross section was measured in pp collisions at $\sqrt{s}=7$ TeV and p-Pb collisions at $\sqrt{s_{\rm NN}}=5.02$ TeV down to $p_{\rm T}=0$ using an analysis technique that is based on the estimation and subtraction of the combinatorial background, without reconstruction of the D$^0$ decay vertex. The nuclear modification factor $R_{\rm pPb}(p_{\rm T})$, defined as the ratio of the $p_{\rm T}$-differential D-meson cross section in p-Pb collisions and that in pp collisions scaled by the mass number of the Pb nucleus, was calculated for the four D-meson species and found to be compatible with unity within experimental uncertainties. The results are compared to theoretical calculations that include cold-nuclear-matter effects and to transport model calculations incorporating the interactions of charm quarks with an expanding deconfined medium.


Introduction
The measurement of the production cross section of hadrons containing heavy quarks, charm and beauty, in proton-proton (pp) collisions is a sensitive test of perturbative Quantum Chromodynamics (pQCD) calculations. The inclusive transverse momentum (p T ) and rapidity (y) differential cross sections can be calculated in the collinear factorisation approach as a convolution of three terms: i) the parton distribution functions (PDF) of the incoming protons; ii) the partonic hard scattering cross section; and iii) the fragmentation function, which models the non-perturbative transition of a heavy quark to a given heavy-flavour hadron species [1]. At LHC energies, implementations of these calculations are available at next-to-leading order (NLO) accuracy in the general-mass variable-flavour-number scheme, GM-VFNS [2][3][4], and at fixed order with next-to-leading-log resummation, FONLL [5,6]. Calculations of heavy-flavour production cross sections in hadronic collisions also exist within the framework of k Tfactorisation, at leading order (LO) approximation, with unintegrated gluon distributions (UGDFs) to account for the transverse momenta of the initial partons [7][8][9]. At LHC energies, the measurement of charm production at low p T probes the parton distribution functions of the proton at small values of parton fractional momentum x and squared momentum transfer Q 2 . For illustration, in the simplified scenario of a 2 → 2 process at leading order, charm quarks (m c ≈ 1.5 GeV/c 2 ) with p T = 0.5 GeV/c and rapidity y = 0 probe the parton distribution functions at x ≈ 4 × 10 −4 and Q 2 ≈ 10 GeV 2 . Perturbative QCD calculations have substantial uncertainties at low p T , owing both to the large effect of the choice of the factorisation and renormalisation scales at low Q 2 and to the sizeable uncertainties on the gluon PDFs at small x [10]. Therefore, a precise measurement of the D-meson production cross section down to p T = 0 could provide an important constraint to pQCD calculations and to low-x gluon PDFs. This is also relevant for cosmic-ray and neutrino astrophysics, where high-energy neutrinos from the decay of charmed hadrons produced in particle showers in the atmosphere constitute an important background for neutrinos from astrophysical sources [11][12][13][14]. Furthermore, the measurement in pp collisions provides the reference for results in heavy-ion collisions, where heavy quarks are sensitive probes of the properties of the hot and dense medium with partonic degrees of freedom formed in the collision -the Quark-Gluon Plasma. In this context, the measurement of D-meson production down to p T = 0 in pp collisions also allows the precise determination of the total charm-production cross section, which is a crucial ingredient for the models of charmonium regeneration in the Quark-Gluon Plasma [15][16][17].
Measurements in proton-nucleus collisions allow an assessment of the various effects related to the presence of nuclei in the colliding system and denoted as cold-nuclear-matter (CNM) effects. In the initial state, the PDFs are modified in bound nucleons as compared to free nucleons, depending on x and Q 2 [18,19]. At LHC energies, the most relevant effect is shadowing: a reduction of the parton densities at low x, which becomes stronger when Q 2 decreases and the nucleus mass number A increases. This effect, induced by the high phase-space density of small-x partons, can be described, within the collinear factorisation framework, by means of phenomenological parametrisations of the modification of the PDFs (denoted as nPDFs) [20][21][22]. If the parton phase-space reaches saturation, PDF evolution equations are not applicable and the most appropriate theoretical description is the Colour Glass Condensate effective theory (CGC) [23][24][25][26][27]. The modification of the small-x parton dynamics can significantly reduce D-meson production at low p T . Furthermore, the multiple scattering of partons in the nucleus before and/or after the hard scattering can modify the kinematic distribution of the produced hadrons: partons can lose energy in the initial stages of the collision via initial-state radiation [28], or experience transverse momentum broadening due to multiple soft collisions before the heavy-quark pair is produced [29][30][31]. These initial-state effects are expected to have a small impact on D-meson production at high p T (p T > 3-4 GeV/c), but they can induce a significant modification of the D-meson cross section and momentum distribution at lower momenta. For this reason, a measurement of the D-meson production cross section and its nuclear modification factor R pPb (the ratio of the cross section in p-Pb collisions to that in pp interactions scaled by the mass number of the Pb nucleus) down to p T = 0 could provide important information. In addition to the initial-state effects discussed above, also final-state effects may be responsible for a modification of heavy-flavour hadron yields and momentum distributions. The presence of significant final-state effects in high-multiplicity p-Pb collisions is suggested by different observations, e.g. the presence of long-range correlations of charged hadrons [32][33][34][35][36], the evolution with multiplicity of the identified-hadron transverse-momentum distributions [37,38], and the suppression of the ψ(2S) production with respect to the J/ψ one [39][40][41]. The correlation measurements can be described by hydrodynamic calculations assuming the formation of a medium with some degree of collectivity (see e.g. [42,43]), even though alternative explanations exist, based on the CGC effective theory (see e.g. [44]) or on the anisotropic escape probability of partons from the collision zone [45]. If a collective expansion in the final state were present, the medium could also impart a flow to heavy-flavour hadrons. The possible effect on the D-meson transverse momentum distributions was first estimated in Ref. [46] by employing an approach based on a blast-wave function with parameters extracted from fits to the light-hadron spectra. More detailed calculations were subsequently carried out in the framework of transport models assuming that also in p-Pb collisions at LHC energies a hot and deconfined medium is formed, which modifies the propagation and hadronisation of heavy quarks [47,48]. The results of these calculations show a modification of the D-meson p T distributions at p T < 4 GeV/c by radial flow, possibly accompanied by a moderate (< 20-30%) suppression at higher p T , caused by in-medium energy loss.
In this article, we report on the measurements of production cross sections and nuclear modification factors of D mesons performed in minimum-bias p-Pb collisions at √ s NN = 5.02 TeV with the ALICE detector. In Ref. [49], the results of p T -differential cross sections and R pPb of D 0 , D + and D * + mesons for p T > 1 GeV/c, and of D + s mesons for p T > 2 GeV/c, at mid-rapidity were reported. We complement them in this article with measurements of production cross sections of D 0 , D + and D * + mesons as a function of rapidity in three p T intervals. For the D 0 meson, we also report an extension down to p T = 0 of the measurements of the p T -differential production cross sections in p-Pb collisions at √ s NN = 5.02 TeV and in pp collisions at √ s = 7 TeV published in Refs. [49] and [50], respectively. This allowed a determination of the p T -integrated D 0 cross section at mid-rapidity, which for pp collisions at √ s = 7 TeV is more precise than the previous result [50].
The paper is organized as follows. In Section 2, the ALICE apparatus, its performance and the data samples used for the measurement are briefly described. The analysis technique utilized for a first set of measurements of D 0 , D + , D * + and D + s production is presented in Section 3 together with the corrections and the systematic uncertainties. This analysis technique is based on the reconstruction of the D-meson displaced decay vertex and will be, for brevity, indicated as the analysis 'with decayvertex reconstruction' in this article. With this technique the p T -differential production cross section was measured down to p T = 1 GeV/c both in pp collisions at √ s = 7 TeV [50] and in p-Pb collisions at √ s NN = 5.02 TeV [49], as well as in pp and Pb-Pb collisions at √ s NN = 2.76 TeV [51,52]. In order to extend the measurement down to p T = 0, where the decay-vertex selection becomes very inefficient, a different analysis technique, which does not exploit the displaced decay-vertex topology, was developed for the D 0 -meson reconstruction in pp collisions at √ s = 7 TeV and in p-Pb collisions at √ s NN = 5.02 TeV. This analysis technique, denoted as 'without decay-vertex reconstruction' throughout this article, is described in Section 4. The results are presented and discussed in Section 5. The cross sections measured in pp collisions are compared to the results of pQCD calculations, while the measurements of the D-meson nuclear modification factor in p-Pb collisions are compared to models including cold and hot nuclear matter effects.

Apparatus and data samples
The ALICE apparatus [53,54] consists of a central barrel detector covering the pseudo-rapidity range |η| < 0.9, a forward muon spectrometer covering the pseudo-rapidity range −4.0 < η < −2.5 and a set of detectors at forward and backward rapidities used for triggering and event characterization. In the following, the detectors used for the D-meson analysis are described.
The D mesons are reconstructed in the mid-rapidity region using the tracking and particle identification capabilities of the central barrel detectors, which are located in a large solenoidal magnet that produces a magnetic field of 0.5 T along the beam direction (z axis). The innermost detector of the central barrel is the Inner Tracking System (ITS), which is comprised of six cylindrical layers of silicon detectors with radii between 3.9 and 43.0 cm. The two innermost layers, with average radii of 3.9 cm and 7.6 cm, are equipped with Silicon Pixel Detectors (SPD); the two intermediate layers, with average radii of 15.0 cm and 23.9 cm, are equipped with Silicon Drift Detectors (SDD) and the two outermost layers, with average radii of 38.0 cm and 43.0 cm, are equipped with double-sided Silicon Strip Detectors (SSD). The low material budget (on average 7.7% of a radiation length for tracks crossing the ITS at η = 0), the high spatial resolution, and the small distance of the innermost layer from the beam vacuum tube, allow the measurement of the track impact parameter in the transverse plane (d 0 ), i.e. the distance of closest approach of the track to the interaction vertex in the plane transverse to the beam direction, with a resolution better than 75 µm for p T > 1 GeV/c [55].
The ITS is surrounded by a large cylindrical Time Projection Chamber (TPC) [56] with an active radial range from about 85 to 250 cm and an overall length along the beam direction of 500 cm. It covers the full azimuth in the pseudo-rapidity range |η| < 0.9 and provides track reconstruction with up to 159 points along the trajectory of a charged particle as well as particle identification via the measurement of specific energy loss dE/dx. The charged particle identification capability of the TPC is supplemented by the Time-Of-Flight detector (TOF) [57], which is based on Multi-gap Resistive Plate Chambers (MRPCs) and is positioned at radial distances between 377 and 399 cm from the beam axis. The TOF detector measures the flight time of the particles from the interaction point. The start time of the event can be determined either from the information provided by the T0 detector [58] or via a combinatorial analysis of the particle arrival times at the TOF detector [57]. The T0 detector is composed of two arrays of Cherenkov counters located on either side of the interaction point at +350 cm and −70 cm from the nominal vertex position along the beam line. The T0 time resolution is about 40 ps for pp collisions. The overall TOF resolution, including the uncertainty on the start time of the event, and the tracking and momentum resolution contributions, is about 150 ps in pp collisions and 85 ps for high-multiplicity p-Pb collisions [54].
Triggering and event selection are based on the V0 and SPD detectors and on the Zero Degree Calorimeters (ZDC). The V0 detector consists of two scintillator arrays, denoted V0A and V0C, covering the pseudo-rapidity ranges 2.8 < η < 5.1 and −3.7 < η < −1.7, respectively [59]. The ZDCs are two sets of neutron and proton calorimeters positioned along the beam axis on both sides of the ALICE apparatus at about 110 m from the interaction point.
The data samples used for the analyses presented here include p-Pb collisions at √ s NN = 5.02 TeV and pp collisions at √ s = 7 TeV, collected in 2013 and 2010, respectively. During the p-Pb run, the beam energies were 4 TeV for protons and 1.58 TeV per nucleon for lead nuclei. With this beam configuration, the nucleon-nucleon centre-of-mass system moves in rapidity by ∆y cms = 0.465 in the direction of the proton beam. The D-meson analyses were performed in the laboratory-frame interval |y lab | < 0.5, which leads to a shifted centre-of-mass rapidity coverage of −0.96 < y cms < 0.04. In p-Pb collisions, minimumbias events were selected requiring at least one hit in both of the V0A and V0C scintillator arrays. In pp collisions, minimum-bias events were triggered by requiring at least one hit in either of the V0 counters or in the SPD. The minimum-bias (MB) trigger was estimated to be sensitive to about 96.4% and 87% of the p-Pb and pp inelastic cross sections, respectively [60,61]. Beam-gas and other machine-induced background collisions were removed via offline selections based on the timing information provided by the V0 and the ZDCs, and the correlation between the number of hits and track segments (tracklets) in the SPD detector. For the data samples considered in this paper, the probability of collision pile-up was below 4% per triggered pp event and below the per-cent level per triggered p-Pb event. An algorithm to detect multiple interaction vertices was used to reduce the pile-up contribution. An event was rejected if a second interaction vertex was found. The remaining undetected pile-up was negligible in the present analysis. Only events with a primary vertex reconstructed within ±10 cm from the centre of the detector along the beam line were considered. The number of events passing these selection criteria was about 10 8 for p-Pb collisions and about 3.1 · 10 8 for pp collisions. The corresponding integrated luminosities, L int = N MB /σ MB , where σ MB is the MB trigger cross section measured with van der Meer scans, are 48.6 µb −1 , with an uncertainty of 3.7%, for the p-Pb sample [60], and 5.0 nb −1 (±3.5%) for the pp sample [61].
3 Analysis with decay-vertex reconstruction in p-Pb collisions 3.1 D 0 , D + , D * + and D + s meson reconstruction and selection D 0 , D + , D * + and D + s mesons, and their charge conjugates, were reconstructed via their hadronic decay channels D 0 → K − π + (with a branching ratio, BR, of 3.88 ± 0.05%), D + → K − π + π + (BR = 9.13 ± 0.19%), D * + → D 0 π + (BR = 67.7 ± 0.5%) followed by D 0 → K − π + , and D + s → φ π + → K − K + π + (BR = 2.24 ± 0.10%) [62]. The D 0 , D + , and D + s mesons decay weakly with mean proper decay lengths (cτ) of about 123, 312 and 150 µm [62], respectively. The analysis strategy was based on the reconstruction of secondary vertices separated by a few hundred µm from the interaction point. The D * + meson decays strongly at the primary vertex, and the decay topology of the produced D 0 was reconstructed along with a soft pion originating from the primary vertex. The transverse momentum of the soft pion produced in the D * + decays typically ranges from 0.1 to 1.5 GeV/c, depending on the D * + p T . D 0 , D + and D + s candidates were formed using pairs and triplets of tracks with the correct chargesign combination. Tracks were selected by requiring |η| < 0.8, p T > 0.3 GeV/c, at least 70 (out of a maximum of 159) associated space points and a fit quality χ 2 /ndf < 2 in the TPC, and at least two (out of six) hits in the ITS, out of which at least one had to be in either of the two SPD layers. D * + candidates were formed by combining D 0 candidates with tracks with p T > 0.1 GeV/c and at least three hits in the ITS, out of which at least one had to be in the SPD. The track selection criteria reduce the D-meson acceptance, which drops steeply to zero for |y lab | > 0.5 at low p T and for |y lab | > 0.8 at p T > 5 GeV/c. A p T -dependent fiducial acceptance region was therefore defined as |y lab | < y fid (p T ), with y fid (p T ) increasing from 0.5 to 0.8 in the transverse momentum range 0 < p T < 5 GeV/c according to a second-order polynomial function, and y fid = 0.8 for p T > 5 GeV/c.
The selection of the D-meson decay topology was mainly based on the displacement of the tracks from the interaction vertex, the separation of the primary and secondary vertices, and the pointing of the reconstructed D-meson momentum to the primary vertex. A detailed description of the variables used to select the D-meson candidates can be found in Refs. [50,63]. The actual cut values were optimized for the signal and background levels of the p-Pb sample; they depend on the D-meson species and p T , but they are the same in all the considered rapidity intervals.
Further reduction of the combinatorial background was obtained by applying particle identification (PID) to the decay tracks. A 3σ compatibility cut was applied to the difference between the measured and expected signals for pions and kaons for the TPC dE/dx and the time-of-flight measured with the TOF detector. Tracks without hits in the TOF detector were identified using only the TPC information. PID selections were not applied to the pion track from the D * + strong decay. A tighter PID selection was applied to the D + s candidates: tracks without a TOF signal (mostly at low momentum) were identified using only the TPC information and requiring a 2σ compatibility with the expected dE/dx. This stricter PID selection strategy was needed in the D + s case due to the large background of track triplets and the short D + s lifetime, which limits the effectiveness of the geometrical selections on the displaced decayvertex topology. In addition, in the cases of D + → K − π + π + and D + s → K − K + π + decays, the charge signs of the decay particles were exploited in combination with the pion and kaon identification. Since in both these decay modes, the decay particle with the opposite charge sign with respect to the D meson has to be a kaon, a candidate was rejected if the opposite-sign track was not compatible with the kaon hypothesis. The applied PID strategy provides a reduction of the combinatorial background by a factor of about three at low p T while preserving an efficiency of 95% for the D 0 , D + and D * + signals and of 85% for the D + s signal. The fraction of signal candidates passing the PID selections is lower than that expected from a perfectly Gaussian response due to the non-Gaussian tail of the TOF signal and the non-negligible contamination originating from wrong associations between reconstructed tracks and TOF hits [64].
In the D + s case, in order to select D + s → φ π + decays with φ → K − K + , candidates were rejected if none of the two pairs of opposite-charge tracks (required to be compatible with the kaon hypothesis) had an invariant mass compatible with the PDG world average for the φ meson mass (1.0195 GeV/c 2 ) [62]. The difference between the reconstructed K + K − invariant mass and world-average φ mass was required to be less than 5-10 MeV/c 2 depending on the D + s p T interval. This selection preserves 70-85% of the D + s signal.
The D-meson raw yields were extracted from fits to the D 0 , D + and D + s candidate invariant-mass distributions and to the mass difference ∆M = M(Kππ) − M(Kπ) distributions for D * + candidates. In the fit function, the signal is modeled with a Gaussian and the background is described by an exponential term for D 0 , D + and D + s candidates and by a threshold function multiplied by an exponential (a √ ∆M − m π · e b(∆M−m π ) ) for the D * + case. For all four D-meson species, the mean values of the Gaussian functions in all transverse momentum and rapidity intervals were found to be compatible within uncertainties with the PDG world average values [62]. The Gaussian widths are consistent with the simulation results with deviations of at most 15%.
With the analysis based on the decay-vertex reconstruction, D-meson yields were extracted as a function of the transverse momentum in the range 1 < p T < 24 GeV/c for D 0 , D + and D * + (2 < p T < 12 GeV/c for D + s ) in a rapidity interval |y lab | < y fid (p T ). The yield of D 0 , D + and D * + mesons was measured also as a function of rapidity in three p T intervals: 2 < p T < 5 GeV/c, 5 < p T < 8 GeV/c and 8 < p T < 16 GeV/c. The rapidity interval of the measurement was |y lab | < 0.7 for the lowest p T interval and |y lab | < 0.8 for the other two p T intervals. Figure 1 shows the D 0 , D + and D + s candidate invariant-mass distributions and the D * + mass-difference distribution in four p T intervals in the fiducial acceptance region |y lab | < y fid (p T ). In addition, the invariant-mass (mass-difference) distributions of D 0 , D + and D * + candidates in two rapidity intervals, namely |y lab | < 0.1 and −0.8 < y lab < −0.4 (−0.7 < y lab < −0.4 for p T < 5 GeV/c), are shown in the upper and lower panels of Fig. 2 for three p T intervals.

Acceptance, efficiency and subtraction of beauty feed-down contribution
The D-meson raw yields extracted in each p T and y interval were corrected to obtain the prompt D-meson cross sections In the formula, N D+D,raw is the raw yield (sum of particles and antiparticles). It includes contributions from both prompt (i.e. produced in the charm quark fragmentation, either directly or through decays of excited open charm and charmonium states) and from feed-down D mesons (i.e. originating from beauty-hadron decays). The factor 1/2 accounts for the fact that the measured yields include particles and antiparticles while the cross sections are given for particles only; f prompt is the fraction of prompt D mesons in the raw yield; (Acc × ε) prompt is the product of acceptance and efficiency for prompt D mesons, where ε accounts for primary vertex reconstruction, D-meson decay track reconstruction and    ) candidates and their charge conjugates and of the mass difference for D * + (bottom right) candidates (and charge conjugates) in the rapidity interval |y lab | < y fid (p T ) in p-Pb collisions. The dashed lines represent the fit to the background while the solid lines represent the total fit function. One p T interval is shown for each species: 1 < p T < 2 GeV/c for D 0 , 5 < p T < 6 GeV/c for D + , 8 < p T < 12 GeV/c for D + s and 16 < p T < 24 GeV/c for D * + . selection, and for D-meson candidate selection with secondary vertex and PID cuts; ∆p T and ∆y are the widths of the transverse momentum and rapidity intervals; BR is the branching ratio of the considered decay channel, and L int is the integrated luminosity.
The acceptance and efficiency correction factors were obtained from Monte Carlo simulations including detailed descriptions of the geometry of the apparatus and of the detector response. Proton-proton collisions were generated by using the PYTHIA v6.4.21 event generator [65] with the Perugia-0 tune [66]. Events containing a cc or bb pair were selected and an underlying p-Pb collision generated with HIJING 1.36 [67] was added to each of them in order to obtain a better description of the multiplicity distributions observed in data. The generated D-meson p T distribution was weighted in order to match the shape predicted by FONLL calculations [5] at √ s = 5.02 TeV, based on the observation that FONLL provides a good description of the measured D-meson p T -differential cross sections at √ s = 2.76 and The dashed lines represent the fit to the background while the solid lines represent the total fit function. One p T interval is shown for each species: 2 < p T < 5 GeV/c for D 0 , 5 < p T < 8 GeV/c for D + and 8 < p T < 16 GeV/c for D * + . 7 TeV [6,50,51,68].
The efficiency depends on the multiplicity of charged particles produced in the collision, since the primary vertex resolution, thus the resolution for the topological selection variables, improves at high multiplicity. Therefore, the generated events were weighted on the basis of their charged-particle multiplicity in order to match the multiplicity distribution observed in data. The weight function was defined as the ratio between the distribution of the number of tracklets (segments of tracks connecting two hits in the SPD layers and aligned with the primary vertex) measured in data and that obtained in the Monte Carlo simulation. The efficiency varies from about 1% to 30% depending on D-meson p T and species. As an example, the product of acceptance and efficiency Acc × ε for prompt D 0 mesons is shown in Fig. 3 (left panel) as a function of p T in the rapidity range |y lab | < y fid (p T ). In the same figure, the efficiencies when the PID selection is not applied (about 5% higher as expected from the PID strategy utilized) and efficiencies for D 0 mesons from B decays are also shown (about a factor of two higher because the decay vertices of feed-down D mesons are more displaced from the primary vertex and they are more efficiently selected by the topological selections). The figures of Acc × ε as a function of p T for D + , D * + and D + s mesons can be found in Ref. [69]. The right-hand panel of Fig. 3 shows the prompt D 0 Acc × ε as a function of y lab for the three momentum intervals considered in this analysis. The small decrease at |y lab | > 0.4 is due to the detector acceptance. The correction factor f prompt was calculated with a FONLL-based method as where A is the mass number of the Pb nucleus. The procedure uses the B-meson production cross section in pp collisions at √ s = 5.02 TeV estimated with FONLL calculations, the B → D + X decay kinematics from the EvtGen package [70], the efficiencies for D mesons from beauty-hadron decays and a hypothesis on the nuclear modification factor R feed-down pPb of D mesons from B decays. On the basis of calculations including initial state effects through the EPS09 nuclear PDF parametrisations [20] or the Color Glass Condensate formalism [27], it was assumed that the R pPb of prompt and feed-down D mesons were equal and their ratio was varied in the range 0.9 < R feed-down pPb /R prompt pPb < 1.3 to evaluate the systematic uncertainties. The resulting f prompt values and their uncertainties are shown in the right-hand panels of Fig. 4 for D 0 , D + and D * + mesons in the |y lab | < y fid (p T ) interval. The central values of f prompt range between 0.81 and 0.96 depending on D-meson species and p T with no significant rapidity dependence.

Systematic uncertainties
The systematic uncertainties on the raw yield values were determined for each p T and y interval by repeating the fit in a different mass range, by varying the background fit function and by counting the candidates in the invariant-mass region of the signal peak after subtracting the background estimated from the side bands. The alternative background fit functions considered were a linear or a second order polynomial function for D 0 , D + and D + s and a · (∆M − m π ) b for the D * + . For the D 0 meson, the systematic uncertainty on the raw yield extraction also includes a contribution due to signal candidates reconstructed when swapping the masses of the final state kaon and pion (reflections). This contribution, which is strongly reduced by the PID selection, was estimated to be 3% (4%) at low (high) p T based on the invariant-mass distribution of these candidates in the simulation.
For D + s mesons, it was also verified that the contribution to the measured yield due to other decay channels giving rise to the same K − K + π + final state, in particular D + s → K * 0 K + and D + s → f 0 (980)π + , is completely negligible due to the much lower efficiency for the selection of these decays induced by the cut on the KK invariant mass in combination with the kaon and pion identification [63].
The systematic uncertainty on the tracking efficiency was estimated by comparing the probability to match the TPC tracks to the ITS hits in data and simulation, and by varying the track quality selection criteria. It amounts to 3% for each track, which results in a 6% uncertainty for the two-body decay of D 0 mesons and 9% for D + , D * + , and D + s mesons, which are reconstructed from three-body final states. The systematic uncertainty on the D-meson selection efficiency reflects residual discrepancies between data and simulations on the variables used in the displaced decay-vertex topology selection criteria. This effect was estimated by repeating the analysis with different values of the selection cuts, which significantly vary the signal-to-background ratio and efficiencies. The value of the uncertainty was estimated from the variation of the corrected yields. The systematic uncertainties are largest at low p T , where the efficiencies are lowest, and decrease with increasing p T , with no dependence on rapidity.
The systematic uncertainty associated with particle identification was estimated for D 0 , D + and D * + mesons by comparing the corrected yields with and without applying PID to select pions and kaons. The results for the two cases were found to be compatible; therefore no systematic uncertainty was assigned. In the D + s case, due to the tighter kaon and pion identification criteria, a PID systematic uncertainty of 10% in the interval 2 < p T < 4 GeV/c and 5% at p T > 4 GeV/c was estimated by varying the PID selection criteria with the procedure described in Ref. [63].
The effect on the efficiencies due to the shape of the simulated D-meson p T distribution was evaluated by considering different shapes (PYTHIA, FONLL) and was found to range from 0 to 4% depending on p T . No significant systematic effect is induced by the rapidity distribution of the generated D mesons because the efficiency does not have a pronounced rapidity dependence. The effect of possible differences between the charged-multiplicity distributions in data and simulations was found to be negligible.
The systematic uncertainty due to the subtraction of feed-down D mesons from B decays was estimated as in previous measurements [50] by varying the FONLL parameters (b-quark mass, factorisation and renormalisation scales) as prescribed in [6] and by varying the hypothesis on the R feed-down pPb as described in Section 3.2. An alternative method based on the ratio of FONLL predictions for D and B meson cross sections was also used [50].
The cross sections have a systematic uncertainty on the normalisation induced by the uncertainties on the integrated luminosity (3.7% [60]) and on the branching ratios of the considered D-meson decays.
A summary of the systematic uncertainties is reported in Tables 1 and 2. The systematic uncertainties on PID, tracking and selection efficiencies are mostly correlated among the different p T and rapidity intervals, while the raw-yield extraction uncertainty is mostly uncorrelated.

Prompt fraction with a data-driven approach
The prompt fractions in the raw yields of D 0 , D + and D * + mesons, f prompt , calculated with the FONLLbased method of Eq. (2) were cross-checked with a data-driven method that exploits the different shapes of the distributions of the transverse-plane impact parameter to the primary vertex (d 0 ) of prompt and feed-down D mesons. The prompt fraction was estimated via an unbinned likelihood fit of the d 0 distribution of D 0 (D + )-meson candidates with invariant mass |M − M D | < 1.5(2)σ (where σ is the width Feed-down from B Table 1: Relative systematic uncertainties on prompt D-meson production cross sections in p-Pb collisions in two p T intervals and the rapidity range |y| < y fid (p T ). Feed-down from B 3.7% Branching ratio 1.3% 2.1% 4.5% Table 2: Relative systematic uncertainties on prompt D-meson production cross sections in p-Pb collisions in the p T interval 5 < p T < 8 GeV/c and two rapidity intervals.
of the Gaussian function describing the D-meson signal in the invariant-mass fits) and of D * + -meson candidates with a mass difference |∆M − ∆M D * + | < 2.5σ , using the fit function In this function, S and B are the signal raw yield and background in the selected invariant-mass range; are functions describing the impact parameter distributions of prompt D mesons, feed-down D mesons, and background, respectively. The function F prompt is a detector resolution term modelled with a Gaussian and a symmetric exponential term, 1 2λ exp − |d 0 | λ , describing the tails of the impact-parameter distribution of prompt D mesons. F feed-down is the convolution of the detector resolution term with a symmetric double-exponential function (F feed-down true ) describing the intrinsic impact parameter distribution of secondary D mesons from B-meson decays, which is determined by the decay length and decay kinematics of B mesons. The parameters of the F prompt and F feed-down true functions were fixed to the values obtained by fitting the distributions from Monte Carlo simulations, except for the Gaussian width of the detector-resolution term, which was kept free in the data fit to compensate for a possible imperfect description of the impact-parameter resolution in the simulation. The widths recovered from the fit to the data were found to be in agreement with the simulation for p T > 3 GeV/c and slightly larger at lower p T . For D 0 and D * + mesons, the background fit function, F backgr , is the sum of a Gaussian and a symmetric exponential term centred at zero. For D + mesons, the background impact-parameter distribution has a double-peak structure with a depletion around zero induced by the selections applied. The shape was thus modelled with two Gaussians and two symmetric exponential terms. The parameters of F backgr were fixed by fitting the impact parameter distribution of background candidates in the side-bands of the signal peak in the invariant-mass distributions (mass difference for D * + mesons), namely in the interval 4σ shows examples of fits to the impact-parameter distributions of D 0 , D + and D * + mesons in the transverse-momentum intervals 3 < p T < 4 GeV/c, 5 < p T < 6 GeV/c and 6 < p T < 8 GeV/c, respectively.
The prompt fraction estimated with the data-driven approach has systematic uncertainties due to i) the shape assumed for prompt D-meson, feed-down D-meson, and background impact-parameter distributions, ii) the uncertainty on the signal and background yields, and iii) the consistency of the procedure, evaluated with a Monte Carlo closure test. Several checks were carried out to estimate the systematic uncertainty from the shape assumed for the impact-parameter distributions of the prompt and feed-down components. The fit was repeated fixing the Gaussian width in the F prompt functions to the values expected from the simulation and using template distributions from the simulation in place of the F feed-down and F prompt functional forms. Furthermore, the stability of the results against a possible imperfect description of the impact parameter resolution in the simulation was verified with a dedicated "fast" simulation in which the reconstructed track properties were modified to match the impact parameter resolution measured in data, following the procedure described in [71]. In addition, the fit procedure was also repeated after tuning the p T distributions of prompt and feed-down D mesons in the simulation to match those predicted by FONLL calculations. The uncertainty deriving from the parametrisation of F backgr was estimated by extracting the background impact-parameter distribution from different invariant-mass intervals. Overall, the systematic uncertainty arising from the shape assumed for prompt D-meson, feed-down D-meson, and background impact parameter distributions is typically smaller than 4%. The systematic effect due to the uncertainty on the signal and background yields was determined by repeating the fit with S and B varied according to the quadratic sum of the statistical and systematic uncertainties on the raw yield described in Section 3.3. The resulting deviation of the prompt D-meson raw yield, f prompt · S, was used to define the related systematic uncertainty, which ranges from 0 to 10% depending on the meson species and p T , with typical values around 2% at intermediate p T . It was also checked that the variation of the width of the invariant-mass (mass-difference for D * + mesons) interval around the D-meson peak in which f prompt is evaluated yields a sizable effect (3%) only for D * + mesons. Fi- nally, a Monte Carlo closure test was carried out to verify the consistency of the procedure with simulated data by comparing the f prompt values recovered with the impact-parameter fit and the input ones: the difference, typically about 1%, was considered as a systematic uncertainty. The total systematic uncertainty on f prompt with the data-driven approach is about 2% for D 0 mesons and 5% for D + and D * + mesons for p T < 12 GeV/c, and increases at higher p T up to 11% for D * + mesons in the interval 16 < p T < 24 GeV/c.
The prompt fraction of D 0 , D + and D * + mesons measured with this method is shown in Fig. 4 (right). For the interval 1 < p T < 2 GeV/c, given the poor precision of the impact-parameter fit, a lower limit could be estimated only for D 0 mesons at a 95% confidence level on the basis of statistical and systematic uncertainties. For the same reason, in the highest p T interval, 16 < p T < 24 GeV/c, the prompt fraction could be determined with the data-driven method only for D * + mesons. The prompt fraction measured with the impact-parameter fits is found to be compatible with the FONLL-based estimation within uncertainties. For D 0 mesons, the data-driven approach provides a more precise determination of the prompt fraction, while for D * + and D + mesons smaller uncertainties are obtained with the FONLLbased method. In addition, the data-driven results are not available at low p T (p T < 2 GeV/c) and, for D 0 and D + mesons, at high p T (p T > 16 GeV/c). Finally, it should also be considered that the systematic uncertainty on the FONLL-based f prompt calculation partially cancels in the computation of the nuclear modification factor, because it is correlated between the p-Pb cross-section and the pp reference. Note that for the data sample of pp collisions at √ s = 7 TeV used to compute the reference for the nuclear modification factor, f prompt could be measured with the data-driven method only for D 0 mesons with poor statistical precision in a limited p T interval (2 < p T < 12 GeV/c) [50]. For these reasons, the FONLLbased method was used in the calculation of the production cross sections and nuclear modification factors with the current data samples. The analysis presented here demonstrates that the data-driven method will become fully applicable on the upcoming larger data samples.
4 D 0 analysis in pp and p-Pb collisions without decay-vertex reconstruction 4

.1 Analysis method
In order to extend the measurement of D-meson production to p T < 1 GeV/c, a different analysis method, not based on geometrical selections on the displaced decay-vertex topology, was developed for the two-body decay D 0 → K − π + (and its charge conjugate). Indeed, at very low p T , the Dmeson decay topology can not be efficiently resolved because of the insufficient resolution of the track impact parameter and the small Lorentz boost. Furthermore, selection criteria based on secondary-vertex displacement tend to select with higher efficiency non-prompt D mesons from beauty-hadron decays, thus increasing the systematic uncertainty on the subtraction of the beauty feed-down contribution. Using an analysis technique mainly based on particle identification and on the estimation and subtraction of the combinatorial background, it was possible to measure the D 0 -meson yield down to p T = 0 in pp and p-Pb collisions.
The D 0 yield was extracted in eight p T intervals in the range 0 < p T < 12 GeV/c from an invariant-mass analysis of pairs of kaons and pions with opposite charge sign (UnLike Sign, ULS). D 0 candidates were defined from tracks with |η| < 0.8 and p T > 0.3 GeV/c (0.4 GeV/c in the p-Pb analysis). Tracks were selected with the same criteria described in Section 3.1 for the analysis with decay-vertex reconstruction, with the only difference that the request of at least one hit in either of the two layers of the SPD was not applied for pp collisions. Pion and kaon identification was based on the same strategy used in the analysis with decay-vertex reconstruction, i.e. based on compatibility selections at 3 σ level between the measured and expected dE/dx in the TPC and time-of-flight from the interaction vertex to the TOF detector. Tracks without TOF information were identified based only on the TPC dE/dx signal. The resulting D 0 and D 0 candidates were selected by applying a fiducial acceptance cut |y lab | < 0.8 on their rapidity. As compared to the analysis with decay-vertex reconstruction described in Section 3.1, a wider fiducial acceptance region was used in this analysis to preserve more candidates at low p T . The resulting invariant-mass distributions of Kπ pairs in the transverse momentum intervals 0 < p T < 1 GeV/c and 1 < p T < 2 GeV/c are shown in the left-hand panels of Figs. 5 and 6 for pp and p-Pb collisions, respectively.
Four different techniques were used to estimate the background distribution: (i) like-sign pairs; (ii) event  mixing; (iii) track rotation; and (iv) side-band fit. The like-sign (LS) method is based on Kπ combinations with same charge sign. In each p T interval, the ULS background invariant-mass distribution was estimated from the LS ones as N K + π − = 2 · √ N K + π + · N K − π − , where N K + π + and N K − π − are the number of like-sign Kπ pairs in a given invariant-mass interval. The event-mixing method estimates the uncorrelated background by pairing each kaon of a given event with all pions of other events having similar multiplicity and vertex position along the beam axis. In the track-rotation technique, for each D 0 (and D 0 ) candidate, up to nine combinatorial-background-like candidates were created by rotating the kaon track by different angles in the range between 5π 6 and 7π 6 radians in azimuth. In the case of the eventmixing and track-rotation methods, the background is normalized to match the yield of Kπ pairs at one edge of the invariant-mass range considered for the extraction of the D 0 raw yield.
The invariant-mass distributions of background candidates estimated with these three methods (i-iii) are shown as lines in the left panels of Figs. 5 and 6 for the pp and p-Pb cases, respectively. The background distribution is subtracted from the ULS Kπ invariant-mass distribution. Some examples of the resulting distributions, which contain the D 0 signal and the remaining background, are shown in Fig. 5 for the track-rotation (middle panels) and LS (right-hand panels) methods in pp interactions and in the middle panels of Fig. 6 for the event-mixing method in p-Pb collisions. The D 0 raw yield (sum of particle and antiparticle contributions) was extracted via a fit to the background-subtracted invariant-mass distribution. The fit function is composed of a Gaussian term to describe the signal and a second-order polynomial function to model the remaining background. Side-band fit bkg subtracted The fourth approach to the background treatment consists of a two-step fit to the ULS Kπ invariant-mass distribution. In the first step, the side bands of the D 0 peak (|M(Kπ) − M(D 0 )| > 2.5 σ , where σ is the Gaussian width of the D 0 peak from the simulation), were used to evaluate the background shape, which was modeled with a fourth order polynomial for p T < 2 GeV/c and with a second-order polynomial for p T > 2 GeV/c. In the second step, the invariant-mass distribution was fitted in the whole range, using a Gaussian function to model the signal and the polynomial function from the previous step to describe the background. In the right-hand panels of Fig. 6 the invariant-mass distribution of D 0 candidates after subtracting the background estimated from the side bands is shown, together with the Gaussian function that describes the signal peak.
In the fits for all four methods, the width of the Gaussian was fixed to the value from the simulation, while the centroid was left as a free parameter of the fit and was found to be compatible, within uncertainties, with the PDG world-average value of the D 0 mass [62].
The raw-yield values from the four methods for the background subtraction were found to be consistent within 10% in all p T intervals of the pp and p-Pb data samples. The arithmetic average of the four values was, therefore, computed and used in the calculation of the cross sections. The statistical uncertainties on these average raw-yield values were defined as the arithmetic average of the uncertainties from the four background-subtraction methods. In the case of the pp sample, the signal-to-background ratio ranges from 10 −3 (at low p T ) to 2 · 10 −2 (at high p T ), while the statistical significance is about 4 in the bin 0 < p T < 1 GeV/c and larger than 6 up to p T = 4 GeV/c. For the p-Pb sample, the signal-to-background ratio increases from 7 · 10 −4 to 4 · 10 −2 with increasing p T and the statistical significance is about 4 in the two lowest p T intervals and larger than 7 at higher p T . The statistical uncertainties on the raw yield are larger than those obtained in the analysis with decay-vertex reconstruction, except for the interval 1 < p T < 2 GeV/c in the case of pp collisions. In both pp and p-Pb collisions, this strategy allowed the measurement of the D 0 signal in the interval 0 < p T < 1 GeV/c, which was not accessible with the displaced-vertex selection technique.

Corrections
The product of the acceptance and the efficiency, Acc × ε, for D 0 -meson reconstruction and selection with the approach described in the previous subsection was determined using Monte Carlo simulations. Events containing prompt and feed-down D-meson signals were simulated using the PYTHIA v6.4.21 event generator [65] with the Perugia-0 tune [66]. In the case of p-Pb collisions, an underlying event generated with HIJING 1.36 [67] was added to obtain a realistic multiplicity distribution. The calculation of the D 0 efficiency was performed utilizing p T and event-multiplicity dependent weights, so as to match the D-meson p T spectra predicted by FONLL calculations and the measured charged-particle multiplicity distributions at mid-rapidity. The resulting Acc × ε of prompt D 0 mesons for the p-Pb sample is shown as a function of p T in Fig. 7 and compared to that for the analysis with decay-vertex reconstruction. The efficiency is higher by a factor of about 20 at low p T (3 at high p T ) in the case of the analysis that does not make use of selections on the displacement of the D 0 decay point. The p T dependence of the Acc × ε is less steep as compared to the analysis with decay-vertex reconstruction. Note that for the analysis without decay-vertex reconstruction the efficiency is almost independent of p T and the increase of the Acc × ε with increasing p T is mainly determined by the geometrical acceptance of the apparatus, i.e. by the fraction of D 0 mesons with |y lab | < 0.8 having the two decay tracks in |η| < 0.8. Unlike in the analysis with decay-vertex reconstruction, the efficiency is the same for prompt D 0 and for D 0 from beauty-hadron decays, as expected when no selection is made on the displacement of the D 0 decay vertex from the interaction point.
Since the acceptance and the efficiency are the same for prompt and feed-down D 0 mesons, the production cross section for 'inclusive' D 0 mesons (i.e. sum of the prompt and feed-down contributions) in the rapidity range |y lab | < 0.5 can be calculated as where N D 0 +D 0 ,raw (p T ) are the D 0 raw yields.
The production cross section of prompt D 0 mesons was obtained as The values of f prompt were estimated with the same pQCD-based method used for the analysis with decayvertex reconstruction as described in Section 3.2. The resulting f prompt values are similar for pp and p-Pb collisions: they decrease with increasing p T , from a value of about 0.96 at low p T (p T < 4 GeV/c) to about 0.89 in the interval 8 < p T < 12 GeV/c. The prompt contribution to the D 0 -meson raw yield is larger than in the analysis with decay-vertex reconstruction, since the feed-down component is not enhanced by the selection criteria.

Systematic uncertainties
The following sources of systematic uncertainty were considered for the prompt D 0 cross section: (i) systematic uncertainty due to the signal extraction from the invariant-mass distributions; (ii) systematic uncertainty affecting the Acc×ε correction factor; and (iii) systematic uncertainty due to the beauty feeddown subtraction. In addition, the cross sections are affected by (iv) a global normalisation uncertainty, due to the determination of the integrated luminosity (3.5% in pp and 3.7% in p-Pb) and the D 0 → K − π + branching ratio (1.3%).
The systematic uncertainty on the raw yield extraction was estimated in each p T interval and for each of the four background-subtraction techniques from the distribution of the results obtained by repeating the fit to the invariant-mass distributions varying i) the fit range and ii) the functions used to model the signal and background contributions. In particular, an exponential and a third-order polynomial function were used as alternative functional forms to describe the background in the LS, event-mixing and track-rotation analyses, while in the analysis with the side-band technique polynomials of second, third and fourth order were used. The signal line shape was varied by using Gaussian functions with the mean fixed to the PDG world-average D 0 mass and varying the widths by ±15% with respect to the value expected from Monte Carlo simulations, based on the deviations between the Gaussian width values observed in data and simulations for the analysis with decay-vertex reconstruction. The effect of the signal line shape was also tested by comparing the raw yields extracted through the fits with those obtained with a method based on the counting of the entries in the invariant-mass distributions after subtraction of the (residual) background estimated from a fit to the side bands of the D 0 peak. The r.m.s. of the distribution of the raw yield values obtained from the fit variations was assigned as the systematic uncertainty. A possible additional systematic effect could arise from signal candidates that pass the selection criteria also when the (K, π) mass hypothesis for the decay tracks is swapped. A large fraction of these 'reflections' is rejected by the applied PID selections. The effect of the remaining contribution was estimated by repeating the fits including an additional term to describe this 'reflected-signal' based on its invariant-mass shape in Monte Carlo simulations and was found to be negligible. The reflection contribution induces a smaller systematic effect than in the analysis with decay-vertex reconstruction due to the smaller signal-to-background ratio. In the case of background estimation with the eventmixing technique, the result was found to be stable against variations of the criteria on vertex position and event multiplicity used to define the samples of collisions to be mixed. The 3.7% Branching ratio 1.3% 1.3% Table 3: Relative systematic uncertainties on the p T -differential production cross section of prompt D 0 mesons in p-Pb and pp collisions for the analysis without decay-vertex reconstruction.
in all p T intervals, by the contribution of the signal line shape, which is common to all the backgroundsubtraction approaches. Therefore, when computing the average of LS, event-mixing, track-rotation and side-band results, it was propagated as a fully correlated uncertainty.
The uncertainty on the Acc × ε correction factor originates from imperfections in the detector description in the Monte Carlo simulations, which could affect the particle reconstruction, the D 0 -candidate selection efficiency, and the kaon and pion identification. In addition, the correction factor could also be sensitive to the generated shapes of the D 0 -meson p T distribution and of the multiplicity of particles produced in the collision. The systematic uncertainty on the tracking efficiency, which includes the effects of track reconstruction and selection, was estimated by comparing the efficiency of track prolongation from the TPC to the ITS between data and simulation, and by varying the track quality selections. It amounts to 4% per track in the pp sample and 3% per track in the p-Pb sample. The stability of the corrected yield was tested against variations of the single-track p T selection and K/π identification criteria used to form the D 0 candidates. No systematic effect was found to be induced by the single-track p T cut. In the case of the particle-identification criteria, different selections were tested, and the corrected yields were found to be compatible with those from the standard 3 σ cut. Nevertheless, an analysis without applying PID selections could not be performed due to the insufficient statistical significance of the signal. This test was carried out in the analysis with decay-vertex reconstruction, resulting for the pp sample in an estimated uncertainty of 5% for p T < 2 GeV/c and 3% at higher p T , while no systematic uncertainty due to the PID was observed in the p-Pb case. The same uncertainties were therefore assigned to the cross sections obtained with the analysis without decay-vertex reconstruction. The effect on the efficiency due to possible differences between the real and simulated D 0 momentum and charged-multiplicity distributions was studied by varying the input distributions (using the D-meson p T shapes predicted by FONLL and PYTHIA and the charged-multiplicity distributions from HIJING and from data) and was found to be negligible.
The systematic uncertainty due to the subtraction of the beauty-feed-down contribution was estimated following the same procedure of the analysis with decay-vertex reconstruction as described in Section 3.3. As compared to the analysis with decay-vertex reconstruction, the smaller contribution of D 0 from beauty-hadron decays, due to the absence of a selection on the decay-vertex topology, results in a smaller systematic uncertainty on the feed-down subtraction.
The assigned uncertainties, estimated with the methods described above, are reported in Table 3 for four p T intervals and for pp and p-Pb collisions.   Figure 8 shows the p T -differential cross section for D 0 mesons with |y| < 0.5 in pp collisions at √ s = 7 TeV. In the left-hand panel of the figure, the cross section obtained from the analysis without decay-vertex reconstruction is shown for inclusive and for prompt D 0 mesons, i.e. before and after the subtraction of the cross section of D 0 mesons from beauty-hadron decays. The subtraction of the feed-down contribution increases the systematic uncertainties at low p T , where the uncertainty of the correction is largest, and at high p T , because the correction increases ( f prompt decreases) with p T . In the right-hand panel of Fig. 8 the cross section for prompt D 0 mesons is compared with that obtained with decay-vertex reconstruction as published in Ref. [50]. The results are consistent for most of the p T intervals within one σ of the statistical uncertainties, which are independent for the two measurements because of their very different signal-to-background ratios and efficiencies. Figure 9 compiles the most precise ALICE measurement of the p T -differential cross section of prompt D 0 mesons, which uses in each p T interval the data point with the smallest total uncertainty, namely the results from the analysis without decay-vertex reconstruction in 0 < p T < 2 GeV/c and those from the analysis with decay-vertex reconstruction in 2 < p T < 16 GeV/c. The cross section is compared with results from perturbative QCD calculations, two of which are based on collinear factorisation (FONLL [5, 6] 1 and GM-VFNS [2][3][4]) and one is a leading order (LO) calculation based on k Tfactorisation [8]. The ratios of the data to the three calculated cross sections are shown in the bottom-right panel of Fig. 9. The ratio to FONLL is approximately constant at 1.5, but consistent with unity within the theoretical and experimental uncertainties. A ratio data/FONLL larger than unity was observed also at other values of √ s, from 0.2 to 13 TeV [51,68,[73][74][75]. The ratio to GM-VFNS is approximately constant at 0.75. The ratio to the LO k T -factorisation calculation is consistent with unity for p T < 2 GeV/c and  Figure 9: p T -differential production cross section of prompt D 0 mesons with |y| < 0.5 in the interval 0 < p T < 16 GeV/c, in pp collisions at √ s = 7 TeV. The data points in 0 < p T < 2 GeV/c are obtained from the analysis described in this article, while the data points in 2 < p T < 16 GeV/c are taken from Ref [50]. The cross section is compared to three pQCD calculations: FONLL [6]  p T > 5 GeV/c, while it is larger than unity for 2 < p T < 5 GeV/c.
The average transverse momentum p T of prompt D 0 mesons was measured by fitting the cross section reported in Fig. 9 with a power-law function: where C, p 0 and n are the free parameters. The result is: p T prompt D 0 pp, 7 TeV = 2.18 ± 0.08 (stat.) ± 0.07 (syst.) GeV/c .
The systematic uncertainty has three contributions. The first accounts for the uncorrelated systematic uncertainties on the p T -differential cross section and it was obtained by repeating the fit using the uncorrelated systematic uncertainties as errors on the data points. The second contribution accounts for the uncertainties that are correlated among the p T intervals and it was computed from the variation of p T observed when repeating the fit by moving all data points to the upper (lower) edge of the correlated uncertainties. The third source of systematic uncertainty is due to the fit function and it was estimated using different functions and using an alternative method, which is not based on fits to the spectrum, but on direct calculations of p T from the data points with different assignments of the average transverse momentum of D 0 mesons in the intervals of the p T -differential measurement.
The production cross section of prompt D 0 mesons per unit of rapidity at mid-rapidity was obtained by integrating the p T -differential cross section shown in Fig. 9. The systematic uncertainty was defined by propagating the yield extraction uncertainties as uncorrelated among p T intervals (quadratic sum) and all the other uncertainties as correlated (linear sum). The resulting cross section is: This measurement is consistent within statistical uncertainties with the value obtained in the analysis with decay-vertex reconstruction [50] (516 ± 41 (stat.) +138 −179 (syst.) ± 18 (lumi.) ± 7 (BR) µb), but it has a total systematic uncertainty reduced by a factor of about two on the low side and almost three on the high side, where the earlier measurement was affected by large uncertainties on the feed-down correction and on the extrapolation to p T = 0 (a factor 1.25 +0. 29 −0.09 [50]), respectively. For completeness, we also report the inclusive cross section of D 0 mesons, without feed-down subtraction, as obtained by integrating the inclusive cross section shown in Fig. 8 (left): The central values of the prompt and inclusive dσ /dy are numerically very similar. However, this should not lead to a conclusion that the prompt fraction is essentially unity, because the two cross section determinations are to a large extent independent. Indeed, the contribution of D 0 mesons with p T > 2 GeV/c is taken from the results obtained with different analysis techniques in the two cases: the analysis 'with decay-vertex reconstruction' is used for the prompt cross section and the analysis 'without decay-vertex reconstruction' for the inclusive one. The uncertainties on the results from these two analyses are to a large extent independent, having in common only the 8.5% contribution due to the tracking and PID efficiency correction, and the contributions from the luminosity and the BR.
The cc production cross section per unit of rapidity at mid-rapidity (|y| < 0.5) was calculated by dividing the prompt D 0 -meson cross section by the fraction of charm quarks hadronising into D 0 mesons (fragmentation fraction, FF), 0.542 ± 0.024 [72] and correcting for the different shapes of the distributions of y D 0 and y cc (cc pair rapidity). This correction is composed of two factors. The first factor accounts for the different rapidity shapes of D 0 mesons and single charm quarks and it was evaluated to be unity based on FONLL calculations. A 3% uncertainty on this factor was evaluated from the difference between values from FONLL and the PYTHIA 6 [65] event generator. The second factor is the ratio dσ /dy cc dσ /dy c , which was estimated from NLO pQCD calculations (MNR [76] and POWHEG [77]) as σ cc |y|<0.5 /σ c |y|<0.5 = 1.034. A 1.5% uncertainty on this factor was estimated from the difference among the values obtained varying the factorisation and renormalisation scales in the MNR calculation and interfacing, via the POWHEG-BOX package [78], the NLO calculations with a parton shower simulation with PYTHIA. The resulting cc cross section per unit of rapidity at mid-rapidity is: dσ cc pp, 7 TeV /dy = 988 ± 81 (stat.) +108 −195 (syst.) ± 35 (lumi.) ± 44 (FF) ± 33 (rap. shape) µb .
The total production cross section of prompt D 0 mesons (average of particles and antiparticles) was calculated by extrapolating to full phase space the cross section measured at mid-rapidity. The extrapolation factor was defined as the ratio of the D 0 production cross sections in full rapidity and in |y| < 0.5 calculated with the FONLL central parameters: 8.57 +2.52 −0.38 . The systematic uncertainty on the extrapolation factor was estimated by considering the contributions due to i) the uncertainties on the CTEQ6.6 PDFs [79] and ii) the variation of the charm-quark mass and the renormalisation and factorisation scales in the FONLL calculation, as proposed in [6]. The resulting cross section is: The total charm production cross section was calculated by dividing the total prompt D 0 -meson production cross section by the fragmentation fraction reported above. The resulting cc production cross section in pp collisions at √ s = 7 TeV is: which has smaller systematic and extrapolation uncertainties as compared to the value of Ref. [51]. We verified that the precision of the cc production cross-section determination does not improve if the results calculated from D + and D * + mesons, which have significantly larger extrapolation uncertainties as compared to the D 0 one, are included via a weighted average procedure, as done in Ref. [51]. In Fig. 10, the total charm production cross section is shown as a function of the centre-of-mass energy of the collision together with other measurements [51,68,73,[80][81][82]. The LHCb value was computed by multiplying the p T -integrated charm cross section at forward rapidity [68] by the rapidity extrapolation factor given in Ref. [83]. The proton-nucleus (pA) measurements were scaled by 1/A, assuming no nuclear effects. The curves show the results of next-to-leading-order pQCD calculations (MNR [76]) together with their uncertainties obtained varying the calculation parameters as suggested in [6]. The dependence of the charm production cross section on the collision energy is described by the pQCD calculation, with all the data points lying close to the upper edge of the uncertainty band.

D-meson production cross section in p-Pb collisions at
√ s NN = 5.02 TeV Figure 11 shows the p T -differential production cross section for D 0 mesons with −0.96 < y cms < 0.04 in p-Pb collisions at √ s NN = 5.02 TeV. In the left-hand panel of the figure, the cross section obtained from the analysis without decay-vertex reconstruction is shown for inclusive and for prompt D 0 mesons, while in the right-hand panel the cross section for prompt D 0 mesons is compared with that obtained with decay-vertex reconstruction [49]. The results are consistent within one σ of the statistical uncertainties.
As for pp collisions, the most precise measurement of the prompt D 0 production cross section is obtained using the results of the analysis without decay-vertex reconstruction in the interval 0 < p T < 2 GeV/c and those of the analysis with decay-vertex reconstruction for p T > 2 GeV/c [49] The cc production cross section in −0.96 < y cms < 0.04 is: dσ cc p−Pb, 5.02 TeV /dy = 151 ± 14 (stat.) +13 −26 (syst.) ± 6 (lumi.) ± 7 (FF) ± 5 (rap. shape) mb .
The average transverse momentum p T of prompt D 0 mesons, obtained with the same procedure described above for pp collisions, is: TeV, compared with the respective pp reference cross sections scaled by the Pb mass number A = 208. For the D 0 meson, the results in 0 < p T < 2 GeV/c are obtained from the analysis without decay-vertex reconstruction, while those in 2 < p T < 24 GeV/c are taken from the analysis with decay-vertex reconstruction. The results from the other three D-meson species are the same as in Ref. [49]. The systematic uncertainty of the feed-down correction is displayed separately.
The p T -differential cross sections for the other three D-meson species (D + , D * + and D + s ) [49] 2 are shown in the other panels of Fig. 12.
In the same figure, the cross sections in p-Pb collisions are compared with the corresponding pp reference cross sections, scaled by the Pb mass number A = 208. The pp reference cross sections at √ s = 5.02 TeV were obtained by applying a p T -and D-species-dependent scaling factor to the cross sections measured at √ s = 7 TeV, namely the cross section shown in Fig. 9 for D 0 mesons and those published in Refs. [50,63] 2 The cross section for D + s mesons in p-Pb collisions and the corresponding pp reference were updated with respect to Ref. [49] to account for the change of the world-average branching ratio of D + s → φ π + → K − K + π + from 2.28% [84] to 2.24% [62]. for the other species. The scaling factor was defined as the ratio of the cross sections at 5.02 TeV (in −0.96 < y cms < 0.04) and 7 TeV (in |y cms | < 0.5) from the FONLL calculation [6], as described in Ref. [85]. Its systematic uncertainty was defined by consistently varying the charm-quark mass and the values of the factorisation and renormalisation scales at the two energies [85]. The uncertainty decreases with increasing p T , with values of, for example, +15 − 5 % for 0 < p T < 1 GeV/c, +6 −3 % for 3 < p T < 4 GeV/c and ±2% for p T > 12 GeV/c. For D 0 mesons, the cross section was measured in pp collisions at √ s = 7 TeV up to only p T = 16 GeV/c; the pp reference for the interval 16 < p T < 24 GeV/c was defined using the FONLL cross section multiplied by the ratio of data/FONLL in the interval 5 < p T < 16 GeV/c, which has a value of about 1.4 (see Ref. [52] for more details).
The ratios of the p T -differential cross sections of the various D-meson species were calculated taking into account the correlation of the systematic uncertainties induced by the corrections for tracking efficiency and feed-down from beauty decays. In Fig. 13 these ratios are shown together with those for pp collisions at √ s = 7 TeV (from Ref. [63] 3 ): within uncertainties, the relative abundances of the four species are not modified in p-Pb with respect to pp collisions. Figure 14 shows the cross sections as a function of rapidity for prompt D 0 , D + and D * + mesons in p-Pb collisions at √ s NN = 5.02 TeV in three p T intervals: 2-5 GeV/c (for −1.16 < y cms < 0.24), 5-8 GeV/c and 8-16 GeV/c (for −1.26 < y cms < 0.34). The cross sections do not vary with y cms , within uncertainties, for all three p T intervals. The D 0 -meson data are compared with a cross section obtained by multiplying the FONLL [6] result by the mass number A and the nuclear modification factor R pPb   Figure 14: Production cross sections as a function of rapidity (y cms ) for prompt D 0 , D + and D * + mesons in p-Pb collisions at √ s NN = 5.02 TeV, for three p T intervals. The D 0 -meson data are compared with a cross section obtained by multiplying the FONLL [6] calculation by the mass number A and the nuclear modification factor R pA estimated as a function of y with the MNR NLO pQCD calculation [76], with CTEQ6M PDFs [79] and the EPS09NLO nuclear PDF parametrisation [20]. estimated as a function of y with the MNR NLO pQCD calculation [76] with CTEQ6M PDFs [79] and the EPS09NLO nuclear PDF parametrisation [20]. The uncertainty of the calculation is the quadratic sum of the FONLL uncertainty on the cross section and the EPS09NLO uncertainty on R pPb . The calculation describes the measurements within uncertainties. As already observed for pp collisions at √ s = 2.76 and 7 TeV [50,51], the data points lie close to the upper limit of the FONLL uncertainty band. The absence of a visible rapidity dependence in −1.26 < y cms < 0.34 is common to the data and the calculation. For the latter, nuclear shadowing induces a cross section variation of only about 2-3% within this interval. scaled by the lead mass number A = 208: The systematic uncertainties of the p-Pb and pp measurements were considered as independent and propagated quadratically, except for the uncertainty on the feed-down correction, which was recalculated for the ratio of cross sections by consistently varying the FONLL calculation parameters in the numerator and in the denominator. Figure 15 shows the nuclear modification factors R pPb of prompt D 0 , D + and D * + mesons in the left-hand panel and their average, along with the R pPb of D + s mesons, in the right-hand panel. All the results are obtained with the analysis based on decay-vertex reconstruction [49]. The average of the nuclear modification factors of the three non-strange D-meson species was calculated using the inverse of the relative statistical uncertainties as weights. The systematic error of the average was calculated by propagating the uncertainties through the weighted average, where the contributions from tracking efficiency, beauty feed-down correction, and scaling of the pp reference were taken as fully correlated among the three species. R pPb is compatible with unity over the full p T interval covered by the measurements and it is also compatible for non-strange and strange D mesons.
The nuclear modification factor of prompt D 0 mesons in the interval 0 < p T < 12 GeV/c was also computed using the cross sections in pp and p-Pb collisions resulting from the analysis without decayvertex reconstruction. In Fig. 16 it is compared with the result obtained from the analysis with decayvertex reconstruction, which covers the interval 1 < p T < 24 GeV/c [49]. The two measurements are consistent within statistical uncertainties. In the previous subsections it was shown that the analysis without decay-vertex reconstruction provides the best determination of the D 0 cross section in the interval 1 < p T < 2 GeV/c, where the analysis with decay-vertex reconstruction is affected by a large uncertainty on the feed-down correction. This is not the case for the R pPb measurement, because the feed-down uncertainty cancels to a large extent for this observable. D mesons, as obtained by using the D 0 measurement without decay-vertex reconstruction for the interval 0 < p T < 1 GeV/c and the average of the measurements for D 0 , D + and D * + mesons in the interval 1 < p T < 24 GeV/c [49]. The data are compared with theoretical results. In the left-hand panel of this figure, four models including only CNM effects are displayed: a calculation based on the Color Glass Condensate formalism [27], a pQCD calculation based on the MNR formalism [76] with CTEQ6M PDFs [79] and EPS09NLO nuclear modification [20], a LO pQCD calculation with intrinsic k T broadening, nuclear shadowing and energy loss of the charm quarks in cold nuclear matter [86], and a higher-twist calculation based on incoherent multiple scatterings (Kang et al.) [87]. The three former calculations describe the data within uncertainties in the entire p T range, while the last one (Kang et al.), which has a different trend with respect to the others, is disfavoured by the data at p T < 3-4 GeV/c. CNM effects are expected to be largest for small p T , where, in addition, the predictions of the different theoretical approaches differ. The uncertainty of the present measurement for the lowest p T interval is about 50% and does not allow us to draw a conclusion. However, the analysis technique without decayvertex reconstruction, applied on future larger data samples, should provide access to the physics-rich range down to p T = 0. In the right-hand panel of Fig. 17, the data are compared to the results of two transport model calculations, Duke [47] and POWLANG [48], both of them assuming that a Quark-Gluon Plasma is formed in p-Pb collisions. Both models are based on the Langevin approach for the transport of heavy quarks through an expanding deconfined medium described by relativistic viscous hydrodynamics. The Duke model includes both collisional and radiative energy loss. The POWLANG model considers only collisional processes with two choices for the transport coefficients, based on hardthermal-loop (HTL) and lattice-QCD (lQCD) calculations, respectively. In both approaches the D-meson nuclear modification factor shows a structure with a maximum at p T ≈ 2.5 GeV/c, possibly followed by a moderate (< 20-30%) suppression at higher p T , resulting from the interplay of CNM effects and interactions of charm quarks with the radially expanding medium. The precision of the measured Dmeson R pPb does not allow us to discriminate between scenarios with only CNM effects or hot medium effects in addition, even though the data seem to disfavour a suppression larger than 15-20% in the interval 5 < p T < 10 GeV/c.
The p T -integrated nuclear modification factor of prompt D 0 mesons in −0.96 < y cms < 0.04 was computed using the dσ prompt D 0 /dy values for pp and p-Pb collisions reported in Eqs. (8) and (13) and using  Figure 17: Nuclear modification factor R pPb of prompt D mesons in p-Pb collisions at √ s NN = 5.02 TeV: average R pPb of D 0 , D + and D * + mesons in the interval 1 < p T < 24 GeV/c [49], shown together with the D 0 R pPb in 0 < p T < 1 GeV/c. In the left-hand panel, the data are compared with results of theoretical calculations including only CNM effects: CGC [27], NLO pQCD [76] with EPS09 nPDFs [20], a LO pQCD calculation with CNM effects (Vitev et al.) [86] and a calculation based on incoherent multiple scatterings (Kang et al.) [87]. In the righthand panel, the results of the Duke [47] and POWLANG [48] transport models are compared to the measured D-meson R pPb . FONLL to scale the pp cross section to the centre-of-mass energy and rapidity interval of the p-Pb measurement. The result is: R prompt D 0 pPb (p T > 0, −0.96 < y cms < 0.04) = 0.89 ± 0.11 (stat.) +0. 13 −0.18 (syst.) .

Summary
We have presented a comprehensive set of results on charm production in p-Pb and pp collisions, complementing the measurements reported in Refs. [49] and [50]. The production cross sections of the prompt charmed mesons D 0 , D + , D * + and D + s in p-Pb collisions at a centre-of-mass energy per nucleon pair √ s NN = 5.02 TeV were measured as a function of p T in the rapidity interval −0.96 < y cms < 0.04. The p T -differential production cross sections, obtained with an analysis method based on the selection of decay topologies displaced from the interaction vertex, were reported in the transverse momentum range 1 < p T < 24 GeV/c for D 0 , D + and D * + mesons and in the range 2 < p T < 12 GeV/c for D + s mesons. The ratios of the cross sections of the four D-meson species were determined as a function of p T and were found to be compatible with those measured in pp collisions at √ s = 7 TeV in the rapidity interval |y cms | < 0.5.
The production cross sections of the non-strange D mesons, D 0 , D + and D * + , were also measured in p-Pb collisions as a function of rapidity in three p T intervals. No significant rapidity dependence was observed in the range −1.26 < y cms < 0.34.
In addition, employing an analysis technique that does not use the reconstruction of the D 0 decay vertex, the prompt D 0 production cross section was measured down to p T = 0 in pp collisions at √ s = 7 TeV and p-Pb collisions at √ s NN = 5.02 TeV. The results of the two different analysis techniques, with and without decay-vertex reconstruction, were found to be compatible in the common p T range. The analysis without decay-vertex reconstruction provides a more precise measurement of the D 0 cross section for p T < 2 GeV/c. This allowed a determination of the total (p T integrated) D 0 production cross section, dσ /dy, at mid-rapidity, which is not affected by uncertainties due to the extrapolation to p T = 0. The resulting cross section in pp collisions at √ s = 7 TeV is dσ prompt D 0 pp, 7 TeV /dy = 518 ± 43 (stat.) + 57 −102 (syst.) ± 18 (lumi.) ± 7 (BR) µb .
The total systematic uncertainty is smaller by a factor of about two on the low side and almost three on the high side as compared to our previous result [50]. The resulting total cc production cross section in pp collisions at √ s = 7 TeV is: The p T -differential nuclear modification factor R pPb was found to be compatible with unity in the transversemomentum interval 0 < p T < 24 GeV/c. This result provides clear experimental evidence [49,52] that the modification of the D-meson transverse momentum distributions observed in Pb-Pb collisions as compared to pp interactions is due to final-state effects induced by the interactions of the charm quarks with the hot and dense partonic medium created in ultra-relativistic heavy-ion collisions. The uncertainties of the present measurement are about 20-30% for p T > 1 GeV/c, considering the average of D 0 , D + and D * + R pPb , and about 50% in the interval 0 < p T < 1 GeV/c, where the D 0 could be reconstructed with the analysis technique without decay-vertex reconstruction. The results are described within uncertainties by theoretical calculations that include initial-state effects, which are expected to be small for p T > 2 GeV/c but significant for p T close to 0, where the predictions of the different theoretical approaches differ. The observed R pPb is also described by transport calculations assuming the formation of a deconfined medium in p-Pb collisions, even though the data seem to disfavour a suppression larger than 15-20% in the interval 5 < p T < 10 GeV/c. The current precision of the measurement does not allow us to draw conclusions on the role of the different CNM effects and on the possible presence of additional hot-medium effects. However, the analysis technique without decay-vertex reconstruction, applied on future larger data samples, should provide access to the physics-rich range down to p T = 0.