1 Introduction

After the great achievement of discovering a new boson at the LHC [1, 2], the primary goal is now to study its properties in detail, and to detect the slightest hints for possible extensions of the Standard Model. Certainly, precise theory predictions are indispensable to achieve this aim, which calls for calculations at next-to-leading order (NLO) accuracy and beyond.

NLO predictions nowadays should be considered as the standard for experimental data analysis. Ideally, matching NLO results to a parton shower and merging different jet multiplicities should be aimed for. However, this also requires fast and highly automated NLO tools to be available, to be compared to a vast amount of measurements, most of them dealing with multi-particle final states.

The development of automated NLO tools has seen tremendous progress in the past years, leading to public codes [37] which are able to produce multi-particle NLO predictions for user-defined processes, or to dedicated frameworks [815], which allowed to produce an impressive collection of NLO processes.

The integrand-reduction method [1618] has changed our way of addressing the decomposition of amplitudes in terms of master integrals, whose coefficients can be determined by applying algebraic projections to polynomial functions.

The principle of an integrand-reduction method, which is valid at any order in perturbation theory [1923], is the underlying multi-particle pole expansion for the integrand of any scattering amplitude, or, equivalently, a representation where the numerator of each Feynman integral is expressed as a combination of products of the corresponding denominators, with polynomial coefficients. These coefficients correspond to the residue of the integrand at the multiple-cut. Each residue is a multivariate polynomial in the irreducible scalar products formed by the loop momenta and either external momenta or polarization vectors constructed out of them.

GoSam is a code which was designed to maximally exploit both the integrand reduction for dimensionally regulated one-loop amplitudes [16, 24], as implemented in Samurai [25], as well as improved tensor reduction methods as developed in [26, 27]. The algebraic expression of the integrands are automatically generated by means of the Golem technology [26, 2830].

The polynomial structure of the multi-particle residues is a qualitative information that turns into a quantitative algorithm for decomposing arbitrary amplitudes in terms of master integrals at the integrand level. In fact, in the context of an integrand-reduction, any explicit integration procedure is replaced by a simpler operation like polynomial fitting, which in Samurai is implemented via Discrete Fourier Transform [3133].

GoSam produces analytic expressions for the integrands. Because of this feature, it is suitable to be interfaced with a new library, called Ninja [34, 35], implementing an ameliorated integrand-reduction method, where the decomposition in terms of master integrals is achieved by Laurent expansion through semi-analytic polynomial divisions [36]. With the new reduction algorithm, GoSam-2.0 can produce results for NLO virtual corrections that are more accurate and less time consuming than the ones provided by version 1.0.

In this paper we present the new version 2.0 of the program GoSam [6], which has been used already to produce a multitude of NLO predictions both within [35, 3747] and beyond [48, 49] the Standard Model. The new version contains important improvements in speed, numerical robustness, range of applicability and user-friendliness. GoSam can be linked to different Monte Carlo programs via the Binoth-Les-Houches-Accord BLHA [50], where the extended version BLHA2 [51] is also implemented. The program can be downloaded from [52] http://gosam.hepforge.org. The structure of the paper is the following. In Sect. 2 we give a brief overview of the program structure. The new features of the program are presented in Sect. 3. Section 4 describes the installation and usage of GoSam, while in Sect. 5 we give examples illustrating some of the new features, before we conclude in Sect. 6. The appendices contain a commented example of an input card for convenience of the user, and some details about higher rank integrals.

2 Overview of the program

GoSam can be used either as a standalone code producing one-loop (and tree level) amplitudes, or it can be used as a One Loop Provider (OLP) in combination with a Monte Carlo (MC) program, where the interface is automated, based on the standards defined in [50, 51]. The main workflow of GoSam is shown in Fig. 1 for the standalone version and in Fig. 2 for GoSam as an OLP within a Monte Carlo setup.

Fig. 1
figure 1

Basic workflow of GoSam

In the standalone version, the user will fill out a process run card which we call process.in, where the process is defined, together with some options. Then the code for the virtual amplitudes is generated by invoking gosam.py process.in.

After running the above command with an appropriate run card, all the files which are relevant for code generation will be created. The command make source will invoke QGRAF [53] and FORM [54, 55] to generate the diagrams and algebaric expressions for the amplitudes, using also spinney [56] for the spinor algebra within FORM and haggies [57] for code generation. In version 2.0 of GoSam, the production of optimized code however is largely relying on the new features of FORM version \(\ge \)4. The command make compile will finally compile the produced Fortran90 code.

Fig. 2
figure 2

Schematic setup for GoSam as an OLP in combination with a Monte Carlo program

In the OLP version, the information for the code generation is taken from the order file generated by the Monte Carlo program. Depending on the MC, the whole generation can be invoked automatically and steered by its setup. This is shown schematically in Fig. 2 and explained in more detail in Sect. 4.3.

The amplitudes are evaluated using \(D\)-dimensional reduction at integrand level [16, 31, 58], which is available through two different reduction procedures and libraries: Samurai [25, 33] and Ninja [35, 36]. Alternatively, tensorial reconstruction [27] is also available, based on the libraries Golem95C [30, 59, 60] and OneLOop [61].

It should be emphasized that all the reduction- and integral libraries used in GoSam-2.0 are included in the program package, and the installation script described in Sect. 4.1 will take care of compilation and linking, such that the user does not have to worry about installing them separately. Interfacing other tensor integral libraries, such as LoopTools [3, 62], PJFRY [63, 64] or Collier [65], should be straightforward, due to the modular structure of our setup.

