\section[Monte Carlo Generators]{Monte Carlo Generators\footnote{By
Rong-Gang Ping}}
\label{part1:sec:generator}

\subsection{Introduction}
Precision measurements will be a central theme and
challenge for the \bes3 physics research program, and these will 
require high precision Monte Carlo (MC) generators.

High quality and precise MC simulations will be
essential for minimizing experimental systematic
uncertainties.  They are
used to determine detection efficiencies 
and to model backgrounds.  Thus,
the MC generators must simulate the 
underlying processes being studied as precisely as possible. 
Recently, high-precision generators 
({\it e.g.} KKMC, Bhlumi etc.) based on 
Yennie-Frautchi-Suura exponentiation 
have been developed for the QED processes 
$e^+e^-\to ff$ ($f:$ fermion). 
The official ``precision tags'' of these
generators are at the order of 1\% or less.
Generators that incorporate dynamical information into 
hadron decays have also
been developed, most notably EvtGen, which was produced by the 
BaBar and CLEO collaborations to model $B$ meson decays. 
These developments provide us with the luxury of
being able to choose which among the existing
generators is most suitable for simulating physics processes
in the tau-charm threshold  region.

However, most of these generators were originally intended for 
energies above the tau-charm threshold region. In general,
MC generators are  process- and model-dependent.  Only
a few MC generators cover the full energy scale of high energy
physics experiments.   So, at tau-charm threshold energies, the 
migration of the MC generators that were originally developed 
for higher energy scales requires careful tuning of
parameters and further comparisons with data.  
In addition, the comprehensive
generation of exclusive charmonium decays
requires that more models are included
in the EvtGen framework.

In this section, we present a general description of the \bes3
generator framework, and give brief introductions to the \bes3 event
generators, such as KKMC, BesEvtGen, various QED generators, and 
some inclusive generators. For details, the reader is directed to
to the generator guides and/or related publications.

\subsection{Generator framework}

The default generator framework for \bes3 uses {\bf KKMC +
BesEvtGen} to generate charmonium decays. Charmonium production
via  $e^+e^-$ annihilation is illustrated 
in Fig.~\ref{part1:fig:fw}.
The incoming positrons and electrons can radiate real photons
via initial state radiation (ISR) before they annihilate into a 
virtual photon.  Corrections for these radiative processes 
are crucial in $e^+e^-$ annihilation experiments, especially
for measurements performed  near a  
resonance or a production threshold (see chapter 5). In order
to achieve precise results, generators for
$e^+e^-$ collision must carefully take ISR into account. 
The KKMC generator is used to simulate  $c \bar{c}$ production 
via $e^+e^-$ annihilation with the inclusion of ISR effects 
with high  precision; it also includes the effects of the beam
energy spread. The subsequent charmonium 
meson decays are generated with BesEvtGen.

%---------------------------------------------------
\begin{figure}[htbp]

\begin{center}
\hspace*{-.cm} \epsfysize=6cm \epsffile{./Part1/figures/fig1.eps}
\parbox{1\textwidth}{\caption{Illustration of \bes3 generator framework.
\label{part1:fig:fw}}}
\end{center}
\end{figure}
%===================================================
It should be noted that the events are generated in the
centre-mass-system (cms) of the $e^+e^-$ beam. 
However,  the $e^+e^-$ beams at BEPCII
are not aligned exactly back to back; there is a crossing angle
between the two beam of about 22~mrad. Thus, the produced charmonium
state is not at rest and instead moves along the 
$x-$direction with a small
momentum. As a result, the generated events have to be boosted to the 
laboratory system before proceding through the detector simulation. 
This boost is implemented outside of the generator framework.

\subsection{\bes3 Generators}
Early generators used at \bes3 were those used for BESII, which
includes about 30 generators.  These are now obsolete and we do
not recommend their use.\footnote{Currently, the truth tables of these
generators are not available in the simulation} In what follows, we
focus on the generators currently used in the \bes3 generator
framework.
\subsubsection{KKMC}
KKMC~\cite{part1:kkmc} is an event generator for the precise
implementation of the Electroweak Standard Model 
formulae for the processes $e^+e^-\to f\bar f+n\gamma$ 
($f=\mu,~\tau,~d,~u,~s,~c,~b$) at 
centre-of-mass energies from the $\tau^+\tau^-$ 
threshold up to 1~TeV. KKMC was originally designed
for LEP, SLC, and is also suitable for future Linear Colliders,
$b,~c,~\tau-$ factories etc.

