# Melody Infilling with User-Provided Structural Context

###### Abstract

This paper proposes a novel Transformer-based model for music score infilling,
to generate a music passage that fills in the gap between given past and
future contexts. While existing infilling approaches can generate a passage
that connects smoothly locally with the given contexts, they do not take into
account the musical form or structure of the music and may therefore generate
overly smooth results. To address this issue, we propose a structure-aware
conditioning approach that employs a novel attention-selecting module to
supply user-provided structure-related information to the Transformer for
infilling. With both objective and subjective evaluations, we show that the
proposed model can harness the structural information effectively and generate
melodies in the style of pop of higher quality than the two existing
structure-agnostic infilling models.

##  1 Introduction

In recent years, machine learning techniques have been widely applied to
symbolic music generation. A large number of models attain _sequential
generation_ by accounting for only the past context, i.e., the generated music
depends on only the preceding musical content [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14]. While sequential generation can find useful use cases, it
does not align with typical human compositional practices which can be non-
sequential in nature. Musicians often write motifs or small pieces to get
inspiration first, before working on the middle parts to connect them.

Figure 1: Comparison between (a) structure-agnostic and (b) structure-aware
approaches for music score infilling.

Hence, we focus on the scenario when both the past and _future_ contexts are
given, which is called music score infilling or inpainting [15]. As shown in
Figure 1(a), the task is to let models fill in the missing part between the
two given segments. Prompt-based conditioning approaches [16, 17, 18, 15, 19,
20, 21, 22, 23] have been applied to such a task in recent years, treating the
two given segments as the “prompt.” Among them, the variable-length infilling
model (VLI) [20] obtains promising results by adding special positional
encodings to XLNet [24], a permutation-based language model that is naturally
suitable for generative tasks with given bi-directional contexts. The
experiment of VLI shows that their model is capable of connecting the past and
future contexts smoothly locally for infilling solo piano passages of up to 4
bars (measures).

Considering composers usually write musical pieces in a hierarchical manner
[25], we note that prompt-based conditioning approaches have a strong
limitation: they generate results with only consideration of local smoothness
among the past context, future context, and result, without taking care of the
overall musical _form_ or _structure_ of the music. For instance, a composer
may like to write a song in a musical form of ABA’B’. If we consider the
concatenation of the segments corresponding to A and B (i.e., AB) as the past
context, and the segment corresponding to B’ as the future context, and feed
them to an existing infilling model, the model may generate a sequence that
consists of similar melody and chord progression as the segments corresponding
to B and B’, not the intended repetition or variation of the segment
corresponding to A.

To address this issue, we propose in this paper a novel structure-aware
setting for music infilling. As shown in Figure 1(b), besides the past and
future contexts exploited by conventional structure-agnostic, prompt-based
models, out approach additionally capitalizes for the infilling task the
_structural context_ , a music segment corresponding to a certain part of the
whole music that is supposed to share the same _structure label_ (such as A or
B) with the missing segment. Accordingly, besides local smoothness, the model
also needs to consider the similarity between the infilled segment and the
structural context. Here, we assume the structural context is provided by a
user, not generated by a model. For example, the user may designate the
segment corresponding to A as the structural context, thereby inform the model
with the intended musical form.

We improve upon the VLI model [20] in the following ways to realize structure-
aware infilling. First, we use the classic Transformer [26, 27, 28] instead of
the more sophisticated XLNet [24] as the model backbone, to make it easier to
add a conditioning module to exploit the structural context. To improve the
capability of the Transformer to account for bi-directional contexts, we
propose two novel components, the _bar-count-down technique_ (Section 3.2) and
_order embeddings_ (Section 3.3), which respectively give the model an
explicit control of the length of the generated music, and a convenient way to
attend to the future context. Second, being inspired by the Theme Transformer
[29], we use not a Transformer decoder-only architecture but a sequence-to-
sequence (seq2seq) Transformer encoder/decoder architecture, using the cross-
attention between the encoder and decoder as the conditioning module to
account for the structural context. Moreover, we propose an _attention-
selecting module_ that allows the Transformer to access multiple structural
contexts while infilling different parts of a music piece, which can be useful
both in the training and inference time (Section 3.4) .

For evaluation, we compare our model with two strong baselines, the VLI [20]
and the work of Hsu & Chang [21], on the task of symbolic-domain melody
infilling of 4-bar content using the POP909 dataset [30] and the associated
structural labels from Dai _et al._ [31]. With objective and subjective
analyses, we show that our model greatly outperforms the baselines in the
structure completeness of the generated pieces, without degrading local
smoothness.

We set up a webpage for demos111https://tanchihpin0517.github.io/structure-
aware_infilling and open source our code at a public GitHub
repository.222https://github.com/tanchihpin0517/structure-aware_infilling

Figure 2: Schematic diagram of (a) the proposed seq2seq Transformer model for
structure-aware infilling, and (b) a zoom-in of the decoder highlighting how
the decoder utilizes the order embedding and structure index.

##  2 Related Work

Generating missing parts with given surrounding contexts has been attempted by
early works. DeepBach [17] predicts missing notes based on the notes around
them. They use two recurrent neural networks (RNNs) to capture the past and
future contexts, and a feedforward neural network to capture the current
context from notes with the same temporal position as the target note. COCONET
[16] trains a convolutional neural network (CNN) to complete partial musical
scores and explores the use of blocked Gibbs sampling as an analog to
rewriting. They encode the music data with the piano roll representation and
treat that as a fixed-size image, so the model can only perform fixed-length
music infilling. Inpainting Net [15] uses an RNN to integrate the temporal
information from a variational auto-encoder (VAE) [32] for bar-wise
generation, Wei _et al._ [23] build the model with a similar concept as
Inpainting Net and use the contrastive loss [33, 34] for training to improve
the infilling quality. Some Transformer-based models have also been proposed
to achieve music infilling. Ippolito _et al._ [18] concatenate the past and
future context with a special separator token. They keep the original
positional encoding of the contexts and the missing segment, which again
limits the length of given contexts and generated sequence to be fixed. We see
that these infilling models impose some data assumptions and thereby have
certain restrictions, e.g., the length of the input sequence cannot be
arbitrary, or the missing segment needs to be complete bars. The work of Hsu &
Chang [21] is free of these restrictions. They use two Transformer encoders to
capture the past and future context respectively and generate results with a
Transformer decoder. The VLI model [20] can also realize variable-length
infilling. However, to our best knowledge, no existing models have explicitly
considered structure-related information for infilling.

Structure-based conditioning has been explored only recently by Shi _et al_.
[29] in their Theme Transformer model for sequential music generation. They
use a seq2seq Transformer to account for not only the past context but also an
additional pre-given theme segment that is supposed to manifest itself
multiple times in the model’s generation result. The present work can be
considered as an extension of their work to the scenario of music infilling.

##  3 Methodology

Given a past context $C_{\text{past}}$ and a future context
$C_{\text{future}}$, the general, structure-agnostic music infilling task
entails generating an _infilled segment_ $T$ that interconnects
$C_{\text{past}}$ and $C_{\text{future}}$ smoothly, preferably in a musically
meaningful way. When using an autoregressive generative model such as the
Transformer as the model backbone, the training object is to maximize the
following likelihood function:

$\prod_{0<k\leq|T|}P(t_{k}|t_{<k},C_{\text{past}},C_{\text{future}})\,,$ (1)

where $t_{k}$ denotes the element of $T$ at timestep $k$, $t_{<k}$ the
subsequence consisting of all the previously generated elements, and $|\cdot|$
the length of a sequence.

Extending from Eq. (1), we propose and study in this paper a special case,
called structure-aware music infilling, where an additional segment $G$
representing the _structural context_ is given, leading to the new objective:

$\prod_{0<k\leq|T|}P(t_{k}|t_{<k},C_{\text{past}},C_{\text{future}};G)\,.$ (2)

As depicted in Figure 2(a), our model is based on Transformer with the
encoder-decoder architecture. It uses the decoder to self-attend to the prompt
(i.e., $C_{\text{past}}$ and $C_{\text{future}}$) and the previously-generated
elements (i.e., $t_{<k}$), and the encoder to cross-attend to the structural
context $G$. We provide details of the proposed model below.

Note that we do not require the length of all the involved segments to be
fixed; namely $|T|$, $|C_{\text{past}}|$, $|C_{\text{future}}|$ and $|G|$ are
all variables in our setting.

###  3.1 REMI-based Token Representation

To incorporate structure-related information to our representation of the
music data, we devise an extension of the REMI-based representation [8] that
comprises five types of tokens: Bar, Struct, Tempo, Position, Pitch and
Duration. Table 1 lists the vocabulary of our token representation. Bar
consists of numbers from 1 to 32, standing for the number of remaining bars on
the generation process. A music form, e.g., ABA’B’, consists of multiple
groups of similar phrases or sections (each of multiple bars), e.g., {A, A’}
and {B, B’}, where each group can be said to be associated with the same
_structure label_. We use Struct to indicate the structure label for each bar.
Tempo and Position are related to the musical metre. Tempo is the current
tempo of beats per minute (BPM), and Position is the temporal distance between
the onset of a musical note and the beginning of its bar, denoted by the
number of 16-th notes. Pitch and Duration are related to musical notes, which
are the MIDI pitch number and duration in 16-th notes, respectively. We show
an example of how we encode the musical content in Figure 3.

Token type | Voc. size | Values
---|---|---
Bar | 32 | 1, 2, … , 32
Struct | 16 | 0, 1, … , 15
Tempo | 47 | 28, 32, … , 212
Position | 16 | 0, 1, … , 15
Pitch | 86 | 22, 23, … , 107
Duration | 16 | 1, 2, … , 16
Table 1: The vocabulary of the token representation.

Figure 3: An example of representing a two-bar segment with our adapted REMI-
based token representation. With the bar-count-down technique, Bar(2) and
Bar(1) are used for the first and second Bar tokens, respectively.

###  3.2 Bar-Count-Down Technique

The work of Hsu & Chang [21] uses special BOS and EOS tokens as the “signal”
to start or stop the generation process. At inference time, the infilled
segment generated by their model comes to an end when the model generates an
EOS token. While this may work fine in certain cases, doing so cannot give us
an explicit control of the number of bars to be generated for the infilled
segment. Such a control is preferable when we want to make sure that the
previous context and the future context are a certain number of bars apart,
which is highly needed for structure-aware infilling. For example, a user may
want to specify the music form as A8B8A’8B’8, meaning that all the four
sections A, B, A’, B’ are eight-bar long each.

To have such a control, we employ a special token representation technique
called “bar-count-down.” For each infilled sequence $T$, we adjust the suffix
number of Bar tokens to match the length of $T$. Take Figure 3 as an example:
The number in Bar tokens are counted down from two because the sequence in
Figure 3 is 2-bars long. Once training a model with this setup, the length of
$T$ can be controlled effectively by the number of remaining bars associated
with the first Bar token given on generation.

Figure 4: Illustration of the order embedding, where $re.$ and $mo.$ stand for
the real position and model-viewed position. Conceptually, we shift the model-
viewed position by $O_{i}$ to make it consistent with the real position.

###  3.3 Order Embedding

Transformers with causal masking are mainly designed for sequential
generation. To apply the model to infilling tasks where the missing part is in
the middle of the input sequence, the model proposed by Hsu & Chang [21]
attends to bi-directional context from two encoders with cross-attention. As
we want to instead use only the self-attention of the decoder to exploit bi-
directional information, we reorder the sequence {$C_{\text{past}}$, $T$,
$C_{\text{future}}$} to {$C_{\text{past}}$, $C_{\text{future}}$, $T$}. Doing
so would however change the original positional relationship among
$C_{\text{past}}$, $T$, and $C_{\text{future}}$.333The principal idea of the
attention mechanism [26] is to use the token embeddings of two tokens to
compute their correlation, leading to the so-called attention score. However,
using the token embeddings alone fails to consider the position-related
relations of the two tokens (e.g., whether they are neighbors or distant
apart). Accordingly, in practice, people add token-wise positional embeddings
to the token embeddings before computing their attention [35, 36, 37].  As
depicted in Figure 4(b), the _real_ positional relationships among the
segments entails associating the tokens in $T$ with positional embeddings
corresponding to a set of positions $p_{2}$ that signifies the model the
segment $T$ is after $C_{\text{past}}$ (i.e., $p_{1}$ $\prec$ $p_{2}$) and is
before $C_{\text{future}}$ ($p_{2}$ $\prec$ $p_{3}$).444We use $p\prec q$ to
denote that any elements in the set $p$ is smaller, or “temporally before,”
any elements in the set $q$. After reordering, however, using the typical way
of computing the positional embeddings from left to right by the Transformers,
$T$ would be assigned with positional embeddings corresponding to $p_{3}$,
meaning that by the _model-viewed_ positional relationships, $T$ is after both
$C_{\text{past}}$ and $C_{\text{future}}$. The real and the model-viewed are
mismatched.

