Fitting B/C cosmic-ray data in the AMS-02 era: A cookbook

AMS-02 on the International Space Station has been releasing data of unprecedented accuracy. This poses new challenges for their interpretation. We refine the methodology to get a statistically sound determination of the cosmic-ray propagation parameters. We inspect the numerical precision of the model calculation, nuclear cross-section uncertainties, and energy correlations in data systematic errors. We used the 1D diffusion model in USINE. Our $\chi^2$ analysis includes a covariance matrix of errors for AMS-02 systematics and nuisance parameters to account for cross-section uncertainties. Mock data were used to validate some of our choices. We show that any mis-modelling of nuclear cross-section values or the energy correlation length of the covariance matrix of errors biases the analysis. It also makes good models ($\chi^2_{\rm min}/{\rm dof}\approx1$) appear as excluded ($\chi^2_{\rm min}/{\rm dof}\gg1$). We provide a framework to mitigate these effects (AMS-02 data are interpreted in a companion paper). New production cross-section data and the publication by the AMS-02 collaboration of a covariance matrix of errors for each data set would be an important step towards an unbiased view of cosmic-ray propagation in the Galaxy.


Introduction
Particle physics detectors in space have opened a new era for the study of Galactic cosmic rays (GCRs). The Alpha Magnetic Spectrometer (AMS-02) instrument on the International Space Station (ISS) provides the best data to date for leptons and nuclei (Aguilar et al. 2013(Aguilar et al. , 2014a(Aguilar et al. ,b, 2015a(Aguilar et al. ,b, 2016(Aguilar et al. , 2018b, with an uncertainty of a few percent on a large energy range. Its measurements will probably remain unrivalled for at least the next decade in the GeV-TeV energy range. In principle, high-precision data can be used to constrain different propagation scenarios or candidates in the context of dark matter indirect detection. However, promises of high-precision cosmic-ray (CR) physics can only be fulfilled if the various sources of uncertainties, data and model, are fully accounted for.
-Data uncertainties: AMS-02 systematic uncertainties are diverse in origin and dominate the error budget of measured fluxes and ratios overall. In experiments measuring spectra, correlations in adjacent energy bins may be introduced at the data analysis stage. These correlations could wash out or mimic spectral features in the data. In principle, the best approach to automatically account for such effects is to fold laurent.derome@lpsc.in2p3.fr david.maurin@lpsc.in2p3.fr pierre.salati@lapth.cnrs.fr † boudaud@lpthe.jussieu.fr ‡ yoann.genolini@ulb.ac.be the model prediction to the instrument full response and directly compare with the number of events. However, because the AMS-02 instrument response is not available, the next best approach is to incorporate a correlation matrix of errors or use nuisance parameters when comparing a model to the data. Such a matrix is also not available; however, we can rely on educated guesses to derive it and inspect the consequences on the model parameters.
-Input ingredient uncertainties: the dominant source of uncertainty in the modelling is from nuclear cross sections Maurin et al. 2010). Propagating these uncertainties to the model parameters have already been investigated in several studies (Giesen et al. 2015;Génolini et al. 2015;Tomassetti 2017;Reinert & Winkler 2018), and we revisit this question here in more details with the use of mock (simulated) data. Controlled data were introduced in a CR propagation context in Coste et al. (2012) to study possible biases on model parameters from using primary and secondary CR data of very different accuracy. In this study, mock data are used to characterise the bias on reconstructed model parameters when accounting for cross-section uncertainties, and more importantly, to assess how well nuisance parameters on cross sections allow one to recover unbiased values of these parameters. -Model numerical precision: to be able to test various model hypotheses at the required level of the data, the model calculation must be at a much higher precision than the data uncertainty. The diffusion equation is a second order differ-1 LAPTH-015/19 arXiv:1904.08210v2 [astro-ph.HE] 21 Jun 2019 ential equation in space and momentum, and we discuss the impact of energy boundary conditions here, along with other effects that could prevent reaching the desired precision.
Except for the numerical precision, studying how to best deal with data and cross-section uncertainties is mostly independent of the propagation model and of the specific quantity studied. For practical purpose, our methodology is illustrated on the B/C ratio, which is one of the most frequently discussed quantity in the CR literature (e.g. Maurin et al. 2001). This is a methodology paper, and the full analysis of AMS-02 data and the interpretation of the model parameters are left for the companion paper (Genolini et al. 2019). The paper is organised as follows: Sect. 2 briefly introduces the 1D model and its parameters, and details two configurations used for the analysis. Sect. 3 discusses how to ensure a good precision at various stages of the calculation: boundary conditions, numerical stability, and comparison of the model to the data. Sect. 4 shows two different parametrisations of nuisance parameters for nuclear cross sections, and mock data are used to fully characterise the impact of cross-section uncertainties. In Sect. 5, we detail the systematics of AMS-02 data-from which a covariance matrix of error is built-, and we show the impact of the correlation length (of the covariance matrix) on the best fit results and errors on the model parameters. Cross sections and covariance matrix effects are then dealt with together in Sect. 6, to assess which one dominantly impacts the analysis of AMS-02 B/C data. We summarise our findings and give some recommendations in Sect. 7.
For the sake of readability, some more technical and detailed discussions are postponed in the appendices: Appendix A shows that the AMS-02 B/C data conversion from R to E k/n as presented in Aguilar et al. (2016) induces an energy-dependent bias ( ∼ 3%); App. B details how the covariance matrix of errors and nuisance parameters are included in the χ 2 analysis;App. C gathers several boundary coefficients that can be implemented for the numerical solution of the discretised second-order differential diffusion equation; App. D presents a thorough analysis of the stability of the latter solution (for the 1D model), also determining a stability criterion for the Crank-Nicholson solution with a vanishing second-order term (V a → 0); App. E shows a more detail view of how specific cross-section reactions impact the calculated B/C ratio.

Model and parameters
Many modellings of propagation models are possible, with different geometries, more or less involved spatial dependences, possible time-dependence, etc. For simplicity, and because most of our results and conclusions should not depend on this modelling, we use throughout the paper a 1D diffusion model, as implemented in the usine package (Maurin 2018) 1 . The equations and solutions can be found for instance in Putze et al. (2011), and for conciseness, we do not repeat them here. Such a model also proves useful, because it can be compared, in some simple cases, to compact analytical solutions (see, e.g. App. D).

1D propagation model
In this model, sources and gas are in a thin disc of half-height h in which energy losses and reacceleration occur. Particles diffuse in an homogeneous region of height L above and below the disc. The free parameters of the model that we vary in this study are: the rigidity dependence, R = pc/(Ze), of the homogeneous and isotropic spatial diffusion coefficient K(R), see Sect. 2.2; the Alfvnic speed V a of scatterers mediating the strength of the diffusion in momentum K pp (R), the latter being related to the spatial diffusion coefficient and depends on the geometry of the turbulence (Schlickeiser 2002); the strength of V c , a constant Galactic wind perpendicular to the thin disc.
Other model parameters (halo size L, source spectrum) are irrelevant for this study. For instance, changing L would merely lead to a rescaling of the above parameters (e.g. Putze et al. 2011), so we fix it to 10 kpc for practical purpose (and we fix h to 100 pc).
The B/C value is insensitive to the value of the universal spectral index of sources (e.g. Maurin et al. 2002;Génolini et al. 2015), so it is fixed in the analysis.

Parameters for Model A and Model B
The impact of various uncertainties on transport parameters depends on the exact number and nature of the free parameters considered. We rely on two configurations, which correspond to two extreme cases of a more generic parametrisation of the diffusion coefficient, further detailed in the companion paper. They are denoted Model A and Model B in the rest of the paper: -Model A: diffusion-convection-reacceleration model with where η t allows for a sub-relativistic change of the diffusion coefficient as parametrised in Maurin et al. (2010), and where K HE = (1 + (R/R h ) δ h /s h ) −s h is a high energy break whose parameter values are taken from Génolini et al. (2017). This configuration has 5 free transport parameters: K 0 , δ, η t , V a , and V c . -Model B: pure diffusion model (no V c , no V a ) with a double broken power-law, at both high and low energy: This configuration has 4 free parameters: K 0 , δ, R l , and δ l . The smoothness parameter s l has only a minor impact on the results, so it is fixed to 0.05 (quick transition) to speed up the fitting procedure.

Model precision: general considerations
The requirements for any analysis is (i) that the model calculation can be enforced at a precision much better than the precision of the data which will constrain it, and (ii) to ensure that the model and the data compared refer to the exact same quantity.
We focus on the model calculation in this section, but at the data level, biases can also sometimes be introduced, as exemplified in App. A with the conversion of B/C data from R to E k/n proposed in Aguilar et al. (2016).

Energy boundary conditions and numerical stability
The transport equation of CRs (e.g. Maurin 2018) is a second order differential equation in space and in momentum (if reacceleration is present), whose solution depends on the boundary conditions. These conditions should in principle be fixed by physics requirements, but there is no consensus as to what they are. We underline that spatial and momentum boundary conditions are generally not dealt with on the same footing: while they are usually clearly indicated in publications and are recognised as being part of the properties of a model for the former, this is not the case for the latter (which is discussed below).
The transport equation can be cast into a generic conservation equation on the energy co-ordinate x = ln E k/n : with u is the cosmic-ray differential density in energy, u 0 a source term, J E a current (convection and diffusion), and α, β, and γ are coefficients related to energy losses, diffusion in momentum, etc. 2 Boundary conditions At very high energy, for nuclei, the timescale of energy losses and gains becomes very large compared to the escape time, suggesting the condition u(x max ) = u 0 (x max ), which is seemingly used in all propagation codes. At low energy, different boundary conditions have been used in the literature, corresponding to different physical situations: -No curvature in the spectrum, as introduced in Donato et al. (2001) for antiprotons: Physically this means that, at x min , the outward current from energy losses balances exactly the inward reacceleration current. This condition thus depends on the coefficients α, β and γ of the equation. From Eq. (4), one can infer that for very small values of γ, this will create a strong gradient of u to maintain J E = 0. -No density gradient in momentum ∂ f /∂p| x min =0 (Evoli et al. 2017), which translates into ∂/∂p(u/(pE))| E min = 0.
Numerical solution and precision In the semi-analytical models implemented in usine and used here, as for most propagation codes, the second order differential equation in energy is solved numerically, by solving the equation on a grid. In practice, we make use of the semi-implicit Crank-Nicholson method and the resolution proceeds via the inversion of a tridiagonal matrix (see App. C). The first and last energy bins are set by the boundary conditions, as reported in Table C.1. The precision of the numerical inversion depends on the number of points on the grid. We find that the boundary conditions at low energy described above yield similar results, provided that the number of energy bins is large enough and that the lower energy E min is far below the range of interest. However, they differ with respect to the minimum number of energy bins required to reach the same level of precision. The B/C ratio obtained from each of these conditions are compared in Fig 1 to a reference ratio obtained setting E min = 1 MeV/n and using 5000 2 For instance, in the case of the 1D diffusion model described in Sec. 2.1, the above coefficients are given by Putze et al. (2010): α(x) = 2h/(E k A), β(x) = b losses (E), γ(x) = β 2 K pp /E k , and u 0 (x) = 2hq/A, with A = 2h nvσ inel + V c + KS coth (S L/2) and S = V 2 c /K 2 + 4 Γ rad /K points per energy decade. We checked that the reference ratio does not depend, at the per mille level, on the chosen boundary condition. The red, blue and green curves are obtained for the first, second and third boundary conditions at low energy, respectively. In the top panel, we change the number of points in the energy grid (10, 50 and 100 bins per decade) whereas in the bottom panel we move the low-energy bound E min from 100 MeV/n down to 1 MeV/n. We obtain similar results for each low-energy boundary condition, provided that the number of points per energy decade is larger than 10 and E min is much lower than the energy range of interest. This is probably the reason why no boundary condition at low energy is specified in the numerical codes GALPROP (Strong et al. 2011, p.35) and PICARD (Kissmann 2014, p.5). However, the choice of the boundary condition is important for the convergence. We find that the first condition (no curvature in the spectrum) converges better than the others and yields a precision at the percent level even using only 10 bins per decade when starting from E min = 1 MeV/n. We therefore recommend to make use of the no curvature boundary condition at low energy, with E min = 1 MeV/n and using 50 bins per decade, to ensure numerical systematics lower than the percent level. Finally, this method can be unstable for γ → 0, in which case Eq. (4) boils down to a first order differential equation. A simple prescription to obtain the solution keeping the same solver is to enforce a non-null but small γ, with a non-vanishing yet small V a . We checked that setting a lower limit on the Alfvénic speed such that V 2 a /(K 0 ∆x 2 ) ≥ 10 −1 Myr −1 where ∆x is the spacing of the energy grid, stabilises the V a = 0 solution at the per mille level.
3.2. 'Model vs data' error using R mean or of bin range estimate To our knowledge, models are always calculated at a single point and then compared to data measured over a bin range. This can lead to a systematics we quantify here.
Meaning of R mean in data All data measurements are based on a number of events in the detector (corrected for the acceptance, efficiencies, etc.) per unit area, solid angle, unit time, and energy bin. To be practical, let us assume that, like AMS-02, the experiment provides data per rigidity bin [R min , R max ] 3 . Usually, for display purpose, the central bin reported in the experiments is the geometric or more rarely the arithmetic mean: Neither of those means are satisfactory to represent the measured flux F, because the correct central bin R exact mean should be calculated from the condition This is a well known issue (Lafferty & Wyatt 1995): providing the exact R mean from the data requires the knowledge of the spectral shape of the flux that the experiment is actually trying to measure! F(R ×,+ mean ) vs F(R exact mean ) for fluxes and ratios In the context of minimisation studies, the above discussion should be irrelevant as the theoretical flux is known: it can be integrated over the bin range and compared with the data without approximation. However, standard practice in the literature is to fit the data using R ×,+ mean . We quantify below the relative difference between the exact and approximate calculation for a flux, For practical calculations, we assume power-law fluxes F = F 0 R −α , so that the normalisation F 0 simplifies in Eq. (7). We can also estimate the relative difference for B/C, taking the ratio of two power-law fluxes of indices α num and α den : Model error on fluxes We show in Fig. 2 the module |E F | as a function of α. The different line styles correspond to different bin widths, and the larger the bin width, the larger |E F |. Also, F(R × mean ) is a better approximation than F(R + mean ), except for α ∼ 0 (thick dim vs thin light grey lines). F(R × mean ) is exact for α = 0 and α = 2 and the relative difference is positive above α = 2 3 The reasoning would be the same if we were to take E k/n instead.  (7), as a function of the flux spectral index α. Two mean rigidity definitions are compared, R × mean in dim grey and R + mean in light grey, see Eq. (5), for different bin size ranges (from 1 decade, solid line, down to 0.1 decade, dotted line). To guide the eye, the green dash-dotted line shows when the relative difference is 3%. See text for discussion. and negative below α = 2. To guide the eye, the green dashdotted line shows the typical 3% uncertainty on the AMS-02 data: all values of α and ∆R above this line, using F(R ×,+ mean ) in model calculations produces a bias larger than 3%. We do not study fluxes here, but primary and secondary fluxes have slopes of ∼ 2.8 − 3.1, for which the bias is maximal. Nevertheless, the maximal rigidity bin width in AMS-02 data for proton and He flux is R max /R min ≈ 1.6, for which the approximate calculation is smaller than the data uncertainty.
Model error on ratios We repeat the analysis for the ratio of two power laws of slope α num and α den , see Eq. (8). Figure 3 shows colour-coded values of log 10 (E R ). The x-axis is α den − α num : for the B/C ratio, this difference ranges from ∼ 0.2 to 0.7 at high energy, while negative values mimic the decreasing ratio below a few GV. We show our results for three α den values, where the lower value (top panels) mimics the flattening of the Carbon spectrum at low energy, while the higher value (bottom panels) corresponds to the high-energy slope: E R grows with increasing α den − α num and with the data bin size (y-axis); the three rows show a growing relative difference (from top to bottom) with α den . Also, as already observed for fluxes, the approximation Ratio(R × mean ) is always better than Ratio(R + mean ): for any given x − y position in Fig. 3, E R is always smaller in the left panel than in the right panel. To guide the eye, the green dashed line delimit the contour for which E R ≡ 3%, with larger uncertainties in reddish regions and smaller uncertainties in blueish ones.
For B/C from AMS-02 data, the bin range size goes from 0.08 decade at low rigidity to 0.3 decade for the last few rigidity bins where the systematic uncertainty reaches 10% (Aguilar et al. 2016(Aguilar et al. , 2018b Colour-coded relative difference log 10 (|E R |) between the exact and approximate ratio calculation in a bin, Eq. (8), as a function of the numerator and denominator spectral difference, α den − α num (x-axis), and as a function of the rigidity bin width, log 10 (R max /R min ) (y-axis). For instance, a value of 2 (red) corresponds to a relative difference of 100%, and a value of −1 (blue) to a relative difference of 0.1%. The left and right panels correspond to calculations using R × mean and R + mean respectively, see Eq. (5). The rows correspond to three different values of the denominator spectral index α den . In each panel, the dash-dotted green contour delimits regions in which the relative difference is above or below 3%. See text for discussion.
values of E R for almost all rigidities. However, for the highest rigidity bins, the model error from using Ratio(R ×,+ mean ) is systematic (same sign) and reaches a maximum of −3% for α num − α den 0.7. In a region where power-law breaks are usually fitted, the exact calculation is recommended 5 .

Handling cross-section uncertainties
Nuclear cross sections are measured by 'external' experiments, and these measurements can be incorporated as a distribution of probability in the χ 2 minimisation via nuisance parameters (see App. B): cross sections far from their most probable values must be penalised in the minimisation, see Eq. (B.6).
The difficulty lies in the characterisation of the uncertainties, the choice of the nuisance parameters, and assessing the robustness of the procedure. We start by characterising the impact of cross-section uncertainties on the B/C ratio ( § 4.1). We then present two different strategies for the choice of nuisance parameters ( § 4.2). To assess the successfulness of these two strategies, we have to rely on the analysis of mock data for many config- The thick (resp. thin) lines are for the interstellar (resp. solarmodulated at φ Force−Field = 800 MV) calculation. The red vertical line highlights the first rigidity point of AMS-02 B/C data.
urations ( § 4.3). We then discuss how well these configurations capture and propagate all cross-section uncertainties to the transport parameter level ( § 4.4).

Quantifying the impact on B/C ratio
Cross section data uncertainties are typically at ∼ 5 − 10% level for inelastic cross sections, and 15 − 25% level for production cross sections (Génolini et al. 2018). However, because the data are sometimes scarce, old, not always consistent with one another, and sometimes even missing for some reactions, several parametrisation of the whole network of reactions exist. A conservative estimate of the impact of cross-section uncertainties on the B/C calculation can be based on the scatter observed from using several of these parametrisations (see Génolini et al. 2018 for more details): -Inelastic cross sections, σ inel : we use below B94 (Barashenkov & Polanski 1994), W96 (Wellisch & Axen 1996), T99 (Tripathi et al. 1996(Tripathi et al. , 1999, and W03 (Webber et al. 2003). Except for T99, the scaling σ He /σ H is taken from Ferrando et al. (1988). -Production cross sections, σ prod : W98 (Webber et al. 1998a,b,c), S01 6 , W03 (Webber et al. 2003), and G17 (Moskalenko et al. 2001;Moskalenko & Mashnik 2003).
For a given set of propagation parameters, we calculate the B/C ratio for various parametrisations, and we plot in Fig. 4 the relative variation with respect to a reference T99 for σ inel and W03 for σ prod ). The maximum impact of inelastic cross sections is 3% 7 at ∼ 5 GV (left panel). It slowly decreases to zero at higher R, because the escape time from the Galaxy decreases with R while the destruction time remains constant (see, e.g. Fig. D.1). The maximum impact of the production cross sections 6 Same dataset as in Webber et al. (2003), but fitted by Aim Soutoul (private communication). 7 We wrongly reported a 10% impact in Génolini et al. (2018) because of an error in the inelastic cross section on He for two parametrisations (the faulty files have been corrected in usine v3.5). is 10%, and it is equally seen at low and high rigidity (right panel) because the Boron flux is directly related to its production cross section. These results are similar for Models A and B (not shown) and are independent of the solar modulation level (compare the black and grey lines in Fig. 4).
Actually, a huge network of reactions is involved in the calculation of any given secondary cosmic ray, making the modelling of uncertainties for each individual reaction a daunting task. Obviously, this full network is taken into account to calculate B/C, but we model and incorporate cross-section uncertainties for the most relevant reactions only: for the production, 16 O and 12 C make ∼ 70% of the Boron flux via 10,11 B (Génolini et al. 2018), and for inelastic interaction, 16 O, 12 C, and 11 B are the most relevant. The results of App. E show that the variation seen on the B/C ratio from cross-section uncertainties almost completely originate from these dominant reactions.

From uncertainties to nuisance parameters
To estimate uncertainties on selected reactions, one could use a parametric formula to fit the cross-section data and extract the best-fit parameters and uncertainties to propagate as nuisance parameters. This is the strategy followed by Reinert & Winkler (2018) for production cross sections. However, as already said, the reliability of the data is not always clear, with many inconsistent data points, from a mixture of very old and more recent experiments with probably underestimated systematics (Génolini et al. 2018). All these unknowns most certainly break down the statistical meaning of the χ 2 values and uncertainty determination of these nuclear data. We assume here that the crosssection uncertainties are fully captured by existing parametrisations (Sect. 4.1) 8 . It is difficult to argue which of the two above approaches gives the most realistic description. Indeed, the values and uncertainties on the cross-section data and the models could be fully, partly, or not at all correlated, which would increase or decrease the uncertainty on the calculated B/C ratio (see the discussion in Génolini et al. 2018). Without new crosssection data, the degree of belief one can have in the modelling of cross-section uncertainties can hardly be improved.
Our approach probably allows for larger uncertainties than those taken in Tomassetti (2017) and Reinert & Winkler (2018), which also focus on a subset of reactions only. However, we recall that the uncertainties on this subset must 'emulate' the total uncertainties from the whole network of reactions (see the discussion in App. E). To go beyond qualitative arguments, we inspect in Sect. 4.3 whether the degrees of freedom used to model cross-section uncertainties are conservative enough not to bias the determination of the transport parameters. Before doing so, the next two paragraphs discuss two ways to model cross-section uncertainties as nuisance parameters. 4.2.1. Normalisation, scale, and slope (NSS) Technically, how to choose nuisance parameters so that they enable to move from one parametrisation to another? The latter are shown (solid lines) in Fig. 5, with σ inel (resp. σ prod ) in the left (resp. right) panels, and there is no obvious scaling formula between the curves. A possibility is to start from a reference cross section and apply several simple (uncorrelated with some noncommutative) transformations: This set of transformations is denoted NSS in the following. It is our first option to generate nuisance parameters for cross-section uncertainties. To better visualise how NSS change cross sections, we draw 1000 values for each of the three uncorrelated NSS parameters (Norm., Scale, and Slope), and then show in Fig. 6 the median, 1σ, and 2σ contours from the associated 1000 realisations of σ NSS /σ ref . Whereas the normalisation and the low-energy slope changes are independent of any reference cross section (left and right panels), the energy scale bias is strongly dependent on it (middle panel). Indeed, the reference in Fig. 6 is an inelastic cross section whose energy dependence has a low-energy peak, a dip, and a second smaller peak (see Fig. 5): shifted to the right-hand side and divided by the unscaled one, it gives a series of three bumps.
For each reaction, the NSS nuisance parameters are chosen so that σ NSS /σ ref ± 1σ-calculated from Gaussian distributed samples of (µ, σ) Norm, Scale, Slope -encompasses the various cross-section parametrisations. This is shown in Fig. 5 for inelastic (left panels) and production (right panels) cross sections, with grey lines showing the median (dashed), 1σ (dotted), and 2σ (dash-dotted) envelopes of σ NSS /σ ref ; solid coloured lines are the literature parametrisations. The corresponding NSS parameters are gathered in Table 1, and they serve as nuisance parameters in the analysis below 9 . In order to keep as fewest nuisance parameters as possible (not to slow down too much the minimisation procedure), only a normalisation and energy scale is applied to inelastic cross sections, whereas a normalisation and a slope suffices to capture the range covered by production cross-section parametrisations.

Linear combination (LC)
Our second and more straightforward option is to define cross sections as a linear combination of the available cross-section parametrisations, where the index i runs on the parametrisations shown in Fig. 5. The sum of the C i coefficients must be close to 1, so that we naturally recover each parametrisation when only one C i is nonnull. This LC allows to combine the different shapes (energy dependences) of the various cross sections, which is key for the determination of the transport parameters (see next section). To Fig. 5. Models (as listed in Sect. 4.1) and range of cross sections (quantiles corresponding to median, 68%, and 95% CLs) generated from a reference cross section biased by Gaussian distributed nuisance parameters (as gathered in Table 1). The reactions showed correspond to the dominant ones discussed in Sect. 4.1, for inelastic (left column) and production (right column) cross sections. allow for possible normalisation systematics, we apply a loose constraint on the sum of the C i coefficients, To be able to compare this approach to the NSS approach above, we set (µ C , σ C ) inel = (1, 0.04) and (µ C , σ C ) prod = (1, 0.15) to match the spread set on normalisation parameters in  (9), energy scale (10), and slopes (11) with respective mean and variance (µ, σ) Norm = (1, 0.05), (µ, σ) Scale = (1, 0.2), and (µ, σ) Slope = (0, 0.02). . From left to right, the nuisance parameters correspond to a normalisation, energy scale, and a modification of the slope below an energy threshold E thresh. k/n . Unused parameters are indicated by '-'. Notes. Parameters with σ = 0 amount to fixed parameters.
that is an additional term in the χ 2 , The C i parameters are taken to be flat in [−0.5, 1.5] and are forbidden to wander outside this range.

Mock data: generation and configurations
We are almost ready to address some important questions related to cross-section uncertainties. How do they propagate to transport parameter uncertainties? Can we recover the true values of the transport parameters using 'wrong' values for the cross sections? However, the only way to answer these questions is to analyse controlled data, whose input ingredients and parameters are known.

Mock data generation
To generate simulated data as close as possible to real data, we proceed as follows. Firstly, select the model (e.g. 1D model here) and its input ingredients (e.g. a specific cross-section dataset). Secondly, select a dataset to fit (e.g. B/C AMS-02 data) and perform the fit. Thirdly, use the best-fit model to simulate data close to the real data in the following way: (i) interpolate model values at data energies, y model k (e data k ); (ii) draw at each e data k a value from a normal distribution G(0, 1), and use the latter and σ data k (data error) to form the mock data values (iii) repeat as many times as necessary to obtain the desired number of simulated data. Lastly, analyse the mock data using the same setup or varying the input ingredients (depending on what is studied, see below).

Mock data configurations
We list and label the many cases considered below: in the forthcoming figures, each configuration is associated with a unique colour-and line-style, as recapped in Table 2.
-Propagation parameters (×2): 10 each analysis is repeated for Model A (free parameters K 0 , δ, η t , V a , and V c ) and Model B (free parameters K 0 , δ, R l , and δ l ), see Sect. 2.2. We do so because the two models have different correlations between their parameters and cross-section uncertainties may impact them differently. For instance, reacceleration smooths spectral features, and it is present in Model A only. -Cross sections to generate and fit mock data (×2): In the unbiased case, the cross sections in the propagation model used to generate and fit mock data are the same (T99 for σ inel and W03 for σ prod ). In the biased case, mock data are still fit with T99 and W03, but they were generated from a different set of cross sections (W96 for σ inel and G17 for σ prod ) 11 . -Type of nuisance parameters to fit mock data (×2): we either use 'normalisation, scale, and slope' (NSS) nuisance parameters, that is µ|σ Norm, Scale, Slope values prescribed in Table 1, or linear combination (LC) nuisance parameters, that is C i coefficient weighting various cross-section parametrisations with normalisation uncertainties σ C i = σ Norm (see previous section and Eq. 12). -Nuisance parameters to fit mock data (×4): we have four types of runs to assess the impact of adding more and more nuisance parameters in the analysis, labelled No nuis.

Results of the mock data analysis
The analysis starts with the generation of 1000 mock data (see above), based on given values of the transport parameters, and a given choice of cross-section parametrisations. We then perform a χ 2 analysis on each mock data and store the best-fit parameters 10 Reference values are those of Sect. 5. They are used for all mock configurations to allow for a more compact presentation of the results in Figs 7 and 8. Thus, mock B/C data do not always represent the measured one (not shown), but this does not impact our conclusions. 11 We emphasise that cross-section values for all reactions, not just the dominant ones (see Sect. 4.1), are taken from the other parametrisations.  and the associated χ 2 min value 12 . By construction, χ 2 min /dof ∼ 1 for our mock data, so that from the one-dimensional distribution of the parameter values and their correlations, we can reconstruct 1σ and 2σ confidence intervals. Also, comparing the parameter distribution and their 'true' input value allows to assess the successfulness of our procedure. Figure 7 shows the 1σ contours (68% confidence level) from the 2D probability distribution functions of the transport parameters, with and without nuisance parameters in the fit. We underline a few features in these plots:

Unbiased case: Sanity check
-Contours from statistical errors only: black solid lines are 1σ contours from the analysis without nuisance parameters. Their size and shape depend on the level and energy dependence of the data statistical error (blue line of Fig. 10). Tight correlations are seen on K 0 and δ for both models. As expected for the unbiased analysis (i.e. same cross sections used to generate and fit mock data), the contours encompass the true value of the parameters ('+' symbols).  and Model B (bottom panel), for the unbiased case (cross sections for the analysis are the same as the cross sections used to generate mock data). For display purpose, the 2D probability distribution functions are estimated using a Gaussian Kernel (default method to define the bandwidth of gaussian kde in scipy python library); the irregular shapes are related to statistical fluctuations. The colour code is related to the nuisance parameters used and the line style to the type of nuisance parameters (see Table 2). The '+' symbols represent true values. See text for discussion.
-Fit with σ inel and σ prod nuisance parameters: blue lines (resp. orange lines) show the 1σ contours from the fit with σ inel (resp. σ prod ) as nuisance parameters. The size of the contours is not too strongly impacted by the cross-section nuisance parameters, because the minimum of χ 2 is left unchanged (not shown) and the additional degrees of freedom provided by the nuisance parameters are 'unused'. Nevertheless, the contours are deformed differently, because inelastic and production cross sections impact differently the B/C ratio-see for instant the blue (σ ine ) and orange (σ prod )    Fig. 8. Distribution of best-fit values (χ 2 min , then transport parameters) from the analysis of 1000 mock data for Model A (left panel) and B (right panel), for the biased case (cross sections for the analysis differ from those used to generate mock data). For display purpose, 1D probability distribution functions are estimated using a Gaussian Kernel. The line style and colours indicate the type and configuration of nuisance parameters used (see Table 2). The vertical dashed lines represent true values. See text for discussion. contours for K 0 vs R lo in Model B. The fit with combined nuisance parameters (green lines) gives contours that encompass both the previous ones. The fine details depend on the Model (A or B) and the type of nuisance (NSS in solid and LC in dashed lines) used.
From these results alone (unbiased case), one cannot conclude on the impact of cross-section uncertainties on the transport parameters. In fact, the unbiased case is just an elaborate sanity check. It confirms that, in a scenario where cross sections are perfectly known, adding cross-section uncertainties has only a marginal effect.

Biased case: uncertainties and biases on transport parameters
To go further, we repeat the analysis fitting mock data with cross sections that differ from the ones used to generate them, that is biased case (see Table 2). We show in Fig. 8, from top to bottom, the χ 2 min /dof distribution and the 1D probability distribution function of all transport parameters. For readability, we only show the results for the No nuis. (black lines) and Inel.+Prod. (green lines) cases. In this figure, solid (dashed) lines correspond to NSS (LC) nuisance type.
-Impact on goodness of fit (top panels): the black lines, which correspond to a fit with the transport parameters only (No nuis.), show that using wrong cross sections can lead to χ 2 min /dof values larger than one. Taken at face value, one would conclude that the model is excluded. Adding crosssection nuisance parameters-which encompass the true cross-section values at 1σ-allows to recover χ 2 min /dof ∼ 1 (green lines). The LC nuisance parameters (green dashed lines) fare slightly better than NSS ones (green solid lines): this is understood as the 'true' cross-section values can be reached in the LC case, whereas they can only be approached in the NSS case.
-Biased transport parameters (remaining panels): without nuisance parameters (black lines), the transport parameters are strongly biased, up to several σ away from their true value (vertical dashed line). Using nuisance parameters (black vs green lines) has two effects: it enlarges the probability distribution function of the transport parameters, and it shifts the distribution towards the true value. Overall, the two schemes allow to recover unbiased parameters. A mismatch is observed for the strongly correlated δ and K 0 parameters when using NSS in Model B. The latter is particularly sensitive to any small energy-dependent difference in the crosssection values as it directly reflects on the calculated B/C. On the other hand, in Model A, this difference can be smoothed out by reacceleration.
We finally comment on the fact that the LC case does not recover fully unbiased transport parameters. Whereas nuisance parameters enable the cross sections to match their 'true' values (the one used to generate the data), they can only do so for the selected four production cross sections and three inelastic reactions. The remaining ones are different from those used to generate the mock. This 'reaction network' effect explains the observed residual biases.

Biased case: posterior on nuisance parameters
We show in Fig. 9 violin plots for the nuisance parameters obtained after the fit. We only show these parameters for the Inel.+Prod. configuration, that is the analysis in which we fit mock data with transport parameters plus production and inelastic cross-section nuisance parameters (see Table 2). The rows in Fig. 9 show, for the four production and three inelastic reactions (see Sect. 4.1), the values of the associated nuisance parameters (two per reaction). It is interesting to show the results for the unbiased (resp. biased) case, in red (resp. blue), corresponding to the use of the same (resp. different) cross sections to generate and fit mock data. Let us comment on these distributions.
NSS analysis (left panels): the nuisance parameters for the NSS analysis are a normalisation and energy scale parameters LC vs. biased unbiased Fig. 9. Nuisance parameters from the analysis of 1000 mock data for Model A (top panels) and Model B (bottom panels). The nuisance parameters are shown reaction by reaction (rows: production then inelastic cross sections), each reaction having two nuisance parameters (see list in Table 2). The number in parenthesis beside the reaction corresponds to its overall impact on the B/C calculation, as reported in Table 1. We show for the NSS analysis (left panels) normalised and centred parameters, whereas LC analysis (right panels) are shown between zero and one. We use violin plots to highlight the probability density of the parameter (y-axis) at different values (x−axis), and our violin plots include a marker for the median (black '+' symbol) along with the 1σ range of the parameter (thick black line). In order to directly compare the distribution of the nuisance parameters for the unbiased and biased analyses, we superimpose them on the same line in red and blue respectively. See text for discussion.
for production cross section, and a normalisation and low-energy slope for inelastic cross sections (see Eqs. 9-11 and Table 1). The parameters are centred and normalised (to their σ value) so that on the x−axis, unbiased parameters are expected to be centred on zero and between -1 and +1 (1σ range).
-Unbiased analysis (red): as expected, the distributions are centred on zero and have overall a very small width. -Biased analysis (blue): the distributions are now offset, because nuisance parameters are used to improve the fit. Almost all parameters fall within their 1σ value, indicating that the range of variation for these nuisance parameters was well calibrated in Sect. 4.2.
Actually, we tried different values of the nuisance parameters (not shown): with a smaller range, the 'true' cross sections cannot be recovered as the nuisance parameters would need to be several σ away from their central value, which would penalise the χ 2 . In turn, this biases the transport parameters (discussed in the previous section): the mild bias that was observed for the NSS case (w.r.t. to the LC case) is related to the fact that µ slope is almost 2σ away in Fig. 9.
LC analysis (right panels): nuisance parameters for the LC analysis are the coefficients C j i (see Eq. 12), where the index i runs on the cross-section parametrisation enabled in the analysis, and j runs on the various reactions considered. These coefficients typically vary from 0 (if the parametrisation is unused) to 1 (if the cross section is dominant in the LC). In principle, we should have as many coefficients as the number of available cross-section parametrisations. However, the inspection of Fig. 4 shows that some parametrisations are, up to a normalisation, very close to some others. As a result, when more than two parametrisations are considered as nuisance (not shown), there are several possible combinations to reproduce the original cross section (used to generate the mock): the χ 2 function has several local minima and minuit has difficulties to find the true minimum 13 . That is why we chose only two parametrisations in our analyses (as listed in Table 2) and the distribution of values of the nuisance parameters are shown in the right panels of Fig. 9: -Unbiased analysis (red): cross sections used to generate and analyse mock data are T99 for σ inel (resp. W03 for σ prod ), so that we should recover C T99 ≈ 1 (resp. C W03 ≈ 1) for all inelastic (resp. production) cross sections and 0 for the other C i . This is what is observed for all reactions. The parameters for inelastic cross sections (three bottom rows) display overall very broad distributions: we recall that the latter only have a small impact on the B/C calculation ( 3%), so that a fit with data with similar uncertainties will not be sensitive to them. -Biased analysis (blue): now, the starting cross sections to generate mock data, for all reactions in the network, are W96 for σ inel and G17 for σ prod , and we observe C W96 ≈ 1, C G17 ≈ 1, and C others ≈ 0, as expected.

Conclusions on the impact of cross-section uncertainties
We have seen that assuming wrong cross sections can strongly bias the model fit, and thus bias the deduced transport parameters. Starting from the wrong cross-section values, we showed that nuisance parameters on a limited number of reactions allow to mostly recover the true values of the transport parameters. However, the procedure is not perfect owing to 'reaction network' effects, that is the fact that we only use as nuisance a small, 13 There are more involved methods to find it, but this would further complicate the analysis for no obvious gain on the results. What matters is the capability to recover the true cross section with one combination of C i , not with several. though representative, sample of all the reactions involved. The LC parameters fare slightly better than NSS parameters, but this is only true because LC parameters always contain 'true' cross sections of the analysis. In real life, we do not know what are the real cross sections, and there is no guarantee that the LC approach would still fare better than the NSS one.
We want to stress that the above procedure is not even as straightforward as presented. There was, to some extent, some fine tuning done on the range chosen for the nuisance parameters to best recover our mock data. Although we were guided by the spread between the cross sections (see Fig. 5), we had somehow to extend the range of some parameters in successive tests. In particular, for NSS, the low-energy slope was taken larger than what was strictly required from the inspection of the spread (see Fig. 5). However, a posteriori, this made sense, because not only the normalisation but also the slope of the cross-section reaction matters in the analysis (especially for Model B), and a larger slope parameter was needed to reconcile the energydependences of W03 and G17 parametrisations. Even for LC, which looks less problematic, there were some issues. We already underlined the pitfalls (in terms of minimisation with minuit) of having too similar cross-section parametrisations in the linear combination. It was not mentioned earlier, but the allowed range set for the LC coefficients also matters: using [0, 1.5] instead of [−0.5, 1.5] affects the distribution of the nuisance parameters shown in Fig. 9, although the transport parameters are only very mildly affected.
Furthermore, the reader should keep in mind that regarding (i) the importance of cross-section uncertainties and (ii) which reactions should be used as nuisance, the conclusions strongly depend on the data uncertainties assumed. Indeed, the above analysis was based on AMS-02-like statistical uncertainties, that is an extreme and too conservative situation for the data. This was chosen in order to demonstrate the proof of principle of our approach. Adding systematics, which are dominant over most of the energy range in AMS-02 data, will obviously make crosssection uncertainties less impacting and the residual biases on transport parameters less severe. Accordingly, with larger uncertainties, the number of reactions to include as nuisance is also decreased: there is no gain in adding cross sections whose impact on B/C is smaller than the data uncertainties, only issues. Indeed, unnecessary reactions increase the run time of minimisations, and worse, these reactions create multiple minima that are harder to deal with. Part of these issues would be alleviated by using more evolved sampling engines, like a Markov Chain Monte Carlo (e.g. Putze & Derome 2014), but it remains better to use as few reactions as possible.
To assess the realistic impact of cross sections on the B/C analysis, we could repeat the above analysis with mock data accounting for statistical and systematic uncertainties. However, it is more interesting to illustrate how real data analysis should proceed. This is presented in Sect. 6, but before doing so, we have to discuss how to handle systematic uncertainties in the B/C analysis.

Handling systematics from experimental data
Almost all, if not all CR phenomenological studies, account for data uncertainties as the quadratic sum of statistical and systematics uncertainties. Doing so ignores any possible energy correlations for the systematic errors. This has two important consequences on the model best-fit analysis. For instance, considering two extreme cases, fully uncorrelated and fully correlated uncertainties, corresponds to adding quadratically the uncertainties or Stat. Acc. Scale Unf.
Acc. norm. Acc. LE Acc. res. to allow for a global normalisation of the data (or more precisely to an energy-dependent normalisation related to the energy dependence of the uncertainty). Starting from the same uncertainties, a χ 2 analysis on the two different cases would lead to a smaller χ 2 min in the former than in the latter case, and possibly to different values for the best-fit parameters of the model.
A better approach is to use the correlation matrix of error in the χ 2 analysis (see App. B). However, the AMS-02 collaboration does not provide this matrix, and we have to rely on the provided information to build one. We then inspect how sensitive the analysis is on our choices.

Origin of B/C systematic errors
The errors on the B/C ratio measured by AMS-02 are described in Aguilar et al. (2018b). The different contributions obtained from table VI of the Supplemental Material of Aguilar et al. (2018b) are shown in Fig. 10 as thick solid lines.
As explained in Aguilar et al. (2018b), the unfolding error (Unf.) corresponds to the contribution coming from the uncertainty on the rigidity resolution function and the unfolding procedure. The rigidity scale error (Scale) is the sum of the contribution from residual tracker misalignment and from the uncertainty on the magnetic field map measurement and its temperature time-dependent correction. The acceptance error (Acc.) is the sum of different contributions: survival probability of Boron and Carbon in the detector, Boron contamination from heavier nuclei fragmentation (mainly carbon), and uncertainty on the 'data/Monte Carlo' corrections to the Boron and Carbon acceptances.

Building the covariance matrix: correlation length
To properly take into account AMS-02 data uncertainties, one needs to define the covariance matrices C α for α=(Stat., Unf., Scale, Acc.), and minimise the χ 2 defined by Eqs (B.1-B.2). As these covariance matrices are not provided explicitly in Aguilar et al. (2018b), we start from the covariance matrices of relative errors C α rel , estimated from the following expression: with (C α rel ) i j the ij-th element built from the relative errors σ α i and σ α j at rigidity bins R i and R j , and where the parameter l α ρ is the correlation length associated with the error α (in unit of decade of rigidity).
For this study, we set the covariance matrix to be (C α ) i j = (C α rel ) i j × model i × model j (see App. B for a justification), and we set the correlation lengths l α ρ to the following values: l Stat. ρ = 0 because the number of events on each bin are independent; l Scale ρ = ∞ since the uncertainty on the rigidity scale affects all rigidities similarly; l Unf. ρ = 0.5 because errors from the unfolding procedure and from the rigidity response function affect intermediate scales. As seen on Fig. 10, this error is sub-dominant compared to Stat. and Acc. errors, and we checked that the results are not affected by our choice for l Unf.
ρ . -The value of the correlation length for the Acc. error is more critical, because this error dominates the systematic error and it cannot be easily defined. The dependence of χ 2 min /dof and of the fitted parameters with this correlation is studied below for different values l Acc. ρ = 0.01 . . . 3, which cover the range from lower than the bin size (fully uncorrelated) to the full range (fully correlated).
As the acceptance error is a combination of errors which are expected to have a rather small correlation length ('data/Monte Carlo' corrections) and others which are expected to have a large correlation length (cross-section normalisation), one can try to decompose this error into different contributions with different correlation lengths. In particular, the rise of the acceptance error at low rigidity is not expected to be correlated with larger rigidities: it is related to the rapid change of the acceptance at low energy mostly because of energy losses in the detector. One can therefore construct a better description of the covariance matrix by splitting acceptance errors in three independent parts: a normalisation error, Acc. norm. (dash-dotted orange line in Fig 10), with a large correlation length (l ρ ∼ 1.0); a rise at low rigidity, Acc. LE (dotted orange line), with an intermediate correlation length (l ρ ∼ 0.3); a residual error, Acc. res. (dashed orange line), defined so that the quadratic sum of the three contributions equals the full acceptance error. This last part corresponds mainly to 'data/Monte Carlo' corrections and the rigidity-dependent parts of other acceptance errors. Its correlation length is not well defined and left free in the following.
Near the completion of this article, we found out that Cuoco et al. (2019) also proposed to use a correlation matrix of errors to analyse AMS-02 data. However, while these authors focus on p and use a single correlation length fit on the data, our analysis relies on several correlations lengths whose values are motivated by physics processes in the AMS-02 detectors.

Parameter and goodness-of-fit dependence on correlation length
We have built two different covariance matrices, which partly depend on an unknown correlation length l Acc. ρ . We can now per- ρ for propagation models A (left) and B (right) and for the full acceptance error (blue) and the split acceptance error (orange). In the case of split acceptance error, l Acc. ρ corresponds to the correlation length of the Acc. res. contribution only. Bottom panels: Comparison of best-fit B/C (lines) and AMS-02 data (symbols) for the above models and configurations, i.e. full (blue lines, top) vs split (orange lines, bottom) acceptance errors. Only a sample of correlation lengths are shown (0.015, 0.1, and 1 decade).
form a χ 2 analysis with minos to extract robust errors on the parameters. The analysis is repeated on the two propagation model configurations A and B introduced in Sect. 2.1.
The top panels of Fig. 11 show the values obtained for χ 2 min /dof and best-fit parameters as a function of l Acc. ρ for mod-els A (left) and B (right) and for the full acceptance error (blue circles) and the split acceptance error (orange circles). The B/C from the best-fit model along with AMS-02 data are shown on the bottom panels of Fig. 11 for the same models, that is for the full (blue lines, top) and split (orange lines, bottom) acceptance errors. As expected, χ 2 min /dof strongly depends on l Acc. ρ for both models. The best-fit parameters are stable (i.e. fluctuate within errors estimated from the fit) for low and large l Acc. ρ but undergo a rapid jump around l Acc. ρ = 2 for model A when one uses the full acceptance error description. These features are problematic since it means that the best-fit parameters are very sensitive to the choice of l Acc.
ρ . In addition, with the full acceptance error, the best-fit obtained for model A and l Acc. ρ ≈ 1 does not pass through the data points as featured by the upper-left plot of the bottom panels in Fig. 11. This is explained as follows: with a large correlation, the cost on the χ 2 for a global deviation between data and model is moderate and thus accepted, and would correspond to a global bias in the measured B/C. Although correct from a mathematical standpoint, this interpretation is disputable given our crude modelling of the systematic errors. This unwanted behaviour is absent when we use the split acceptance error modelling.
From the above results, we conclude that the best way to handle the systematic errors is to use the split acceptance errors approach. Indeed, not only does it provide a more realistic description of the acceptance systematic error, but it also leads to more stable results w.r.t. the values taken for l Acc.
ρ . In this approach, l Acc. ρ = 0.1 is a reasonable choice which gives a χ 2 min /dof ∼ 1 and conservative errors for the fit parameters.

Joint impact of cross-section uncertainties and data systematics
The previous section provides us with a realistic treatment of the data errors. In this light, we can revisit the impact of cross-section uncertainties on the best-fit parameters and errors (Sect. 4.2). Indeed, we showed in the most challenging case (statistical only in the data) that NSS and LC nuisance parameters enable to recover the correct transport parameters when starting from the wrong cross sections, whereas systematic errors dominate over a wide dynamical range (see Fig. 10). Nevertheless, because neither NSS nor the LC approach is perfect (see discussion in Sect. 4.4.4), it is important to test both to ensure, as a minimal consistency check, that consistent values of the transport parameters (within their uncertainties) are obtained in both approaches. For this purpose, we analyse the 'real' B/C data using the covariance matrix of errors (see previous section), with both NSS and LC approaches, and varying the number of reactions used as nuisance parameters. This allows us to validate our strategy for the actual data, as used in the companion paper (Genolini et al. 2019) for the B/C physics analysis. It also exemplifies how an analysis should be carried out in the methodology we propose. Our results are presented in Fig. 12, in which we display the best-fit parameters and errors of Model A (top) and Model B (bottom) for an increasing number of reactions used as nuisance (from left to right). The four production cross sections are introduced by order of importance with respect to their contribution to the secondary boron. We then introduce the inelastic cross sections of 11 B; we have checked that the impact of other inelastic cross sections is negligible. We recall that we can start from different parametrisations of the full network of cross sections: for production cross sections, we either start from G17) For every additional reaction as nuisance, four different fits are performed: starting either with G17) or W03 parametrisations for the production cross sections; using either CL or NSS for the implementation of nuisance parameters. The black dashed line in the χ 2 min panel corresponds to the threshold χ 2 min /dof = 1. See text for discussion. or W03), whereas we only consider T99 for inelastic ones (their impact is negligible, see below). Several comments are in order about these results: -For both Model A and B, even without nuisance parameters (no nuisance on x-axis), the best-fit parameters for the two cross-section cases considered (W03 and G17) are consistent within errors. This means that the covariance matrix mitigates most of the errors coming from using the wrong cross sections (see discussion in Sect. 4.3). This would not have been the case (not shown) using simply the statistical and systematic uncertainties in quadrature. This further demonstrates the importance of having the correct covariance matrix of errors. It also emphasises the fact that energy correlations on intermediate scales (one decade) in data uncertainties could relax, to some extent, the need for very accurate cross sections. -When adding nuisance parameters (NSS or LC), the consistency between the parameters is improved, in particular for δ (in both models A and B). With more degrees of freedom, this translates into better χ 2 min values and larger uncertainties on the parameters. The latter is only significant for Model B, and the lack of increase in Model A probably comes from the fact that it has many degenerate 'low-energy' degrees of freedom (V a , V c , η T ) which already make the uncertainties maximal. We stress that the improvement depends on the initial set of cross sections used and method, but overall, for this specific analysis, with the covariance matrix of error dominating the error budget, only a few reactions need to be taken into account.
-Focusing on the fit quality (χ 2 min values), we see that G17 systematically gives a better fit than W03. In the LC approach, the productions cross section initially set to W03 also choose to go to G17. This is probably not too surprising as G17 is expected to better match existing cross-section data, whereas W03 is based on a global semi-empirical fit to these same data (see Sect. 4 and Génolini et al. 2018).
Based on these results, the recommendation for the B/C analysis, is to start from G17 production cross sections, and to use the NSS nuisance parameters. The latter allow for more freedom than LC ones, so that slight improvements are still possible when including several cross-section reactions as nuisance (though these improvements are not very important statistically in this case). These recommendations are followed to define benchmark models in our companion paper (Genolini et al. 2019), in which the values of the parameters shown in Fig. 12 are discussed and interpreted.

Recommendations and conclusions
Faced with the challenges of interpreting cosmic-ray data of unprecedented accuracy, we have refined the methodology to properly account for all uncertainties (model, ingredient, and data) in the fit to the data. The proposed methodology was exemplified on the analysis of the AMS-02 B/C ratio.
The first step was to ensure a model precision higher than the data uncertainty: we inspected in detail the numerical stability of the model and the impact of energy boundary conditions. Some low-energy boundary conditions fare better than others, but setting any of them to MeV values ensure a good precision of the model calculation above a few hundreds of MeV/n. When using a Crank-Nicholson approach to solve the second-order differential diffusion equation on energy, we have checked its precision and provided a criterion to numerically converge to the correct solution when V a → 0 (i.e. if no reacceleration, corresponding to a first-order differential equation). We have also quantified the systematics from using the point-estimate calculation of a flux or ratio compared to the correct calculation integrating the model over the energy bin. While the discussion is partly specific to the model used and the species inspected, our considerations are generic. Obviously, the precision tests should always be repeated and compared to the data uncertainty for other species, models, and data considered.
The second step was to handle properly cross-section uncertainties. We detailed the impact of the most important reactions on the B/C ratio ( 3% for inelastic cross sections and ∼ 10% for production cross sections). We then proposed an approach to account for these uncertainties via Gaussian distributed nuisance parameters, based on a combination of Normalisation, Scale, and low-energy Slope cross-section modifications (NSS) or based on linear combinations (LC) of existing parametrisations. We validated this choice on simulated data, showing that the degrees of freedom enabled by these nuisance parameters allow to recover the true parameters (when starting from a different set of cross sections simulated data were generated with). Simulated data also show that starting from the wrong cross-section values, valid propagation models would be excluded based on statistical criterion (χ 2 min /dof 1). The nuisance parameters we proposed also cure this problem.
The third step was to handle as best as possible data uncertainties. We accounted for possible energy correlations in the AMS-02 data via the covariance matrix of errors. As the AMS-02 collaboration does not provide such a matrix, we proposed a best-guess model, based on the information available in Aguilar et al. (2018b) and its supplemental material. The crucial parameters are the correlation length associated with various systematics, correlating more or less strongly various energy bins. The dominant effect is from the acceptance systematics, and we showed an unphysical dependence of the transport parameters with the acceptance correlation length. After a more careful inspection of the systematics, we discussed the fact that the acceptance systematics is actually a mix of several systematics with very different correlation lengths. Splitting the acceptance systematics in three parts stabilised the dependence of the transport parameters with the correlation length. To fully solve this issue, the publication, along with the data, of the correlation matrix by the AMS-02 collaboration is necessary. This is likely a very difficult task, and waiting for its completion, further informations on the various systematics, further splits and indications on each of the systematics correlation length would already be extremely useful. Indeed, not only does it possibly biases the transport parameters fit to the data, but it also has a huge impact on the statistical interpretation of the model inspected: depending on the correlation length assumed, we can either conclude on a perfect fit to the data χ 2 min /dof ∼ 1 or exclude the model (χ 2 min /dof 2 − 3). The fourth and last step was to consider a realistic analysis, applying the method developed to handle cross-section uncertainties (2 nd step) with the full data uncertainties, that is accounting for the covariance matrix of errors (3 rd step). Because of energy correlations in the systematics, the impact of cross-section uncertainties can be lessened. In the context of the analysis of the AMS-02 B/C data, the impact of systematics was found to be dominant over that of cross-section uncertainties. In any case, for any analysis, we recommend to implement the dominant nuclear reactions as nuisance parameters, checking the results against various choices of production cross sections and the two possible strategies for the nuisance parameters (NSS or LC).
Our methodology can be used for any CR species, but the most important cross sections and their uncertainties depend on the species (e.g. Génolini et al. 2018), so that specific nuisance parameters need to be changed for both the NSS and LC methods. Then, data uncertainties have generally different origins for different species, with different sub-detectors and selections cuts applied. For these reasons, the conclusions that can be drawn concerning the most impacting effect (cross sections or data systematics) can be different from one species to another, and so should be carefully inspected for each species and data considered.
Further results based on this methodology are presented in two companion papers: Genolini et al. (2019) present the interpretation of the B/C ratio data and constraints on the transport parameters. Boudaud et al. (2019) use these transport parameters and their uncertainties to calculate the astrophysical flux of antiprotons. We emphasise that all the results presented here and in the companion papers are based on usine v3.5 (Maurin 2018), available at https://lpsc.in2p3.fr/usine 14 .

approximate conversion
CR data are mostly published and analysed as a function of the kinetic energy per nucleon (see, e.g. the data collected in the Cosmic-Ray Data Base 15 , Maurin et al. 2014). The latter quantity is conserved in nuclear reactions (in the straight-ahead approximation) and propagation codes usually solve the transport equation per E k/n . However, it is not the quantity CR detectors measure; for instance, hadronic calorimeters provide the total energy, whereas spectrometers like AMS-02 provide the rigidity. Conversion from one energy unit to another is only exact if the nucleus (m, A, Z) is identified. For elements, unless the isotopic content is known, the conversion is approximate.
The uncertainty brought from energy unit conversions was neglected in the past because of larger uncertainties, but this is no longer possible for modern data. For instance, the conversion from R to E k/n in an experimental context in which only elemental fluxes are measured is discussed by the PAMELA collaboration in App. B of Adriani et al. (2014), and by the AMS collaboration for the B/C ratio in the Supplemental Material of Aguilar et al. (2016). As the practice remains in the field to fit data as a function of E k/n , we argue below that this is not a good procedure.
To convert B/C data from R to E k/n , the AMS-02 collaboration relies on an average mass number, of 12 for Carbon and 10.7 for Boron. Figure A.1 shows these values compared to the theoretical calculation from a model reproducing B/C data. In the top panel, the varying A C for the model results from the fact that Carbon contains mostly primary 12 C and a small fraction of secondary 13 C ( 15% at 1 GV and steadily vanishing at higher rigidities). For the Boron (bottom panel), both 10 B and 11 B are of secondary origin, but their rigidity evolution is related to two subtle effects: (i) ≈ 15% of 14 The current release is v3.4, but v3.5, specifically developed for this analysis, will be online soon. 10 B comes from the decay of 10 Be (Génolini et al. 2018), and as the effective lifetime increases with energy, the fraction of 10 B with respect to that of 11 B decreases with rigidity; (ii) 10 B has a larger fraction originating from 2-step reactions (w.r.t. direct '1-step' production) than 11 B has (see Table 1 and Fig. 3 of Génolini et al. 2018), and as 2-step reactions have a steeper rigidity dependence than 1-step ones, again the fraction of 10 B decreases with rigidity (w.r.t. that of 11 B). In Fig. A.2, we show the impact of these two different choices when converting B/C from R to E k/n . The top panel shows the residual of B/C data vs R (w.r.t. our best-fit model), in order to give a visual reference for the difference between the model and data. The bottom panel shows residuals of B/C vs E k/n for different conversions (w.r.t. our best-fit model converted without approximation). The black curve shows the conversion bias when assuming a constant A for Boron and Carbon, where part of the bias comes from assuming A B = 10.7 (red dotted line), and part from assuming A C = 12 (blue dashed line): the bias is positive and the largest at the lowest E k/n (∼ 3%) and null at 1 GeV/n; it is negative, reaches ∼ 2% at ∼ 4 GeV/n, and then decreases. The pattern of AMS-02 data (converted using the same approximation) with respect to the black solid line is similar to the one seen in the top panel, indicating that the origin of the discrepancy with the exact model calculation is the wrong assumption made for A .
We can summarise the above subtle discussion as follows: if we fit a model on AMS-02 B/C data as a function of rigidity, this model will be offset from the converted AMS-02 B/C data as a function of E k/n . The offset is not a simple scaling, it is instead energy dependent because the isotopic content of B and C elements is energy dependent (in a non-trivial way). Whereas the maximum bias is 'only' ∼ 3%, this is already significant compared to other AMS-02 uncertainties. Moreover, in AMS publication, the uncertainty associated with the conversion is estimated to range from 1% (lowest energy) to 4% (highest energy), which does not reflect our results. For all these reasons, we conclude that AMS-02 data, and in general all data, should be fit in their native energy scale in order to avoid a non-necessary bias introduced by converting the data to another energy scale. We

Fig. A.2.
Top panel: B/C residual (vs R) calculated from the difference between AMS-02 data and our reference model (best-fit model). Bottom panel: B/C residual (vs E k/n ) calculated from the difference between various R-to-E k/n -converted B/C (red, blue and black lines) and the 'exact' B/C (reference model converted with correct isotopic content). The AMS-02 data vs E k/n are taken from Aguilar et al. (2016), and result from the same conversion as done for the solid black line. See text for discussion stress that the usine package allows one to fit any combination of data in their native energy scale.

Appendix B: χ 2 with covariance or nuisance
To characterise the impact of the uncertainties on the model parameters, we rely on the χ 2 analysis implemented in usine and described in Maurin (2018), using the minuit package (James & Roos 1975) for minimisation. In particular, the minos option in minuit allows to reliably reconstruct asymmetric error bars on the parameters, taking into account both parameter correlations and non-linearities. The generic form of the χ 2 we use is where we loop over all time periods t (corresponding to different modulation levels) and all quantities q selected in the minimisation. The quantities D cov and N are detailed below.
Covariance The quadratic distance D cov measures the distance between the data and the model, accounting for a covariance matrix C, 16 which correlates i j energy bins (n E bins in total). Without correlations, C is diagonal (systematic errors σ k on data), and we recover the standard expression Covariance from relative errors As discussed in Sect. 5, we built for each AMS-02 systematics α the covariance matrix of relative errors C α rel . The latter can be related to the covariance C α require for Eq. (B.2) in two different ways: While using C data may seem more natural, Blobel (2006) showed that if an overall normalisation factor is present in the data, including it in the fit should be done via a factor in the model, not in the data; otherwise, the reconstructed model parameters are biased (see also D'Agostini 1994). For this reason we decided to use C model in our analysis. We note however that a global normalisation factor corresponds to a situation in which the correlation length is infinite, which is not the case for the data we consider (see Sect. 5). To ensure that either using Eq. (B.4) or (B.5) does not affect our conclusions, we fit 10 000 mock B/C data under these two assumptions, and checked that (i) the input model parameters were recovered in both cases, and (ii) up to the level of precision reached, potential biases were much smaller than the 1σ uncertainties on the reconstructed parameters.
Nuisance parameters Nuisance parameters are parameters contingent to the analysis performed, but whose value can affect the result of the analysis. An example is given by CR cross sections, that are instrumental for the model calculation, but whose values and uncertainties were determined by 'external' experiments. Nuisance parameters can appear at various levels of the modelling: (i) global nuisance parameters N related to the model and thus independent of the data (e.g. cross sections), (ii) timedependent nuisance parameters N t (e.g. modulation parameter for a specific data-taking period), (iii) data-dependent nuisance parameters N t,q (e.g. systematic errors on data as an alternative to using a covariance matrix). In principle, any probability distribution function is possible, and it is determined from the auxiliary experiment. However, in usine, only Gaussian-distributed nuisance parameters are enabled, so that each adds in the χ 2 , Eq. (B.1), a contribution whereȳ and σ 2 y are the mean and variance of the parameter, and y the tested value.

(C.2)
This equation can readily be written as a matrix equation M is a tridiagonal matrix defined by its coefficients Solving this system requires to fix the boundary conditions. Several possibilities have been tested in Appendix D.
As regards the low-energy boundary at x min ≡ x 0 , we list several suitable prescriptions, and report results for the corresponding b 0 and c 0 in the half-upper part of which implies that u −1 = 2 u 0 − u 1 . We compute the coefficients b 0 and c 0 for a first (L2) and second (L3) order accurate method; the former was used in Donato et al. (2001). -No phase space density gradient (L4). The phase space distribution f is flat for a CR momentum p = 0. We implement this condition at x 0 . Requiring that ∂ f /∂p vanishes translates into ∂(u/pE) ∂p If written in term of x = ln E k it reads If we discretise this condition, we are led to ∂u (C.11) and get, according to (LeVeque 1998), a second order accurate method. Injecting this condition into the differentiation scheme let us define b 0 and c 0 . Top: first matrix coefficients a 0 and b 0 (Eqs. C.5 and C.6) for low-energy boundary conditions (prescription L3). Bottom: last matrix coefficients b K and c K (Eqs. C.6 and C.7) for high-energy boundary conditions (prescription H4).

Low-energy conditions
At high-energy (i.e. at the highest point x max ≡ x K of the grid), several conditions can be implemented along the same lines. The resulting coefficients a K and b K are listed in the halfbottom part of Table C.1.
-No energy flow (H1). The condition J E = 0 at x K translates into J K+ 1 2 = 0. -No curvature in the spectrum (H2 and H3). We require that which implies that u K+1 = 2 u K − u K−1 . -No energy losses nor diffusive reacceleration (H4). As discussed in Appendix D, the CR density u is given by u 0 at high energy insofar as energy losses and diffusive reacceleration do not play any role in this regime. We require that u(x K ) = u 0 (x K ), hence the condition a K = 0 and b K = 1 of

Appendix D: Stability of the numerical solution
The numerical solution of Eq. (4) might exhibit instabilities when diffusive reacceleration vanishes with the Alfvénic speed V a . To explore the onset of these instabilities and to remedy them, we consider the same 1D geometry as discussed in Sect. 2.1, that is a thin disc of half-thickness h and a magnetic halo of half-thickness L. We focus on Model A, presented in Sect. 2.2, that is a standard diffusion/convection/reacceleration transport model. For definitiveness, all figures presented in this Appendix are based on the following values for the transport parameters: K 0 = 0.030 kpc 2 Myr −1 , δ = 0.65, η t = −0.49, L = 10 kpc, V c = 15.1 km/s and V a = 74.6 km/s. These values are among those that give a good fit to the B/C ratio and as such are sufficient to illustrate our discussion.

D.1. Simplified 1D model and solutions
Transport equation The CR density in space and energy u(z, E) fulfils the transport equation where z is the vertical co-ordinate. The source term q acc denotes the rate with which CRs are injected. CRs diffuse with a spatial diffusion coefficient K that follows Eq. (1), are convected away from the disc at velocity V c , suffer from energy losses at a rate b(E) < 0 (ionisation, Coulomb friction, and adiabatic expansion in the wind), or gain energy via an energy diffusion coefficient 17 K EE = (2/9) × V 2 a β 4 E 2 /K. CR injection, as well as energy losses and energy diffusion are localised in the disc.
From now on, the Galactic disc is treated as in the infinitely thin limit, and all nuclear interactions on the interstellar medium (ISM) have been discarded. Requiring that the CR density vanishes at the boundaries z = ±L of the magnetic halo allows to straightforwardly express u(z, E) as a function of its value inside the Galactic disc u(E, 0).
Timescales Transport inside the magnetic halo, energy losses and diffusive reacceleration are the three processes at play in the transport of CR nuclei. To determine which of these processes is dominant and inside which energy range it prevails, we can calculate the associated timescales. Galactic diffusion and convection can be combined into the residence time of CRs inside the Galactic disc where τ conv = h/V c and τ diff = hL/K are the convection and diffusion timescales. For energy losses, we define τ loss as the ratio −E k /b(E), where E k is CR kinetic energy. Diffusive reacceleration occurs over a timescale τ DR ≡ E 2 k /K EE . These timescales are plotted as a function of kinetic energy E k in Fig. D.1. The behaviour is fairly generic and the same trends appear for heavier nuclei as well as for secondary species.
All these processes can be combined through the effective timescale τ eff which we define as High-and low-energy analytical solutions We are only interested in the solution in the disc, u(z = 0, E) ≡ u, and using the above timescales the transport equation (D.1) boils down into the PDE -High-energy limit: space diffusion dominates over the other processes. As energy losses and diffusive reacceleration do not play any role in this regime, the solution to the CR transport equation (D.4) is (D.5) -Low-energy limit: energy losses dominate and diffusive reacceleration can be neglected. The transport equation (D.4) has an analytic solution which can be cast into the form where the pseudo-timet is defined as For above-mentioned reasons, the analytic solutions u 0 and u loss become equal in the high-energy limit. We have set them equal at the highest energy point E k,max of our analysis, for which a value of 10 3 GeV is assumed.
These solutions are used below to check the precision of the numerical calculation.
Numerical solution The numerical solution of Eq. (D.1) is obtained as follows. First, the equation can be recast into Eq. (4), where the coefficients α, β, and γ, of our simplified model are As explained in Appendix C, this Eq. (4) can be put on a grid in x ≡ ln E k/n to numerically solve the equation. The solution depends on the boundary conditions implemented, the impact of which is studied below.

D.2. Impact of boundary conditions
Various boundary conditions can be implemented at the lowest x min ≡ x 0 and highest x max ≡ x K energy points of the x-grid as shown in Table C.1.

Reference boundary conditions vs analytical solutions: At
x max , the four boundary conditions H of Table C.1 yield the same CR proton flux and we always find that u is close to u 0 above a few tens of GeV. We have decided to implement prescription H4, which is the most natural condition given that τ eff τ disc at high energy. At x min , the prescription that yields the most stable behaviour is L3 with ∂ 2 u/∂x 2 = 0 up to second order. Our fiducial conditions are therefore L3 and H4. For illustrative purpose, Fig. D.2 shows a comparison of the analytical and numerical solutions 18 . The long dashed-dotted black curve stands for the approximation u 0 , for which energy losses and diffusive reacceleration are switched off. The solid black curve features the solution u loss , where diffusive reacceleration alone is suppressed. The exact solution u is featured by the short dashed purple and long dashed orange curves. The former is obtained through the direct inversion of Eq. (C.3) while for the latter, a Crank-Nicholson recursion is used to get u CN converging from u 0 to the exact solution u. Both results agree with a precision better than 10 −10 . 18 The source term has been set proportional to 1/ √ β R α to grossly match the proton data. Notice that we have not performed a fit since   Table C.1. Above 3 MeV, all fluxes agree up to double precision. Below that energy, some differences appear. Condition L2 always yields a flux that agrees with the fiducial result with a precision better than 10 −4 . Condition L4 is associated with moderate wiggles, with a relative difference that nevertheless reaches 10% at 1 MeV. The worst prescription is L1 which generates very large instabilities exceeding 100% below 2 MeV. It is remarkable that in spite of these, the fiducial result is obtained above 3 MeV.
In the regime where diffusive reacceleration is switched off, the numerical solution u of Eq. (D.4) is given by the analytic solution u loss displayed in relation (D.6). This situation offers a unique opportunity to investigate how low-energy boundary conditions affect the stability and precision of the numerical solution. To this purpose, we have used the cosmic-ray transport parameters of Model A with the exception of a vanishing Alfvénic speed V a . The relative difference between u and u loss is plotted as a function of proton kinetic energy in Fig. D.4. The numerical solution is derived by direct inversion of Eq. (C.3). Depending on the prescription used at x min , u can be very close to the actual result u loss or completely out of range. As featured by the short dashed purple curve, the most precise condition is L3 with a level of precision of 10 −4 . Condition L2 yields also a very accurate solution u with a relative error of at most 10 −3 at 100 MeV. As could have been anticipated from Fig. (D.3), setting J E = 0 yields the worst numerical result which is orders of magnitude larger than the correct solution below 30 GeV. Finally, condition L4 only yields the correct result above 70 GeV. We find that the relative difference between u and u loss even exceeds 100% below 2 GeV, as exhibited by the short dashed-dotted green curve of Fig. D.4. D.3. Numerical stability when V a → 0 Although condition L3 yields the most precise solution, the short dashed purple curve of Fig. D.4 exhibits wiggles for vanishing Alfvénic speed. In our example, these instabilities never exceed a level of 10 −4 and have no effect on the numerical solution u. In some configurations though, in particular those with a less finegrained x-grid, they could reach a level where they would impair the capability of the fitting routine used in the B/C analysis. It is then important to understand the reason for these instabilities and to remedy them.
Is it specific to the solver used? To commence, we have investigated if these instabilities are related to the method used to derive the numerical solution u. In the direct inversion procedure, the matrix M defined in Eq. (C.4) is inverted through a fast recursion that takes advantage of its tridiagonal nature. One may wonder if this procedure does not generate numerical errors insofar matrix M could be far from the unity matrix I. Complementarily, the Crank-Nicholson procedure makes use of the matrix I + M ∆t/2 which is arbitrarily close to unity if the time step ∆t of the recursion is small enough. We find that deriving u through a Crank-Nicholson recursion yields a relative change with respect to the direct inversion result of Fig. D.4 (short dashed purple curve) which is always less than 10 −9 above 10 MeV while reaching a maximum of 4 × 10 −6 Fig. D.4. The cosmic-ray transport parameters of Model A are used, except for the Alfvénic speed V a set equal to 1 m/s. In this regime, the numerical result u of Eq. (D.4) is equal to the analytic solution u loss . The relative difference between u and u loss is plotted as a function of kinetic energy E k . The low-energy boundary prescriptions of Table C.1 are respectively featured by the solid red (L1), long dashed orange (L2), short dashed purple (L3) and short dashed-dotted green (L4) curves. The most precise condition is L3 while the worst one is L1.
at E k = 2 MeV. In these calculations, the Alfvénic speed is V a = 1 m/s. Increasing the speed alleviates further the discrepancy between the two numerical results. The difference is at most 2 × 10 −6 for a velocity of 1 km/s and decreases below 4 × 10 −7 at 1.75 km/s. We conclude that the same wiggles appear should u be derived by directly inverting Eq. (C.3) or by letting u evolveà la Crank-Nicholson. The origin of instabilities has to be looked elsewhere.
Failure of 2 nd -order schemes to solve 1 st -order equations While performing the previous check, we have serendipitously observed that the wiggles disappear as V a increases. In the panels of Fig. D.5, four different values have been assumed for the Alfvénic speed and the relative difference |u − u loss |/u loss is plotted as a function of E k for each of them. In the upper panel, the numerical solution u exhibits instabilities which are no longer visible in the lower panel. The solution becomes smooth for a critical value of order 1.75 km/s. Above that speed, u slowly departs from u loss as diffusive reacceleration starts to be felt by the proton flux.
A tentative explanation for the presence of instabilities is that when V a is vanishingly small, the numerical result u is not derived with the appropriate method. The transport equation (D.4) becomes first order in this regime and only one boundary condition suffices to determine its solution. We have actually obtained u loss by requiring that it should be equal to u 0 at the highest energy point. Strictly speaking, a low-energy boundary condition is no longer necessary. Of course, this is not as simple as that since we proceed numerically through the inversion of matrix M whose elements a k , b k and c k depend on the functions α, β and γ as discussed in Appendix C. Energy losses and diffusive reaccel- When diffusive reacceleration vanishes, we expect the proton flux to be given by the analytic solution u loss . The relative difference between the numerical result u (direct inversion) and u loss is calculated with the low-energy boundary prescription L3. As V a increases from 1 m/s to 2.5 km/s, u becomes more stable and wiggles disappear. The transition occurs for a critical value of V a ∼ 1.75 km/s. The number of bins per decade of energy is N dec = 50. eration respectively enter in the definition of matrix M through the combinations α β/∆x and α γ/∆x 2 , with ∆x the spacing of the energy grid.
Regularisation of the 2 nd -order scheme From a numerical perspective, the Alfvénic speed vanishes when α γ/∆x 2 is negligible with respect to 1, as is clear from Eq. (C.6). To explore this regime, we define the numerical strength of diffusive reacceleration through the ratio α γ ∆x 2 ≡ τ disc τ DR ∆x 2 , (D.9) Fig. D.6. The ratio τ disc /τ DR ∆x 2 is plotted as a function of kinetic energy E k for three different configurations. In all cases, the parameters of Model A have been assumed with the exception of the Alfvénic speed. The solid black curve corresponds to the critical value V a = 1.75 km/s above which the instabilities which affect the numerical solution u in Fig. D.5 are noticeably reduced. For that velocity, the ratio τ disc /τ DR ∆x 2 reaches a maximum of 0.5. Enlarging the range of Alfvénic speeds for which the onset of stability occurs yields the yellow band. The long dashed red and short dashed-dotted purple curves both correspond to V a = 0.5 km/s. In the former case, the spacing N dec of the energy grid is 25, whereas it is 300 in the latter.
which we have plotted as a function of kinetic energy E k in Fig. D.6. Model A has been assumed with the exception of V a . The solid black curve corresponds to an Alfvénic speed of 1.75 km/s. At that critical value, the instabilities of the numerical result u start to recede, as featured in the lower panel of Fig. D.5 by the smoothness of the short dashed purple curve above 300 MeV. Concomitantly the ratio τ disc /τ DR ∆x 2 reaches a maximum of 0.5. Notice that the onset of stability is an illdefined process which takes place for Alfvénic speeds between 1.5 and 2 km/s, hence the yellow strip of Fig. D.6. The prescription which we propose for getting rid of the numerical perturbations of u is to require the ratio τ disc /τ DR ∆x 2 to overshoot that band, with a maximum exceeding a benchmark value of 0.7. Because the energy grid is made coarser with fewer bins per decade, the interval ∆x increases and we expect the above criterion to be fulfilled for larger values of V a . This is actually what we observe. So far, all the results presented in Appendix D are based on 50 bins per decade. If we degrade the resolution of the x-grid and use 25 bins per decade, we find that wiggles start to recede when the Alfvénic speed exceeds a critical value of 1.75 × 2 = 3.5 km/s. Conversely, if the xgrid is refined with 100 bins per decade, the transition occurs at 1.75/2 = 0.875 km/s. As a final consistency check, we have derived u with an Alfvénic speed V a of 0.5 km/s and two different values for the energy spacing N dec . Our results are featured in Fig. D.7 where the same line patterns and colour codes as in Fig. D.6 have been used for the two lower curves. The long dashed red line has been derived with 25 bins per decade. Notice how the correspond- ing curve of Fig. ??. We expect u to exhibit numerical instabilities which we actually observe in Fig. D.7. In the case of the short dashed-dotted purple curve, a more refined grid is used with N dec = 300 and the numerical solution u is smooth. The stability condition is now satisfied as shown by the corresponding curve of Fig. D.6.
Recommendation and conclusion To conclude this Appendix, let us discuss how to implement practically the criterion which we have found. To ensure the stability of the numerical result u, we require the ratio τ disc /τ DR ∆x 2 to reach a maximum in excess of 0.7. In the regime where the Alfvénic speed is very small, this implies a very fine structure of the energy grid. In Fig. 1 for instance, the reference B/C case is derived with 5000 energy bins per decade. Our study confirms that this procedure leads to the correct CR flux. However, the CPU time significantly increases with N dec and the B/C fit may become impracticable. The procedure which we suggest is to fix N dec at a benchmark value of 50 for instance. For a given set of CR propagation parameters, the critical value V S a of the Alfvénic speed at which u becomes stable can be determined from the ratio τ disc /τ DR ∆x 2 calculated, say, at the lowest energy point. In practice, τ disc and τ DR are respectively decreasing and increasing functions of E k . This procedure ensures that V S a is always much smaller than the Alfvénic speed at which diffusive reacceleration becomes as important as disc transport. With N dec = 50, the former is only 3.8% of the latter. During the B/C fit, V a is forced to be larger than the lower limit V S a which we find, in the case of Model A, to be 1.75±0.25 km/s. In this configuration, a very rough criterion is to require that the ratio V 2 a /K 0 ∆x 2 exceeds 5 × 10 −2 Myr −1 or, alternatively, that V 2 a /K 0 is larger than 10 −4 Myr −1 .  Fig. E.1. Impact of inelastic cross-section uncertainties on B/C ratio for specific reactions as a function of rigidity, shown for Model A and Model B discussed in Sect. 2.1. In each panel, two quantities are shown: the relative difference between a cross section (of a given reaction) and a reference parametrisation T99 in blue (the associated y-axis is on the right-hand side of the plot, also in blue), and the associated impact on the B/C ratio for this cross-section parametrisation w.r.t. to the reference B/C (the associated y-axis is on the left-hand side in black). To guide the eye, the vertical red line indicates the rigidity of the first AMS-02 data point. The bottom panels show the overall impact when all reactions (i.e. all nuclei in the network) are replaced. For the latter panel, dark and grey curves correspond to IS and modulated (φ FF = 0.8 GV) B/C ratio to emphasise that results are independent of the modulation level.