## 4 Discussion

Table 3: RMS distances between dose distributions in a water phantom for different open field sizes. The first three groups of columns correspond to lateral profiles for different field sizes and the last two columns correspond to the depth profile of the 30 cm \(\times\) 30 cm field. Values are given as percentage of the maximum dose in the profile calculated from PRIMO-generated phase space. The ’mean’ and ’std’ rows contain, respectively, the mean and standard deviation of values in their respective columns. The last row contains the \(p\)-value of the Wilcoxon signed-rank test for equality of mean values of RMS for CGAN and RoCGAN models. The universality of the conditional GANs was achieved at the cost of handling a large volume of training data--almost 570 MC phase spaces, each containing some \(10^{7}\) particles, were generated. This resulted in some \(0.5\,\mathrm{TB}\) of data collected. Such a massive simulation campaign could not be completed without the grid infrastructure of our University. As mentioned in the Introduction, we decided not to use variance reduction techniques when preparing the training data for conditional GANs. This decision was made after a comprehensive series of experiments aimed at reproducing the results of [8] based on phase spaces generated with variance reduction techniques. Because these experiments were not successful, we decided to collect MC training data with variance reduction switched off. After the successful reproduction of the results of [PERSON], [PERSON], and [PERSON] [8] with such data, we were able to extend their work to the application of conditional GANs. Arguably, one could try to retrieve discrete weights that are assigned to phase space particles when using variance reduction, from continuous outputs of GANs--this is how the classification task is solved with deep models. However, the outputs of classification networks can be interpreted as probabilities, which guide the assignment of discrete classes to classified objects, based on continuous outputs. This is not the case for phase spaces, which is another argument not to use variance reduction when preparing training data for our GAN models. The same arguments concerning the continuity of the learnt probability distributions led us to remove annihilation photons from the training data. The absence of these photons in GAN-generated phase spaces is clearly visible in Figure 2. Of course, one may train some regression model to predict how the fraction of annihilation photons in phase spaces depends on the parameters of the electron beam. One may also fit the probability density functions of the parameters of these photons (except their energy, which is fixed). The results of this study demonstrate, however, that the absence of annihilation photons in GAN-generated phase spaces does not affect the dose distributions in either phantoms or patients. Note that in the description of the architectures used in this study, some values of hyperparameters were mentioned, such as the number of neurons in dense layers, equal to 400, or the dimensionality of the noise vector at the input of the generator, equal to 8. These parameters were reported in the study of [PERSON], [PERSON], and [PERSON] [8] as being optimal for the task of photon generation and, for this reason, were also used in our study. Because the models described in this study are extensions of their model, the optimal hyperparameters of our model may differ from the optimal hyperparameters reported for their GAN model. The results found for the hyperparameters that they suggested [8] are, however, sufficient to justify our decision not to search for any better hyperparameters. The model that we propose is more general than other approaches to fast and efficient phase space generation. For example, [PERSON] et al. [27], in their GPU-based approach, assume rotational symmetry of their phase space--which need not apply in the case that we consider.