More details about the reduction procedures implemented in GoSam will be given in Sect. 3.

3 New features

The version 2.0 of GoSam comes with several new features, which lead to an improvement in speed for both the generation and the evaluation of the amplitudes, more compact code, and more stable numerical evaluation. Further, the range of applicability of the code is extended, in particular to deal with effective theories and physics Beyond the Standard Model.

We will describe some of the new features in more detail below.

3.1 Improvements in code generation

3.1.1 Producing optimised code with FORM version 4

While in version 1.0 of GoSam the Fortran code for the amplitudes was written using haggies [57], we now largely use the features provided by FORM version 4.x [55] to produce optimized code. This leads to more compact code and a speed-up in amplitude evaluation of about a factor of ten. The option to use haggies is still available by setting the extension noformopt.

3.1.2 Grouping/summing of diagrams which share common subdiagrams

Already in the first release of GoSam, the diagrams were analyzed according to their kinematic matrix \(S_{ij}\) and grouped together before reduction. This lead to an important gain in efficiency, both with reduction based on integrand reduction methods, as well as with classical tensor reduction techniques. Details about the way diagrams are grouped can be found in [6]. This feature is still present when Samurai or Golem95C are used for computing the amplitudes.

In the new release an option called diagsum combines diagrams which differ only by a subdiagram into one “meta-diagram” to be processed as an entity. This allows one to further reduce the number of calls to the reduction program and therefore to increase the computational speed.

Fig. 3
figure 3

Example of diagrams sharing a common tree part, which are summed when the diagsum option is set to diagsum=true

When the option diagsum is active, diagrams which differ only by a propagator external to the loop, as is the case e.g. for the \(Z/\gamma ^\star \) propagator in QCD corrections to the production of \(Z+\)jets, are summed together before being processed by FORM. Similarly, diagrams which differ only by an external tree part, but which share exactly the same set of loop propagators, are summed together prior the algebraic manipulation. An example is shown Fig. 3. Finally, diagrams which share the same set of propagators, but have different particles circulating in the loop, as shown in Fig. 4, are also summed into one “meta-diagram”. The default setting for this option is diagsum=true.

Fig. 4
figure 4

Example of diagrams sharing a common loop propagator, but with different particle content in the loop, which are summed when the diagsum option is set to diagsum=true

3.1.3 Numerical polarisation vectors

The use of numerical polarisation vectors for massless gauge bosons (gluons, photons) is activated by default. This means that the various helicity configurations for the massless bosons will be evaluated numerically, based on a unique code containing generic polarisation vectors, rather than producing separate code for each helicity configuration. To switch off this default setting, for example if the user would like to optimize the choice of reference vectors for each helicity configuration, the option polvec=explicit should be given in the input file process.in.

3.2 Improvements in the reduction

The algebraic generation of the integrands in GoSam is tailored to the maximal exploitation of the \(D\)-dimensional integrand reduction algorithm.

In the previous version, GoSam-1.0, Samurai has been the default library for the amplitude decomposition in terms of master integrals. Within the original integrand reduction algorithm, implemented in Samurai, the determination of the unknown coefficients multiplying the master integrals requires: (i) to sample the numerator on a finite subset of the on-shell solutions; (ii) to subtract from the integrand the non-vanishing contributions coming from higher-point residues; and (iii) to solve the resulting linear system of equations. Gauss substitutions and the integrand subtractions enforce a triangular system solving strategy, which proceeds top-down, from the pentuple-cut to the single-cut. In this fashion, because of the integrand subtractions, the integrand which has to be evaluated numerically gets updated at any level, cut-by-cut, by the subtraction of the polynomial residues determined at the previous step. The sampling and the determination of the coefficients in Samurai proceeds with a projection technique based on the Discrete Fourier Transform [31, 33].

In the new version GoSam-2.0, the amplitude decomposition is obtained by a new integrand-reduction method [36], implemented in the C++ code Ninja [34, 35], which is the default reduction library.

In Ref. [36] an improved version of the integrand reduction method for one-loop amplitudes was presented. This method allows, whenever the analytic dependence of the integrand on the loop momentum is known, to extract the unknown coefficients of the residues by performing a Laurent expansion of the integrand with respect to one of the free loop components which are not constrained by the corresponding on-shell conditions.

Within the Laurent expansion approach, the system of equations for the coefficients becomes diagonal. In fact, in the asymptotic limit, both the integrand and the higher-point subtractions exhibit the same polynomial behaviour as the residue. Therefore one can identify the unknown coefficients with the ones of the expansion of the integrand, corrected by the contributions coming from higher-point residues. In other words, the subtractions of higher-point contributions are replaced by corrections at the coefficient level. Because of the universal structure of the residues, the parametric form of these corrections can be computed once and for all, in terms of a subset of the higher-point coefficients.

This novel \(D\)-dimensional unitarity-based algorithm is lighter than the original integrand reduction method, because less coefficients need to be determined, and turns out to be faster and numerically more accurate.

The integrand reduction via Laurent expansion has been implemented in the library Ninja, where the Laurent expansions of the integrands are performed by a polynomial division between some parametric expansions of the numerator and the uncut denominators. The expansions of the numerator, required by Ninja as input, are efficiently generated by GoSam using FORM, after collecting the terms that do not depend on the loop momentum into global abbreviations.

