1 Introduction

At LHC experiments, interest in \(\uptau \) leptons lies in the use of decays for the measurements of the properties of hard production processes, of the properties of resonances like W, Z or Higgs boson or in the searches for New Physics.

That is why, it was of interest to prepare a package called TauSpinner which can be used for changing with weights generated event samples including \(\uptau \) lepton decays. In many cases one can argue that such re-weighting of the sample with different physics assumptions may be of little use. Why not simply generate another series of events with different assumptions and compare distributions obtained from them? Indeed one can think re-weighting may bring little benefits and considerable risks, e.g. if the original sample has some sectors of the phase space biased by a particular technical cut-offs, or if it features zero matrix element on some hyper-surface within the phase space manifold. Arbitrary large weights may then appear. However, in several cases such disadvantages are balanced by the benefits. The weighted events sample is statistically correlated with the original one, thus the statistical errors affect the estimate of the differences only. Even larger CPU gain is expected, if the sample is processed with simulation of the detector effects. A full simulation of the detector response usually requires few orders of magnitude more CPU time than generation of physics events, or the calculation of events weight. Even the inclusion of Next to Leading Order (NLO) QCD effects in the generation can be CPU costly. Re-weighting to a different production process with the same final state (set of final states) can be also of interest. That is why the re-weighting algorithms of TauSpinner were prepared; simultaneously for \(\uptau \) lepton pair production and \(\uptau \) lepton decays. The weight could depend on ten or even more four momenta taken from kinematical configurations of stored events. The proposed implementation was widely used in experimental analyses at LHC; in the domains of Standard Model precision measurements [1,2,3], Higgs boson discovery and particle properties measurements [4,5,6,7,8] and searches for New Physics [9, 10].

At the beginning the TauSpinner project was focused on the longitudinal spin effects only [11]. It was used to calculate appropriate weights, to include spin effects into (or removed from) the generated events sample. With time, other options were added. In Ref. [12], an additional weight was introduced to manipulate the production process by adding or replacing the generated production process with an alternative one, including for example exchange of new intermediate particles. Reference [13] brought the possibility of introducing complete spin effects (longitudinal and transverse) in decays of intermediate Higgs bosons, and in Ref. [14] in the Drell–Yan process as well. The production process was modeled with lowest order \(2 \rightarrow 2\) matrix elements. In [15] the implementation of hard processes featuring the parton level matrix elements for production of \(\uptau \) lepton pairs and two jets was introduced. This was motivated by the experimental analyses becoming sensitive to Electroweak Higgs and the Z boson production in the fusion of WW or ZZ pairs. The question of systematic uncertainties due to the approximation where \(2 \rightarrow 2\) or \(2 \rightarrow 4\) matrix elements were used for the calculation of spin effects could be addressed since then. With time also more sophisticated options for treatment of spin effects were prepared. In Ref. [13] possibility to assign helicity to \(\uptau \) leptons was added. An approximation was used taking only the longitudinal components of density matrix for \(\uptau \) lepton pair production into account. In [14] one loop electroweak (EW) corrections in the Drell–Yan process became available for the weight calculation. Finally let us mention that available options allow to configure the TauSpinner algorithm to work on samples where only partial spin effects were taken into account and to correct them to full spin effects.

All these different options were introduced into TauSpinner because of user’s interest and under the pressure of time during converging very fast analyses of LHC Run I data by ATLAS and CMS experiments. That is why there is a need and the opportunity now to document them systematically and archive the code which will be used during the final LHC Run II analyses.

New applications of the TauSpinner are currently developed. The most recent example, where re-weighting techniques of TauSpinner were used for the precision measurement at LHC is the \(\sin ^2{\uptheta }_{eff}^{lep}\) measurement by the ATLAS Collaboration [16]. The TauSpinner algorithms served as a tool for introducing genuine EW and other loop corrections to the samples generated with EW leading order (LO) matrix elements.

Contrary to the previous papers we will emphasize here less phenomenological applications, but rather focus on common theoretical/phenomenological basis and relations between different options. Whenever possible we will address the point of the theoretical uncertainties of the proposed algorithms with references to our previous publications on TauSpinner.

The focus of the present paper is the documentation of the program. We do not repeat the physics reasons why options or particular approximations were then prepared. The principles of algorithms for the exact treatment of all spin effects for the \(\uptau \) leptons production and decay are known since a long time. Also, all approximations used by us and applied in other currently used programs of today were investigated already not later than a decade ago, see e.g. Ref. [17] of the final publication on the LEP precision measurements.

The general purpose Monte Carlo programs for LHC such as Pythia [18], Herwig [19] or Sherpa [20] feature \(\uptau \) lepton decays and corresponding spin effects, often without any approximations. This depend on the particular process of \(\uptau \) leptons in the final state. Re-weighting algorithms are available in these programs as well, see e.g. [21,22,23], even though they not necessarily rely on event record formats, presently used for storing events of LHC experiments, or are prepared for \(\uptau \) lepton physics. Such re-weighting options are usually not used in the LHC experiments analyses, for events which have been already generated and stored. The TauSpinner therefore offers as we will explain later with very little compromising on the physics precision, solution for reweighting.

Discussion, comparisons of different programs and their results for the modelling of spin effects in a multitude of high energy processes is of vital interest but remains out of the scope of the present publication. Fortunately we can refer to conference contributions and workshops, see e.g. [21, 24], with the caviat however that so far details on the \(\uptau \) lepton physics at LHC are largely shadowed by the interest and complexity of higher order QCD corrections. The extensive work like the one in Ref. [17] for LEP is to our knowledge at present not available. It should not be a surprise, Ref. [17] was published many years after LEP experiments stopped taking data. Likely it will be the case for LHC too and the comprehensive review will have to wait for the time of finalising precision measurements of the full Run II data.

Our paper is organized as follows. In Sect. 2 a theoretical basis for describing \(\uptau \) leptons in production and decay matrix elements is introduced. We define weights calculated by the program. Details of kinematics; definition of frames and transformations connecting them, used for calculation of hard parton-level amplitudes or cross section and for calculation of spin effects are given in Sects. 3 and 4. In the sub-sections we explain simplifications and resulting formulae for the differential cross section and spin correlations. Section 5 is devoted to the case when at parton level \(2 \rightarrow 2\) processes are used. Section 6 covers the calculation of density matrices for \(\uptau \) lepton decays; the polarimetric vectors. In Sect. 7 the case of \(2 \rightarrow 4\) processes is discussed and extensions to the algorithms which were needed for the case when the final state consists not only of a \(\uptau \) lepton pair, but also two additional jets are present are explained. Section 8 is devoted to general discussion how systematic uncertainties related to applications of TauSpinner weights can be estimated. The \(\uptau \) lepton decay library Tauola [25] providing some methods for TauSpinner is discussed as well. Section 9, closes the paper. The appendices recall all examples and applications which are included in the most recent release. So far, the documentation for these applications was scattered over several publication appendices and was thus not available in a systematic manner.

2 Theoretical basis

We start the discussion from presenting the exact formula on the cross section for \(pp \rightarrow \uptau \uptau \; X\) or \(pp \rightarrow \uptau \; \upnu _\uptau \; X\) processes, which requires knowledge of the whole process matrix elements, including decays of \(\uptau \) leptons. Considering about 20 \(\uptau \) lepton decay channels we end-up with 400 possible configurations for each \(\uptau \) lepton pair production process. The exact formula can therefore not be used in practice. Nonetheless, it can serve as a starting point for more practical ones, also those involving approximations. The formulae presented below for the \( H (Z/\upgamma ^*) \rightarrow \uptau \uptau \) can be applied also to the \(H^\pm (W^\pm ) \rightarrow \uptau \; \upnu _\uptau \) case. Then the second \(\uptau \) lepton of the formulae should be replaced by \(\upnu _\uptau \) and the part of formula which describes its decay dropped out.

2.1 Exact formula