We introduce a new position-related _segment embedding_ called “order
embedding” to tackle this issue. Specifically, for the positional embeddings
for all the tokens in $C_{\text{past}}$, we add to them the same additional
embedding corresponding to a positional “offset” or “order,” denoted as
$O_{0}$. We similarly incorporate $O_{1}$ and $O_{2}$ to the positional
embeddings for the tokens in $T$ and $C_{\text{future}}$. As long as the
“offset” is big enough, we can have $p_{1}+O_{0}\prec p_{3}+O_{1}\prec
p_{2}+O_{2}$, ensuring that the real and model-viewed positional relationships
are matched, as depicted in Figure 4(c).

We note that, as the same order embedding is added to the positional
embeddings of all the tokens in a segment, the proposed idea works nicely
regardless of whether the segment lengths $|C_{\text{past}}|$, $|T|$,
$|C_{\text{future}}|$ are fixed or not.

###  3.4 Attention-Selecting Module

Figure 5: The schematic of attention selecting. Multiple structural contexts
$G_{1},G_{2},G_{3}$ are passed to the cross-attention block simultaneously,
and the output is filtered by the selector with the structure index.

While the formulation of Eq. (2) considers only one structural context $G$, in
practice, we may want to designate multiple structural contexts {$G_{1}$,
$G_{2}$, …, $G_{N}$} for infilling, with each segment $G_{n}$ corresponding to
a certain structure label such as A and B. This is useful, for example, when
the first part of the infilled segment $T$ is meant to be similar to phrase A,
while the latter part similar to phrase B. To indicate which $G_{n}$ a
specific token $t_{k}$ of $T$ should refer to, we define the _structure index_
$y_{k}\in\\{0,\dots,N\\}$, for $k=\\{1,\dots,|T|\\}$. The structure indices
are also given by the user when the user specifies the intended musical form.
With all these, we extend Eq. (2) to:

$\prod_{0<k\leq|T|}P(t_{k}|t_{<k},C_{\text{past}},C_{\text{future}};G_{1},...,G_{N},y_{k})\,.$
(3)

We use $y_{k}=0$ to indicate the case where $t_{k}$ is supposed to follow none
of the structural contexts (e.g., when $t_{k}$ is part of the bridge). When
$y_{k}\neq 0$, $t_{k}$ follows only one of the structural context $G_{y_{k}}$.
In our implementation, for tokens whose $y_{k}=0$, we only use the self-
attention to attend to the prompt and $t_{<k}$, leading to a formulation akin
to Eq. (1). When $y_{k}\neq 0$, we have a “selector” that picks by $y_{k}$ the
structural context $G_{y_{k}}$ to be attended to via cross-attention,
resulting in a formulation akin to Eq. (2). This is depicted in Figure 2(b)
and Figure 5.

Figure 5 also shows that, in our implementation, instead of computing the
cross attention between the target sequence with a specific structural context
$G_{y_{k}}$, we actually compute the cross attention between the target
sequence with every structural contexts {$G_{1}$, $G_{2}$, …, $G_{N}$} and let
the selector pick the right one. While this seems a waste of computing, we
find doing so faster when GPUs are used.555There is another implementation
detail: actually, not only the tokens in $T$ but also those in
$C_{\text{past}}$ and $C_{\text{future}}$ would go through the Transformer’s
self- and cross-attention blocks. This is to get the latent vectors for the
tokens in $C_{\text{past}}$ and $C_{\text{future}}$. In doing so, we calculate
and employ the structure indices for $C_{\text{past}}$ and $C_{\text{future}}$
as well.

##  4 Experimental Setup

We collect the melody data666Please note that the “melody” data in this paper
is not exact monophonic music. We merge two midi tracks, “MELODY” and “BRIDGE”
of the MIDI files of POP909 [30] to generate the melody data, which is
monophonic most of the time but not always. from the POP909 dataset compiled
by Wang _et al._ [30]. POP909 contains 909 MIDI files of pop piano
performances, though we discard 8 of them due to errors encountered in the
preprocessing stage. We split all remaining songs into 811 (90%) songs for
training and 91 (10%) songs for testing. The 16-th note is set as the minimal
temporal resolution to quantize the tempo, beat, and duration for reducing the
vocabulary size.

Dai _et al._ [31] publicly share the _structural information_ of songs in
POP909 with letters and integers to indicate the structure labels and their
lengths in bars, such as

$\texttt{i4\,A8\,B8\,x4\,A8\,B8\,B8\,X2\,c4\,c4\,X2\,B9\,o2}\,,$ (4)

where the music phrases labeled with the same letter are considered to share
the same structural context.777The lower-case and capital letters indicate
respectively _non-melodic_ and _melodic_ phrases (i.e., where a clear melody
is present, mostly a vocal line or an instrument solo), but we do not use this
information.888Depending on the underlying musical form of a song, different
songs may have different numbers of phrase groups. For example, a song with a
simpler form may only have phrase groups A and B, while other songs have much
more. In the POP909 dataset, a song can contain up to 9 unique phrase groups,
which are labeled as A, B, C, D, etc. Besides, the musical phrases with the
labels i, x, and o are respectively the introduction, bridge, and ending,
which do not have structural context in our setting. For each song, we use the
phrases corresponding to the first occurrence of the structure labels such as
A and B as the structural contexts $G_{1},G_{2}$, etc. For example, we choose
bars 5–12 (i.e., the A8 phrase after i4) and bars 13–20 (i.e., the B8 phrase
before x4) in the example shown in Eq. (4) as the structural contexts for A
and B since they are the first music phrases in the song with the
corresponding labels.

The training data is generated with the following steps: (i) iterating through
all labels except for the first and last ones in the structural information,
(ii) choosing their corresponding music phrases as the infilled sequences $T$,
and (iii) concatenating $T$ with their preceding and following 6-bars music
segments to get $\\{C_{\text{past}},T,C_{\text{future}}\\}$, yielding 8,607
data in total. Before feeding the training data into the model, we reorder the
input sequences and insert additional special tokens, BOS, SEP, and EOS, to
change them into
$\\{\texttt{BOS},C_{\text{past}},\texttt{SEP},C_{\text{future}},\texttt{SEP},T,\texttt{EOS}\\}$.
The reordered input sequence and structural contexts are transformed to the
embeddings with size 512. The model consists of an encoder and a decoder,
where both of them consist of six 8-head self-attention layers with
intermediate layers of dimension 2,048. Each layer of the encoder and decoder
is connected with an 8-head cross-attention, as shown in Figure 2. The output
from the model is transformed back to a probability distribution of the
vocabulary with the softmax function. At inference time, we use nucleus
sampling [38] to sample the output tokens with the threshold value of 0.9.

For evaluation, we create the testing data by: (i) searching from the testing
songs all the 4-bar phrases that correspond to only a structure label, (ii)
keeping only the phrases that share the same structure label with one of its
two neighboring phrases but a different structure label with the other
neighbor, and (iii) setting the 4-bar phrase as the target $T$ and concatenate
them with their preceding and succeeding 6-bar music segments, which are set
as the past context $C_{\text{past}}$ and future context $C_{\text{future}}$,
respectively. We get 156 test cases of {$C_{\text{past}}$, $T$,
$C_{\text{future}}$}, each with 16 bars (i.e., $6+4+6$). All the cases have
the form of, e.g., AA’B or ABB’, and the target lengths are 4 bars with
arbitrary number of notes (hence _variable_ sequence lengths). In this
setting, the attention selection mechanism is used only for training, since
the target sequence $T$ in our testing data only have one structural context
to refer to.

We consider VLI [20] and the model from Hsu & Chang [21] as the baselines. By
design, only our model has access to an external structural context. However,
we consider the comparison as valid, since $C_{\text{past}}$ and
$C_{\text{future}}$ are presumably long enough to provide sufficient context,
and at least one of them has the same structure label as $T$. Besides, in our
implementation, we found the model Hsu & Chang [21] rarely generates infilled
segments with the desirable number of bars. Therefore, we slightly improve
their model by incorporating the bar-count-down technique.

| $H\downarrow$ | $GS\uparrow$ | $D\downarrow$
---|---|---|---
Ours | 2.75$\pm 0.80$ | 0.70$\pm 0.08$ | 25.73$\pm 19.45$
VLI[20] | 3.47$\pm 1.57$ | 0.67$\pm 0.09$ | 49.40$\pm 25.12$
Hsu [21] | 9.87$\pm 4.64$ | 0.64$\pm 0.09$ | 65.41$\pm 38.00$
Original | 2.78$\pm 0.89$ | 0.70$\pm 0.09$ |  0.00$\pm~{}~{}0.00$
Table 2: Objective evaluation results. $H$: pitch class histogram cross
entropy, $GS$: grooving pattern similarity, $D$: melody distance
($\uparrow$/$\downarrow$: the higher/lower the better).

##  5 Objective Evaluation Results