Ninja and the new version of Samurai, as well as Golem95C, all distributed with the GoSam-2.0 package, can deal with processes where the masses of the internal particles are complex, and where the rank \(r\) of the numerator of the integrands can exceed the number \(N\) of denominators by one unit, i.e. \(r \le N+1\), as it may happen e.g. in effective theories (see also Sect. 3.5.1).

3.2.1 The extension derive

The derive feature generates code to access the tensor coefficients of each diagram or group of diagrams individually. While it has been among the possible keywords for the extensions options in GoSam-1.0 already, it now has been promoted to be used by default in the context of tensorial reconstruction [27]. It improves both the speed and the precision of tensorial reconstruction and makes connection to other reduction methods.

The idea behind it is to compute the numerator \(\mathcal {N}(q)\) from a Taylor series

$$\begin{aligned} \mathcal {N}(q)&= \mathcal {N}(0) + q^\mu \frac{\partial }{\partial q_\mu }\mathcal {N}(q)\vert _{q=0}\nonumber \\&+\frac{1}{2!} q^\mu q^\nu \frac{\partial }{\partial q_\mu } \frac{\partial }{\partial q_\nu } \mathcal {N}(q)\vert _{q=0} + \cdots \end{aligned}$$
(1)

In this form one can read off a one-to-one correspondence between derivatives at \(q=0\) and the coefficients of the tensor integrals.

At a technical level, the files helicity \(^{*}\) /d \(^{*}\) h \(^{*}\) l1d.f90 contain the routines derivative( \(\mu ^2\) , [ \(i_1\) ], [ \(i_2\) ],...) and reconstruct_d \(^{*}\) (coeffs), where the latter is only generated in conjunction with the extension golem95, and coeffs is a type which comprises all coefficients of a diagram of a certain rank. The number of optional indices \(i_1\), \(i_2\), ...determine which derivative should be returned. The subroutine reconstruct_d \(^{*}\) also takes into account the proper symmetrisation.

3.3 Electroweak scheme choice

Regularisation and renormalisation within the Standard Model can be performed using various schemes, which also may differ in the set of electroweak parameters considered as input parameters, while other electroweak parameters are derived ones. Within GoSam-2.0, different schemes can be chosen in several different ways by setting appropriately the flag model.options, depending on whether the scheme might be changed after the generation of the code or not.

By default, when the flag is not set in the input card, GoSam generates a code which uses \(\mathrm {m_W}\), \(\mathrm {m_Z}\) and \(\mathrm {\alpha }\) as input parameters, allowing however to change this in the generated code, by setting the variable ewchoice in the configuration file common/config.f90 to the desired value. The user can choose among 8 different possibilities, which are listed in Table 1. When the electric charge \(\mathrm {e}\) is set algebraically to one, the symbol for \(\mathrm {e}\) will not be present in the generated amplitudes. This can be useful e.g. if the Monte Carlo generator used in combination with GoSam will multiply the full result by the coupling constants at a later stage of the calculation. In scheme number 8, \(m_W\) is derived from a formula where both \(\mathrm {e}\) and \(G_F\) enter. Thus, using \(e=1\) in combination with the standard value for \(G_F\) would lead to the wrong gauge boson masses. Therefore the scheme 8 cannot be used if \(\mathrm {e}\) is set algebraically to one.

Table 1 Possible choices to select the electroweak scheme. To simplify the notation we write the sine of the weak mixing angle as \(\mathrm {sw}\). The lists of derived parameters contain only the parameters which are computed from the input parameters and used in the expressions for the amplitudes

The flag model.options in the input card allows one also to directly set the values of the different parameters appearing in the model. If the values of exactly three electroweak parameters are specified, GoSam automatically takes them as input parameters. In that case, in order to be able to switch among different schemes after code generation, the variable ewchoose also must be added to the model.options flag.

3.4 Stability tests and rescue system

Within the context of numerical and semi-numerical techniques, we should be able to assess in real time, for each phase space point, the level of precision of the corresponding one-loop matrix element. Whenever a phase space point is found in which the quality of the result falls below a certain threshold, either the point is discarded or the evaluation of the amplitude is repeated by means of a safer, albeit less efficient procedure. This procedure is traditionally called “rescue system”.

Apart from improvements in the stability of the reduction itself, which are provided by the new versions of Samurai and Golem95C, and in particular by the new reduction algorithm Ninja, the new version of GoSam also has a more refined rescue system as compared to version 1.0.

Looking at the literature, we observe that various techniques for detecting points with low precision have been implemented within the different automated tools for the evaluation of one-loop virtual corrections.

A first commonly used approach relies on the comparison between the numerical values of the infrared pole coefficients computed by the automated tool with their known analytic results dictated by the universal behaviour of the infrared singularities [66]. We refer to this as the pole test.

The main advantages of this method are its broad applicability to all amplitudes and the fact that it requires a negligible additional computation time. However, since not all integrals which appear in the reconstruction of the amplitude give a contribution to the double and single poles, this method often provides an overestimate of the precision, which might result in keeping phase space points whose finite part is less precise than what is predicted by the poles.

Different techniques have been proposed that target directly the precision of the finite part. Using the symmetry properties of scattering amplitudes under scaling of all physical scales, or alternatively the invariance under rotation of the momenta, we can build pairs of points that should provide identical results, both for the finite parts and for the poles, and use the difference between them as an estimator of the precision.

The scaling test [67], is based on the properties of scaling of scattering amplitudes when all physical scales (momenta, renormalisation scale, masses) are rescaled by a common multiplicative factor \(x\). As shown in [67], this method provides a very good correlation between the estimated precision and the actual precision of the finite parts.