The basic formula for the cross-section at the process \( pp \rightarrow \uptau ^+\uptau ^- X ; \uptau ^+ \rightarrow Y^+ {{\bar{\upnu }}}; \uptau ^-\rightarrow Y'^- \upnu \) reads:

$$\begin{aligned} d \upsigma = |{{\mathscr {M}}}|^2 d\Omega = |{{\mathscr {M}}}|^2 d\Omega _{prod} \; d\Omega _{\uptau ^+} \; d\Omega _{\uptau ^-} \end{aligned}$$
(1)

where \({{\mathscr {M}}}\) denotes complete matrix element. Obviously terms due to average over initial state spin degrees of freedom and the flux factor are omitted. Because of the \(\uptau \) lepton width being very small, the \(\uptau \) lepton propagator module squared, to a perfect approximation, reduces to the Dirac \(\delta \) function in lepton virtuality and so the infinitesimal element in the kinematical phase space factorizes into \(d\Omega _{prod} \; d\Omega _{\uptau ^+} \; d\Omega _{\uptau ^-}\).

The formula (1) is not very convenient, because of the 400 distinct processes and matrix elements. Fortunately, as for the phase space parametrization, because of a narrow \(\uptau \) lepton width, matrix elements can be also expressed as the product of amplitudes for production and decays, summed over the \(\uptau \) spin projections (\(\uplambda =1,2\)) on at this point unspecified axes,

$$\begin{aligned} {{\mathscr {M}}}=\sum _{\uplambda _1 \; \uplambda _2=1}^2{{\mathscr {M}}}_{\uplambda _1 \; \uplambda _2}^{prod} \; {{\mathscr {M}}}_{\uplambda _1}^{\uptau ^+}{{\mathscr {M}}}_{\uplambda _2}^{\uptau ^-}. \end{aligned}$$
(2)

The cross-section can be expressed then with the rewritten exact formula, which thanks to Fierz identity decouples summations of the decay and production matrix elements. It introduces the correlations back in a form of a spin weight, \(wt_{spin}\)

$$\begin{aligned} d \upsigma= & {} \Bigl (\sum _{\uplambda _1\uplambda _2 }|{{\mathscr {M}}}^{prod}|^2 \Bigr ) \Bigl (\sum _{ \uplambda _1}|{{\mathscr {M}}}^{\uptau ^+}|^2 \Bigr ) \Bigl (\sum _{\uplambda _2}|{{\mathscr {M}}}^{\uptau ^-}|^2 \Bigr ) wt_{spin} \nonumber \\&d\Omega _{prod} \; d\Omega _{\uptau ^+} \; d\Omega _{\uptau ^-}. \end{aligned}$$
(3)

This formula is the core of the TauSpinner algorithm, but not only. It is used in the Tauola \(\uptau \) decay library interface as foundation of the “after-burn” approach [25] and also in the KKMC Monte Carlo [26]. For details of the geometrical formulation and naming conventions Ref. [27] may be the most useful.

The spin weight \(wt_{spin}\) is dimensionless, and contains information of all spin effects transmitted from the production to the decay of \(\uptau \) leptons,

$$\begin{aligned} wt_{spin} = \sum _{i,j=t,x,y,z} R_{i,j} h^i_{\uptau ^+} h^j_{\uptau ^-}. \end{aligned}$$
(4)

The indices ij, of the adjoint (to 1/2 representations of fermions) rotation group representation run over txyz. The polarimetric vector \(h^i_{\uptau ^\pm }\) is calculated from the formula

$$\begin{aligned} h^i_{\uptau ^{\pm }} =\sum _{\uplambda , {{\bar{\uplambda }}}} \upsigma ^i_{\uplambda , {\bar{\uplambda }}} {{\mathscr {M}}}_{\uplambda }^{\uptau ^{\pm }} {{\mathscr {M}}}^{\uptau ^{\pm } \; \dagger }_{{\bar{\uplambda }} }, \end{aligned}$$
(5)

where \(\upsigma ^i_{\uplambda , {\bar{\uplambda }}}\) stands for Pauli matrices. The \( h^i_{\uptau ^{\pm }}\) are normalized further to set their time-like component to 1, taking \(\frac{h^i_{\uptau ^{\pm }}}{h^t_{\uptau ^{\pm }}} \rightarrow h^i_{\uptau ^{\pm }} \). We will often use shortened form for the notation \(h^i_{\uptau }\) or \(h^i_{\pm }\). The superscript i will be dropped if we will have all components in mind.

The spin correlation matrix \(R_{i,j}\) is calculated from the formula

$$\begin{aligned} R_{i,j}=\sum _{\uplambda _1, {\bar{\uplambda }}_1 \uplambda _2, {\bar{\uplambda }}_2}\upsigma ^i_{\uplambda _1, {\bar{\uplambda }}_1} \upsigma ^j_{\uplambda _2, {\bar{\uplambda }}_2} {{\mathscr {M}}}^{prod}_{\uplambda _1 \uplambda _2 } {{\mathscr {M}}}^{prod \; \dagger }_{{\bar{\uplambda }}_1 {\bar{\uplambda }}_2 } \end{aligned}$$
(6)

and also normalized to set its time-like component to 1, namely \( \frac{R_{i,j}}{R_{t,t}}\rightarrow R_{i,j} \).

Formula (4) is universal, it does not depend on the production process, and there are no approximations introduced. It features useful properties: \(0<wt_{spin}<4\) and weight average \(<wt_{spin}>=1\). The use of expressions (5) and (6) moves our description from the language of spin amplitudes toward the language of cross-sections and probability distributions; since amplitudes squared contribute only.

All complexities are in the calculation of \(R_{i,j}\) spin correlation matrix for production and \(h^i_{\uptau ^+} h^j_{\uptau ^-}\) polarimetric vectors for the decay of \(\uptau \) leptons. The \(R_{i,j}\) matrix describes the full spin correlation between the two \(\uptau \) leptons as well as the individual spin states of the \(\uptau \) leptons. The \(R_{i,j}\) depend on kinematics of the production process only, and \(h^i_{\uptau ^+} h^j_{\uptau ^-}\) respectively on the kinematics of \(\uptau ^+\) and \(\uptau ^-\) leptons. The explicit definition of the matrix \(R_{i,j}\) and vectors \(h^i_{\uptau ^+}\), \(h^j_{\uptau ^-}\) is rather lengthy and also well known, see Refs. [28, 29] for detailed definitions. It is decay channel dependent.

So far we discussed the case of a \(\uptau \) lepton pair in the final state, being the case of \(H \rightarrow \uptau \uptau \) or \(Z/\upgamma ^* \rightarrow \uptau \uptau \) processes. The case of only one \(\uptau \) lepton in the final state, that is the case of \(W^\pm \rightarrow \uptau \; \upnu _\uptau \) or \(H^\pm \rightarrow \uptau \; \upnu _\uptau \) is much simpler. The \(R_{i,j}\) matrix is replaced by the vector of components \(R_t,R_x,R_y,R_z= 1,0,0,\mp 1\) respectively for W and charged Higgs decays. The sum over two indices is thus reduced to the sum over one index only, the axis z is the direction of \(\uptau _\upnu \) from \(W^\pm /H^\pm \) decay as seen from the \(\uptau \) lepton rest-frame, and the spin weight read thus \(wt_{spin}= 1\pm h_{\uptau }^z\). The frames choices (presented in the next Section) for that case could have been simpler than for Z / H decays, no details of transverse directions are then needed.

2.2 Formula using parton level amplitudes

We do not have at our disposal matrix elements for the complete \(pp \rightarrow \uptau ^+\uptau ^- X\) process, but instead, following factorization theorems, we can represent the cross-section with the help of the parton level amplitudes, convoluted with the parton density functions (PDFs) and summed over all flavours (flavour configurations of incoming partons.Footnote 1 Thus, from formula (3) we obtain:

$$\begin{aligned}&d \upsigma = \sum _{flav.} \int dx_1dx_2 f(x_1, \ldots )f(x_2, \ldots )d\Omega ^{part.\; lev.}_{prod} \; d\Omega _{\uptau ^+} \; d\Omega _{\uptau ^-} \nonumber \\&\quad \Bigl (\sum _{\uplambda _1, \uplambda _2 }|{{\mathscr {M}}}^{prod}_{part.\; lev.}|^2 \Bigr ) \Bigl (\sum _{\uplambda _1 }|{{\mathscr {M}}}^{\uptau ^+}|^2 \Bigr ) \Bigl (\sum _{\uplambda _2 }|{{\mathscr {M}}}^{\uptau ^-}|^2 \Bigr ) wt_{spin}. \nonumber \\ \end{aligned}$$
(7)

At this point we would like to decouple the calculation of \(wt_{spin}\) as much as possible from the PDFs. Note, that this is needed for the \(Z/\upgamma ^*\) mediated processes due to V and A for Z boson and \(\upgamma ^*\) couplings to fermions. For the H or W mediated processes the spin polarization state does not depend on flavours of incoming partons. For the \(Z/\upgamma ^*\) the \(R_{i,j}\) used in calculation of \(wt_{spin}\), is taken as the weighted average (with PDFs and production matrix elements squared) over all flavour configurations, as in the following eq.

$$\begin{aligned} R_{i,j} \rightarrow \frac{ \sum _{flav.} f(x_1,\ldots )f(x_2,\ldots ) \Bigl (\sum _{\uplambda _1, \uplambda _2 }|{{\mathscr {M}}}^{prod}_{parton\ level}|^2 \Bigr ) R_{i,j} }{\sum _{flav.} f(x_1,\ldots )f(x_2,\ldots ) \Bigl (\sum _{\uplambda _1, \uplambda _2 }|{{\mathscr {M}}}^{prod}_{parton\ level}|^2 \Bigr )\;\;\;\;\;\;\;} . \nonumber \\ \end{aligned}$$
(8)

No approximation is introduced in this way. The denominator of Eq. (8) cancels explicitly the corresponding factor of Eq. (7) (that is also the integrand of the following Eq. (9), first line).

To introduce the changes due to different spin effects in modified production process or the decay models, one can define in the generated sample (i.e. without re-generation of events) the weight WT, representing the ratio of the new to old cross-sections at each point in the phase space.

Equation (7) for modified cross-section, takes then the form

$$\begin{aligned} d \upsigma= & {} \sum _{flavours} \int dx_1dx_2 \;\; f(x_1,...)f(x_2,...)\nonumber \\= & {} \Bigl (\sum _{\uplambda _1, \uplambda _2 }|{{\mathscr {M}}}^{prod}_{parton\; level}|^2 \Bigr )d\Omega ^{parton\; level}_{prod} \nonumber \\&\Bigl (\sum _{\uplambda _1 }|{{\mathscr {M}}}^{\uptau ^+}|^2 \Bigr ) \; d\Omega _{\uptau ^+}\; \; \; \Bigl (\sum _{\uplambda _2 }|{{\mathscr {M}}}^{\uptau ^-}|^2 \Bigr ) \; d\Omega _{\uptau ^-}\nonumber \\&\times \; wt_{spin} \; \times \; WT. \end{aligned}$$
(9)

A variant of Eq. (9) is used in Tauola.Footnote 2

In general the weight WT factorizes into production (\(wt_{prod}\)), decay (\(wt_{{decay}}^{\uptau ^\pm }\)) and the ratio of spin correlation/polarization weights, new to the old one (\({wt_{spin\; new}}/{wt_{spin\; old}}\)):

$$\begin{aligned} WT = wt_{prod} \; \; wt_{decay}^{\uptau ^+} wt_{decay}^{\uptau ^-}{wt_{spin\; new}}/{wt_{spin\; old}}. \end{aligned}$$
(10)

The first three terms of the weight, represent modification of the matrix elements for production and decays

$$\begin{aligned} wt_{prod}= & {} \frac{\sum _{flav.}f(x_1, \ldots )f(x_2, \ldots )\Bigl (\sum _{spin }|{{\mathscr {M}}}^{prod}_{part. lev.}|^2\Bigr ) \Big |_{new}}{\sum _{flav.}f(x_1, \ldots )f(x_2, \ldots )\Bigl (\sum _{spin }|{{\mathscr {M}}}^{prod}_{part. lev.}|^2\Bigr ) \Big |_{old}}, \nonumber \\\end{aligned}$$
(11)
$$\begin{aligned} wt_{decay}^{\uptau ^\pm }= & {} \frac{\sum _{spin }|{{\mathscr {M}}}^{\uptau ^\pm }_{new}|^2}{\sum _{spin }|{{\mathscr {M}}}^{\uptau ^\pm }_{old}|^2}. \end{aligned}$$
(12)

The combined weight as in Eq. (10), is nothing else than ratios of spin averaged amplitudes squared for the whole process; new to old. The eventual changes in the PDFs parametrizations should be taken into account in calculation of \(wt_{prod}\) and also in the ratio \({wt_{spin\; new}}/{wt_{spin\; old}}\) in formula (10). In case the production process or decay models are not modified, respectively \(wt_{prod}\) and \(wt_{decay}^{\uptau ^{\pm }}\) are equal to 1. The ratio of spin weights \(wt_{spin\; new}/wt_{spin\; old}\) allows for introduction of new spin effects. In case of originally unpolarized sample, the \(wt_{spin\; old} = 1\) and \(wt_{spin\; new}\) alone allows to introduce the desired spin effects.

Formula (9) can be rewritten to the equivalent form, which underlines the separation useful for the organization of the program, with segments for production of \(\uptau \) leptons, their decays and the spin weights. Let us recall that the spin weight \(wt_{spin}\) is the only part depending simultaneously on the production and decay kinematics. For the production of \(\uptau \) lepton pair it has always the form of Eq. (4). Ratio of the weight calculated from the new and old matrix elements has to be taken. Reorganizing some terms we can finally write:

$$\begin{aligned} d\upsigma = \Bigl [ d\upsigma _{prod}\;\; d\Gamma _{decay}^{\uptau ^+} d\Gamma _{decay}^{\uptau ^-}\Bigr ]\; wt_{spin\; old}\;\; \Bigl (\frac{wt_{spin\; new}}{wt_{spin\; old}}\Bigr ),\nonumber \\ \end{aligned}$$
(13)

where

$$\begin{aligned} d\upsigma _{prod}= & {} \sum _{flavours} \int dx_1dx_2 f(x_1, \ldots )f(x_2, \ldots )\nonumber \\&\times d\Omega ^{parton\; level}_{prod} \Bigl (\sum _{spin }|{{\mathscr {M}}}^{prod}_{parton\; level}|^2 \Bigr ) wt_{prod} \nonumber \\ d\Gamma _{decay}^{\uptau ^+}= & {} d\Omega _{\uptau ^+} \Bigl (\sum _{spin }|{{\mathscr {M}}}^{\uptau ^+}|^2 \Bigr ) wt_{decay}^{\uptau ^+},\nonumber \\ d\Gamma _{decay}^{\uptau ^-}= & {} d\Omega _{\uptau ^-} \Bigl (\sum _{spin }|{{\mathscr {M}}}^{\uptau ^-}|^2 \Bigr )wt_{decay}^{\uptau ^-}. \end{aligned}$$
(14)

All four components of the overall weight (10) are given separately to underline, wherever possible, their dependence on all or only sub-set of phase space dimensions. Note that for \(W^\pm /H^\pm \rightarrow \uptau \; \upnu _\uptau \) we have not prepared so far any option which allows to modify production processes.

3 WT calculations in TauSpinner

The formulae listed above are used in TauSpinner for the calculation of distinct components of WT, see Eq. (10). Let us start with the main weight of the spin effects, \(wt_{spin}\) defined by Eq. (4). With this weight, for the samples where spin effects of \(\uptau \) lepton production are absent, they can be inserted into decay distributions. Alternatively, its inverse can be used to remove spin effects from a sample where they are taken into account. As a building block of this weight introducing the dependence on the production process, the matrix \(R_{i,j}\), is given by the formula (8). The other weights, \(w_{prod}\) and \(w_{decay}^{\uptau ^\pm }\) are defined by formulae (1112).

It is useful to introduce the notation \(P^z_{\uptau }=R_{t,z}=R_{z,t}\), which represents the longitudinal polarization of the single \(\uptau \) lepton (if one integrates out possible configurations of the other \(\uptau \) lepton ). In usually sufficient approximation of helicity states, that is when transverse momenta of \(\uptau \) decay products are neglected, as is the case of ultra-relativistic \(\uptau \) leptons, the \(P^z_{\uptau }\) is the only non-trivial (dynamic dependent) element of matrix R. All others are equal to ±1, or can be set to 0. We will return to the details later.

In the calculation of \(wt_{spin}\) and \(w_{prod}\) the physics uncertainty depends on the accurateness of the factorization assumptions for separation of patron level matrix elements and PDFs and also on the choice of a particular PDFs parametrization. Nothing in principle would change if instead of \(2\rightarrow 2\) body production matrix element one would use the the ones for \(2\rightarrow 2+n\), where n denotes additional partons/jets or other particles (of summed spin-states). In addition to the choice of PDFs (eventually also model of underlying event interactions) for parton level matrix elements one has to make a careful choice of how hard scattering kinematics is reconstructed from information available in the event.

Calculation of \(wt_{decay}^{\uptau ^{\pm }}\) involves modeling of \(\uptau \) lepton decays only. This weight is useful in studies of the resulting systematic uncertainties. This part of the code is using function of the Tauola library.

We will return to these points later, but one can keep it in mind already now, while reading the following.

3.1 Kinematical frames

The components necessary for the WT weight are calculated in different frames. This is a correct approach as long as details of boosts and rotations connecting frames are meticulously followed. Also spin states of the \(\uptau \) leptons may be defined in different frames than four momenta of the hard process. Bremsstrahlung photons and properties of the matrix element in their presence, require a dedicated treatment.

The basic formula (1) can provide exact results in principle. In practice, we have to introduce approximations to adapt to the fact that matrix elements are calculated from the parton level amplitudes, and to the way how these amplitudes are reconstructed by the TauSpinner algorithm where only four momenta of outgoing \(\uptau \) leptons and partons can be used. The definition of quantization frames is an essential element of the arrangements, let us provide now the necessary details.

Table 1 Frames used for the calculation of components used in weights calculation, Eq. (10). Specified are also frames to which these components need to be transformed

For calculating all components of the event weights (to prepare kinematical configurations of events necessary for that purpose) we define in total four frames (group of frames):

A : :

The basic frame (starting point) for kinematic transformations and all other frame definitions.

The rest frame of the \(\uptau \) lepton pair is used (and not of \(\uptau \) lepton pair with the final state bremsstrahlung photons combined). Such choice is possible thanks to the properties of bremsstrahlung amplitudes. Emitted photons do not carry out the spin. This non-trivial observation is exploited also in Photos Monte Carlo phase space parametrization, see Refs. [30, 31]. The definition of the rest frame of the \(\uptau \) lepton pairs is completed with incoming partons set along the z-axis.

\(A':\) :

The rest frame of the \(\uptau \) lepton pairs and the final state bremsstrahlung photons combined. Incoming partons are again set along the z-axis. This frame is used for calculating the production weight \(wt_{prod}\) and the spin correlation matrix \(R_{i,j}\); if no bremsstrahlung photons are present it is equivalentFootnote 3 to frame A. In every case we reconstruct \(x_1, x_2\), the arguments of the PDF function, from the virtuality M and the longitudinal to the beam direction component (\(p_L\)) of the intermediate state (sum of momenta of \(\uptau ^+\; \uptau ^-\; n\upgamma \)) momentum in lab frame. The center of mass energy of pp scattering is used to calculate \(x_1 x_2 \) through relations \(x_1 x_2 CMS_{ENE}^2 = M^2(\uptau ^+\; \uptau ^-\; n\upgamma )\), \((x_1-x_2)\) \(CMS_{ENE} = 2 p_L(\uptau ^+\; \uptau ^-\; n\upgamma )\). The \(n\upgamma \) is assumed to correspond to the final state bremsstrahlung associated with the \(\uptau \) lepton pair production and its momentum has to be taken into account, but only in the calculation of the virtuality for the intermediate \(Z/\upgamma ^*\) state in case of \(2\rightarrow 2\) amplitudes.Footnote 4 Note that \(A'\) is used for \(x_1, x_2 \) calculation only. The \(2\rightarrow 2\) hard process scattering angle is calculated in frame A.

B : :

The rest frame of the \(\uptau \) lepton pairs, with \(\uptau \) leptons along the z-axis. It is used for common orientation of production and decay coordinate systems. In this frame the polarimetric vectors \(h_{\pm }\) are defined. Transformation \(A \rightarrow B \) requires rotation.

\(C_{\uptau ^{\pm }}:\) :

The rest frames of individual \(\uptau \) leptons with the direction of the boost to \(\uptau \) lepton pair rest-frame along the z-axis. Transformation \(B \rightarrow C_{\uptau ^+}\) or \(C_{\uptau ^-}\) requires boost only.

\(D_{\uptau ^{\pm }}:\) :

The rest frames of individual \(\uptau \) leptons, with \(\upnu _{\uptau }\) along the z-axis. It is used for the calculating decay weights. In fact in the frames \(D_{\uptau ^{\pm }}\) also the polarimetric vectors \(h_{\uptau ^{\pm }}\) are calculated and then rotated back to frame \(C_{\uptau ^{\pm }}\).

In Table 1, we summarize which frames are used for calculations of different variables and then to which frames they are boosted (rotated) before being used in formula (7). Let us stress that it is not only important to define all the frames of type \(A-D\) but also the Lorentz transformations between them.

The frame of type A is used for calculation of the hard process amplitudes. If only longitudinal components of spin density matrix are taken into account, we do not need to define in detail the transverse directions (quantization frame versors) with respect of \(\uptau \) lepton momenta, and control on the corresponding details of boost methods to the rest frames of \(\uptau \) leptons is not needed. However, the code of TauSpinner controls such details of the boosts, because it is prepared to handle also cases when the complete spin density matrix is used.

The frames of type B and of type C have common direction of the z-axis, also x- and y- axes coincide. Frame B is used for \(R_{i,j}\) calculation if transverse degrees of freedom are taken into account. Calculation of the spin weight, that is contraction of indices in \(wt_{spin} = \sum _{ij} R_{i,j}\) \( h^i_{\uptau ^+} h^j_{\uptau ^-}\), is performed in frames \(C_{\uptau ^+}\), \(C_{\uptau ^-}\). It enables control on transverse spin effects. Frames of type D are used for calculation of decay matrix elements and \(h^{i}_{\uptau ^+},h^{i}_{\uptau ^-} \) polarimetric vectors with methods from the Tauola library, see Ref. [29] for details.

Let us note that we have used such frames in many applications already at the time of LEP analyzes. They were useful for comparisons and tests. These choices once established can be easily modified whenever necessary, e.g. to fulfill the constraints of particular conventions of spin amplitude calculations, see e.g. in Ref. [27].

Let us comment on the possible future improvement of the definition of the frame A, to allow useful freedom of choice. At present in the TauSpinner the simplest possible ansatz is used in definition of lepton pair rest-frame A. For the frame A beam direction (necessary to define Born-level scattering angle), it is assumed that no jets of substantial \(p_T\) are present and \(p_T\) can be ignored. This can be improved without redoing the design of the above tree of frame definitions. The studies for matrix elements featuring one or two high \(p_T\) jets are already documented in Refs. [32, 33]. The corresponding modifications of the code were not yet introduced into TauSpinner, as there are no clear indications of their numerical importance, but it is a path for the possible forthcoming improvement.

3.2 Production weight \(wt_{prod}\) and spin correlation matrix \(R_{i,j}\)

The \(R_{i,j}\) matrix is not Lorentz invariant. In fact, its indices run over coordinates in two frames, \(C_{\uptau ^{+}}\) and \(C_{\uptau ^{-}}\). As input for matrix element calculation the four momenta of A frame are used. For details of relations between frames and elements used in weight calculations, see also Table 1.

For calculation of the production weight \(wt_{prod}\) and the spin correlation matrix \(R_{i,j}\), the centre-of-mass frame of the \(\uptau \) lepton pair with incoming partons being along the z-axis (frame of type A) is not the optimal one. It is nonetheless used if there is no interest in the transverse spin degrees of freedom. Frame of type B, with \(\uptau \) leptons along the z-axis, is more convenient and with the x and the y axes parallel to the ones of frames \(C_{\uptau ^{\pm }}\), represents the most convenient setup. In fact all these three frames B and \(C_{\uptau ^{\pm }}\) are used simultaneously for calculation of the spin weight of Eq. (4).

The kinematical frames for \(\uptau \) lepton pair production and \(\uptau \) decays need to be explicitly related by the set of Lorentz transformations with the frames used in matrix element calculations. Let us recall details in a form of algorithmic steps, which need to be performed on all decay products of \(\uptau \) leptons before calculation of \(R_{i,j}\) and \(h^{i/j}_{\uptau ^\pm }\) (for \(h^{i/j}_{\uptau ^\pm }\) further steps will be still needed):

  • Boost both \(\uptau \) leptons and their decay products from the laboratory frame to the rest-frame of \(\uptau \) lepton pair.

  • Rotate all to the frame, where the direction of incoming partons is along the z-axis (frame A).

  • Rotate so that \(\uptau \) leptons are set along the z-axis and incoming partons remain in the \(z-y\) plane (frames \(C_{\uptau ^\pm }\) have to be correlated with B by a boost along the z axis). These frames are used for \(R_{i,j}\) spin states definition too.

  • Presence of the final state bremsstrahlung from \(\uptau \) lepton pair brings complication, because the rest frame of the \(\uptau \) lepton pair is not the rest frame of the resonance which decayed into \(\uptau \) lepton pair. For the sake of kinematical transformations, frames A and B defined as above are used. However, for the calculation of matrix elements we use frame \(A'\), where effectively bremsstrahlung photons are absorbed into \(\uptau \) lepton momenta. For calculation of \(x_1, x_2\) we use the invariant mass, which can be easily calculated in frame \(A'\).

3.3 Decay weight \(wt_{decay}^{\uptau ^{\pm }}\) and polarimetric vectors \(h_{\uptau ^{\pm }}\)

The decay weight \(wt_{decay}^{\uptau ^{\pm }}\) and the polarimetric vectors \(h_{\uptau ^{\pm }}\) are calculated for each outgoing \(\uptau \) lepton in its rest frame, denoted as frame \(D_{\uptau ^{\pm }}\) (in this frame neutrino of \(\uptau \) lepton decay is along the z-axis). Lorentz transformations of the previous sub-section have to be supplemented with the one relating frames \(C_{\uptau ^{\pm }}\) with \(D_{\uptau ^{\pm }}\).

  • Boost all decay products along the z-axis to the rest frame of the \(\uptau ^{\pm }\) lepton (frames \(C_{\uptau ^{\pm }}\)).

  • Rotate again \(\uptau \) lepton daughters so that \(\uptau \) neutrino is along the z-axis (frames \(D_{\uptau ^{\pm }}\)).

  • Calculate in frames \(D_{\uptau ^{\pm }}\) polarimetric vectors \(h^i_{\uptau ^\pm }\), rotate them back from \(D_{\uptau ^{\pm }}\) to \(C_{\uptau ^{\pm }}\). Only then they can be contracted with \(R_{i,j}\) for \(wt_{spin}\) calculation.

Decay weights and polarimetric vectors for \(\uptau ^+\) and \(\uptau ^-\) are calculated in the frame \(D_{\uptau ^{\pm }}\), using code from Tauola. Tat is why \(\upnu _\uptau \) along the z-axis is required.

4 Exact and approximate spin weight \(wt_{spin}\)

Basic formula (3) of Sect. 2.1 is exact. Because of approximated calculations (introduction of parton level amplitudes) or as explained later in the section, to obtain a physical picture easier to interpret (valid in ultra-relativistic case only) we can introduce simplifications. No such simplification was introduced yet. Let us recall first that according to \(R_{i,j}\) and \(h_{\uptau ^{\pm }}^i\) definitions, \(R_{t,t}=1\) and \(h_{{\pm }}^t=1\) (we can use shorter notation \(h_{{\pm }}^i=h_{\uptau ^{\pm }}^i\)).

4.1 Neglecting \(m_\uptau ^2\) terms

With the choices of the kinematical frames as defined in Sect. 3.1 and neglecting \(m_\uptau ^2\) terms following the ultra-relativistic limit, one gets that \(R_{z,z} = sign = \pm 1\) (the sign depends on whether the decaying object is a scalar or a vector boson). Also non-diagonal terms \(R_{t,x}=0\), \(R_{t,y}=0\), \(R_{x,t}=0\), \(R_{y,t}=0\), \(R_{z,x}=0\), \(R_{z,y}=0\), \(R_{x,z}=0\), \(R_{y,z}=0\), independently whether the decay of spin zero (scalar) or spin one (vector) state is considered. Formula (4) reduces to:

$$\begin{aligned} wt_{spin}= & {} 1+ { sign} \ \ h^z_{\uptau ^+} h^z_{\uptau ^-} + R_{z,t} h^z_{\uptau ^+} + R_{t,z} h^z_{\uptau ^-} \nonumber \\&+ \sum _{i,j=x,y} R_{i,j} h^i_{\uptau ^+} h^j_{\uptau ^-}, \end{aligned}$$
(15)

or if notation of individual \(\uptau \) lepton longitudinal polarization \(P^z_{\uptau }\) is used (for Higgs decays \(P^z_{\uptau }=0\)),

$$\begin{aligned} wt_{spin}= & {} 1+ { sign} \ \ h^z_{\uptau ^+} h^z_{\uptau ^-} + P^z_{\uptau } h^z_{\uptau ^+} + P^z_{\uptau } h^z_{\uptau ^-} \nonumber \\&+ \sum _{i,j=x,y} R_{i,j} h^i_{\uptau ^+} h^j_{\uptau ^-}. \end{aligned}$$
(16)

Let us stress that the formulae (1516) are quantization frame dependent. One has to be careful especially with signs if the kinematical transformations, as explained in Sect. 3.1 are not followed. Distinct conventions for defining those frames are used in the literature.

4.2 Neglecting transverse spin correlations and spin state probabilities

A further approximation (not always used) to include longitudinal spin effects only, means that terms \(R_{i,j}\) are set to zero for \(i,j=x,y\). In general those terms can be large, but as they result in dependencies of transverse with respect to \(\uptau \) lepton direction components of \(\uptau \) lepton decay products momenta, they often do not lead to measurable effects and can be dropped.

With this approximation, formula (16) becomes

$$\begin{aligned} wt_{spin} = 1+ { sign}\ h^z_{+} h^z_{-} + P^z_{\uptau } h^z_{\uptau ^+} + P^z_{\uptau } h^z_{\uptau ^-}, \end{aligned}$$
(17)

Using formula (17), one will be able to introduce probabilities for spin states \(p_\uptau ^z\) which will be defined later.

For the decay of a scalar resonance (e.g. Higgs) we define (equal) probabilities for \( \uptau \) pair configurations being left-right (\(+\)) or right-left (−). We rewrite formula (17) and decompose \(wt_{spin}\) into a sum of \(wt_{spin}^+\) and \(wt_{spin}^-\):

$$\begin{aligned} wt_{spin}= & {} 0.5 (1+ h^z_{\uptau ^+}) (1- h^z_{\uptau ^-}) + 0.5 (1- h^z_{\uptau ^+}) (1+ h^z_{\uptau ^-}) \nonumber \\= & {} wt_{spin}^+ + wt_{spin}^- \end{aligned}$$
(18)

For the decay of a scalar into \(\uptau \) lepton pair, the spin state probability is \(p_{\uptau }^z=\frac{1}{2}\) (the subscript z denotes spin projection on the z axes of frames type C).

For the decay of a vector resonance, the probability \(p_{\uptau }^z\) depends on the intermediate boson virtuality and \(\uptau \) lepton direction, thus we can rewrite formula (17) as

$$\begin{aligned} wt_{spin}= & {} p_{\uptau }^z (1+ h^z_{\uptau ^+}) (1+h^z_{\uptau ^-}) + (1- p_{\uptau }^z) (1- h^z_{\uptau ^+}) (1- h^z_{\uptau ^-})\nonumber \\= & {} wt_{spin}^+ + wt_{spin}^-. \end{aligned}$$
(19)

Note that \(p_{\uptau }^z\) can be interpreted as the probability of creating first \(\uptau \) lepton of the pair in a spin state \((+)\) along the z direction, whereas \(P_{\uptau }^z\) as its longitudinal polarization. Obviously, from comparison of above Eqs. (17) and (19), following relation occurs:

$$\begin{aligned} p^z_{\uptau } =0.5 - 0.5 P_{\uptau }^z \end{aligned}$$
(20)

which can be rewritten as

$$\begin{aligned} P^z_{\uptau } = 2 (1- p^z_{\uptau } ) - 1. \end{aligned}$$
(21)

4.3 Longitudinal versus transverse spin correlations

In the formalism discussed above, there is a seemingly rather minor difference between the situations when the complete spin effects or only longitudinal ones are taken into account. The case of longitudinal spin effects only means that all \(R_{i,j}\) components are set to zero except \(R_{t,z}\), \(R_{z,t}\) and \(R_{t,t}=1\), \(R_{z,z} = \pm 1\); the sign depends on whether the decaying object is a scalar or a vector and \(R_{t,z}\) is equal to longitudinal \(\uptau \) lepton polarization \(P_{\uptau }^z\). No difference in the re-weighting algorithm is needed with this definition of \(R_{i,j}\). The transverse spin correlations are introduced with non-zero \(R_{x,x}\), \(R_{y,y}\) and off-diagonal \(R_{x,y}\), \(R_{y,x}\), without any modifications of the t and z components.

5 The \(2 \rightarrow 2\) parton level processes

The complete event weight WT is factorized into multiplicative components: production (\(wt_{prod}\)), decay (\(wt_{decay}^{\uptau ^\pm }\)) and spin correlation/polarization (\(wt_{spin}\)):

$$\begin{aligned} WT = wt_{prod} wt_{decay}^{\uptau ^+}wt_{decay}^{\uptau ^-} wt_{spin}. \end{aligned}$$
(22)

If the sample is polarized the last factor should read \(wt_{spin\; new}/wt_{spin\; old}\).

The implemented methods calculate internally a complete set of weights but as a default one, the spin correlation/polarization weight, as most often used in the applications is returned.Footnote 5 Other weights are returned by supplementary methods.Footnote 6

5.1 Production weight

The production weight \(wt_{prod}\) which is a sum over all configurations of \(\uptau \) leptons spin and flavours of incoming partons of matrix element squared multiplied by PDFs is calculated in frame \(A'\). The parton level angular kinematic configuration is usually taken in the A frame. The \(R_{i,j}\) are calculated in A or \(A'\) frame, except the case when transverse spin effects are taken into account and frame B has to be used.

5.2 Decay weights

Calculation of the decay weights \(wt_{decay}^{\uptau ^+}\) and \(wt_{decay}^{\uptau ^-}\) is a by-product of polarimetric vectors of \(h^i_{\uptau ^+}\) and \(h^j_{\uptau ^-}\) calculation. This calculation is performed in frames \(D_{\uptau ^\pm }\). The methods of Tauola used for \(h^j_{\uptau ^-}\) calculation, provide at the same time decay matrix elements squared summed over the \(\uptau \) lepton spin which are used in \(wt_{decay}^{\uptau ^\pm }\).

5.3 Spin correlation matrix \(R_{i,j}\)

In most cases the spin correlation matrix \(R_{i,j}\) is calculated in frame A or \(A'\). Frame B is used if transverse spin effects are taken into account.

Calculations of the production weight and of spin correlation matrix \(R_{i,j}\) are related with each other. It is important to realize that in the collinear approximation

$$\begin{aligned} R_{t,z}=\frac{\upsigma ^+_{prod} - \upsigma ^-_{prod}}{\upsigma ^+_{prod} + \upsigma ^-_{prod}} \end{aligned}$$
(23)

where \(\upsigma ^\pm _{prod}\) denotes the sum of matrix element squared multiplied by PDFs, and the first \(\uptau \) lepton spin is ±. In this approximation and for Eq. (23) the difference between frames A and \(A'\) can be ignored.

Note, that the weight \(wt_{prod}\) is obtained as a by-product of \(R_{i,j}\) calculation, in fact of its \(R_{t,z}\), \(R_{z,t}\) components.Footnote 7 In case of using directly the formula for Born cross-section with vector/axial couplings and \(Z/\upgamma ^*\) propagators (implemented in TauSpinner) this connection is less transparent.

5.3.1 Case of a spin zero resonance

If the \(\uptau \) lepton mass is small in comparison to the \(\uptau \) lepton pair virtuality then \(R_{z,z} = -1\). For the scalar Higgs boson holds \(R_{x,x} = R_{y,y} = 1\) and \(R_{x,x} = R_{y,y} = -1\) for the pseudo-scalar, while the mixed scalar-pseudoscalar configuration the formula includes scalar-pseudoscalar mixing angle and non-zero off-diagonal \(R_{x,y}, R_{y,x}\) terms. This extension is important for the simulation of Higgs CP parity signatures.

5.3.2 Case of a spin one resonance (Drell–Yan)

For a neutral vector boson \(R_{z,z} = 1\), if the \(\uptau \) lepton mass is small in comparison of \(\uptau \) lepton pair virtuality. The non-zero off-diagonal terms are

$$\begin{aligned} R_{t,z} = R_{z,t} = 2 \cdot p_{\uptau }^z-1. \end{aligned}$$
(24)

In the present implementation, if the EW corrections are neglected the transverse spin correlations for neutral vector boson/photon exchange are neglected as well and \(R_{x,x} = R_{y,y} = R_{x,y} = R_{y,x} = 0\). We are simply missing the code for the Born level expressions taking into account the transverse spin effects. Fortunately, if EW corrections calculation is activated, thanks SANC library [35] tables ported from the Tauola, not only the first order EW corrections become available, but the transverse spin effects as well.

5.3.3 Case of a spin two resonance X (non SM Higgs)

In this case \(R_{z,z} = 1\) as in the Drell–Yan case. The non-zero off-diagonal terms are

$$\begin{aligned} R_{t,z} = R_{z,t} = 2 \cdot p_{\uptau }^z-1. \end{aligned}$$
(25)

the difference to Drell–Yan case is in \( p_{\uptau }^z\) angular dependence (defined in \(\uptau \) lepton pair rest frame B). It is described by spherical polynomial of the fourth order and not of the second order. This case was introduced in the paper [12] and corresponding example of the TauSpinner application.

5.4 Calculating the \(wt_{spin}\) weight

For the \(wt_{spin}\) calculation formulae (1516) are available. However, unless required differently by the user, the default version is to omit transverse spin correlations, i.e. \( R_{x,x} = R_{y,y} = R_{x,y} = R_{y,x} = 0\), corresponding to formula (17). In the following we will exploit components of \(R_{i,j}\) for the individual cases prepared in the previous sub-section.

5.4.1 Case a of spin zero resonance (scalar Higgs)

$$\begin{aligned} wt_{spin}= & {} 1.0 + sign \cdot h^{z}_{+} h^{z}_{-} + R_{x,x} h^{x}_{+} h^{x}_{-} + R_{yy} h^{y}_{+} h^{y}_{-} \nonumber \\&+ R_{x,y} h^{x}_{+} h^{y}_{-} + R_{y,x} h^{y}_{+} h^{x}_{-} \end{aligned}$$
(26)

where \(sign = -1\).

5.4.2 Case a of spin two resonance X (non SM Higgs)

$$\begin{aligned} wt_{spin}= & {} 1.0 + sign \cdot h^{z}_{+} h^{z}_{-} + h^{z}_{+} + h^{z}_{-} + P^z_{\uptau } h^{z}_{+} + P^z_{\uptau } h^{z}_{-} \nonumber \\&+ R_{x,x} h^{x}_{+} h^{x}_{-} + R_{y,y} h^{y}_{+} h^{y}_{-} + R_{x,y} h^{x}_{+} h^{y}_{-} + R_{y,x} h^{y}_{+} h^{x}_{-}\nonumber \\ \end{aligned}$$
(27)

where \(sign = +1\). Note, that this form depends on Born level cross section provided (by a pointer) at the execution time with the user function. It is used in calculating \(R_{i,j}\). At present only \(P_\uptau ^z\) is non-zero in implemented examples.

5.4.3 Case a of spin one resonance (Drell–Yan)

$$\begin{aligned} wt_{spin}= & {} 1.0 + sign \cdot h^{z}_{+} h^{z}_{-} + h^{z}_{+} + h^{z}_{-} + P^z_{\uptau } h^{z}_{+} + P^z_{\uptau } h^{z}_{-}\nonumber \\&+ R_{1,1}^{EW} R_{x,x} h^{x}_{+} h^{x}_{-} + R_{2,2}^{EW} R_{y,y} h^{y}_{+} h^{y}_{-} \nonumber \\&+ R_{1,2}^{EW} R_{x,y} h^{x}_{+} h^{y}_{-} + R_{2,1}^{EW} R_{y,x} h^{y}_{+} h^{x}_{-} \end{aligned}$$
(28)

where \(sign = +1\) and \(R_{1,1}^{EW}\), \(R_{1,2}^{EW}\), \(R_{2,1}^{EW}\) and \(R_{2,2}^{EW}\) denote the averaged (with the production cross-section) pre-tabulated transverse spin correlations terms, calculated using \({\mathscr {O}}(\upalpha )\) EW corrections from the SANC program.Footnote 8 \( R_{x,x} = R_{y,y} = R_{x,y} = R_{y,x} = 1\) should be set, in case we want to use \({\mathscr {O}}(\upalpha )\) EW corrections from SANC. Or one can also set some of them to 1 and the remaining ones to 0 in case one is interested in studying only some components of transverse-spin effects.

The \( R_{x,x}, R_{y,y}, R_{x,y}, R_{y,x} \) are used directly as transverse components for \(R_{i,j}\) in case of non-standard model calculation. If one is not interested in the actual size of transverse effects, as predicted by \({\mathscr {O}}(\upalpha )\) EW corrections, one can also modify hard coded pre initialized to zero values, or use non SM Higgs options discussed previously.

Generated Drell–Yan samples may feature only partial spin effects, e.g. just the \( (1.0 + sign \cdot h^{z}_{+} h^{z}_{-})\) part of the spin effects. Then \(wt_{spin}\) has to take this into account, the denominator of such form has to be introduced, as to remove this partial effect. The numerator given in Eq. (28) will introduce the required (usually full) spin effect. Let us list the formulae for the typical cases:

  • If in the generated sample spin correlations between two \(\uptau \) leptons are included but no other effects, the weight takes the form:

    $$\begin{aligned} wt_{spin}^{no\ pol} = \frac{wt_{spin}}{ 1.0 + sign \cdot h^{z}_{+} h^{z}_{-} }. \end{aligned}$$
    (29)

    Such choice for the sample introduces dominant spin effect (the correlation), which at the same time is free of systematic errors. It is a consequence of the spin 1 state decaying to \(\uptau \) lepton pair.

  • If in the generated sample spin correlations and partial (no angular dependence and no incoming quark flavour dependence) polarization effects are included, the weight should take the form:

    $$\begin{aligned}&wt_{spin}^{no\ angular} \nonumber \\&\quad = \frac{wt_{spin}}{ 1 + sign \cdot h^{z}_{+} h^{z}_{-} + P^{z, part}_{\uptau } h^{z}_{+} + P^{z, part}_{\uptau } h^{z}_{-}} \end{aligned}$$
    (30)

    where the denominator again represents spin correlations present in the sample. One can expect the \(P^{z, part}_{\uptau }=P^{z}_{\uptau }(s,\cos (\uptheta =0))\) calculated for incoming electrons being the easiest way to obtain an average correction. This approach reproduces correctly the average individual \(\uptau \) lepton polarization for the events of \(\uptau \) lepton pair virtuality close to the Z boson peak. Such choice for the generated sample could be motivated as follows. It features all spin effects except those which depend on the incoming partons PDFs, thus it is free of related systematic uncertainties, making it convenient for studying systematic uncertainty from PDFs. The corrections introduced with \(wt_{spin}^{no\ angular}\) are even smaller than those of \(wt_{spin}^{no\ pol}\).

5.5 Use of spin correlation/polarization weight in special cases

If the generated sample feature spin effects then the \(wt_{spin}\) of formula (3) can be used as weight \( WT = 1/wt_{spin}\) to remove spin effects.

The cases when only a part of spin effects is taken into account, like in Ref. [36], more specifically the spin correlation but no effects due to vector and axial couplings to the intermediate \(Z/\upgamma ^{*}\) state, can be corrected with the help of the appropriate weights as in examples for Eqs. (2930). On the other hand, such partial spin effects can be also removed completely, e.g. for consistency checks. The case, when spin correlations and average \(\uptau \) lepton polarization are present, but angular dependence is absent, can be treated as usual with Eq. (10).

5.6 Born cross-section

Until now, we were expressing formulae in the language of spin amplitudes and spin weights (spin correlation matrix \(R_{i,j}\)). However, often cross-sections calculated at the parton level are available for the explicit helicity states of the outgoing \(\uptau \) leptons. Several such lowest order formulae for calculating cross-sections of an analytical form are implemented in the code of the TauSpinner itself, or of its examples. Some of them represent the legacy code, ported from different projects, others were coded for the TauSpinner application as benchmarks on the EW parameters setting and are used in the published tests. For completeness of the documentation we describe them in Appendix B.9.

6 Polarimetric vectors, polarization and helicity states

Calculation of the polarimetric vectors \(h_{\uptau }\) is performed using the code from the Tauola library. The conventions is that \(h_{\uptau } = (h_{\uptau }^x, h_{\uptau }^y, h_{\uptau }^z, h_{\uptau }^t)\) (i.e. the last component is time-like) following the convention used in FORTRAN. The same FORTRAN code calculates decay matrix element squared, which are returned as well, as auxiliary information.

Depending on which decay channel is present the calculation is performed using the respective functions from the Tauola library. Not for all \(\uptau \) lepton decay channels, see Table 2, \(h_\uptau \) is nonetheless calculated. About 97.5% of the decay width is covered, i.e. the polarimetric vector h is calculated, otherwise its spatial components are setFootnote 9 to 0.

To calculate decay matrix elements, \(\uptau \) lepton decay products have to be boosted into the \(\uptau \) lepton rest-frame: we first boost all products to the \(\uptau \) lepton pair rest frame, then rotate from A to B so that a \(\uptau \) lepton of Z / H decay is along the z-axis. An intermediate step is to boost from the \(\uptau \) lepton pair rest-frame to \(C_\uptau \), followed by a rotation to have the neutrino from \(\uptau \) lepton decay along the z-axis (\(D_\uptau \) frame). The rotation angles \(\phi _2\), \({\uptheta }_2\) are stored for rotating back of the polarimetric vector to the \(\uptau \) lepton rest-frame B or \(C_\uptau \).

Table 2 Summary of \(\uptau \) lepton decay modes implemented for calculation of polarimetric vectors. Branching fractions for each decay mode according to [37] illustrate the completeness of the algorithm. The “Other” decay modes are treated as unpolarized ones

As a by-product of the \(h_\uptau \) calculations, the \(wt_{decay}^{\uptau ^\pm }\) of Eq. (12) is obtained.

6.1 Longitudinal polarization

The calculation of components of the \(R_{i,j}\) spin density matrix in the ultra-relativistic limit is then equivalent to the calculation of modules for matrix elements of \(\uptau \) lepton pair production in given helicity configurations. Depending on the approach, either \(p^z_{\uptau }\) or \(P^z_{\uptau }\) is calculated from the other one, using respectively formula (21) or (20). The case when EW effects are included, technically differs only slightly,Footnote 10 despite the fact that then the transverse spin effects can be taken into account. In all cases the relation \(R_{t,z}= P^z_{\uptau }\) holds, no pre-tabulated EW results are used for this component of \(R_{i,j}\). This can be easily activated though, e.g. if results for large s are needed. Around the Z peak presently implemented EW library may be less suitable. Formula (19) is used for attribution of helicity states.

6.1.1 Case of a spin = 0 resonance (scalar (Higgs))

In \(H \rightarrow \uptau \uptau \) lepton decays the probability of the helicity state denoted \(p^z_{\uptau }\) is equal to 0.5 for \( P^z_{\uptau } = 1\) and for \( P^z_{\uptau } = -1\) as well, see Table 3.

6.1.2 Case of spin = 1 resonance (Drell–Yan)

In \(Z/\upgamma ^* \rightarrow \uptau \uptau \) lepton decays the probability of the helicity state denoted \(p^z_{\uptau }\) is a function of the \(\uptau \) lepton scattering angle, \(\uptheta \), and the center of mass energy squared of the hard process, s. It is true at Born level, and in the ultra-relativistic limit [36].

Note that the rest frame of the production process and the rest frame of the \(\uptau \) lepton pair might not be the same due to photon bremsstrahlung in the \(\uptau \) lepton pair production vertex. We have discussed this already in Sect. 3.1, but let us complete some more technical details now.

The center-of-mass system of \(\uptau \) lepton pairs is used for calculating \( \cos \uptheta \) and the direction of incoming partons is set along z-direction in the laboratory frame. The following definitions are used:

$$\begin{aligned} \cos {\uptheta }_{1} = \frac{{\varvec{\uptau }}^+ \cdot {b}^{+}}{|{\varvec{\uptau }}^{+}| |{b}^{+}|}, \quad \cos {\uptheta }_{2} = \frac{{\varvec{\uptau }}^- \cdot {b}^{-}}{|{\varvec{\uptau }}^{-}| |{b}^{-}|}, \end{aligned}$$
(31)

where \( {b}^{+} \), \( {b}^{-}\) denote 3-vectors of incoming beams, in the laboratory frame defined along the z-axis. The definition of an effective \(\cos \uptheta \) is constructed following Ref. [38]

$$\begin{aligned} \cos \uptheta = \frac{\cos {\uptheta }_{1} \cdot \sin {\uptheta }_{2} + \cos {\uptheta }_{2} \cdot \sin {\uptheta }_{1} }{ \sin {\uptheta }_{1} + \sin {\uptheta }_{2}}. \end{aligned}$$
(32)

At Born level, for a given flavour of incoming partons and in the ultra-relativistic limit, the \(p^z_{\uptau }\) is defined, Ref. [36], as

$$\begin{aligned} p^z_{\uptau } =\frac{ \frac{d \upsigma }{d \cos \uptheta }(s, \cos \uptheta , P^z_{\uptau } = 1)}{ \frac{d \upsigma }{d \cos \uptheta }(s, \cos \uptheta , P^z_{\uptau } = 1) + \frac{d \upsigma }{d \cos \uptheta }(s, \cos \uptheta , P^z_{\uptau } = -1) },\nonumber \\ \end{aligned}$$
(33)

where

$$\begin{aligned}&\frac{d \upsigma }{d \cos \uptheta }(s, \cos \uptheta , P^z_{\uptau }) = (1 + \cos ^2 \uptheta )F_0(s) + 2 \cos \uptheta \ F_1(s) \nonumber \\&\quad -P^z_{\uptau } [(1 + \cos ^2 \uptheta )F_2(s) + 2 \cos \uptheta \ F_3(s)] \end{aligned}$$
(34)

and \(F_i(s)\) are four form factors which depend on the initial and the final state fermion couplings to the Z boson and its propagator.

Table 3 Probability for the helicities of the of \(\uptau \) leptons from different origins [36]

In the TauSpinner algorithm the flavour of the initial partons is assumed to be unknown, the probability \(p^z_{\uptau }\) is calculated as a weighted average over all possible initial state quark configurations. This requires averaging (summing) over all production matrix elements square convoluted with the structure functions

$$\begin{aligned} p^z_{\uptau } = \frac{\sum _{(flav.: i,j)} f_i(x_1,Q^2) f_j(x_2, Q^2) \cdot \sum _{spin }|{{\mathscr {M}}}^{prod}_{i,j}|^2 \cdot p^z_{\uptau }(i,j)}{\sum _{(flav.: i,j)} f_i(x_1,Q^2) f_j(x_2, Q^2) \cdot \sum _{spin }|{{\mathscr {M}}}^{prod}_{i,j}|^2 },\nonumber \\ \end{aligned}$$
(35)

where the indices ij denote flavours of incoming partons.

For calculating the spin weight, the polarization \(P^z_{\uptau }\) of the single \(\uptau \) lepton in a mixed quantum state is calculated neglecting transverse spin degrees of freedom (ultra-relativistic limit). The \(P^z_{\uptau }\) is then a linear function of the probability for the helicity state,Footnote 11 Eq. (21).

6.1.3 Case of a spin two resonance X (not a Higgs)

In this case a user provided function required to replace \(\frac{d \upsigma }{d \cos \uptheta }\), the non-Standard physics effective Born parametrizations, is not included in the TauSpinner library, and a dummy function is provided only. It can be replaced with a user one, see Ref. [12] for details and in particular the TAUOLA/TauSpinner/examples/tau-reweight-test.cxx directory. This \(2\rightarrow 2\) parton level process function nonSM_adoptH (or nonSM_adopt) has the following arguments (int ID, double S, double cost,int H1,int H2, int key). It can be activated in the user code at the execution time, see Appendix B.2.

6.2 Attributing \(\uptau \) (or \(\uptau \) pair) helicity states

For the individual event, the \(\uptau \) helicity (\(+/-\)) is attributed stochastically. The probability for given configurations of the longitudinal polarization of \(\uptau \) leptons of different origins [36] is shown in Table 3. These probabilities can be used, when decay kinematical configurations of the decays are not yet constructed.

However, once the configurations of decay products are generated the event-by-event calculation of the probability for helicity states has to take into account polarimetric vectors \(h_{+}\) and \(h_{-}\). The \((+)\) is chosen if probabilities, calculated with the formulae below, are smaller than a generated random number RRR sampled uniformly in [0,1] range, otherwise \((-)\) is taken:

  • Case of a spin zero resonance (scalar Higgs)

    $$\begin{aligned} p(-) = \frac{ 1 + sign \cdot h^{z}_{+} \cdot h^{z}_{-} + h^{z}_{+} + h^{z}_{-} }{ 2 + 2 \cdot sign \cdot h^{z}_{+} \cdot h^{z}_{-} } \end{aligned}$$
    (36)

    where \(sign = -1\).

  • Case of a spin two resonance X (not a Higgs)

    $$\begin{aligned} p(-) = (1 + P^z_{\uptau }) \frac{ 1 + sign \cdot h^{z}_{+} \cdot h^{z}_{-} + h^{z}_{+} + h^{z}_{-} }{ 2 + 2 \cdot sign \cdot h^{z}_{+} \cdot h^{z}_{-} + 2.0 \cdot P^z_{\uptau } \cdot (h^{z}_{+} + h^{z}_{-}) }\nonumber \\ \end{aligned}$$
    (37)

    where \(sign = +1\).

  • Case of a spin one resonance (Drell–Yan)

    $$\begin{aligned} p(-) = (1 + P^z_{\uptau }) \frac{ 1 + sign \cdot h^{z}_{+} \cdot h^{z}_{-} + h^{z}_{+} + h^{z}_{-} }{ 2 + 2 \cdot sign \cdot h^{z}_{+} \cdot h^{z}_{-} + 2.0 \cdot P^z_{\uptau } \cdot (h^{z}_{+} + h^{z}_{-}) }\nonumber \\ \end{aligned}$$
    (38)

    where \(sign = +1\).

7 The \(2 \rightarrow 4\) process

At this point we have completed the discussion for the case when the TauSpinner is used assuming a parton level processes of \(2\rightarrow 2\) type. Let us turn now to the case when \(2\rightarrow 4\) parton level processes are used. This extension has been introduced recently, see Ref. [15] for a detailed description.

The baseline algorithm remains essentially the same. The differences can be grouped into few parts

  • Kinematics

    For calculation of factorization scale, instead of virtuality of \(\uptau \) lepton pair, virtuality of lepton pair combined with jets is used. In fact a few options to define the \(Q^2\) factorization scale have been implemented. The definitions of frames type A, B, \(C_{\uptau ^\pm }\) and \(D_{\uptau ^\pm }\) as explained for case of \(2 \rightarrow 2\) processes are used. In principle the additional rotation by the angle \(\uppi \) around the axis x would be again needed for the \(\uptau ^-\) in transformations from B, \(C_{\uptau ^-}\) frames. This is due to convention used for spin amplitudes.Footnote 12 The definition of the previously discussed frame \(A'\) needs to be modified. Not only bremsstrahlung photons need to be added to \(\uptau \) leptons to obtain kinematic configurations for matrix element calculation, but outgoing partons (jets) four-momenta have to be taken into account as well.

  • Matrix Element Calculation

    Matrix element squared are calculated for given helicity states of \(\uptau \) leptons and flavours of incoming/outgoing partons in frame A’. In particular formula (23) is used for calculation of \(R_{z,t}\) and \(R_{t,z}\), which are then used as of frame B, without any modifications. The EW scheme used and \(\upalpha _s(Q^2)\) can be configured using several options defined in Ref. [15].

  • Extension due to flavours of accompanying partons/jets

    All sums \(\sum _{flavour}\) as used in Sect. 2.2 should read now as sums over flavours of incoming and outgoing partons. Of course PDFs convolution with distributions is used for incoming partons only. This modification is extending re-weighting algorithm dependence on the final state components consisting of partons (hadronic jets). This technically simple change may be thus of a concern because of additional types of the systematic uncertainties involved.

Except these changes, the algorithms are not modified. However only longitudinal spin effects can be simulated because we use helicity states, in the ultra-relativistic approximation in matrix element calculation. In future, if necessary, we can extend the case to the complete spin effects treatment. Minor extension of the program will be needed. Approximation is in the matrix element calculation only. It may even be possible to use for that purpose presently available MadGraph amplitudes discussed in Ref. [15]. Better control of the complex phases will be however needed.

8 On the systematic errors

In the following the limitations of the program and its systematic uncertainties will be discussed.

One of the questions is whether TauSpinner can be used to modify spin/production/decay features of events; when \(\uptau \) lepton decay library other than Tauola was used, when its physics initialization was different, or when events were generated with QCD matrix elements of higher order than implemented in TauSpinner? If yes, what is the systematic uncertainty or bias which should be attributed to the predictions obtained using a Monte Carlo sample with weights calculated by TauSpinner?

The evaluation of them is not universal, it needs to be repeated for every new observable. We therefore cannot focus the discussion on the tool itself, but rather present general observations concerning re-weighting techniques for the \(\uptau \) lepton physics. The topic obviously can not be all-embracingly covered in the present paper.

Nowadays Monte Carlo programs such as Herwig [39], Sherpa [20], Pythia [40] have their own \(\uptau \) lepton decay algorithms and physics initializations. One can argue, if in some aspects, they are not better than the ones used in publicly available version of the Tauola library. One can also argue that the re-weighting with algorithms like TauSpinner is nowadays an obsolete technique, and that it is better to generate new event samples with modified required physics input, or to use generator own re-weighting methods.

In some cases this might be true but it is not always easy to apply in practice. For example, experiments store events in a format which must be universal for all generators. Inevitably some intermediate information is lost. Also, re-generation of such experiment-specific samples with modified assumptions is time-consuming, because of the detector response simulation and often also because of the CPU needed for each event of the desired phase space region. Event generation became CPU expensive in modern Monte Carlo generators, because of the complexity of the phase space and multiplicity of the outgoing legs in the matrix-elements.

The evaluation of systematic uncertainties of the re-weighting technique implemented in TauSpinner is nonetheless mandatory. It can be divided into three main domains:

A. :

Physics driven uncetainty, related to approximations used for particular matrix element calculations of the production and the \(\uptau \) lepton decays, finally of the parton distribution functions.

B. :

Approximations related to the program design.

C. :

Technical uncertainties related to the mismatch in the way how information is being passed to the program or of approximations used in the generation of samples to be re-weighted.

A.

Technically, any \(\uptau \) lepton decay generator, to a great degree, can be understood as consisting of three elements: (i) a phase space generator, (ii) a calculator of matrix elements and finally (iii) a model for hadronic current for semileptonic decays. The last one (iii) is prone to large systematic uncertainties. TauSpinner shares the code for (ii) and (iii) with Tauola. That is also why part of the systematic uncertainties is common. The precision of models used in construction of hadronic currents is optimistically at 5 % precision level and realistically one can expect a precision rather at the level of 10 or 20 % only. Smaller ambiguities are expected for inclusive distributions like branching ratios or one-dimensional spectra, larger ones for multidimensional distributions. It is crucial, that the work on related comparisons with the data, fits and evaluation of systematic uncertainties is performed within the experiments. Let us focus on the systematic uncertainty evaluation and practical consequences for TauSpinner when applied to events where \(\uptau \) lepton decays are simulated with a different library than Tauola. The particular choice of hadronic currents used in samples generated with Herwig, Sherpa or Pythia needs to be known and the same choice has to be used for TauSpinner too. The techniques how to check if proper choice was taken are documented in Ref. [13] (Section 4.5 “Consistency checks”). Consequences of mismatches are of numerical importance.

If the matrix elements used in the \(\uptau \) lepton decay sample generation do not match those assumed to be used for the calculation of TauSpinner weights, results can be largely inaccurate. Particularly numerical instabilities may occur if the matrix element used for the weight denominators would approach zero in non-depleted regions of the phase space. The problem may appear for multi-scalar final states, but for \(\uptau ^\pm \rightarrow l^\pm \upnu {\bar{\upnu }}\), \(\uptau ^\pm \rightarrow \uppi ^\pm \upnu \) or even \(\uptau ^\pm \rightarrow \uppi ^\pm \uppi ^0 \upnu \) decays, which amount for 2/3 of all \(\uptau \) lepton decays, this problem is generally absent. Let us concentrate on the case of \(\uptau ^\pm \rightarrow (3\uppi )^\pm \ \upnu \) because it contributes more than 20 % to the \(\uptau \) lepton decay rate. We have observed that in some regions of the phase space the modeling of \(\uptau \) lepton decays can lead to distributions which differ by a factor of 2, or even more, depending on the data used as an input. At the same time, for more inclusive results like one-dimensional distributions differences can be of the order of 10 % or less. For numerical evaluation see Ref. [41] (Section 10). Eight variants of hadronic currents were presented and used for the discussion in Section 2 of Ref. [41], most of them as available in Tauola, but one of them was taken from Pythia 8, in the version of the year 2015. Tests how to check if indeed sufficient level of precision was achieved are discussed in the summary of that paper. It is stressed that at least 3-dimensional distributions are necessary to appropriately identify differences. Tests of modelling for \(\uptau \) lepton decays are particularly important for applications based on Machine Learning techniques. Such tests were performed in Ref. [42], for Higgs CP parity sensitive observables in \(H\rightarrow \uptau ^+\uptau ^-\) with \(\uptau \) lepton decays to three scalars.

B.

Let us note that not only the matrix elements, used for \(\uptau \) lepton decays in the re-weighted sample, have to match the one used in the weight calculation. Also the level of approximation used for calculation of production matrix element and in particular spin effects have to match the one used in spin weight denominators. See Ref. [13], Section 4, for details on the consistency checks.Footnote 13

The matrix element for \(pp \rightarrow \uptau ^+\uptau ^- X\) production are generally not available. They are obtained from the factorization theorems separating parton distribution (parton showers) from the hard matrix elements. For the case of pp collisions, references [32, 33] can be used to provide necessary input from the theoretical side for the algorithmic solutions. The tests of consistency are presentedFootnote 14 in Section 5.4 of Ref. [13]. Following the results of references [32, 33] tests consisting of comparing spin effects implemented in different \(\uptau \) lepton pair rest frames can be very useful on top of the ones for the dependence of results on EW schemes studied in these papers.Footnote 15

The comparisons of results obtained from TauSpinner working in \(2 \rightarrow 2\) and \(2 \rightarrow 4\) matrix element modes offer the way to check if factorization used in TauSpinner algorithm is sufficiently precise for the configurations featuring high \(p_T\) jets.

C.

One should bear in mind, that information on intermediate and also final state particles stored by many of todays generators use distinct variants of encoding conventions, even if the same format like HepMC is used in every case. That can be a problem for many applications used by experiments, e.g. in the estimation if reconstruction algorithms work properly, and if the initial input of the generation can be deconvoluted from the event response of the detector. Inescapably this may cause problems for TauSpinner, too. Implicitly, the event record design relies on the assumption that the event is represented by a tree-like structure. This generally can not be assured, in particular because of quantum interference and quantum entanglement. Some approximations need to be used, or information of intermediate states, such as EW bosons abandoned.Footnote 16

Several options of TauSpinner initialization are prepared. They can help to understand if the samples were e.g. generated particular, partial spin implementation only. Then they can be used to re-weight to the required physics assumptions, see Ref. [13].

9 Summary

In this paper we have presented the theoretical basis and description of algorithms used in the TauSpinner program for simulating spin effects in the production and the decay of \(\uptau \) leptons in proton-proton collisions at the LHC. The primary source of \(\uptau \) leptons are Drell–Yan processes of single W and Z boson production, often accompanied by additional jets. Since the Higgs boson discovery by ATLAS and CMS Collaboration in 2012, the \(H \rightarrow \uptau \uptau \) lepton decay became the most promising channel for studying CP properties of its couplings to fermions. With more data available from Run II of the LHC also \(\uptau \) lepton decays in case of multi-boson production will become part of interesting signatures.

The algorithms discussed here allow for the separation of the \(\uptau \) lepton production and decay in phenomenological studies. We have discussed options used for simplifying descriptions and approximations used.

Although the framework of TauSpinner is prepared for implementation of the non Standard Model couplings, we have not given too much attention to this possible development path. We have recalled in the Appendices most of examples and applications. They are available with the distributed code. References, covering details wherever possible are given. The technical information is brief, details are delegated to the README files. Techniques of how to estimate systematic uncertainties for the results obtained with TauSpinner were briefly reviewed.