We propose three new metrics for objective evaluation, all of which have not
been used in the literature of music infilling. The first two metrics, pitch
class histogram cross entropy ($H$) and grooving pattern similarity ($GS$),
are extensions of the ones proposed by Wu & Yang for sequential generation
[10] to our infilling task, evaluating respectively the consistency in terms
of pitch class distribution (which is related to tonality) and rhythmic
pattern. For $H$, we compute per test case the pitch class histogram of $T$,
and that histogram of the concatenation of $C_{\text{past}}$ and
$C_{\text{future}}$, and then report the cross entropy between these two
histograms. For $GS$, we use per bar a 16-dim binary vector indicating where
there is at least a note onset for every position in a bar, calculate one
minus the normalized XOR difference between every pair of bars [10], one from
$T$ and the other from either $C_{\text{past}}$ and $C_{\text{future}}$, and
then report the average per test case. The third metric, melody distance ($D$)
measures the melody distance (dissimilarity) between the infilled segment $T$
and the ground truth one (denoted as $T\\#$) using the algorithm proposed by
Hu _et al._ [39]. Lower $H$ and higher $GS$ may imply that $T$ connects
$C_{\text{past}}$ and $C_{\text{future}}$ smoothly, while lower $D$ indicates
that the generation result is similar to a human-made one.

Table 2 shows that our model achieves the best result in all the three
metrics, followed by VLI and then the model of Hsu & Chang. Besides being
consistent with the contexts, the infilling result of our model is closest to
the ground truth one $T\\#$, demonstrating the effectiveness of exploiting the
structural context. Figure 6 exemplifies how the infilled bars by our model
fit the desired musical form.

| M | R | S | O
---|---|---|---|---
all | Ours | 3.46 | 3.51 | 3.40 | 3.42
VLI[20] | 2.96 | 3.14 | 3.12 | 2.97
Hsu [21] | 2.60 | 2.95 | 2.75 | 2.64
Real | 3.77 | 3.77 | 3.62 | 3.66
pro | Ours | 3.58 | 3.28 | 3.28 | 3.42
VLI[20] | 2.67 | 2.86 | 2.78 | 2.72
Hsu [21] | 2.36 | 2.75 | 2.39 | 2.44
Real | 3.61 | 3.56 | 3.42 | 3.42
Table 3: Results of the user study: mean opinion scores in 1–5 in M (melodic
fluency), R (rhythmic fluency), S (Structureness), and O (Overall), from ’all’
the participants or only the music ’pro’-fessionals.

Figure 6: Results generated by (a) our model and (b) VLI. The structural
relations of bars 4-5 (green area) and bars 8-9 (red area) are preserved well
in (a) but not in (b).

##  6 Subjective Evaluation Results

We conduct additionally an online user study for subjective evaluation. We
have 91 anonymous volunteers, where 12 of them are marked as professionals
according to the question about their musical background. Each subject is
presented with 3 out of 15 sets of music segments randomly sampled from the
testing data. We inform them that the first and last 6 bars are the given
prompts, and the middle 4 bars are the music generated by a model. Each set of
music contains in random order 4 music including 3 generated by the models and
1 from the real data. The subjects rate each of the 4 music in a 5-point
Likert scale (the higher the better) according to their (i) melodic fluency:
do the pitches of notes go in the right tonality and connect the contexts
fluently? (ii) rhythmic fluency: are the notes played on the right beats?
(iii) structureness: how is the generated part of the music similar to its
contexts? (ix) overall: how much do they like the music?

Table 3 shows the mean opinion scores (MOS) of the user study. Echoing the
result of the objective evaluation, the proposed model outscores the baselines
by a large margin in all the four subjective metrics, and is close to the real
music with a small gap. The same observations can be made from either the
average result of all the subjects, or only that from the 12 professionals.

However, we notice that our model may overly imitate the given structural
contexts in some cases, as exemplified in Figure 7. When this happens, the
generated music sounds rigid and non-creative. We conjecture that this can be
attributed to the limited diversity of our training data—the melodies
corresponding to the same structure label in POP909 appear to be too similar
to each other, which may not be uncommon for pop songs. To study this, we
implement additionally a ‘Copy’ baseline that simply copies the structural
contexts as the result, and include its infilling result to the demo website.
Our own subjective listening of its result confirms that the proposed method
still outperforms the ‘Copy’ baseline most of the time, as the connections
between the targets and their contexts are considered by our model, but not by
the ‘Copy’ baseline.

Figure 7: A result generated by our model, where $C_{\text{future}}$ is not
shown in this figure. Bars 3–6 (green area) and bars 7–10 (red area) look
identical since the model overly imitates the given structural context. (Best
viewed in color.)

##  7 Conclusion

In this paper, we have proposed a new structure-aware conditioning approach
for music score infilling. To help Transformers exploit bi-directional
contexts, we employ the order embedding to shift the position viewed by the
model. Besides, we introduce a new attention-selecting mechanism to account
for multiple structural contexts. Evaluations on 4-bar melody infilling
validate the superiority of the proposed model over two existing Transformer-
based structure-agnostic infilling methods [20, 21].

We can extend this work in three ways. First, instead of relying on user
inputs, we may build models that generate the musical form automatically and
predict the structural context for a specific infilled segment to refer to.
Second, we like to expand our work to other music genres and polyphonic music.
Finally, we like to study how the attention-selecting mechanism can be applied
to sequential generative tasks such as theme-based generation [29].

##  8 Acknowledgement

We are grateful to Shih-Lun Wu for sharing the unpublished idea of the bar-
count-down technique, Ping-Yi Chen and Chin-Jui Chang for the assistance with
experiments and discussion, Shan Lee for the help of figure drawing, and Chun-
Wei Lai and Sophia Lin for the help in finding volunteers for the user study.
We also thank the anonymous reviewers for their valuable feedbacks. Our
research is funded by grants NSTC 109-2628-E-001-002-MY2 and NSTC
110-2221-E-006-137-MY3 from the National Science and Technology Council of
Taiwan.

## References

  * [1] N. Boulanger-Lewandowski, Y. Bengio, and P. Vincent, “Modeling temporal dependencies in high-dimensional sequences: Application to polyphonic music generation and transcription,” in _Proc. International Conference on Machine Learning_ , 2012, pp. 1881–1888.
  * [2] F. Colombo, “Algorithmic composition of melodies with deep recurrent neural networks,” _Poster Session of International Conference on Artificial Intelligence and Statistics_ , 2016.
  * [3] B. L. Sturm, J. F. Santos, O. Ben-Tal, and I. Korshunova, “Music transcription modelling and composition using deep learning,” in _Proc. Conference on Computer Simulation of Musical Creativity_ , 2016.
  * [4] A. Roberts, J. Engel, C. Raffel, C. Hawthorne, and D. Eck, “A hierarchical latent vector model for learning long-term structure in music,” in _Proc. International Conference on Machine Learning_ , 2018, pp. 4364–4373.
  * [5] L.-C. Yang, S.-Y. Chou, and Y.-H. Yang, “MidiNet: A convolutional generative adversarial network for symbolic-domain music generation,” in _Proc. International Conference on Music Information Retrieval_ , 2017.
  * [6] C.-Z. A. Huang, A. Vaswani, J. Uszkoreit, N. Shazeer, I. Simon, C. Hawthorne, A. M. Dai, M. D. Hoffman, M. Dinculescu, and D. Eck, “Music Transformer,” in _Proc. International Conference on Learning Representations_ , 2019.
  * [7] C. Donahue, H. H. Mao, Y. E. Li, G. W. Cottrell, and J. McAuley, “LakhNES: Improving multi-instrumental music generation with cross-domain pre-training,” in _Proc. International Conference on Music Information Retrieval_ , 2019.
  * [8] Y.-S. Huang and Y.-H. Yang, “Pop Music Transformer: Beat-based modeling and generation of expressive pop piano compositions,” in _Proc. ACM International Conference on Multimedia_ , 2020, pp. 1180–1188.
  * [9] Y. Ren, J. He, X. Tan, T. Qin, Z. Zhao, and T.-Y. Liu, “PopMAG: Pop music accompaniment generation,” in _Proc. ACM Multimedia_ , 2020.
  * [10] S.-L. Wu and Y.-H. Yang, “The Jazz Transformerm on the front line: Exploring the shortcomings of ai-composed music through quantitative measures,” in _Proc. International Conference on Music Information Retrieval_ , 2020.
  * [11] S. Dai, Z. Jin, C. Gomes, and R. B. Dannenberg, “Controllable deep melody generation via hierarchical music structure representation,” in _Proc. International Conference on Music Information Retrieval_ , 2021.
  * [12] S.-L. Wu and Y.-H. Yang, “MuseMorphose: Full-song and fine-grained music style transfer with one Transformer VAE,” _arXiv preprint arXiv:2105.04090_ , 2021.
  * [13] J. Liu, Y. Dong, Z. Cheng, X. Zhang, X. Li, F. Yu, and M. Sun, “Symphony generation with permutation invariant language model,” _arXiv preprint arXiv:2205.05448_ , 2022.
  * [14] H.-W. Dong, K. Chen, S. Dubnov, J. McAuley, and T. Berg-Kirkpatrick, “Multitrack Music Transformer: Learning long-term dependencies in music with diverse instruments,” _arXiv preprint arXiv:2207.06983_ , 2022.
  * [15] A. Pati, A. Lerch, and G. Hadjeres, “Learning to traverse latent spaces for musical score inpainting,” in _Proc. International Conference on Music Information Retrieval_ , 2019.
  * [16] C.-Z. A. Huang, T. Cooijmans, A. Roberts, A. Courville, and D. Eck, “Counterpoint by convolution,” in _Proc. International Society for Music Information Retrieval_ , 2017.
  * [17] G. Hadjeres, F. Pachet, and F. Nielsen, “Deepbach: a steerable model for bach chorales generation,” in _Proc. International Conference on Machine Learning_ , 2017, pp. 1362–1371.
  * [18] D. Ippolito, A. Huang, C. Hawthorne, and D. Eck, “Infilling piano performances,” in _Proc. NIPS Workshop on Machine Learning for Creativity and Design_ , 2018.
  * [19] T. Bazin and G. Hadjeres, “Nonoto: A model-agnostic web interface for interactive music composition by inpainting,” in _Proc. International Conference on Computational Creativity_ , 2019.
  * [20] C.-J. Chang, C.-Y. Lee, and Y.-H. Yang, “Variable-length music score infilling via XLNet and musically specialized positional encoding,” in _Proc. International Conference on Music Information Retrieval_ , 2021.
  * [21] J.-L. Hsu and S.-J. Chang, “Generating music transition by using a Transformer-based model,” _Electronics_ , vol. 10, no. 18, 2021.
  * [22] C.-P. Tan, C.-J. Chang, A. W. Y. Su, and Y.-H. Yang, “Music score expansion with variable-length infilling,” in _Proc. International Conference on Music Information Retrieval_ , 2021, late-breaking and demo paper.
  * [23] S. Wei, G. Xia, Y. Zhang, L. Lin, and W. Gao, “Music phrase inpainting using long-term representation and contrastive loss,” in _Proc. IEEE International Conference on Acoustics, Speech and Signal Processing_ , 2022, pp. 186–190.
  * [24] Z. Yang, Z. Dai, Y. Yang, J. Carbonell, R. R. Salakhutdinov, and Q. V. Le, “XLNet: Generalized autoregressive pretraining for language understanding,” _Proc. Advances in Neural Information Processing Systems_ , vol. 32, 2019.
  * [25] F. Lerdahl and R. S. Jackendoff, _A Generative Theory of Tonal Music, Reissue, with a New Preface_. MIT press, 1996.
  * [26] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, “Attention is all you need,” _Proc. Advances in Neural Information Processing Systems_ , vol. 30, 2017.
  * [27] Z. Dai, Z. Yang, Y. Yang, J. Carbonell, Q. V. Le, and R. Salakhutdinov, “Transformer-XL: Attentive language models beyond a fixed-length context,” in _Proc. Annual Meeting of the Association for Computational_ , 2019.
  * [28] A. Radford, K. Narasimhan, T. Salimans, and I. Sutskever, “Improving language understanding by generative pre-training,” 2018.
  * [29] Y.-J. Shih, S.-L. Wu, F. Zalkow, M. Müller, and Y.-H. Yang, “Theme Transformer: Symbolic music generation with theme-conditioned transformer,” _IEEE Transactions on Multimedia_ , 2022.
  * [30] Z. Wang, K. Chen, J. Jiang, Y. Zhang, M. Xu, S. Dai, G. Bin, and G. Xia, “POP909: A pop-song dataset for music arrangement generation,” in _Proc. International Conference on Music Information Retrieval_ , 2020.
  * [31] S. Dai, H. Zhang, and R. B. Dannenberg, “Automatic analysis and influence of hierarchical structure on melody, rhythm and harmony in popular music,” in _Proc. Conference on AI Music Creativity_ , 2020.
  * [32] D. P. Kingma and M. Welling, “Auto-encoding variational bayes,” in _Proc. International Conference on Learning Representations_ , 2014.
  * [33] T. Chen, S. Kornblith, M. Norouzi, and G. Hinton, “A simple framework for contrastive learning of visual representations,” in _Proc. International conference on machine learning_ , 2020, pp. 1597–1607.
  * [34] K. He, H. Fan, Y. Wu, S. Xie, and R. Girshick, “Momentum contrast for unsupervised visual representation learning,” in _Proc. IEEE/CVF conference on computer vision and pattern recognition_ , 2020, pp. 9729–9738.
  * [35] P. Shaw, J. Uszkoreit, and A. Vaswani, “Self-attention with relative position representations,” in _Proc. Conf. North American Chapter of the Association for Computational Linguistics_ , 2018.
  * [36] G. Ke, D. He, and T.-Y. Liu, “Rethinking positional encoding in language pre-training,” in _Proc. International Conference on Learning Representations_ , 2021.
  * [37] A. Liutkus, O. Cífka, S.-L. Wu, U. Simsekli, Y.-H. Yang, and G. Richard, “Relative positional encoding for Transformers with linear complexity,” in _Proc. International Conference on Machine Learning_ , 2021.
  * [38] A. Holtzman, J. Buys, L. Du, M. Forbes, and Y. Choi, “The curious case of neural text degeneration,” in _Proc. International Conference on Learning Representations_ , 2020.
  * [39] N. Hu, R. B. Dannenberg, and A. L. Lewis, “A probabilistic model of melodic similarity,” in _Proc. International Computer Music Conference_ , 2002.


DESY 21-005

EPJC published version

CASCADE3
A Monte Carlo event generator based on TMDs
S. Baranov1, A. Bermudez Martinez2, L.I. Estevez Banos2, F. Guzman3, F.
Hautmann4,5, H. Jung2, A. Lelek4, J. Lidrych2, A. Lipatov6, M. Malyshev6, M.
Mendizabal2, S. Taheri Monfared2, A.M. van Kampen4, Q. Wang2,7 H. Yang2,7
1Lebedev Physics Institute, Russia
2DESY, Hamburg, Germany
3InSTEC, Universidad de La Habana, Cuba
4Elementary Particle Physics, University of Antwerp, Belgium
5RAL and University of Oxford, UK

6SINP, Moscow State University, Russia
7School of Physics, Peking University, China

###### Abstract

The Cascade3 Monte Carlo event generator based on Transverse Momentum
Dependent (TMD) parton densities is described. Hard processes which are
generated in collinear factorization with LO multileg or NLO parton level
generators are extended by adding transverse momenta to the initial partons
according to TMD densities and applying dedicated TMD parton showers and
hadronization. Processes with off-shell kinematics within
$k_{t}$-factorization, either internally implemented or from external packages
via LHE files, can be processed for parton showering and hadronization. The
initial state parton shower is tied to the TMD parton distribution, with all
parameters fixed by the TMD distribution.

##  1 Introduction

The simulation of processes for high energy hadron colliders has been improved
significantly in the past years by automation of next-to-leading order (NLO)
calculations and matching of the hard processes to parton shower Monte Carlo
event generators which also include a simulation of hadronization. Among those
automated tools are the MadGraph5_amc@nlo [1] generator based on the mc@nlo
[2, 3, 4, 5] method or the Powheg [6, 7] generator for the calculation of the
hard process. The results from these packages are then combined with either
the Herwig [8] or Pythia [9] packages for parton showering and hadronization.
Different jet multiplicities can be combined at the matrix element level and
then merged with special procedures, like the MLM [10] or CKKW [11] merging
for LO processes, the FxFx [12] or MiNLO method [13] for merging at NLO, among
others. While the approaches of matching and merging matrix element
calculations and parton showers are very successful, two ingredients important
for high energy collisions are not (fully) treated: the matrix elements are
calculated with collinear dynamics and the inclusion of initial state parton
showers results in a net transverse momentum of the hard process; the special
treatment of high energy effects (small $x$) is not included.

The Cascade Monte Carlo event generator, developed originally for small $x$
processes based on high-energy factorization [14] and the CCFM [15, 16, 17,
18] evolution equation, has been extended to cover the full kinematic range
(not only small $x$) by applying the Parton Branching (PB) method and the
corresponding PB Transverse Momentum Dependent (TMD) parton densities [19,
20]. The initial state evolution is fully described and determined by the TMD
density, as it was in the case of the CCFM gluon density, but now available
for all flavor species, including quarks, gluons and photons at small and
large $x$ and any scale $\mu$. For a general overview of TMD parton densities,
see Ref. [21].

With the advances in determination of PB TMDs [19, 20], it is natural to
develop a scheme, where the initial parton shower follows as close as possible
the TMD parton density and where either collinear (on-shell) or
$k_{t}$-dependent (off-shell) hard process calculations can be included at LO
or NLO. In order to be flexible and to use the latest developments in
automated matrix element calculations of hard process at higher order in the
strong coupling $\alpha_{s}$, events available in the Les Houches Event (LHE)
file format [22], which contains all the information of the hard process
including the color structure, can be further processed for parton shower and
hadronization in Cascade3.

In this report we describe the new developments in Cascade3 for a full PB-TMD
parton shower and the matching of TMD parton densities to collinear hard
process calculations. We also mention features of the small-$x$ mode of
Cascade3.

##  2 The hard process

The cross section for the scattering process of two hadrons $A$ and $B$ can be
written in collinear factorization as a convolution of the partonic cross
section of partons $a$ and $b$, $a+b\to X$, and the densities
$f_{a(b)}(x,\mu)$ of partons $a$ ($b$) inside the hadrons $A$ ($B$),

$\sigma(A+B\to Y)=\int dx_{a}\int
dx_{b}\,f_{a}(x_{a},\mu)\,f_{b}(x_{b},\mu)\,\sigma(a+b\to X)\,,$ (1)

where $x_{a}(x_{b})$ are the fractions of the longitudinal momenta of hadrons
$A,B$ carried by the partons $a(b)$, $\sigma(a+b\to X)$ is the partonic cross
section, and $\mu$ is the factorization scale of the process. The final state
$Y$ contains the partonic final state $X$ and the recoils from the parton
evolution and hadron remnants.

In Cascade3 we extend collinear factorization to include transverse momenta in
the initial state, either by adding a transverse momentum to an on-shell
process or by using off-shell processes directly, as described in detail in
Sections 2.1 and 2.2. TMD factorization is proven for semi-inclusive deep-
inelastic scattering, Drell-Yan production in hadron-hadron collisions and
$e^{+}e^{-}$ annihilation [23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35]. In the high-energy limit (small-$x$) $k_{T}$-factorization has been
formulated also in hadronic collisions for processes like heavy flavor or
heavy boson (including Higgs) production [14, 36, 37, 38], with so-called
unintegrated parton distribution functions (uPDFs), see e.g. Refs. [39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49].

###  2.1 On-shell processes

The hard processes in collinear factorization (with on-shell initial partons,
without transverse momenta) can be calculated by standard automated methods
like MadGraph5_amc@nlo [1] for multileg processes at LO or NLO accuracy. The
matrix element processes are calculated with collinear parton densities (PDF),
as provided by LHAPDF [50].

We extend the factorization formula given in eq.(1) by replacing the collinear
parton densities $f(x,\mu)$ by TMD densities ${\cal A}(x,k_{t},\mu)$ with
$k_{t}$ being the transverse momentum of the interacting parton, and
integrating over the transverse momenta.

However, when the hard process is to be combined with a TMD parton density, as
described later, the integral over $k_{t}$ of the TMD density must agree with
the collinear ($k_{t}$-integrated) density; this feature is guaranteed by
construction for the PB-TMDs (also available as integrated PDFs in LHAPDF
format).

In a LO partonic calculation the TMD or the parton shower can be included
respecting energy momentum conservation, as described below. In an NLO
calculation based on the MC@NLO method [2, 3, 4, 5] the contribution from
collinear and soft partons is subtracted, as this is added later with the
parton shower. For the use with PB TMDs, the Herwig6 subtraction terms are
best suited as the angular ordering conditions coincide with those applied in
the PB-method. The PB TMDs play the same role as a parton shower does, in the
sense that a finite transverse momentum is created as a result of the parton
evolution [51, 52].

When transverse momenta of the initial partons from TMDs are to be included to
the hard scattering process, which was originally calculated under the
assumption of collinear initial partons, care has to be taken that energy and
momentum are still conserved. When the initial state partons have transverse
momenta, they also acquire virtual masses. The procedure adopted in Cascade3
is the following: for each initial parton, a transverse momentum is assigned
according to the TMD density, and the parton-parton system is boosted to its
center-of-mass frame and rotated such that only the longitudinal and energy
components are non-zero. The energy and longitudinal component of the initial
momenta $p_{a,b}$ are recalculated taking into account the virtual masses
$Q_{a}^{2}=k_{t,a}^{2}$ and $Q_{b}^{2}=k_{t,b}^{2}$ [53],

$\displaystyle E_{a,b}$ $\displaystyle=$
$\displaystyle\frac{1}{2\sqrt{\hat{s}}}\left(\hat{s}\pm(Q_{b}^{2}-Q_{a}^{2})\right)$
(2) $\displaystyle p_{z\;a,b}$ $\displaystyle=$
$\displaystyle\pm\frac{1}{2\sqrt{\hat{s}}}\sqrt{(\hat{s}+Q_{a}^{2}+Q_{b}^{2})^{2}-4Q_{a}^{2}Q_{b}^{2}}$
(3)

with $\hat{s}=(p_{a}+p_{b})^{2}$ with $p_{a}(p_{b})$ being the four-momenta of
the interacting partons $a$ and $b$. The partonic system is then rotated and
boosted back to the overall center-of-mass system of the colliding particles.
By this procedure, the parton-parton mass $\sqrt{\hat{s}}$ is exactly
conserved, while the rapidity of the partonic system is approximately
restored, depending on the transverse momenta.

In Fig. 1 a comparison of the Drell-Yan (DY) mass, transverse momentum and
rapidity is shown for an NLO calculation of DY production in pp collisions at
$\sqrt{s}=13$ TeV in the mass range $30<m_{DY}<2000$ GeV. The curve labelled
NLO(LHE) is the calculation of MadGraph5_amc@nlo with the subtraction terms,
the curve NLO(LHE+TMD) is the prediction after the transverse momentum is
included according to the procedure described above. In the $p_{T}$ spectrum
one can clearly see the effect of including transverse momenta from the TMD
distribution. The DY mass distribution is not changed, and the rapidity
distribution is almost exactly reproduced, only at large rapidities small
differences are observed.

Figure 1: Distributions of Drell-Yan mass, transverse momentum and rapidity
for $pp\to DY+X$ at $\sqrt{s}=13$ TeV. The hard process is calculated with
MadGraph5_amc@nlo. NLO(LHE) is the prediction including subtraction terms,
NLO(LHE+TMD) includes transverse momenta of the interacting partons according
to the description in the text.

The transverse momenta $k_{t}$ are generated according to the TMD density
${\cal A}(x,k_{t},\mu)$, at the original longitudinal momentum fraction $x$
and the hard process scale $\mu$. In a LO calculation, the full range of
$k_{t}$ is available, but in an NLO calculation via the MC@NLO method a shower
scale defines the boundary between parton shower and real emissions from the
matrix element, limiting the transverse momentum $k_{t}$. Technically the
factorization scale $\mu$ is calculated within Cascade3 (see parameter
`lhescale`) as it is not directly accessible from the LHE file, while the
shower scale is given by `SCALUP`. The limitation of the transverse momenta
coming from the TMD distribution and TMD shower to be smaller than the shower
scale SCALUP guarantees that the overlap with real emissions from the matrix
element is minimized according to the subtraction of counterterms in the
MC@NLO method.

The advantage of using TMDs for the complete process is that the kinematics
are fixed, independent of simulating explicitly the radiation history from the
parton shower. For inclusive processes, for example inclusive Drell-Yan
processes, the details of the hadronic final state generated by a parton
shower do not matter, and only the net effect of the transverse momentum
distribution is essential. However, for processes which involve jets, the
details of the parton shower become also important. The parton shower, as
described below, follows very closely the transverse momentum distribution of
the TMD and thus does not change any kinematic distribution after the
transverse momentum of the initial partons are included.

All hard processes, which are available in MadGraph5_amc@nlo can be used
within Cascade3. The treatment of multijet merging is described in Section 8.

###  2.2 Off-shell processes

In a region of phase space, where the longitudinal momentum fractions $x$
become very small, the transverse momentum of the partons cannot be neglected
and has to be included already at the matrix element level, leading to so-
called off-shell processes.

In off-shell processes a natural suppression at large $k_{t}$ [54] (with
$k_{t}>\mu$) is obtained, shown explicitly in Fig. 2, where the matrix element
for $g^{*}g^{*}\to Q\bar{Q}$, with $Q$ being a heavy quark, is considered. The
process is integrated over the final state phase space [55],

$\tilde{\sigma}(k_{t})=\int\frac{dx_{2}}{x_{2}}\,d\phi_{1,2}\,{\rm
dLips}\,|ME|^{2}\,(1-x_{2})^{5}\;,$ (4)

where ${\rm dLips}$ is the Lorentz-invariant phase space of the final state,
${\rm ME}$ is the matrix-element for the process, $\phi_{1,2}$ is the
azimuthal angle between the two initial partons, and a simple scale-
independent and $k_{t}$-independent gluon density $xG(x)=(1-x)^{5}$ is
included which suppresses large-$x$ contributions. In Fig. 2 we show
$\tilde{\sigma}(k_{t})$ normalized to its on-shell value $\tilde{\sigma}(0)$
at $\sqrt{s}=13000$ GeV as a function of the transverse momentum of the
incoming gluon $k_{t,2}$ for different values of $x_{1}$, which are chosen
such that the ratio $k^{2}_{t,1}/(x_{1}s)$ is kept constant.

Figure 2: The reduced cross section $\tilde{\sigma}(k_{t})/\tilde{\sigma}(0)$
as a function of the transverse momentum $k_{t,2}$ of the incoming gluon at
$\sqrt{s}=13000$ GeV. (Left) for different values of $k_{t,1}$ and $x_{1}$,
(right) for different heavy flavor masses and fixed values of $k_{t,1}$ and
$x_{1}$.

In Fig. 2 (left) predictions are shown for bottom quarks with mass $m=5$ GeV
and different $k_{t,1}$, in Fig. 2 (right) a comparison is made for different
heavy quark masses. Using off-shell matrix elements a suppression at large
transverse momenta of the initial partons is obtained, depending on the heavy
flavor mass and the transverse momentum. In a collinear approach, with
implicit integration over transverse momenta of the initial state partons, the
transverse momenta are limited by a theta function at the factorization scale,
while off-shell matrix elements give a smooth transition to a high $k_{t}$
tail.

When using off-shell processes, BFKL or CCFM type parton densities should be
used to cover the full available phase space in transverse momentum, which can
lead to $k_{t}$’s larger than the transverse momentum of any of the partons of
the hard process [56]. Until now, only gluon densities obtained from CCFM[15,
16, 17, 18] or BFKL[57, 58, 59] are available, thus limiting the advantages of
using off-shell matrix elements to gluon induced processes.

Several processes with off-shell matrix elements are implemented in Cascade3
as listed in Tab. 1, and described in detail in [60]. However, many more
processes are accessible via the automated matrix element calculators for off-
shell processes, KaTie [61] and Pegasus [62]. The events from the hard process
are then read with the Cascade3 package via LHE files. For processes generated
with KaTie or Pegasus no further corrections need to be performed and the
event can be directly passed to the showering procedure, described in the next
section.

Lepto(photo)production | process | IPRO | Reference
---|---|---|---
| $\gamma^{*}g^{*}\to q\bar{q}$ | 10 | [63]
| $\gamma^{*}g^{*}\to Q\bar{Q}$ | 11 | [63]
| $\gamma^{*}g^{*}\to J/\psi g$ | 2 | [64, 65, 66, 67]
Hadroproduction |  |  |
| $g^{*}g^{*}\to q\bar{q}$ | 10 | [63]
| $g^{*}g^{*}\to Q\bar{Q}$ | 11 | [63]
| $g^{*}g^{*}\to J/\psi g$ | 2 | [67]
| $g^{*}g^{*}\to\Upsilon g$ | 2 | [67]
| $g^{*}g^{*}\to\chi_{c}$ | 3 | [67]
| $g^{*}g^{*}\to\chi_{b}$ | 3 | [67]
| $g^{*}g^{*}\to J/\psi J/\psi$ | 21 | [68]
| $g^{*}g^{*}\to h^{0}$ | 102 | [38]
| $g^{*}g^{*}\to ZQ\bar{Q}$ | 504 | [69, 70]
| $g^{*}g^{*}\to Zq\bar{q}$ | 503 | [69, 70]
| $g^{*}g^{*}\to Wq_{i}Q_{j}$ | 514 | [69, 70]
| $g^{*}g^{*}\to Wq_{i}q_{j}$ | 513 | [69, 70]
| $qg^{*}\to Zq$ | 501 | [71]
| $qg^{*}\to Wq$ | 511 | [71]
| $qg^{*}\to qg$ | 10 | [72]
| $gg^{*}\to gg$ | 10 | [72]
Table 1: Processes included in Cascade3. $Q$ stands for heavy quarks, $q$ for
light quarks.

##  3 Initial State Parton Shower based on TMDs

The parton shower, which is described here, follows consistently the parton
evolution of the TMDs. By this we mean that the splitting functions $P_{ab}$,
the order and the scale in $\alpha_{\mathrm{s}}$ as well as kinematic
restrictions are identical to both the parton shower and the evolution of the
parton densities (for NLO PB TMD densities, the NLO DGLAP splitting functions
[73, 74] together with NLO $\alpha_{\mathrm{s}}$ is applied, while for the LO
TMD densities the corresponding LO splitting functions [75, 76, 77] and LO
$\alpha_{\mathrm{s}}$ is used).

###  3.1 From PB TMD evolution to TMD Parton Shower

The PB method describes the TMD parton density as (cf eq.(2.43) in Ref. [19])

$\displaystyle{x{\cal A}}_{a}(x,k_{t},\mu)$ $\displaystyle=$
$\displaystyle\Delta_{a}(\mu)\ x{{\cal
A}}_{a}(x,k_{t},\mu_{0})+\sum_{b}\int{{dq^{2}}\over{q^{2}}}{{d\phi}\over{2\pi}}\
{{\Delta_{a}(\mu)}\over{\Delta_{a}(q)}}\ \Theta(\mu-q)\ \Theta(q-\mu_{0})$ (5)
$\displaystyle\times$
$\displaystyle\int_{x}^{z_{M}}{dz}\;P_{ab}^{(R)}(\alpha_{\mathrm{s}}(f(z,q)),z)\;\frac{x}{z}{{\cal
A}}_{b}\left({\frac{x}{z}},k_{t}^{\prime},q\right)\;\;,$

with $z_{M}<1$ defining resolvable branchings, ${\bf k}$ (${\bf q}_{c}$) being
the transverse momentum vector of the propagating (emitted) parton,
respectively. The transverse momentum of the parton before branching is
defined as $k_{t}^{\prime}=|{\bf k}+(1-z){\bf q}|$ with ${\bf q}={\bf
q}_{c}/(1-z)$ being the rescaled transverse momentum vector of the emitted
parton (see Fig. 3, with the notation $k_{t}=|{\bf k}|$ and $q=|{\bf q}|$) and
$\phi$ being the azimuthal angle between ${\bf q}$ and ${\bf k}$. The argument
in $\alpha_{\mathrm{s}}$ is in general a function of the evolution scale $q$.
Higher order calculations indicate the transverse momentum of the emitted
parton as the preferred scale. The real emission branching probability is
denoted by $P_{ab}^{(R)}(\alpha_{\mathrm{s}}(f(z,q)),z)$ including
$\alpha_{\mathrm{s}}$ as described in Ref. [19] (in the following we omit
$\alpha_{\mathrm{s}}$ in the argument of $P_{ab}^{(R)}$ for easier reading).
The Sudakov form factor is given by:

$\Delta_{a}(z_{M},\mu,\mu_{0})=\exp\left(-\sum_{b}\int^{\mu^{2}}_{\mu^{2}_{0}}{{dq^{2}}\over
q^{2}}\int_{0}^{z_{M}}dz\ z\ P_{ba}^{(R)}\right)\;.$ (6)

Dividing Eq.(5) by $\Delta_{a}(\mu^{2})$ and differentiating with respect to
${\mu^{2}}$ gives the differential form of the evolution equation describing
the probability for resolving a parton with transverse momentum ${\bf
k}^{\prime}$ and momentum fraction $x/z$ into a parton with momentum fraction
$x$ and emitting another parton during a small decrease of $\mu$,

$\displaystyle{\mu^{2}}\frac{d}{d\mu^{2}}\left(\frac{{x{\cal
A}}_{a}(x,k_{t},\mu)}{\Delta_{a}(\mu)}\right)$ $\displaystyle=$
$\displaystyle\sum_{b}\int_{x}^{z_{M}}{dz}{{d\phi}\over{2\pi}}\;P_{ab}^{(R)}\;\frac{x}{z}\frac{{{\cal
A}}_{b}\left({\frac{x}{z}},k_{t}^{\prime},\mu\right)}{\Delta_{a}(\mu)}\;.\;\;$
(7)

The normalized probability is then given by

$\displaystyle\frac{\Delta_{a}(\mu)}{{x{\cal
A}}_{a}(x,k_{t},\mu)}d\left(\frac{{x{\cal
A}}_{a}(x,k_{t},\mu)}{\Delta_{a}(\mu)}\right)$ $\displaystyle=$
$\displaystyle\sum_{b}{{d\mu^{2}}\over{\mu^{2}}}\int_{x}^{z_{M}}{dz}{{d\phi}\over{2\pi}}\;P_{ab}^{(R)}\;\frac{{\frac{x}{z}{\cal
A}}_{b}\left({\frac{x}{z}},k_{t}^{\prime},\mu\right)}{{x{\cal
A}}_{a}(x,k_{t},\mu)}\;\;$ (8)

This equation can be integrated between $\mu^{2}_{i-1}$ and $\mu^{2}$ to give
the no-branching probability (Sudakov form factor) for the backward evolution
$\Delta_{bw}$,111In Eq.(3.1) ordering in $\mu$ is assumed. However, if angular
ordering as in CCFM [15, 16, 17, 18] is applied then the ratio of parton
densities would change to $[x^{\prime}{\cal
A}_{b}(x^{\prime},k_{t}^{\prime},q^{\prime}/z)]/[x{\cal
A}_{a}(x,k_{t},q^{\prime})]$ as discussed in [60].

$\displaystyle\log\Delta_{bw}(x,k_{t},\mu,\mu_{i-1})$ $\displaystyle=$
$\displaystyle\log\left(\frac{\Delta_{a}(\mu)}{\Delta_{a}(\mu_{i-1})}\frac{x{\cal
A}_{a}(x,k_{t},\mu_{i-1})}{{{x{\cal A}}_{a}(x,k_{t},\mu)}}\right)$
$\displaystyle=$
$\displaystyle-\sum_{b}\int_{\mu_{i-1}^{2}}^{\mu^{2}}{{dq^{\prime\,2}}\over{q^{\prime\,2}}}{{d\phi}\over{2\pi}}\int_{x}^{z_{M}}{dz}\;P_{ab}^{(R)}\;\frac{{x^{\prime}{\cal
A}}_{b}\left(x^{\prime},k_{t}^{\prime},q^{\prime}\right)}{{x{\cal
A}}_{a}(x,k_{t},q^{\prime})}\;,$

with $x^{\prime}=x/z$. This Sudakov form factor is very similar to the Sudakov
form factor in ordinary parton shower approaches, with the difference that for
the PB TMD shower the ratio of PB TMD densities $[x^{\prime}{\cal
A}_{b}\left(x^{\prime},k_{t}^{\prime},q^{\prime}\right)]/[x{\cal
A}_{a}(x,k_{t},q^{\prime})]$ is applied, which includes a dependence on
$k_{t}$.

In Eq.(3.1) a relation between the Sudakov form factor $\Delta_{a}$ used in
the evolution equation and the Sudakov form factor $\Delta_{bw}$ used for the
backward evolution of the parton shower is made explicit. A similar relation
was also studied in Refs. [78, 79]. In Ref [78] the $z_{M}$ limit was
identified as a source of systematic uncertainty when using conventional
showers with standard collinear pdfs; in the PB approach, the same $z_{M}$
limit is present in the parton evolution as well as in the PB-shower. The PB
approach allows a consistent formulation of the parton shower with the PB
TMDs, as in both Sudakov form factors $\Delta_{a}$ and $\Delta_{bw}$ the same
value of $z_{M}$ is used.

The splitting functions $P_{ab}^{(R)}$ contain the coupling,

$P_{ab}(\alpha_{\mathrm{s}},z)=\sum^{\infty}_{n=1}\left(\frac{\alpha_{\mathrm{s}}(f(z,q))}{2\pi}\right)^{n}P_{ab}^{(n-1)}(z)\;,$
(10)

where the scale $f(z,q)$ in the coupling depends on the ordering condition as
discussed later (see Eq.(11)).

The advantage of using a PB TMD shower is that as long as the parameters of
the parton shower are set through TMD distributions the parton shower
uncertainties can be recast as uncertainties of the TMDs, which in turn can be
fitted to experimental data in a systematic global manner.

###  3.2 Backward Evolution for initial state TMD Parton Shower

A backward evolution method, as now common in Monte Carlo event generators, is
applied for the initial state parton shower, evolving from the large scale of
the matrix-element process backwards down to the scale of the incoming hadron.
However, in contrast to the conventional parton shower, which generates
transverse momenta of the initial state partons during the backward evolution,
the transverse momenta of the initial partons of the hard scattering process
is fixed by the TMD and the parton shower does not change the kinematics. The
transverse momenta during the backward cascade follow the behavior of the TMD.
The hard scattering process is obtained as described in section 2. The
backward evolution of the initial state parton shower follows very closely the
description in [60, 80, 81], which is based on Ref. [53].

The starting value of the evolution scale $\mu$ is calculated from the hard
scattering process, as described in Section 2. In case of on-shell matrix
elements at NLO, the transverse momentum of the hardest parton in the parton
shower evolution is limited by the shower-scale, as described in Section 2.1.

Figure 3: Left: Schematic view of a parton branching process. Right: Branching
process $b\to a+c$.

Starting at the hard scale $\mu=\mu_{i}$, the parton shower algorithm searches
for the next scale $\mu_{i-1}$ at which a resolvable branching occurs (see
Fig. 3 left). This scale $\mu_{i-1}$ is selected from the Sudakov form factor
$\Delta_{bw}$ as given in Eq.(3.1) (see also [60]). In the parton shower
language, the selection of the next branching comes from solving
$R=\Delta_{bw}(x,k_{t},\mu_{i},\mu_{i-1})$ for $\mu_{i-1}$ using uniformly
distributed random numbers R for given $x$ and $\mu_{i}$. However, to solve
the integrals in Eq.(3.1) numerically for every branching would be too time
consuming, instead the veto-algorithm [53, 82] is applied.

The splitting function $P_{ab}$ as well as the argument $f(z,q)$ in the
calculation of $\alpha_{\mathrm{s}}$ is chosen exactly as used in the
evolution of the parton density. In a parton shower one treats “resolvable”
branchings, defined via a cut in $z<z_{M}$ in the splitting function to avoid
the singular behavior of the terms $1/(1-z)$, and branchings with $z>z_{M}$
are regarded as “non-resolvable” and are treated similarly as virtual
corrections: they are included in the Sudakov form factor $\Delta_{bw}$. The
splitting variable $z_{i-1}$ is obtained from the splitting functions
following the standard methods (see Eq.(2.37) in [19]).

The calculation of the transverse momentum $k_{t}$ is sketched in Fig. 3
(right). The transverse momentum $q_{t\,c}$ can be calculated in case of
angular ordering (where the scale $q$ of each branching is associated with the
angle of the emission) in terms of the angle $\Theta$ of the emitted parton
with respect to the beam directions $q_{t,c}=(1-z)E_{b}\sin\Theta$,

${\bf q}_{c}^{2}=(1-z)^{2}q^{2}\;\;.$ (11)

Once the transverse momentum of the emitted parton ${\bf q}_{c}$ is known, the
transverse momentum of the propagating parton can be calculated from

${\bf k}^{\prime}={\bf k}+{\bf q}_{c}$ (12)

with a uniformly distributed azimuthal angle $\phi$ assumed for the vector
components of ${\bf k}$ and ${\bf q}_{c}$. The generation of the parton
momenta is performed in the center-of-mass frame of the collision (in contrast
to conventional parton showers, which are generated in different partonic
frames).

The whole procedure is iterated until one reaches a scale $\mu_{i-1}<q_{0}$
with $q_{0}$ being a cut-off parameter, which can be chosen to be the starting
evolution scale of the TMD. It is of advantage to continue the parton shower
evolution to lower scales $q_{0}\sim\Lambda_{qcd}\sim 0.3$ GeV.

The final transverse momentum of the propagating parton ${\bf k}$ is the sum
of all transverse momenta ${\bf q}_{c}$ (see Fig. 3 right):

${\bf k}={\bf k}_{0}-\sum_{c}{\bf q}_{c}\;\;.$ (13)

with ${\bf k}_{0}$ being the intrinsic transverse momentum.

The PB TMD parton shower is selected with `PartonEvolution=2` (or `ICCF=2`).

###  3.3 CCFM parton evolution and parton shower

The CCFM parton evolution and corresponding parton shower follows a similar
approach as described in the previous section and in detail also in Refs. [81,
80, 60, 83]. The main difference to the PB-TMD shower are the splitting
functions with the non-Sudakov form factor $\Delta_{ns}$ and the allowed phase
space for emission. The original CCFM splitting function
$\tilde{P}_{g}(z,q,k_{t})$ for branching $g\to gg$ is given by222Finite terms
are neglected as they are not obtained in CCFM at the leading infrared
accuracy (cf p.72 in [17]).

$\tilde{P}_{g}(z,q,k_{t})=\frac{\bar{\alpha}_{s}(q(1-z))}{1-z}+\frac{\bar{\alpha}_{s}(k_{t})}{z}\Delta_{ns}(z,q,k_{t}),$
(14)

where the non-Sudakov form factor $\Delta_{ns}$ is defined as

$\log\Delta_{ns}=-\bar{\alpha}_{s}(k_{t})\int_{0}^{1}\frac{dz^{\prime}}{z^{\prime}}\int\frac{dq^{2}}{q^{2}}\Theta(k_{t}-q)\Theta(q-z^{\prime}q_{t})\,,$
(15)

with $q_{t}=\sqrt{{\bf q}_{t}^{2}}$ being the magnitude of the transverse
vector defined in Eq.(11) and $k_{t}$ the magnitude of the transverse vector
in Eq.(12).

The CCFM parton shower is selected with `ICCF=1` ( `PartonEvolution=1`). 333A
one loop parton shower (DGLAP like) with $\Delta_{ns}=1$, one loop
$\alpha_{\mathrm{s}}$ and strict ordering in $q$ can be selected with ICCF=0.

##  4 The TMD parton densities

In the previous versions of Cascade the TMD densities were part of the
program. With the development of TMDlib [84, 85] there is easy access to all
available TMDs, including parton densities for photons (as well as Z, W and H
densities, if available).

These parton densities can be selected via `PartonDensity` with a value
$>100000$. For example the TMDs from the parton branching method [19, 20] are
selected via `PartonDensity=102100 (102200)` for PB-NLO-HERAI+II-2018-set1
(set2).

Note that the features of the TMD parton shower are only fully available for
the PB-TMD sets and the CCFM shower clearly needs CCFM parton densities (like
for instance [86]). PB-TMD parton densities are determined in Ref. [87] from
fits to HERA DIS $F_{2}$ measurements for $Q^{2}>3$ GeV2, giving very good
$\chi^{2}$ values. In Refs. [88, 89] the transverse momentum distribution of
Drell-Yan pairs at low and high masses, obtained from PB-TMD densities, are
compared with experimental measurements in a wide variety of kinematic
regions, from low-energy fixed target experiments to high-energy collider
experiments. Good agreement is found between predictions and measurements
without the need for tuning of nonperturbative parameters, which illustrates
the validity of the approach over a broad kinematic range in energy and mass
scales.

##  5 Final state parton showers

The final state parton shower uses the parton shower routine `PYSHOW` of
Pythia. Leptons in the final state, coming for example from Drell-Yan decays,
can radiate photons, which are also treated in the final state parton shower.
Here the method from `PYADSH` of Pythia is applied, with the scale for the QED
shower being fixed at the virtuality of the decaying particle (for example the
mass of the Z-boson).

The default scale for the QCD final state shower is
$\mu^{2}=2\cdot(m_{1\;\perp}^{2}+m_{2\;\perp}^{2})$ (`ScaleTimeShower=1`),
with $m_{1(2)\;\perp}$ being the transverse mass of the hard parton 1(2).
Other choices are possible: $\mu^{2}=\hat{s}$ (`ScaleTimeShower=2`) and
$\mu^{2}=2\cdot(m_{1}^{2}+m_{2}^{2})$ (`ScaleTimeShower=3`). In addition a
scale factor can be applied: `ScaleFactorFinalShower`$\times\mu^{2}$ (default:
`ScaleFactorFinalShower=1`).

##  6 Hadronization

The hadronization (fragmentation of the partons in colorless systems) is done
exclusively by Pythia. Hadronization (fragmentation) is switched off by
`Hadronization = 0` (or `NFRA = 0` for the older steering cards). All
parameters of the hadronization model can be changed via the steering cards.

##  7 Uncertainties

Uncertainties of QCD calculations mainly arise from missing higher order
corrections, which are estimated by varying the factorization and
renormalization scales up and down by typically a factor of 2. The scale
variations are performed when calculating the matrix elements and are stored
as additional weights in the LHE file, which are then passed directly via
Cascade3 to the HEPMC [90] output file for further processing.

The uncertainties coming from the PDFs can also be calculated as additional
weight factors during the matrix element calculation. However, when using
TMDs, additional uncertainties arise from the transverse momentum distribution
of the TMD. The PB-TMDs come with uncertainties from the experimental
uncertainties as well as from model uncertainties, as discussed in Ref. [87].
These uncertainties can be treated and applied as additional weight factors
with the parameter `Uncertainty_TMD=1`.

##  8 Multi-jet merging

Showered multijet LO matrix element calculations can be merged using the
prescription discussed in Ref. [91]. The merging performance is controlled by
the three parameters `Rclus`, `Etclus`, `Etaclmax`. Final-state partons with
pseudorapidity $\eta<$`Etaclmax` present in the event record after the shower
step but before hadronization are passed to the merging machinery if `Imerge =
1`. Partons are clustered using the kt-jet algorithm with a cone radius
`Rclus` and matched to the PB evolved matrix element partons if the distance
between the parton and the jet is $R<1.5\times$`Rclus`. The hardness of the
reconstructed jets is controlled by its minimum transverse energy `Etclus`
(merging scale).

The number of light flavor partons is defined by the `NqmaxMerge` parameter.
Heavy flavor partons and their corresponding radiation are not passed to the
merging algorithm. All jet multiplicities are treated in exclusive mode except
for the highest multiplicity `MaxJetsMerge` which is treated in inclusive
mode.

##  9 Program description

In Cascade3 all variables are declared as `Double Precision`. With Cascade3
the source of Pythia 6.428 is included to avoid difficulties in linking.

###  9.1 Random Numbers

Cascade3 uses the `RANLUX` random number generator, with luxory level `LUX =
4`. The random number seed can be set via the environment variable `CASEED`,
the default value is `CASEED=12345`.

###  9.2 Event Output

When `HEPMC` is included, generated events are written out in HEPMC [90]
format for further processing. The environment variable `HEPMCOUT` is used to
specify the file name, by default this variable is set to
`HEPMCOUT=/dev/null`.

The HEPMC events can be further processed, for example with Rivet [92].

###  9.3 Input parameters

The input parameters are steered via steering files. The new format of
steering is discussed in Section 9.3.1 and should be used when reading LHE
files, while the other format, which is appropriate for the internal off-shell
processes, is discussed in Section 9.3.2.

####  9.3.1 Input parameters - new format

Examples for steering files are under `$install_path/share/cascade/LHE`.

    &CASCADE_input
    NrEvents = -1                  ! Nr of events to process
    Process_Id = -1                ! Read LHE file
    Hadronisation = 0              ! Hadronisation (on =1, off = 0)
    SpaceShower = 1                ! Space-like Parton Shower
    SpaceShowerOrderAlphas=2       ! Order alphas in Space Shower
    TimeShower = 1                 ! Time-like Parton Shower
    ScaleTimeShower = 4            ! Scale choice for Time-like Shower
    !                                 1: 2(m^2_1t+m^2_2t)
    !                                 2: shat
    !                                 3: 2(m^2_1+m^2_2)
    !                                 4: 2*scalup (from lhe file)
    !ScaleFactorFinalShower = 1.   ! scale factor for Final State Parton Shower
    PartonEvolution = 2            ! type of parton evolution in Space-like Shower
    !                                 1: CCFM
    !                                 2: full all flavor TMD evolution
    ! EnergyShareRemnant = 4       ! energy sharing in proton remnant
    !                                 1: (a+1)(1-z)**a, <z>=1/(a+2)=1/3
    !                                 2: (a+1)(1-z)**a, <z>=1/(a+2)=mq/(mq+mQ
    !                                 3: N/(z(1-1/z-c/(1-z))**2), c=(mq/mQ)**2
    !                                 4: PYZDIS: KFL1=1
    ! Remnant = 0                  ! =0 no remnant treatment
    PartonDensity = 102200           ! use TMDlib: PB-TMDNLO-set2
    ! PartonDensity = 102100         ! use TMDlib: PB-TMDNLO-set1
    ! TMDDensityPath= ’./share’    ! Path to TMD density for internal files
    Uncertainty_TMD = 0                        ! calculate and store uncertainty TMD pdfs
    lheInput=’MCatNLO-example.lhe’ ! LHE input file
    lheHasOnShellPartons = 1       ! = 0 LHE file has off-shell parton configuration
    lheReweightTMD = 0             ! Reweight with new TMD  given in PartonDensity
    lheScale = 2                   ! Scale defintion for TMD
    !                                 0: use scalup
    !                                 1: use shat
    !                                 2: use 1/2 Sum pt^2 of final parton/particles
    !                                 3: use shat for Born and 1/2 Sum pt^2 of final parton(particle)
    !                                 4: use shat for Born and max pt of most forward/backward
    !                                    parton(particle)
    lheNBornpart = 2               ! Nr of hard partons (particles) (Born process)
    ScaleFactorMatchingScale = 2.  ! Scale factor for matching scale when including TMDs
    &End

    &PYTHIA6_input
    P6_Itune = 370                 ! Retune of Perugia 2011 w CTEQ6L1 (Oct 2012)
    ! P6_MSTJ(41) = 1              ! (D = 2) type of branchings allowed in shower.
    !                                 1: only QCD
    !                                 2: QCD and photons off quarks and leptons
    P6_MSTJ(45) = 4                ! Nr of flavors in final state shower: g->qqbar
    P6_PMAS(4,1)= 1.6              ! charm mass
    P6_PMAS(5,1)= 4.75             ! bottom mass
    P6_MSTJ(48) =   1              ! (D=0), 0=no max. angle, 1=max angle def. in PARJ(85)
    ! P6_MSTU(111) =  1            ! = 0 : alpha_s is fixed, =1 first order; =2 2nd order;
    ! P6_PARU(112) = 0.2           ! lambda QCD
    P6_MSTU(112)=   4              ! nr of flavours wrt lambda_QCD
    P6_MSTU(113)=                  ! min nr of flavours for alphas
    P6_MSTU(114)=   5              ! max nr of flavours for alphas
    &End

####  9.3.2 Input parameters - off-shell processes

Examples for steering files are under `$install_path/share/cascade/HERA` and
`$install_path/share/cascade/PP`.

    * OLD STEERING FOR CASCADE
    *
    * number of events to be generated
    *
    NEVENT 100
    *
    * +++++++++++++++++ Kinematic parameters +++++++++++++++
    *
    ’PBE1’    1    0    -7000.    ! Beam energy
    ’KBE1’    1    0     2212     ! -11: positron, 22: photon  2212: proton
    ’IRE1’    1    0       1      ! 0: beam 1 has no structure
    *                             ! 1: beam 1 has structure
    ’PBE2’     1   0     7000.    ! Beam energy
    ’KBE2’     1   0     2212     ! 11: electron, 22: photon 2212: proton
    ’IRE2’     1   0        1     ! 0:  beam 3 has no structure
    *                             ! 1:  beam 2 has structure
    ’NFLA’     1   0        4     ! (D=5) nr of flavours used in str.fct
    * +++++++++++++++ Hard subprocess selection ++++++++++++++++++
    ’IPRO’     1   0        2     ! (D=1)
    *                             !  2: J/psi g
    *                             !  3: chi_c
    ’I23S’      1    0       0    ! (D=0) select 2S or 3S state
    ’IPOL’      1    0       0    ! (D=0)  VM->ll (polarization study)
    ’IHFL’      1    0       4    ! (D=4) produced flavour for IPRO=11
    *                             ! 4: charm
    *                             ! 5: bottomΨΨΨΨ
    ’PTCU’      1    0       1.   ! (D=0) p_t **2 cut for process
    * ++++++++++++ Parton shower and fragmentation ++++++++++++
    ’NFRA’     1     0       1    ! (D=1) Fragmentation on=1 off=0
    ’IFPS’     1     0       3    ! (D=3) Parton shower
    *                             ! 0: off
    *                             ! 1: initial state PS
    *                             ! 2: final state PS
    *                             ! 3: initial and final state PS
    ’IFIN’     1     0       1    ! (D=1) scale switch for FPS
    *                             ! 1: 2(m^2_1t+m^2_2t)
    *                             ! 2: shat
    *                             ! 3: 2(m^2_1+m^2_2)
    ’SCAF’     1     0       1.   ! (D=1) scale factor for FPS
    ’ITIM’     1     0       0    ! 0: timelike partons may not shower
    *                             ! 1: timelike partons may shower
    ’ICCF’     1     0       1    ! (D=1) Evolution equation
    *                             ! 0: DGLAP
    *                             ! 1: CCFM
    *                             ! 2: PB TMD evolution
    * +++++++++++++ Structure functions and scales +++++++++++++
    ’IRAM’     1     0       0    ! (D=0) Running of alpha_em(Q2)
    *                             ! 0: fixed
    *                             ! 1: running
    ’IRAS’     1     0       1    ! (D=1) Running of alpha_s(MU2)
    *                             ! 0: fixed alpha_s=0.3
    *                             ! 1: running
    ’IQ2S’     1     0       3    ! (D=1) Scale MU2 of alpha_s
    *                             !  1: MU2= 4*m**2 (only for heavy quarks)
    *                             !  2: MU2 = shat(only for heavy quarks)
    *                             !  3: MU2= 4*m**2 + pt**2
    *                             !  4: MU2 = Q2
    *                             !  5: MU2 = Q2 + pt**2
    *                             !  6: MU2 = k_t**2
    ’SCAL’     1    0     1.0     !  scale factor for renormalisation scale
    ’SCAF’     1    0     1.0     !  scale factor for factorisation scale*
    *’IGLU’    1    0     1201    ! (D=1010)Unintegrated gluon density
    *                             ! > 10000 use TMDlib (i.e. 101201 for JH-2013-set1)
    *                             !  1201: CCFM set JH-2013-set1 (1201 - 1213)
    *                             !  1301: CCFM set JH-2013-set2 (1301 - 1313)
    *                             !  1001: CCFM J2003 set 1
    *                             !  1002: CCFM J2003 set 2
    *                             !  1003: CCFM J2003 set 3
    *                             !  1010: CCFM set A0
    *                             !  1011: CCFM set A0+
    *                             !  1012: CCFM set A0-
    *                             !  1013: CCFM set A1
    *                             !  1020: CCFM set B0
    *                             !  1021: CCFM set B0+
    *                             !  1022: CCFM set B0-
    *                             !  1023: CCFM set B1
    *                             !  1: CCFM old set JS2001
    *                             !  2: derivative of collinear gluon (GRV)
    *                             !  3: Bluemlein
    *                             !  4: KMS
    *                             !  5: GBW (saturation model)
    *                             !  6: KMR
    *                             !  7: Ryskin,Shabelski
    * ++++++++++++ BASES/SPRING Integration procedure ++++++++++++
    ’NCAL’     1    0    50000    ! (D=20000) Nr of calls per iteration for bases
    ’ACC1’     1    0     1.0     ! (D=1) relative prec.(%) for grid optimisation
    ’ACC2’     1    0     0.5     ! (0.5) relative prec.(%) for integration
    * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    *’INTE’    1    0      0      ! Interaction type (D=0)
    *                             ! = 0 electromagnetic interaction
    *’KT1 ’    1    0      0.44   ! (D=0.0) intrinsic kt for beam 1
    *’KT2 ’    1    0      0.44   ! (D=0.0) intrinsic kt for beam 2
    *’KTRE’    1    0      0.35   ! (D=0.35) primordial kt when non-trivial
    *                             ! target remnant is split into two particles
    * Les Houches Accord Interface
    ’ILHA’     1    0      0      ! (D=10) Les Houches Accord
    *                             ! = 0  use internal CASCADE
    *                             ! = 1  write event file
    *                             ! = 10 call PYTHIA for final state PS and remnant frag
    * path for updf files
    * ’UPDF’   ’./share’

##  10 Program Installation

Cascade3 now follows the standard AUTOMAKE convention. To install the program,
do the following

    1) Get the source from http://www.desy.de/~jung/cascade

    tar xvfz cascade-XXXX.tar.gz
    cd cascade-XXXX

    2) Generate the Makefiles (do not use shared libraries)
    ./configure --disable-shared --prefix=install-path --with-lhapdf="lhapdflib_path"
    --with-tmdlib="TMDlib_path"  --with-hepmc="hepmc_path"

    with (as example):
    lhapdflib_path=/Users/jung/MCgenerators/lhapdf/6.2.1/local
    TMDlib_path=/Users/jung/jung/cvs/TMDlib/TMDlib2/local
    hepmc_path/Users/jung/MCgenerators/hepmc/HepMC-2.06.09/local
    3) Compile the binary
    make

    4) Install the executable and PDF files
    make install

    4) The executable is in bin
    run it with:
    export CASEED=1242425
    export HEPMCOUT=outfile.hepmc

    cd $install-path/bin

    ./cascade < $install-path/share/cascade/LHE/steering-DY-MCatNLO.txt