The rotation test [35] exploits the invariance of the scattering amplitudes under an azimuthal rotation about the beam axis, namely the direction of the initial colliding particles. Whenever the initial particles are not directed along the beam axis, one can perform a rotation of all particles by an arbitrary angle in the space of momenta. A validation of this technique, and the corresponding correlation plots, has been presented in [35].

While the scaling and the rotation test provide a more reliable estimate of the precision of the finite parts that enter in the phase space integration, their downside is that they require two evaluations of the same matrix element, therefore leading to a doubling in the computational time.

Additional methods have been proposed, within the context of integrand-reduction approaches, which target the relations between the coefficients before integration, namely the reconstructed algebraic expressions for the numerator function before integration, known as \(\mathcal {N}=\mathcal {N}\) tests [18, 25]. This kind of tests can be applied to the full amplitude (global \(\mathcal {N}=\mathcal {N}\) test) or individually within each residue of individual cuts (local \(\mathcal {N}=\mathcal {N}\) test). The drawback of this technique comes from the fact that the test is applied at the level of individual diagrams, rather than on the final result summed over all diagrams, making the construction of a rescue system quite cumbersome.

For the precision analysis contained in GoSam-2.0, and to set the trigger for the rescue system, we decided to employ a hybrid method, that takes advantage of the computational speed of the pole test, combined with the higher reliability of the rotation test. This hybrid method requires setting three different thresholds. After computing the matrix elements, GoSam-2.0 checks the precision \(\delta _{pole}\) of the single pole with the pole test. Comparing the single pole \(\mathcal {S}_{IR}\) that can be obtained from the general structure of infrared singularities and the one provided by GoSam-2.0, which we label \(\mathcal {S}\), we define

$$\begin{aligned} \delta _{pole} = \left| \frac{ \mathcal {S}_{IR} - \mathcal {S}{} }{ \mathcal {S}_{IR}} \right| . \end{aligned}$$
(2)

The corresponding estimate of the number of correct digits in the result is provided by \(P_{pole}= - \log _{10} (\delta _{pole})\). This step does not require any increase in computational time. The value of \( P_{pole}\) is then compared with two thresholds \( P_{high}\) and \( P_{low}\).

If \(P_{pole} > P_{high}\) the point is automatically accepted. Given the high quality of the computed pole, the finite part is very unlikely to be so poor that the point should be discarded.

If \(P_{pole} < P_{low}\) the point is automatically discarded, or sent to the rescue system. If already the pole has a low precision, we can expect the finite part to be of the same level or worse.

In the intermediate region where \( P_{high} > P_{pole} > P_{low}\), it is more difficult to determine the quality of the result solely based on the pole coefficients. Only in this case the point is recalculated using the rotation test, which requires additional computational time.

If we call the finite part of the amplitudes evaluated before and after the rotation \(\mathcal {A}^\mathrm{fin}\) and \(\mathcal {A}_{rot}^\mathrm{fin}\) respectively, we can define the error \( \delta _{rot}\) estimated with the rotation as

$$\begin{aligned} \delta _{rot} = 2 \left| \frac{ A_{rot}^\mathrm{fin} - A^\mathrm{fin} }{ A_{rot}^\mathrm{fin} + A^\mathrm{fin}} \right| . \end{aligned}$$
(3)

and the corresponding estimate on the number of correct digits as \(P_{rot} = - \log _{10} (\delta _{rot})\). \(P_{rot}\) provides a reliable estimate of the precision of the finite part [35], and can be compared with a threshold \(P_{set}\) to decide whether the point should be accepted or discarded.

The values of the three thresholds \( P_{high} \), \(P_{low}\) and \(P_{set}\) can be chosen by the user, to adjust the selection mechanism to the fluctuations in precision which occur between different processes. In the input card, \( P_{high} \), \(P_{low}\) and \(P_{set}\) correspond to PSP_chk_th1, PSP_chk_th2 and PSP_chk_th3, respectively, see Appendix A. It is worth to notice that the rotation test can be bypassed simply by setting the initial thresholds \(P_{high}= P_{low}\). In this case the selection is performed solely on the basis of the pole test.

3.5 New range of applicability

3.5.1 Higher rank integrals

The libraries Ninja, Golem95C and Samurai all support integrals with tensor ranks \(r\) exceeding the number of propagators \(N\). Such integrals occur for example in effective theories (a prominent example is the effective coupling of gluons to the Higgs boson), or in calculations involving spin-two particles beyond the leading order. These extensions are described in detail in Refs. [33, 36, 60] and are contained in the distribution of GoSam-2.0. The additional integrals will be called automatically by GoSam if they occur in an amplitude, such that the user can calculate amplitudes involving higher rank integrals without additional effort. Ninja and Samurai provide higher rank integrals for rank \(r=N+1\), version 1.3 of Golem95C [60] provides higher rank integrals and the tensorial reconstruction routines up to \(r=N+1\) for \(N\le 6\), as well as form factors up to rank ten for \(N\le 4\). More details about the higher rank integrals are given in Appendix B.

3.5.2 Production of colour-/spin correlated trees

GoSam can also generate tree level amplitudes in a spin- and colour-correlated form. Colour correlated matrix elements are defined as

$$\begin{aligned} C_{ij}={\langle {\mathcal{{M}}}|}\mathbf {T}_{i}\mathbf {T}_j {|{\mathcal{{M}}}\rangle }, \end{aligned}$$
(4)

