\chapter{Appendix}% \label{chap:appendix} \section{Sherpa Runcards}% \label{sec:runcards} \subsection{Quark Antiquark Anihilation}% \label{sec:qqggruncard} \yamlfile{../prog/runcards/qqgg/Sherpa.yaml} \subsection{Proton Proton Scattering}% \label{sec:ppruncard} \yamlfile{../prog/runcards/pp/Sherpa.yaml} \subsection{Holistic Proton Proton Scattering}% \label{sec:ppruncardfull} \VerbatimInput{../prog/runcards/pp_phaeno_299_port/runcards/with_pT_and_fragmentation_and_mi/Run.dat} \section{Rivet Analysis Code}% \label{sec:rivetcode} \subsection{Simple Diphoton Analysis}% \label{sec:simpdiphotriv} \cppfile{../prog/analysis/qqgg_simple/MC_DIPHOTON_SIMPLE.cc} \subsection{Proton Proton Scattering Analysis}% \label{sec:ppanalysis} \cppfile{../prog/runcards/pp/qqgg_proton/MC_DIPHOTON_PROTON.cc} \subsection{Holistic Proton Scattering Analysis}% \label{sec:ppanalysisfull} \cppfile{../prog/runcards/pp_phaeno_299_port/qqgg_proton/MC_DIPHOTON_PROTON.cc} \section{Mathematical Notes}% \label{sec:matap} \subsection{Equivalence of Importance Sampling and Change of Variables}% \label{sec:equap} Assume the same prerequisites as in \cref{sec:mcint}. Here the proof is made for two dimensions, higher dimension follow analogous (but with a burden of notation). In truth, a multidimensional integral can always be reduced to a series of one dimensional integrals, but doing the calculation for the two dimensional case is illustrative. Define a variable transformation as in \cref{eq:rfuncsap}, where the inverses are taken with reference to the variables before the semicolon and \(a,b\in [0, 1]\). The inverse can be taken, as \(\rho > 0\) is assumed and so all integrals are monotonic. % \begin{equation} \label{eq:rfuncsap} \begin{split} R_x(x) &= \int_y\int_0^x\rho(x, y) \dd{x}\dd{y} \\ R_y(y; x) &= \frac{\int_0^y\rho(x, y) \dd{x}\dd{y}}{\int_y f(x,y)\dd{y}} \\ \vb{x} &= \mqty(x \\ y) = \mqty(R_x^{-1}(a) \\ R_y^{-1}(b, x(a))) \end{split} \end{equation} % The Jacobian determinant is thus given by \cref{eq:jacap}. \begin{equation} \label{eq:jacap} (\partial_a R_x^{-1}(a))\cdot (\partial_b R_y^{-1}(b; x(a))) = \frac{1}{\int_y\rho(x(a), y)\dd{y}}\cdot \frac{\int_y\rho(x(a), y)\dd{y}}{\rho(x(a), y(a, b))} = \frac{1}{\rho(x(a), y(a, b))} \end{equation} % The integral \cref{eq:baseintegral} becomes \cref{eq:newintap} which is the same as if \(f\) (interpreted as a probability density) was transformed to the variables \(a, b\). % \begin{equation} \label{eq:newintap} \int_\Omega \qty[\frac{f(\vb{x})}{\rho(\vb{x})}] \rho(\vb{x}) \dd{\vb{x}} = \int_0^1\int_0^1 \frac{f(x(a), y(a,b))}{\rho(x(a), y(a, b))} \dd{a}\dd{b} \end{equation} % That means taking sampling points \(\{\vb{x_i}\}\sim \rho\) and weighting samples with \(1/\rho(\vb{x})\) is equivalent to taking uniformly distributed samples of \(f\) in \(a,b\) space with the appropriate transformation. This works, because the transformation law \cref{eq:rfuncsap} uniformly distributed samples into samples distributed like \(\rho\). Given a variable transformation, one can reconstruct a corresponding probability density, by chaining the Jacobian with the inverse of that transformation. \subsection{Compatibility of Histograms} \label{sec:comphist} The compatibility of histograms is tested as described in~\cite{porter2008:te}. The test value is \[T=\sum_{i=1}^k\frac{(u_i-v_i)^2}{u_i+v_i}\] where \(u_i, v_i\) are the number of samples in the \(i\)-th bins of the histograms \(u,v\) and \(k\) is the number of bins. This value is \(\chi^2\) distributed with \(k\) degrees, when the number of samples in the histogram is reasonably high. The mean of this distribution is \(k\) and its standard deviation is \(\sqrt{2k}\). The value \[P = 1 - \int_0^{T}f(x;k)\dd{x}\] states with which probability the \(T\) value would be greater than the obtained one, where \(f\) is the probability density of the \(\chi^2\) distribution. Thus \(P\in [0,1]\) is a measure of confidence for the compatibility of the histograms. %%% Local Variables: %%% mode: latex %%% TeX-master: "../document" %%% End: