{'fraction_non_alphanumeric': 0.03367759317467445, 'fraction_numerical': 0.009797118014450748, 'mean_word_length': 4.625258323765786, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Monte Carlo for POLarized (semi-inclusive) Deep Inelastic Scattering

POLDIS is a Monte Carlo program for polarized (semi-inclusive) deep inelastic scattering (DIS). Unpolarized DIS events are generated with the existing lepto-production event generators LEPTO for DIS and AROMA for Heavy Flavor production. The relevant spin asymmetries are computed at partonic level to first order in alpha_s for each generated event, and are then convoluted with the corresponding ratio between the polarized and unpolarized parton distribution functions (i.e. parton polarization). This procedure provides a polarization weight for each event. The average of these polarization weights gives the polarized cross section spin-asymmetry for the generated sample. The code consists of a set of subroutines to be linked with LEPTO and/or AROMA.


Introduction
Polarized lepton-nucleon deep inelastic scattering (DIS) has been studied in the last decades by several experiments which have measured spin asymmetries over a wide kinematic range [1,2]. These experiments have determined the spin structure functions of the proton and the neutron and have tested the related sum rules. When interpreted in the framework of the quark-parton model the experimental results show that the quark spins account for only a rather small fraction of the nucleon spin, thus implying an appreciable contribution either of gluons or possibly of orbital angular momentum. These data indicate also a large positive contribution of u quarks, a negative contribution of d quarks, and, surprisingly, a small negative contribution of s quarks to the proton spin [1]. A general introduction to this subject can be found for example in [3,4].
Inclusive polarized DIS measurements do not allow one to distinguish the role of each individual partonic component. A further separation of the contributions of different constituents to the nucleon spin, like ∆s or ∆G, requires additional input from the study of semi-inclusive DIS, for which only limited data have been obtained so far [5]. In these experiments, in addition to the scattered lepton, one detects also one or more hadrons produced in the interaction. For instance, the study of polarized open-charm lepto-production allows to access the gluon polarization ∆G in a polarized nucleon [6].
In this work we present POLDIS, a program designed to simulate polarized DIS experiments, with particular emphasis on semi-inclusive DIS and Heavy Flavor lepto-production in the quasi-real photo-production limit (Q 2 → 0). For these processes, POLDIS generates the spin-dependent cross section asymmetries between parallel and antiparallel configurations of the incident lepton beam and target nucleon (or proton beam) polarizations, which are measured in these experiments. Since these asymmetries are ratios of cross sections no absolute normalization is needed in their evaluation. The spin-dependent cross sections can be extracted from these spin asymmetries and the spin-independent cross section.
In this program electromagnetic processes mediated by one photon exchange are implemented. The present code can be used over a wide kinematical range, where the effects of the weak interaction can be neglected, i.e. for Q 2 ≤ 100 GeV 2 ≪ M 2 Z 0 . The implementation of the polarization in POLDIS can be summarized in the following steps: 1 -generation of an unpolarized event, 2 -calculation of the partonic level hard-scattering spin asymmetry for this event, 3 -evaluation of the final spin asymmetry and of the spin-dependent cross sections.
The unpolarized event generation is performed with the LEPTO [7] Monte Carlo and the AROMA [8] code for Heavy Flavor (HF) production. The hadronization is based on the LUND string model, which is known to reproduce fairly accurately the final hadronic state in a variety of processes, and is performed with JETSET [9]. The hard-scattering spin asymmetries are calculated for each generated event to order α s 1 and are convoluted with the ratio between the corresponding polarized and unpolarized parton densities (i.e. parton polarization). A polarization asymmetry weight is thus obtained, and the average of these weights for the generated sample gives the polarized cross section asymmetry. The spin-dependent cross sections can be obtained from this asymmetry and the spin-independent cross section. These calculations are performed in a set of subroutines to be linked with the existing unpolarized lepto-production event generator LEPTO [7] for DIS and AROMA [8] for HF production, and JETSET [9] for the hadronization. No modification to these programs is required. The unpolarized parton densities are obtained from the PDFLIB library [10]; various polarized parton densities can be selected from a collection of some existing parametrizations provided with this program, although in a less standardized form. POLDIS has been tested with the most recent versions of these programs (LEPTO 6.5, AROMA 2.2, and JETSET 7.4); it is also backward compatible with older versions.
A Monte Carlo code for polarized DIS with similar aims, PEPSI, has been presented a few years ago [11]. Similar results could, in principle, be obtained with PEPSI; however no Heavy Flavor generation is included in that program. In order to generate the spin asymmetries, which are indeed the measured quantities, it requires separate runs for opposite spin configuration in addition to a run without polarization. This results in a less convenient usage compared to that adopted in POLDIS. Additionally, POLDIS can also generate simultaneously different asymmetry values using different polarized parton densities.
In the next Section we present the kinematics, formalism, and formulae for the polarized DIS. The partonic level hard-scattering spin-independent and spin-dependent cross sections, calculated to first order in α s are summarized in Appendix A and B. Section 3 describes the structure of the program and the implementation of the physics presented in Section 2. The usage of the program is explained in Section 4. We conclude in Section 5 with a comparison between the scattering asymmetries simulated by our program for some reactions and experimental data.

2
Polarized cross sections 2.1 Kinematics Figure 1 depicts a deep inelastic scattering (DIS) event. The four-vectors k µ = (E, k) and k ′µ = (E ′ , k ′ ) represent the momenta of the incoming and scattered lepton, respectively, and q µ = k µ − k ′µ is the momentum transfer from the lepton to the hadron (γ * four-momentum).
The target nucleon of mass M has four-momentum p µ , and p µ i is the four-momentum of the i th hadron produced in the interaction. The interaction is usually described with the following variables: The right-hand side of each equation is valid only in the laboratory frame, where the target nucleon is at rest, and θ is the lepton scattering angle. The kinematics for inclusive scattering, integrated in azimuth, is completely described by two of the four variables given above, say x and Q 2 . When describing semi-inclusive scattering, three additional variables are needed for each measured hadron; a common choice for these variables is the energy fraction of the hadron with respect to the γ * energy the hadron transverse momentum p T with respect to the γ * direction, and the azimuthal angle between the scattered lepton and the outgoing hadron.

Cross section asymmetries
In a polarized DIS experiment one measures the asymmetries for longitudinal and transverse configurations of the incident lepton and target polarizations. The spin orientations in Eq. 3 refer to the laboratory frame, where the target nucleon is at rest. These asymmetries are directly related to the polarized structure functions g 1 and g 2 . In this paper only the longitudinal asymmetry A is discussed (and included in POLDIS). In the next pages, we will use the following notation for this asymmetry: A LL ≡ A . Usually the scattering asymmetry results are presented in terms of the virtual photon asymmetries A 1 and A 2 where σ T J is the virtual photon absorption cross section in a configuration with total angular momentum J along the incident photon direction, and σ T L is the interference term between transverse and longitudinal virtual photon nucleon scattering.
A 1 and A 2 are related to the measured asymmetry A LL by in the high energy limit (large ν) and neglecting the incident lepton mass. D is the depolarization factor of the virtual photon with respect to the incident lepton, and is the ratio between the unpolarized cross section for the longitudinal and transverse virtual photon components. The ratio R = R(x, Q 2 ) can be obtained from the QCD analysis of unpolarized inclusive DIS data. In practice, however, one uses parametrizations of R obtained directly from DIS experiments (see Section 3.3).
The virtual photon asymmetries are bounded by the positivity relations Since also η ≪ 1 in the kinematic range of most high energy experiments, the term proportional to A 2 can be neglected, and In POLDIS both asymmetries, A LL and A 1 , are generated.

Partonic cross sections
Owing to factorization, the unpolarized (polarized) DIS cross section can be written as a convolution of the unpolarized (polarized) parton distribution function F (∆F ) with the partonic hard-scattering cross sections dσ (d∆σ): Here λ refers to the parallel ↑↑ (λ = +1) and antiparallel ↑↓ (λ = −1) spin configuration of the incoming lepton and target nucleon in the γ * − N c.m.. The terms dσ and d∆σ are the spin-independent and spin-dependent parts of the partonic hard cross section. One introduces also the partonic asymmetry a LL for the hard-scattering process The scattering asymmetry A LL for the reaction is obtained from where the sum runs over the hard-scattering sub-processes calculated to first order in α s (the corresponding Feynman diagrams for dσ are shown in Fig. 2), and is integrated over the accessible phase space. Using the partonic scattering asymmetry a LL , the asymmetry in Eq. 14 can be rewritten, as In the Monte Carlo calculation, dσ F can be viewed as the cross section weight, and a LL ∆F/F as the asymmetry weight for the generated event. The integrals in Eq. 15 are performed by summing these quantities for all events in the generated sample.

2.4
Hard cross sections at order α s in QCD The leading order (L.O.) parton level process is the virtual photo-absorption γ * + q → q (Fig. 2a). At first order in QCD the gluon radiation (Compton diagram) γ * + q → q + G (Fig. 2b) and the photon-gluon fusion (PGF) γ * + G → q +q (Fig. 2c) also contribute to the DIS cross section. Since for the latter two processes there are two partons in the final state, the first order matrix elements involve three new degrees of freedom in addition to the two variables, say x and Q 2 , needed for the L.O. DIS diagram (Fig. 2a). These three new degrees of freedom correspond to the energy, polar angle, and the azimuthal angle φ between the lepton and QCD scattering plane of one of the final partons (the other is fixed by the kinematics). A suitable choice for these new degrees of freedom is [12]: where ξ is the momentum fraction of the incoming parton, and p q is the momentum of the final quark, and the cross sections are five-fold differential In the virtual boson-parton c.m. frame the unpolarized cross section dσ can be decomposed as [12]: ) and the polarized cross section d∆σ as: The cos 2φ term does not appear in Eq. 19, because it enters only in the cross section for the virtual photon longitudinal component, and therefore cancels in ∆σ. After integration over the azimuthal angle φ, only the first term on the right-hand side of Eqs. 18 and 19 remains (i.e. dσ 0 and d∆σ 0 ). When studying HF production, the masses of the quarks must be taken into account. In this case the helicity does not coincide with the quark spin: q ±1/2 = q R/L + O m/ √ŝ (the subscript ±1/2 denotes the quark helicity, and q R/L = 1/2(1 ± γ 5 )q). The HF photon-gluon fusion spin asymmetry a LL reaches the value −1 of the massless case only in the asymptotic limit of very high energies, while at threshold a LL = +1. In the HF lepto-production via the PGF the relevent scales of the process are set by the HF quark mass m Q , and, therefore, this process can be studied also in the quasi-real photo-production limit of Q 2 → 0.
In Appendix A we summarize these partonic cross sections calculated for one photon exchange following the cross section decomposition of Eqs. 18 and 19. In Appendix B we summarize the same cross sections expressed in terms of the Mandelstam variablesŝ,t, andû integrated over the azimuthal angle φ. The unpolarized cross sections have been derived in [12] for the massless case and in [13] for HF. The polarized ones were re-derived by us, extending also the results of [11,14,15].
The partonic scattering asymmetry a LL is obtained from Eq. 13 by adding up the various terms of the cross sections in Eqs. 18 and 19, which are summarized in Appendix A. For instance, the L.O. scattering asymmetry is POLINI (S) initializes the (un)polarized parton distribution functions POLASYM (S) calculates the polarization weight for each generated event with calls to the functions for the calculation of the spin asymmetries calls to the subroutines for the extraction of unpolarized and polarized parton densities, and the calculation of R POLSTR (S) returns the values of the polarized parton densities at given x and Q 2 (PDG flavor code convention) POLINTL (S) contains the internal set of polarized parton densities POLEND (S) gives the spin-dependent cross sections (Monte Carlo estimate) gives the value of R at given x and Q 2 POLDISU (C) contains the POLDIS settings and parameters which include also the asymmetry values For the other Feynman diagrams shown in Fig. 2, the partonic asymmetries result in much more complicated expressions. In Figure 3 we plot the partonic scattering asymmetries a LL of order α s as a function of the c.m. scattering angle ϑ * between the incoming and outgoing partons for various values of the γ * momentum transfer Q 2 and of the c.m. energyŝ. To be noted the Q 2 dependence of these asymmetries. The angle ϑ * is given by 3 Structure of the program POLDIS consists of a set of subroutines for the handling of the polarization, which are linked with the unpolarized lepto-production event generetor LEPTO [7] or AROMA [8]. The hadronization is performed with JETSET [9] using the LUND string model. No modifications to these event generators is required. The PDFLIB library [10] is used as a source for the unpolarized parton distribution functions. We assume familiarity with these programs. Various polarized parton distribution functions, obtained from their authors, are also included, although in a less standardized form. The general structure of POLDIS is similar to a typical Monte Carlo program using LEPTO or AROMA with the addition of calls to some subroutines for the polarization calculations. POLDIS produces in output, in addition to the standard LEPTO output, the polarized scattering asymmetries A LL and A 1 , and the spin-dependent cross sections. POLDIS (as LEPTO) is a slave program, in the sense that the main steering code for the administration of the event generation and the subsequent analysis of these events, has to be provided by the user.
• At the initialization stage standard LEPTO and/or AROMA parameters and switches are selected. Additionally, a parametrization for the polarized distribution functions and for R = σ L /σ T are chosen, and a kinematical interval is defined for the simulation. In the subroutine polini the selected polarized distribution functions are read from the corresponding ASCII file(s). Immediately after that the unpolarized event generator is initialized with a call to linit (LEPTO) or arinit (AROMA).
• In the event loop unpolarized events are generated with calls to lepto (or aroma). The asymmetry is calculated for each event in the subroutine polasym, and the asymmetry results are stored in the common block /poldisu/. At this point the user can perform additional analysis on the generated event: for instance, he can select a binning e.g. in x or y for the asymmetries A LL and A 1 , or study semi-inclusive asymmetries by requiring in the event a π + with z > 0.2.
• In the ending stage the spin-dependent cross sections are estimated in the subroutine polend. The relevant results are printed in the form of a table.