and we define spin-correlated matrix elements as

$$\begin{aligned} S_{ij}={\langle {\mathcal{M},-}|}\mathbf {T}_{i}\mathbf {T}_j {|{\mathcal{M},+}\rangle }. \end{aligned}$$
(5)

The spin-correlated matrix element (as well as the colour correlated matrix element) contains implicitly the sum over all non-specified helicities, while only the helicities with the indices \(i\) and \(j\) are fixed, i.e.

$$\begin{aligned}&\langle \mathcal{M}_{i,-} |{\mathbf T}_i\cdot {\mathbf T}_j |\mathcal{M}_{i,+}\rangle \nonumber \\&=\sum _{\lambda _1,...,\lambda _{i-1},\lambda _{i+1},...,\lambda _n} \langle \mathcal{M}_{\lambda _1,...,\lambda _{i-1},-,\lambda _{i+1},...,\lambda _n}\nonumber \\&\quad \times \, | {\mathbf T}_i\cdot {\mathbf T}_j | \mathcal{M}_{\lambda _1,...,\lambda _{i-1},+,\lambda _{i+1},...,\lambda _n}\rangle . \end{aligned}$$
(6)

These matrix elements are particularly useful in combination with Monte Carlo programs which use these trees to build the dipole subtraction terms for the infrared divergent real radiation part. With these modified tree level matrix elements GoSam is able to generate all necessary building blocks for a complete NLO calculation.

Such a setup has been used successfully in combination with the framework of Herwig++/Matchbox [6870].

3.5.3 Support of complex masses

The integral libraries contained in the GoSam package as well as the GoSam code itself fully support complex masses. The latter are needed for the treatment of unstable fermions and gauge bosons via the introduction of the corresponding decay width. A fully consistent treatment of complex \(W\)- and \(Z\)-boson masses requires the use of the complex mass scheme [71]. According to this scheme the boson masses become

$$\begin{aligned} m_{V}^2 \rightarrow \mu _{V}^2 = m_{V}^2 -i m_{V} \Gamma _{V},\quad V=W,Z. \end{aligned}$$
(7)

Gauge invariance requires that the definition of the weak mixing angle has to be modified accordingly:

$$\begin{aligned} \cos ^2\theta _W = \frac{\mu _W^2}{\mu _Z^2}. \end{aligned}$$
(8)

To make use of the complex mass scheme, we introduce two new model files, sm_complex and smdiag_complex, which contain the Standard Model with complex mass scheme, the first with a full CKM matrix, the latter with a diagonal unit matrix for the CKM matrix. An example dealing with a complex top quark mass is given in Sect. 5.

4 Installation and usage

4.1 Installation

The user can download the code either as a tar-ball or from a subversion repository at http://gosam.hepforge.org.

The installation of GoSam-2.0 is very simple when using the installation script. The latter can be downloaded by

wget http://gosam.hepforge.org/gosam-installer/gosam_installer.py

By default GoSam will be installed into a subfolder ./local of the directory where the installation script is saved. A different path can be specified using the

– –prefix=PATH_where_to_install

option. To run the script the user should execute the following commands

chmod +x gosam_installer.py

./gosam_installer.py [– –prefix=...]

or

python gosam_installer.py [– –prefix=...]

Upon installation, the installer will ask some questions, which are described in more detail in the manual [52], which also can be downloaded from the webpage given above.

To use the default installation all the questions can be “answered” by pressing the ENTER key.

In particular, the installer will check if QGRAF [53] and FORM [54, 55] already exist on the system. If they are not found, one can either press ENTER to have them installed by the script, or provide a path to the binary (tab-completion can be used). If they are found, their version is checked, and if needed the installation of a version which has been tested to run with GoSam is suggested.

As soon as all questions are answered, the main installation process will start. The components will be downloaded, built and installed. The whole procedure can take about 10–30 minutes.

At the end, a script gosam_setup_env.sh will be created in the bin/ subdirectory of the install location, which will set (temporarily) all environment variables as soon as the script is sourced into a shell (with the command source [path]/gosam_setup_env.sh). The installer also gives a recommendation how these environment variables can be set permanently. The script can be used in all tcsh- and bash-compatible shells.

All files which have been installed are tracked in the installer-log.ini file. It is important to keep this file and the install script. They are needed to update and uninstall GoSam. For the default installation, internet access is required.

The program GoSam is designed to run in any modern Unix-like environment (Linux, Mac). The system requirements are Python (\(\ge \!2.6\)), a Fortran  compiler (gfortran or ifort), a C/C++ compiler (gcc/icc), and (GNU) make. Compatibility with gcc versions 4.2.–4.9 as well as clang has been tested. By default, GoSam uses the gfortran/gcc compilers from the GNU Compiler Suite. To use an Intel compiler (ifort/icc), the – –intel option can be used. Specific paths to the compilers can be provided using the – –fc, – –cc, – –cxx options.

All further options can be listed by invoking the installation script with the flag help:

gosam_installer.py – –help.

4.2 Using GoSam

We first start describing the use of GoSam in the standalone version. For the use in combination with a Monte Carlo program, based on the BLHA interface, we refer to Sect. 4.3.

In order to generate the matrix element for a given process the user should create a process specific setup file, process.in, which we call process card. An example process card for the process \(e^+e^-\rightarrow t\bar{t}\) is given in Appendix A, where we explain each entry in detail.