The most important features of KKMC are: the
implementation of ISR-FSR\footnote{FSR stands for final state radiation.}
interference;
second-order subleading corrections; and the exact matrix
element for two hard photons. Effects due to photon emission
from initial beams and outgoing fermions are calculated in QED up to
second order, including all interference effects, within 
the Coherent Exclusive Exponentiation (CEEX) scheme that is based on
Yennie-Frautschi-Suura exponentiation. Electroweak corrections are
included at first order with higher-order extensions using the
DIZET 6.21 library. Final-state quarks hadronize according to the
parton shower model using PYTHIA. Decays of the $\tau$ lepton are
simulated using the TAUOLA library, which takes spin
polarization effects into account.  The code and information on 
the program are available at
the KKMC web page~\cite{part1:webkkmc}.

In the \bes3 generator framework, KKMC is used to generate
charmonium states with the inclusion of ISR effects and the beam
energy spread. The resonances supported by KKMC include the
$J/\psi,~\psi(2S),~\psi(3770),~\psi(4030),~\psi(4160),~\psi(4415)$ and
secondary resonances, such as the 
$\rho,~\rho',~\rho'',~\omega,~\omega',~\phi$
and $\phi'$. Although KKMC supports the simulation of the decay of
these particles, the models in BesEvtGen are more powerful;
FSR effects can be included at the BesEvtGen level by
means of the PHOTOS package.

\subsubsection{BesEvtGen}
BesEvtGen~\cite{part1:besevtgen} is a generator for tau-charm physics
that has been developed from EvtGen,\footnote{The version is
V00-11-07} which was originally designed to study $B$ physics. 
EvtGen has a powerful interface that allows for the generation of
events for a given decay using a model that is easily created by
the user; it also provides access to other generators, such as PYTHIA
and PHOTOS.

The EvtGen interface uses  dynamical information to generate a
sequential decay chain through an accept-reject algorithm,
which is based on the amplitude probability combined with
forward and/or backward spin-density matrix information. The
EvtGen interface is designed to have the functionality to automatically
calculate these spin-density matrices. As an illustration of how the event
selection algorithm works, we consider the sequential decay
$J/\psi\to\rho^0\pi^0,~\rho^0\to \pi^+\pi^-$ and $\pi^0\to
\gamma\gamma$.