Asymmetry evaluation
The scattering asymmetry a LL is calculated for each generated event according to the underlying sub-process and the kinematic variables given by the unpolarized event generator. The unpolarized (F ) parton densities are evaluated at the given x and Q 2 . The polarized (∆F ) parton densities are also evaluated at the given x and Q 2 for 2 or 3 subsets of the selected polarized parton distribution functions set (see Section 3.2), and the parton polarizations, ∆F/F , are thus obtained. The polarization weight is finally calulated for all subsets. The values of the asymmetries A LL and A 1 are updated event by event: N is the number of events generated so far, and D is the virtual photon depolarization (Eq. 6). The values of the asymmetries corresponding to different ∆F 's from the same subset are stored in the common block /poldisu/. The statistical accuracy on the asymmetries depends on the number of generated events N and goes as 1/ √ N . To study, for instance, the x and/or Q 2 behavior of the asymmetry, the values of A LL and A 1 can be binned as a function of x and/or Q 2 .
The spin-dependent cross sections are obtained from the unpolarized cross section σ 0 and the scattering asymmetry A LL :

Polarized parton distribution functions
The following polarized parton distribution functions for the proton are presently included (in parenthesis are shown the corresponding unpolarized parton densities, which should be used for consistency and are automatically selected, and the x/Q 2 range of validity of the parametrization; the notation adopted is that of PDFLIB): Typically, each set of polarized parton densities contain two or three different parametrizations, obtained from the same analysis. The GS polarized parton distribution functions contain three subsets, referred as set A, set B, and set C. The GRSV polarized parton distribution functions contain two subsets, referred as standard and valence scenario. In POLDIS all subsets are used simultaneously, thus giving an output with two or three values for the spin asymmetries A LL and A 1 corresponding to the used subsets. The parton distribution functions are stored on a x/Q 2 grid for each parton component and stored in ASCII files. These polarized parton distribution functions have been obtained from the corresponding authors [16,17,18]. An internal set of polarized distribution functions is also included, mainly for debugging and apparatus studies. Different parametrizations can be implemented by the user by simply editing the subroutine polintl, which contains this internal set. This internal set can be also used, for instance, for evaluating the effects of a large negative sea polarization ∆s < 0 on the scattering asymmetry for a particular channel. It is assumed that these polarized parton densities scale as the corresponding unpolarized distribution functions (no dynamical generation of the sea and gluon polarization is performed). For instance, the following parametrization, based on the SU(6) spin structure of the proton combined with a soft gluon can be used (and it is included): For complex targets (i.e. containing several protons and neutrons) full isospin symmetry is assumed between protons and neutrons: ∆u p v = ∆d n v , ∆G p = ∆G n , etc., and possible nuclear effects are neglected.
The selection of a polarized parton distribution function set is performed by setting the corresponding switch to the desired value: 1 to 5 for the polarized parton densities listed above, 0 for the internal set, and −1 for no polarization. At the initialization stage in subroutine polini, in addition to the polarized parton density, the corresponding unpolarized one is also selected. Our default polarized parton distribution functions set is the GS-96LO, combined with the unpolarized ones of GRV-94LO.