It is recommended to generate and modify a template file for the process card. This can be done by invoking the shell command

gosam.py – –template process.in

which generates the file process.in with some documentation for all defined options. The options are filled with the default values, and some paths are set by the installation script. User-defined options changing the default values can also be set in a global configuration file. The script will search in the GoSam-2.0 directory, in the user’s home directory and in the current working directory for a file named ‘.gosam’ or ‘gosam.in’.

In order to generate the Fortran code for the process specified in the input card one needs to invoke

gosam.py process.in

4.3 Structure of the generated code

The generated process directory will have the following sub-directory structure:

  • codegen: This directory contains files which are only relevant for code generation. These files will therefore not be included in a tar-ball created with make dist.

  • common: Contains Fortran files which are common to all helicity amplitudes and to the constructed matrix element code. The file config.f90 contains some global settings, the file model.f90 contains the definitions and settings for the model parameters. This directory is always compiled first.

  • doc: Contains files which are necessary for creating doc/process.pdf, which displays all Feynman diagrams of the Born level and one-loop amplitude, together with colour and helicity info.

  • helicity \(^{*}\): These directories contain all files for a specific helicity amplitude. The labeling of the helicities can be found in doc/process.pdf. Before invoking make source, this directory only contains the makefiles. After the full code generation, for each diagram three classes of files are created. The basic algebraic expressions for the individual one-loop diagrams are contained in the files d \(^{*}\) h \(^{*}\) l1.txt in an optimized format. The files d \(^{*}\) h \(^{*}\) l1.prc contain the expressions of the numerators as polynomials in the loop momentum. The corresponding Fortran files are d \(^{*}\) h \(^{*}\) l1.f90 and abbrevd \(^{*}\) h \(^{*}\) .f90, where the latter contains the abbreviations. Files generated with the derive option (see Sect. 3.2.1) are named d \(^{*}\) h \(^{*}\) l1d. \(^{*}\), while the input files for Ninja (see Sect. 3.2) are named d \(^{*}\) h \(^{*}\) l1 \(^{*}\) . \(^{*}\). For more details we refer to the manual [52].

  • matrix: Contains the code to combine the helicity amplitudes into a matrix element. Here one also finds the test program test.f90. The files in this directory are always compiled last.

  • Further, there are some files in the main process directory, for example the Born/loop diagram files generated by QGRAF, called diagrams-[0/1].hh, or the model file model.hh.

4.4 Conventions

In the case of QCD corrections, the tree-level matrix element squared can be written as

$$\begin{aligned} \vert \mathcal {M}\vert _{\text {tree}}^2=\mathcal {A}_0^\dagger \mathcal {A}_0= (g_s)^{2b}\cdot a_0. \end{aligned}$$
(9)

The fully renormalised matrix element at one-loop level, i.e. the interference term between tree-level and one-loop amplitudes, can be written as

$$\begin{aligned}&\vert \mathcal {M}\vert _{\text {1-loop}}^2= \mathcal {A}_1^\dagger \mathcal {A}_0+ \mathcal {A}_0^\dagger \mathcal {A}_1= 2\cdot \mathfrak {R}(\mathcal {A}_0^\dagger \mathcal {A}_1)\nonumber \\&\quad =\vert \mathcal {M}\vert ^2_{\text {bare}} \!+\!\vert \mathcal {M}\vert ^2_{\text {ct,}\,\delta m_Q} \!+\!\vert \mathcal {M}\vert ^2_{\text {ct,}\, \alpha _s} \!+\!\vert \mathcal {M}\vert ^2_{\text {wf, g}} \!+\!\vert \mathcal {M}\vert ^2_{\text {wf, Q}}\nonumber \\&\quad =\frac{\alpha _s(\mu )}{2\pi }\frac{(4\pi )^\varepsilon }{\Gamma (1-\varepsilon )} \cdot (g_s)^{2b}\cdot \left[ c_0+\frac{c_{-1}}{\varepsilon }+\frac{c_{-2}}{\varepsilon ^2} +\mathcal {O}(\varepsilon ) \right] .\nonumber \\ \end{aligned}$$
(10)

In the default case the flag nlo_prefactors has the value zero, which means that a call to the subroutine samplitude returns an array consisting of the four numbers \((a_0, c_0, c_{-1}, c_{-2})\), in this order, with the prefactors extracted as given above. In the case of electroweak corrections nlo_prefactors=0 has the same meaning, except that \(\alpha _s\) is replaced by \(\alpha \). If the flag nlo_prefactors has the value one, a factor of \(1/8\pi ^2\) instead of \(\alpha _s/2\pi \) (respectively \(\alpha /2\pi \) in the EW case) has been extracted from the numerical result, while for nlo_prefactors=2 all the prefactors are included in the numerical result.

The average over initial state colours and helicities is included in the default setup. In cases where the process is loop induced, i.e. the tree level amplitude is absent, the program returns the values for \(\mathcal {A}_1^\dagger \mathcal {A}_1\), where a factor of

$$\begin{aligned} \left( \frac{\alpha _s(\mu )}{2\pi }\frac{(4\pi )^\varepsilon }{\Gamma (1-\varepsilon )}\right) ^2 \end{aligned}$$

has been pulled out.

After UV renormalisation has been performed, only IR-singularities remain in the virtual matrix element. The coefficients of the latter can be checked using the routine ir_subtractions. This routine constructs the pole parts of the dipole subtraction terms and returns a vector of length two, containing the coefficients of the single and the double pole, which should be equal to \((c_{-1}, c_{-2})\).