The first chain of the decay is selected based on the probability
\begin{equation}
P_\psi=\sum_{\lambda_\psi,\lambda_\rho}|M^{J/\psi\to\rho^0\pi^0}_{\lambda_\psi,\lambda_\rho}|^2,
\end{equation}
where $M$ stands for the amplitude for $J/\psi\to\rho^0\pi^0$ with the
helicity indexes $\lambda_\psi$ and $\lambda_\rho$. After decaying
the $J/\psi$, one has the forward spin-density matrix
\begin{equation}
{\mathcal
D}^{\rho^0}_{\lambda_\rho,\lambda_\rho'}=\sum_{\lambda_\psi}
M^{J/\psi\to\rho^0\pi^0}_{\lambda_\psi,\lambda_\rho}
[M^{J/\psi\to\rho^0\pi^0}_{\lambda_\psi,\lambda_\rho'}]^*.
\end{equation}
To generate the $\rho^0\to\pi^+\pi^-$ decay, proceed as with the
$J/\psi$, including also ${\mathcal
D}^{\rho^0}_{\lambda_\rho,\lambda_\rho'}$
\begin{equation}
P_\rho={1\over \textrm{Tr}{\mathcal
D}^{\rho^0}}\sum_{\lambda_\rho,\lambda_\rho'}{\mathcal
D}^{\rho^0}_{\lambda_\rho,\lambda_\rho'}A^{\rho^0\to\pi^+\pi^-}_{\lambda_\rho}[A^{\rho^0\to\pi^+\pi^-}_{\lambda_\rho'}]^*.
\end{equation}
To decay the $\pi^0$ with the full correlations between all
kinematic variables in the decay, the EvtGen interface automatically
calculates the backward spin-density matrix by
\begin{equation}
\tilde{\mathcal
D}^{\rho^0}_{\lambda_\rho,\lambda_\rho'}=A^{\rho^0\to\pi^+\pi^-}_{\lambda_\rho}[A^{\rho^0\to\pi^+\pi^-}_{\lambda_\rho'}]^*,
\end{equation}
then the spin-density matrix for the $\pi^0$ is
\begin{equation}
{\mathcal
D}^{\pi^0}=\sum_{\lambda_\psi,\lambda_\rho,\lambda_\rho'}\tilde{\mathcal
D}^{\rho^0}_{\lambda_\rho,\lambda_\rho'}M^{J/\psi\to\rho^0\pi^0}_{\lambda_\psi,\lambda_\rho}
[M^{J/\psi\to\rho^0\pi^0}_{\lambda_\psi,\lambda_\rho'}]^*,
\end{equation}
which is a constant for a spin-0 particle. Thus the $\pi^0$ decay is
selected by the probability
\begin{equation}
P_{\pi^0}={1\over \textrm{Tr}{\mathcal
D}^{\pi^0}}\sum_{\lambda_1,\lambda_2}{\mathcal
D}^{\pi^0}A^{\pi^0\to\gamma\gamma}_{{\lambda_1},\lambda_2}[A^{\pi^0\to\gamma\gamma}_{{\lambda_1},\lambda_2}]^*=
\sum_{\lambda_1,\lambda_2}A^{\pi^0\to\gamma\gamma}_{{\lambda_1},\lambda_2}[A^{\pi^0\to\gamma\gamma}_{{\lambda_1},\lambda_2}]^*.
\end{equation}

BesEvtGen incorporates baryons up to spin=3/2, and has about 30
models for simulating exclusive decays. The
amplitudes for these models are constructed using the helicity
amplitude method, and constrained by imposing parity
conservation. One of the most powerful models is DIY, which can
generate any decays using user-provided amplitudes.
Other useful models are those that generate decays using the
histogram distributions, such as MassH1, MassH2 and 
Body3.\footnote{These correspond to generating events 
according to a 1-D diagram, a Dalitz plot 
or the generation of 3-body decays according to a Dalitz plot plus two
angular distribution plots.} 
BesEvtGen provides access to the
PYTHIA and Lundcharm inclusive generators that can be used,
for example, to generate unknown decays of a given resonance.

\subsubsection{QED generators}

\begin{itemize}
\item Bhlumi and Bhwide

The generators Bhlumi~\cite{part1:bhlumi} and Bhwide ~\cite{part1:bhwide} 
are used to generate the Bhabha scattering process 
$e^+e^-\to e^+e^- + n\gamma$.
These are full energy scale generators even though
they were  originally designed for the high energy
LEP1/SLC and LEP2  colliders.  The Bhlumi generator is
suitable for generating  low angle Bhabha events
($\theta<6^\circ$), while the Bhwide generator is
intended  for wide angle
Bhabha events ($\theta>6^\circ$). Here ``suitable" means that
when these generators work within their suitable region,
they will achieve the tagged precision level; outside of that 
region their precision  will be poorer.
The precision of  Bhlumi is quoted as $0.11\%$ at the LEP1 energy
scale and 0.25\% for LEP2 experiments.  These estimates are based on
comparison with other MC calculations~\cite{part1:bhlumi}. 
The precision of the Bhwide is quoted as 0.3\% at the $Z$ boson peak and 
1.5\% at LEP2 energies.


 Bhlumi
is a multiphoton Monte Carlo event generator for low angle
($\theta<6^\circ$) Bhabha events that
provides four-momentum vectors  of the outgoing
electron, positron and photons. The first
${\mathcal{O}}(\alpha^1)_{YFS}$ version is described in
Ref.~\cite{part1:jadach}. The matrix elements are based on
Yennie-Frautschi-Suura (YFS) exponentiation. They include
exact first-order photonic corrections and leading-log
corrections at second order.  The other higher-order and 
subleading contributions are included in an approximate form.

Bhwide is a wide angle ($\theta>6^\circ$) generator for Bhabha
scattering. The theoretical formulation is based on
${\mathcal{O}}(\alpha)$ YFS exponentiation, with
${\mathcal{O}}(\alpha)$ virtual corrections from 
Ref.~\cite{part1:corr1}.
The YFS exponentiation is realized via Monte Carlo methods based on
a Bhlumi-type Monte-Carlo algorithm, but with some important
extensions: (1) QED interference between the electron and positron
lines are reintroduced as they are important for large
angle Bhabha scattering; (2) the full YFS form factor for the
$2\to2$ process, including all $s-,~t-$ and $u-$channels is
implemented; (3) the exact ${\mathcal{O}}(\alpha)$ matrix element
for the full Bhabha process is included.

Users of these generators are required to specify the
centre-mass-system energy, as well as other cuts on the electrons,
hard photons and soft photons in their job option file. 
Precisions are not given by authors for tau-charm 
energies,  but they are
the most precise generators we have for Bhabha processes.
\item Babayaga~\cite{part1:babayaga} is a 
Monte Carlo event generator for
$e^+e^-\to e^+e^-,~\mu^+\mu^-,~\gamma\gamma$ and $\pi^+\pi^-$ processes 
for energies below 12 GeV. It has a high-precision 
QED calculation of the Bahbha process and is intended 
for precise luminosity determinations for $e^+e^-$ 
$R$ measurements in the the hadronic resonance region. The
calculation is based on the matching of exact next-to-leading order
corrections with a parton shower algorithm. The accuracy of the
approach is demonstrated by a comparison with existing independent
calculations and through a detailed analysis of the main components
of theoretical uncertainty, including two-loop corrections, hadronic
vacuum polarization and light pair contributions. The theoretical
accuracy of Babayaga is quoted as 0.1\%~\cite{part1:bbyaversion}. The
current version of BABAYAGA used at \bes3 is 
V3.5~\cite{part1:bbyaversion}.

To use the Babayaga generator, the user is required to specify the
cms energy of the $e^+e^-$ system, together with the cuts on the
electron, positron and photons.
\end{itemize}

\subsubsection{Inclusive generators}
The PYTHIA programs are commonly used inclusive event generators
for high-energy  $e^+e^-,~pp$ and $ep$ collisions.
Historically, the family of event generators from the Lund group
started with JETSET in 1978; the PYTHIA program followed a few years
later. The version currently available is PYTHIA 6.4. The code and
further information can be found on the Pythia web 
page~\cite{part1:pythia}.


The Lundcharm model was especially adjusted by BESII
for simulating  $J/\psi$ and $\psi(2S)$ inclusive 
decays. $C-$ and $G-$parity constraints were imposed and comparisons
with experimental data were performed~\cite{part1:cjc}.  As
a result, \bes3  officially decided to
use this modified Lundcharm model to generate $J/\psi$ and
$\psi(2S)$ inclusive decays in the BesEvtGen framework.

An advantage of generating inclusive MC events
with Lundcharm running in the EvtGen 
framework is that the decay widths in the Lundcharm model 
can be controlled by the user. Thus, branching fractions and models for
known decays can be specified in the EvtGen decay dictionary, 
while unknown decays are generated with the Lundcharm model. 
When the Lundcharm model is called, a complete decay chain is 
generated, but only the first step of the $J/\psi$ or $\psi(2S)$ 
decay is read out and returned to the EvtGen interface. This 
interface has the 
functionality to check whether that particular decay is included 
among the EvtGen exclusive decay models. Only decays not included in 
the exclusive decay models are allowed to proceed; the decays of 
subsequent daughter
particles proceed via EvtGen Models.

EvtGen also allows access to the PYTHIA model to generate the
QED inclusive decays with the model "PYCONT".  At tau-charm energies,
the area law of the Lundcharm model should be implemented to
constrain the decays, however this has not yet been done in 
BesEvtGen.


\subsection{Summary and outlook}
We present a general description on the generator framework and
the event generators currently used at \bes3, which include KKMC,
BesEvtGen, Bhlumi, Bhwide, Babayaga and inclusive generators.
A cosmic ray generator, CORSIKA~\cite{part1:corsika}, is being
migrated.  Though some event generators for QED processes, such as
$ e^+e^- \to \mu^+\mu^-$ and $\tau^+\tau^-$ in KKMC, and
$e^+e^- \to\gamma\gamma,~\mu^+\mu^-$ and $\pi^+\pi^-$ in Babayaga, are
available, they still don't satisfy the \bes3 requirements for 
hadronic cross-section measurements. The migration of other 
generators is necessary, for example, MCGPJ ($\pi^+\pi^-,~K^+K^-$ 
and  $K^0_SK^0_L$ are available) and PHOKHARA
($\pi^+\pi^-,~\pi^+\pi^-\pi^0,~\pi^+\pi^-\pi^+\pi^-,~K^+K^-,~K^0_SK^0_L,~p\bar
p,~n\bar n$ and $\Lambda\bar \Lambda$ are available) with precision
levels of $(0.1\sim 0.2)\%$.

%%%%%%%%%%%%% end table
