# How to run a Polarized fit

The user should first refer to the detailed guide on how to run a standard unpolarized PDF fit. Most of the steps in that guide still apply here and in the following section we only highlight the differences.

## Preparing a runcard and running a fit

The writing of a polarized fit runcard follows exactly the guideline described in Preparing a fit runcard. The user only needs to modify and adjusts various entries.

In polarized fits, the positivity of the polarized PDFs are enforced using as
a boundary condition an unpolarized PDF set. The information on how such a
constraint is enforced is defined under the key `positivity_bound`

as follows:

```
# Define the unpolarized PDF set to be used as BC for positivity
...
positivity_bound:
unpolarized_bc: NNPDF40_nnlo_pch_as_01180
n_std: 1.00 # Standard Deviation to be added as Shift
...
```

where `unpolarized_bc`

specifies the name of the unpolarized PDF set to be used
as a boundary condition while `n_std`

specifies the shift in terms of the standard
deviation to be applied to the PDF central values. If `n_std=0.0`

then the
PDF central values will be used to constrain their polarized counterparts.

Note

This will also be the PDF set to be used to compute observable predictions during the fit.

Instead, the unpolarized PDF set to be used to compute the t0 covariance matrix need to be specified under the `datacuts`

entry:

```
...
datacuts:
t0pdfset: NNPDFpol11_100 # PDF set to generate t0 covmat
unpolarized_bc: NNPDF40_nnlo_pch_as_01180
q2min: 1.00 # Q2 minimum
w2min: 4.00 # W2 minimum
...
```

And if a theory covariance matrix is included in the fit
(see how to include a theory covariance matrix in a fit
for more details), then the unpolarized PDF set also needs to be specified in the
`theorycovmatconfig`

together with the polarized PDF to be used:

```
# Define the unpolarized PDF set to be used to compute predictions with validphys actions
...
theorycovmatconfig:
point_prescription: '7 point'
theoryids:
from_: scale_variation_theories
pdf: NNPDFpol11_100
unpolarized_bc: NNPDF40_nnlo_pch_as_01180
use_thcovmat_in_fitting: true
use_thcovmat_in_sampling: true
...
```

Given that polarized fits require different fitting bases and different theory
constraints, the fields under the `fitting`

key require some adjustments.
Specifically:

```
...
fitting:
fitbasis: POLARIZED_EVOL_CMP
sum_rules: TSR
basis:
- {fl: sng, trainable: false, smallx: [1.094, 1.118], largex: [1.46, 3.003]}
- {fl: g, trainable: false, smallx: [0.8189, 1.844], largex: [2.591, 5.697]}
- {fl: t3, trainable: false, smallx: [-0.4401, 0.9163], largex: [1.773, 3.333]}
- {fl: t8, trainable: false, smallx: [0.5852, 0.8537], largex: [1.533, 3.436]}
...
```

where `TSR`

specifies that only sum rules on the \(T_3\) and \(T_8\)
distributions are applied. If any of these values are specified differently the program will
raise an error. Note that for polarized fits, the basis name has to start with `POLARIZED_`

and then followed by the basis type (for example `EVOL`

or `FLAVOUR`

).

Note

While the treatment of integrability follows exactly the same concept as in the default unpolarized fits, the treatment of positivity in the polarized case requires specific treatment. Similar to the unpolarized fits, the cost function used to enforce the positivity is defined by the following quantity:

where:

with \(n_i=20\) and \(Q^2=5~\mathrm{GeV}^2\) chosen to be the same as in the unpolarized case. In the polarized case, omitting the \(Q^2\)-dependence, the expression of \(\mathcal{C}_k\) is rather given by:

\[\mathcal{C}_k(x_i) = \mathcal{F}_k(x_i) + \Sigma_k(x_i) - | \Delta \mathcal{F}_k(x_i) |\]

where \(\Sigma_k(x_i)\) represents the one standard deviation error computed at \(x_i\) for the flavour \(k\). \((\Delta) \mathcal{F}_k\) can be a (p)PDF of flavour \(k\) or the longitudinally (polarized) structure functions \((k=1)\). The way in which the unpolarized prediction uncertainties are accounted for during the fit is by sampling according to a normal distribution and ought to enforce the following inequality:

where the subscript \(r\) indicates that the random seed per replica is always different. In practice, when imposing the positivity at the level of PDFs, we enforce the constraints on the individual flavor \(\Delta f_i\) (or respectively \(\Delta \bar{f}_i\)), that is \((\Delta) \mathcal{F}_k \equiv (\Delta) f_k\) (or respectively \((\Delta) \mathcal{F}_k \equiv (\Delta) \bar{f}_k\)).

Once the runcard is ready, the user can follow the guidelines here to set up and run fits.

## Evolving the fit

In order to evolve the fitted replicas, we have to use the polarized DGLAP evolution. This
can simply be done by supplementing a flag to the `evolven3fit`

:

```
evolven3fit evolve $runcard_folder --use_polarized
```

## Comparing polarized fits

Additionally, a specific report template should be used when comparing two polarized
fits. This can be done by simply using the `--use_polarized`

when calling `vp-comparefits`

:

```
vp-comparefits -i --use_polarized
```

To read in details on how to compare two fits, head to the following documentation.