4.5 Interfacing to Monte Carlo programs

The interface of GoSam with a Monte Carlo event generator program is based on the Binoth-Les Houches Accord (BLHA) standards. GoSam-2.0 supports both BLHA1 [50] and BLHA2 [51]. Certainly, a dedicated interface without using the BLHA is also possible, and such an interface with MadGraph/MadDipole/MadEvent [7275] has been built and applied successfully in various phenomenological applications [40, 43, 45, 48, 49].

If GoSam is used as a One Loop Provider (OLP), the Monte Carlo program is steering the different stages of the calculation, in particular the phase space integration and the event generation, as illustrated in Fig. 2. Therefore, the user frontend will depend on the user interface of the Monte Carlo program. The latter will call GoSam at runtime to provide the corresponding value of the one-loop amplitude at the given phase space points.

A number of phenomenological results produced by combining GoSam with various Monte Carlo programs can be found in the literature, e.g in combination with Sherpa [39, 4244, 47], PowHeg [41], Herwig++/Matchbox [68].

Examples how to run GoSam with Sherpa can also be found on the Sherpa manual webpage [76] and on the GoSam process packages webpage [77]. For the interface with PowHeg, a detailed description can be found in the appendix of Ref. [41]. The interface with Herwig++/Matchbox is described in [68].

4.6 Using external model files

The GoSam-2.0 package comes with the built-in model files sm, smdiag, smehc, sm_complex, smdiag_complex, where the latter two are needed in the case of complex masses and couplings, see Sect. 3.5.3. The model files smehc contain the effective Higgs-gluon couplings.

Other models can be imported easily in the UFO (Universal FeynRules Output) [78] format. The model import in the UFO format can be used in the standalone as well as the OLP mode of GoSam, where both the BLHA1 and BLHA2 standards are supported for the syntax of the model import.