Parametrizations of R
In most polarized DIS experiments the virtual photon asymmetry A 1 is obtained from the measured asymmetry A LL (Eq. 9, using a parametrization of R = σ L /σ T determined from unpolarized DIS data. A similar approach is also adopted in POLDIS. The following parametrizations are included (in parenthesis is shown the kinematic range over which R was estimated, and corresponds also to the region, where the parametrization can be used safely): The selection of the desired parametrization of R is obtained by setting the corresponding switch to the appropriate value: 1 to 3 for the parametrizations listed above, and 0 for R = 0. Our default is the NMC-97 parametrization.

POLDIS parameters
The common block /poldisu/ contains the program settings and parameters as illustrtated in Tab. 2.
COMMON / POLDISU / POLLST(10), POLPAR(40) In this common block different asymmetry values are stored. For each spin asymmetry and spin-dependent cross section there are three different values, which correspond to the three subsets of the selected polarized parton distribution functions set.

Interface with LEPTO
The relevant kinematics, program parameters, settings, and switches, used also for the asymmetry calculations, are stored in the LEPTO common block /leptou/: COMMON / LEPTOU / CUT (14), LST(40), PARL(30), X, Y, W2, Q2, U The correspondence between the kinematical variables stored in the common block /leptou/ to the ones discussed in the previous pages is: X ≡ x, Q2 ≡ Q 2 , Y ≡ y, U ≡ ν, and PARL(28) = x p , PARL(29) = z q , PARL(30) = φ.  Figure 4: a) Simulated inclusive asymmetry A p 1 compared to SMC data from polarized protons [22] using the GS-96LO set A (full line) and the GRVS-96LO standard scen. (dashed line) polarized parton densities and the NMC-97 parametrization of R. b) Same as (a) for A d 1 compared to SMC data from a polarized deuteron target [23].
The unpolarized cross sections measured in pb are stored in PARL(23) (numerical integration at the initialization stage) and in PARL(24) (Monte Carlo estimate).
The kinematics of the interaction and of all produced particles is stored in the JETSET common block /lujets/. 4 How to run POLDIS In addition to the standard LEPTO (and AROMA) input parameters and switches, such as the beam energy, target material, etc. (we assume the user to be familiar with them), two additional input switches are required (see previous Section): POLLST(1) = 0 to 5 for the polarized parton densities, and POLLST(4) = 0 to 3 for the parametrization of R. As already mentioned above, the user must provide a steering code for the administration of the event generation and analysis. Before the initialization of POLDIS and LEPTO the relevant parameters, switches, etc. must be set to the corresponding values.
At the end of the event generation loop POLPAR contains various asymmetry values and the spin-dependent cross sections associated with the subsets of the selected polarized parton density set.

5
Results of test runs The inclusive asymmetry A 1 , obtained with the GS-96LO set A and the GRVS-96LO standard scen. polarized parton densities and the NMC-97 parametrization of R, is compared in Fig. 4 to the SMC data from polarized proton [22] and deuteron [23] targets. A fairly accurate agreement between the simulated and the real data can be observed in these plots. It has to be noted, however, that polarized DIS data were used for the evaluation of the polarized parton distribution functions used here, and therefore this agreement can not be considered as a meaningful physics result. On the other hand, such an agreement shows the validity of the procedure adopted in the simulation and the correctness of the calculations. Figures 5 and 6 show the semi-inclusive asymmetries for positive and negative hadrons generated with POLDIS, respectively, compared to the SMC data [5] from polarized protons and deuterons. Also for this simulation we used the GS-96LO set A and the GRVS-96LO standard scen. polarized parton densities and the NMC-97 parametrization of R. In the Monte Carlo simulation a separation between charged pions and kaons can also be made.