## Acknowledgments.

FG acknowledges the support and hospitality of DESY, Hamburg, where part of
this work started. FH acknowledges the hospitality and support of DESY,
Hamburg and of CERN, Theory Division while parts of this work were being done.
SB, ALi and MM are grateful the DESY Directorate for the support in the
framework of Cooperation Agreement between MSU and DESY on phenomenology of
the LHC processes and TMD parton densities. MM was supported by a grant of the
foundation for the advancement of theoretical physics and mathematics “Basis”
20-1-3-11-1. STM thanks the Humboldt Foundation for the Georg Forster research
fellowship and gratefully acknowledges support from IPM. ALe acknowledges
funding by Research Foundation-Flanders (FWO) (application number: 1272421N).
QW and HY acknowledge the support by the Ministry of Science and Technology
under grant No. 2018YFA040390 and by the National Natural Science Foundation
of China under grant No. 11661141008.

##  11 Program Summary

Title of Program: Cascade3 3.1.0

Computer for which the program is designed and others on which it is operable:
any with standard Fortran 77 (gfortran)

Programming Language used: FORTRAN 77

High-speed storage required: No

Separate documentation available:  No

Keywords:  QCD, TMD parton distributions.

Method of solution: Since measurements involve complex cuts and multi-particle
final states, the ideal tool for any theoretical description of the data is a
Monte Carlo event generator which generates initial state parton showers
according to Transverse Momentum Dependent (TMD) parton densities, in a
backward evolution, which follows the evolution equation as used for the
determination of the TMD.