A model description in the UFO format consists of a python package which the user can either generate using FeynRules [79, 80] or write himself and store in any directory. In order to import the model into GoSam one needs to set the model variable in the process card (line 5 in the example process card of Appendix A, specifying the keyword FeynRules in front of the path pointing to the python files defining the model. For example, if we assume that the model description is in the directory $HOME/models /MSSM_UFO, the process card should contain the line model= FeynRules,$HOME/models/MSSM_UFO.

The import of model files generated by LanHEP [81] is also supported. More details about the import from LanHEP are given in the GoSam-2.0 manual [52].

It should be pointed out that GoSam-2.0 provides automatic renormalisation only for QCD corrections. If external model files are used, as well as in the case of electroweak corrections, including the correct renormalisation is at the responsibility of the user.

The examples directory of the GoSam-2.0 package contains several examples for the import of model files, both in UFO and in LanHEP format. The subdirectory examples/model contains model files for the MSSM (as well as for the SM) in both UFO and LanHEP format. A concrete BSM example is discussed in Sect. 5.3.

5 Examples

5.1 \(gg\rightarrow H+\)1 jet in the heavy top mass limit

Recently GoSam was used to compute the virtual corrections for the production of a Higgs boson in association with 2 and 3 jets [39, 43] in the infinite top-mass limit. As an example for this type of processes, where a special model file is needed, containing the Feynman rules for the effective vertices, which furthermore give rise to higher rank loop integrals, we consider here the process \(gg\rightarrow H\,g\).

An example process card for the generation of this process, and a test routine comparing a phase space point with results from analytical amplitude representations is provided among the examples of the GoSam-2.0 distribution. In the following we will refer to that example to describe some feature of this process.

In order to compute amplitudes using the effective gluon-gluon-Higgs vertices, the model smehc has to be used. This model contains also the effective vertex for the Higgs boson decaying to two photons. When setting the powers of the strong coupling using the order flag, one has to remember that the effective vertex counts as two powers of the strong coupling. To compute the virtual corrections for \(H+1\) jet we therefore have to set order=QCD, 3, 5.

The inclusion of the effective gluon-gluon-Higgs coupling at NLO also requires corrections of the Wilson coefficient. At NLO the Wilson coefficient is given by [82]

$$\begin{aligned} C_1= -\frac{\alpha _s}{3\pi }\left( 1+\frac{\alpha _s}{\pi }\frac{11}{4}\right) , \end{aligned}$$
(11)

where the effective Lagrangian is given by

$$\begin{aligned} \mathcal{L}_{\mathrm {eff}}=-\frac{C_1}{4v}HG^{a, \mu \nu }G^a_{\mu \nu }. \end{aligned}$$
(12)

The smehc model file also contains the effective vertex for the Higgs decay into a pair of photons via top- and \(W\)-loops. For the vertex factor we use the formula given by FeynRules [79]:

$$\begin{aligned} g_{\gamma \gamma H}&= \frac{47 e^2}{72 \pi ^2 v}\left( 1 -\frac{14}{705}x_t^2 -\frac{2}{987}x_t^4 +\frac{33}{470}x_W^2 \right. \nonumber \\&\left. +\frac{57}{6580}x_W^4 +\frac{87}{65800}x_W^6+\frac{41}{180950}x_W^8 \right. \nonumber \\&\left. +\frac{5}{119756}x_W^{10} +\frac{213}{26346320}x_W^{12} \right) , \end{aligned}$$
(13)

where \(x_t=\frac{m_H}{m_t}\), \(x_W=\frac{m_H}{m_W}\) and the corresponding effective Lagrangian is given by

$$\begin{aligned} \mathcal{L}_{\mathrm {eff}}=-\frac{1}{4}g_{\gamma \gamma H}H F^{\mu \nu }F_{\mu \nu }. \end{aligned}$$
(14)

Table 3 contains numerical results for \(gg\rightarrow Hg\) at the phase space point shown in Table 2, where we have used \(m_H=125\) GeV, \(v^2=\frac{1}{\sqrt{2}G_F}\), \(G_F=1.16639\times 10^{-5}\) GeV\(^{-2}\).

Table 2 Kinematic point used for \(gg\rightarrow Hg\). The Higgs boson mass is set to \(m_H=125\) GeV
Table 3 Result for Born and virtual amplitude including the QCD corrections to \(gg\rightarrow Hg\). The renormalisation scale is set to \(\mu =m_H=125\) GeV

5.2 Single top production

An example containing complex masses in the loop propagators is the so called s-channel single top quark production, where the top quark has a width \(w_t=1.5\) GeV. In Table 5 we give numerical results for the subprocess \(u\bar{d}\rightarrow \nu _e e^+ b\bar{b}\) at the phase space point given in Table 4. The \(b\)-quarks are taken to be massless and the comparison has been performed against the HELAC-NLO code [4].

Table 4 Kinematic point used for \(u\bar{d}\rightarrow \nu _e e^+ b\bar{b}\). The \(W\)-boson and top-quark mass and width are set to \(m_W=80.25\) GeV, \(w_W=0\), \(m_t=170.9\) GeV and \(w_t=1.5\) GeV
Table 5 Result for Born and virtual amplitude including the QCD corrections to \(u\bar{d}\rightarrow \nu _e e^+ b\bar{b}\). The renormalisation scale is set to \(\mu =m_t=170.9\) GeV

5.3 Graviton production within models of large extra dimensions

As an example for the usage of GoSam with a model file different from the Standard Model we consider the QCD corrections to graviton production in ADD models [83, 84] with large extra dimensions (LED). The corresponding model files in UFO [78] format, which we generated using FeynRules [79, 80], are located in the subdirectory examples/model/LED_UFO. To import new model files within the GoSam setup, the user should specify the path to the model file in the process card. In the given example, this already has been done, i.e. the process card contains the line model=FeynRules,[gosampath]/examples/mod el/LED_UFO.

The example process we included in the GoSam-2.0 distribution is \(u\bar{u}\rightarrow G\rightarrow \gamma \gamma \), where \(G\) denotes a graviton, and the program calculates the virtual QCD corrections. Note that this example also involves integrals where the rank exceeds the number of propagators, due to the spin-2 nature of the graviton. Running make test in the subdirectory examples/uu_graviton_yy should produce the result shown in Table 7, using the phase space point given in Table 6. The full process, including an additional jet, has been calculated in [49], where we refer to for details about the parameter settings.

Table 6 Kinematic point used for \(u\bar{u}\rightarrow G\rightarrow \gamma \gamma \)
Table 7 Result for the virtual amplitude including the QCD corrections to \(u\bar{u}\rightarrow G\rightarrow \gamma \gamma \) within ADD models of large extra dimensions

6 Conclusions

We have presented the program package GoSam-2.0, which is a highly automated tool to calculate one-loop multi-particle amplitudes. As the amplitudes at a first stage are produced in an algebraic form, the program offers a lot of flexibility concerning the particle content and the couplings, the choice of the reduction method and the treatment of the rational parts.

GoSam-2.0 can be used to calculate NLO QCD corrections both within and Beyond the Standard Model, as well as electroweak corrections, in combination with a Monte Carlo program providing the tree-level and NLO real radiation parts. The latter can be interfaced using the Binoth-Les-Houches-Accord, where both BLHA1 and BLHA2 standards are supported. The automated interface to various Monte Carlo programs also offers the possibility to produce parton showered events and to compare different shower Monte Carlo event generators at NLO level.

We also note that the structure of the code is favourable to be used as a building block for the one-loop virtual times singly unresolved real radiation part entering NNLO calculations.

GoSam-2.0 contains many important new features. The installation procedure is extremely simple: all dependencies are provided in one package, and an install script is building the whole package in a completely automated way. Setting up a process is also very user-friendly: the user only has to fill out a well documented text file, the process card, where the program automatically chooses appropriate default values for unspecified options.

Improvements in the code generation compared to version 1.0 lead to more compact and faster code. GoSam-2.0 also contains a new integrand reduction method, the integrand decomposition via Laurent expansion, implemented in the library Ninja, which leads to a considerable gain in stability and speed, in particular for amplitudes containing internal masses.

The range of applicability of GoSam also has been extended considerably. In particular, integrals where the rank exceeds the number of propagators (needed e.g. in effective theories) are fully supported, and propagators for spin-2 particles are implemented. The complex mass scheme is supported, including the complexification of the couplings, and several electroweak schemes can be chosen. Moreover, a new system for stability tests and the rescue of ‘unstable’ phase space points has been implemented. In addition, the program offers the possibility to produce spin-and colour correlated tree-level matrix elements. As a consequence, GoSam-2.0 can provide all the building blocks needed by modern Monte Carlo programs to construct a full NLO event generator, for QCD corrections both within and beyond the Standard Model, as well as electroweak corrections.

Therefore, to follow the strive for precision in the next phases of LHC data taking as well as at a future Linear Collider, not only regarding QCD corrections, GoSam-2.0 can serve as a highly valuable tool.