Restrictions on the complexity of the problem: Any LHE file (with on-shell or
off-shell) initial state partons can be processed.

Other Program used: Pythia (version $>$ 6.4) for final state parton shower and
hadronization, Bases/Spring 5.1 for integration (both supplied with the
program package),
TMDlib as a library for TMD parton densities.

Download of the program: `http://www.desy.de/~jung/cascade`

Unusual features of the program: None

## References

  * [1] J. Alwall, R. Frederix, S. Frixione, V. Hirschi, F. Maltoni, et al.,  JHEP 1407, 079 (2014).  1405.0301
  * [2] S. Frixione and B. R. Webber (2006).  hep-ph/0612272
  * [3] S. Frixione, P. Nason, and B. R. Webber,  JHEP 08, 007 (2003).  hep-ph/0305252
  * [4] S. Frixione and B. R. Webber (2002).  hep-ph/0207182
  * [5] S. Frixione and B. R. Webber,  JHEP 06, 029 (2002).  hep-ph/0204244
  * [6] S. Alioli, K. Hamilton, P. Nason, C. Oleari, and E. Re,  JHEP 04, 081 (2011).  1012.3380
  * [7] S. Frixione, P. Nason, and C. Oleari,  JHEP 0711, 070 (2007).  0709.2092
  * [8] M. Bahr, S. Gieseke, M. Gigg, D. Grellscheid, K. Hamilton, et al.,  Eur. Phys. J. C 58, 639 (2008).  0803.0883
  * [9] T. Sjöstrand, S. Ask, J. R. Christiansen, R. Corke, N. Desai, P. Ilten, S. Mrenna, S. Prestel, C. O. Rasmussen, and P. Z. Skands,  Comput. Phys. Commun. 191, 159 (2015).  1410.3012
  * [10] J. Alwall, S. Hoche, F. Krauss, N. Lavesson, L. Lonnblad, et al.,  Eur. Phys. J. C 53, 473 (2008).  0706.2569
  * [11] S. Catani, F. Krauss, R. Kuhn, and B. R. Webber,  JHEP 11, 063 (2001).  hep-ph/0109231
  * [12] R. Frederix and S. Frixione,  JHEP 12, 061 (2012).  1209.6215
  * [13] K. Hamilton, P. Nason, and G. Zanderighi,  JHEP 10, 155 (2012).  1206.3572
  * [14] S. Catani, M. Ciafaloni, and F. Hautmann,  Phys. Lett. B 242, 97 (1990)
  * [15] M. Ciafaloni,  Nucl. Phys. B 296, 49 (1988)
  * [16] S. Catani, F. Fiorani, and G. Marchesini,  Phys. Lett. B 234, 339 (1990)
  * [17] S. Catani, F. Fiorani, and G. Marchesini,  Nucl. Phys. B 336, 18 (1990)
  * [18] G. Marchesini,  Nucl. Phys. B 445, 49 (1995).  hep-ph/9412327
  * [19] F. Hautmann, H. Jung, A. Lelek, V. Radescu, and R. Zlebcik,  JHEP 01, 070 (2018).  1708.03279
  * [20] F. Hautmann, H. Jung, A. Lelek, V. Radescu, and R. Zlebcik,  Phys. Lett. B 772, 446 (2017).  1704.01757
  * [21] R. Angeles-Martinez et al.,  Acta Phys. Polon. B 46, 2501 (2015).  1507.05267
  * [22] J. Alwall et al.,  Comput. Phys. Commun. 176, 300 (2007).  hep-ph/0609017
  * [23] J. C. Collins and D. E. Soper,  Nucl. Phys. B 193, 381 (1981).  [Erratum: Nucl. Phys.B213,545(1983)]
  * [24] J. C. Collins and D. E. Soper,  Nucl. Phys. B 194, 445 (1982)
  * [25] J. C. Collins, D. E. Soper, and G. F. Sterman,  Nucl. Phys. B 223, 381 (1983)
  * [26] J. C. Collins, D. E. Soper, and G. F. Sterman,  Phys. Lett. B 109, 388 (1982)
  * [27] J. C. Collins, D. E. Soper, and G. F. Sterman,  Nucl. Phys. B 250, 199 (1985)
  * [28] J. Collins,  Foundations of perturbative QCD, Vol. 32.  Cambridge monographs on particle physics, nuclear physics and cosmology., 2011
  * [29] R. Meng, F. I. Olness, and D. E. Soper,  Phys. Rev. D 54, 1919 (1996).  hep-ph/9511311
  * [30] P. M. Nadolsky, D. R. Stump, and C. P. Yuan,  Phys. Rev. D 61, 014003 (2000).  [Erratum: Phys.Rev.D 64, 059903 (2001)], hep-ph/9906280
  * [31] P. M. Nadolsky, D. R. Stump, and C. P. Yuan,  Phys. Rev. D 64, 114011 (2001).  hep-ph/0012261
  * [32] X.-D. Ji, J.-P. Ma, and F. Yuan,  Phys. Rev. D 71, 034005 (2005).  hep-ph/0404183
  * [33] X.-D. Ji, J.-P. Ma, and F. Yuan,  Phys. Lett. B 597, 299 (2004).  hep-ph/0405085
  * [34] M. G. Echevarria, A. Idilbi, and I. Scimemi,  JHEP 07, 002 (2012).  1111.4996
  * [35] J.-Y. Chiu, A. Jain, D. Neill, and I. Z. Rothstein,  Phys. Rev. Lett. 108, 151601 (2012).  1104.0881
  * [36] E. M. Levin, M. G. Ryskin, Y. M. Shabelski, and A. G. Shuvaev,  Sov. J. Nucl. Phys. 53, 657 (1991)
  * [37] J. C. Collins and R. K. Ellis,  Nucl. Phys. B 360, 3 (1991)
  * [38] F. Hautmann,  Phys. Lett. B 535, 159 (2002).  hep-ph/0203140
  * [39] E. Avsar (2012).  1203.1916
  * [40] E. Avsar,  Int. J. Mod. Phys. Conf. Ser. 04, 74 (2011).  1108.1181
  * [41] S. Jadach and M. Skrzypek,  Acta Phys. Polon. B 40, 2071 (2009).  0905.1399
  * [42] F. Dominguez,  Unintegrated Gluon Distributions at Small-x.  Ph.D. Thesis, Columbia U., 2011
  * [43] F. Dominguez, J.-W. Qiu, B.-W. Xiao, and F. Yuan,  Phys. Rev. D 85, 045003 (2012).  1109.6293
  * [44] F. Dominguez, A. Mueller, S. Munier, and B.-W. Xiao,  Phys. Lett. B 705, 106 (2011).  1108.1752
  * [45] F. Hautmann,  Acta Phys.Polon. B 40, 2139 (2009)
  * [46] F. Hautmann, M. Hentschinski, and H. Jung (2012).  1205.6358
  * [47] F. Hautmann and H. Jung,  Nucl. Phys. Proc. Suppl. 184, 64 (2008).  0712.0568
  * [48] S. Catani, M. Ciafaloni, and F. Hautmann,  Phys. Lett. B307, 147 (1993)
  * [49] S. Catani and F. Hautmann,  Nucl. Phys. B427, 475 (1994).  hep-ph/9405388
  * [50] A. Buckley, J. Ferrando, S. Lloyd, K. Nordström, B. Page, M. Rüfenacht, M. Schönherr, and G. Watt,  Eur. Phys. J. C 75, 132 (2015).  1412.7420
  * [51] S. Dooling, P. Gunnellini, F. Hautmann, and H. Jung,  Phys.Rev.D 87, 094009 (2013).  1212.6164
  * [52] F. Hautmann and H. Jung,  Eur. Phys. J. C 72, 2254 (2012).  1209.6549
  * [53] M. Bengtsson, T. Sjostrand, and M. van Zijl,  Z. Phys. C 32, 67 (1986)
  * [54] S. Catani, M. Ciafaloni, and F. Hautmann,  Nucl. Phys. B Proc. Suppl. 29, 182 (1992)
  * [55] G. Marchesini and B. R. Webber,  Nucl. Phys. B 386, 215 (1992)
  * [56] F. Hautmann, H. Jung, and S. T. Monfared,  Eur. Phys. J. C 74, 3082 (2014).  1407.5935
  * [57] E. A. Kuraev, L. N. Lipatov, and V. S. Fadin,  Sov. Phys. JETP 44, 443 (1976)
  * [58] E. A. Kuraev, L. N. Lipatov, and V. S. Fadin,  Sov. Phys. JETP 45, 199 (1977)
  * [59] I. I. Balitsky and L. N. Lipatov,  Sov. J. Nucl. Phys. 28, 822 (1978)
  * [60] H. Jung, S. Baranov, M. Deak, A. Grebenyuk, F. Hautmann, et al.,  Eur. Phys. J. C 70, 1237 (2010).  1008.0152
  * [61] A. van Hameren,  Comput. Phys. Commun. 224, 371 (2018).  1611.00680
  * [62] A. Lipatov, M. Malyshev, and S. Baranov,  Eur. Phys. J. C 80, 330 (2020).  1912.04204
  * [63] S. Catani, M. Ciafaloni, and F. Hautmann,  Nucl. Phys. B 366, 135 (1991)
  * [64] V. Saleev and N. Zotov,  Mod. Phys. Lett. A 9, 151 (1994).  [Erratum: Mod.Phys.Lett.A 9, 1517–1518 (1994)]
  * [65] A. Lipatov and N. Zotov,  Eur. Phys. J. C 27, 87 (2003).  hep-ph/0210310
  * [66] S. Baranov and N. Zotov,  J. Phys. G 29, 1395 (2003).  hep-ph/0302022
  * [67] S. P. Baranov,  Phys. Rev. D 66, 114003 (2002)
  * [68] S. Baranov,  Phys. Rev. D 84, 054012 (2011)
  * [69] S. P. Baranov, A. V. Lipatov, and N. P. Zotov,  Phys. Rev. D 78, 014025 (2008).  0805.4821
  * [70] M. Deak and F. Schwennsen,  JHEP 09, 035 (2008).  0805.3763
  * [71] S. Marzani and R. D. Ball,  Nucl. Phys. B 814, 246 (2009).  0812.3602
  * [72] M. Deak, F. Hautmann, H. Jung, and K. Kutak,  JHEP 09, 121 (2009).  0908.0538
  * [73] W. Furmanski and R. Petronzio,  Z. Phys. C 11, 293 (1982)
  * [74] G. Curci, W. Furmanski, and R. Petronzio,  Nucl. Phys. B175, 27 (1980)
  * [75] Y. L. Dokshitzer,  Sov. Phys. JETP 46, 641 (1977).  [Zh. Eksp. Teor. Fiz.73,1216(1977)]
  * [76] G. Altarelli and G. Parisi,  Nucl. Phys. B 126, 298 (1977)
  * [77] V. N. Gribov and L. N. Lipatov,  Sov. J. Nucl. Phys. 15, 438 (1972).  [Yad. Fiz.15,781(1972)]
  * [78] Z. Nagy and D. E. Soper,  Phys. Rev. D 102, 014025 (2020).  2002.04125
  * [79] L. Gellersen, D. Napoletano, S. Prestel,  Monte Carlo studies,  in 11th Les Houches Workshop on Physics at TeV Colliders:Les Houches 2019: Physics at TeV Colliders: Standard Model Working Group Report, p. 131.  2020\.  Also in preprint 2003.01700
  * [80] H. Jung,  Comput. Phys. Commun. 143, 100 (2002).  hep-ph/0109102
  * [81] H. Jung and G. P. Salam,  Eur. Phys. J. C 19, 351 (2001).  hep-ph/0012143
  * [82] S. Platzer and M. Sjodahl,  Eur. Phys. J. Plus 127, 26 (2012).  1108.6180
  * [83] F. Hautmann and H. Jung,  JHEP 10, 113 (2008).  0805.1049
  * [84] F. Hautmann, H. Jung, M. Krämer, P. Mulders, E. Nocera, et al.,  Eur. Phys. J. C 74, 3220 (2014).  1408.3015
  * [85] N. A. Abdulov et al.,  TMDlib2 and TMDplotter: a platform for 3D hadron structure studies.  2103.09741
  * [86] F. Hautmann and H. Jung,  Nuclear Physics B 883, 1 (2014).  1312.7875
  * [87] A. Bermudez Martinez, P. Connor, F. Hautmann, H. Jung, A. Lelek, V. Radescu, and R. Zlebcik,  Phys. Rev. D 99, 074008 (2019).  1804.11152
  * [88] A. Bermudez Martinez et al.,  Eur. Phys. J. C 80, 598 (2020).  2001.06488
  * [89] A. Bermudez Martinez et al.,  Phys. Rev. D100, 074027 (2019).  1906.00919
  * [90] M. Dobbs and J. B. Hansen,  Comput. Phys. Commun. 134, 41 (2001)
  * [91] A. Bermudez Martinez et al.,  Jet merging with TMD parton branching.  To be published, 2021
  * [92] A. Buckley, J. Butterworth, L. Lonnblad, D. Grellscheid, H. Hoeth, J. Monk, H. Schulz, and F. Siegert,  Comput. Phys. Commun. 184, 2803 (2013).  1003.0694.