%
\subsubsection{\label{subcomphep}{\tt CompHEP}}
%
Let us now discuss in more detail how the package {\tt CompHEP} works.
As already mentioned in Section~\ref{subcompl}, {\tt CompHEP}
essentially consists of two parts: the symbolic and the numerical one.
A flowchart representing the symbolic part is shown in
Fig.~\ref{figcomphep1}.

After choosing the underlying model in {\it menu~1}, one gets to {\it
  menu~2} where the process must be defined and certain diagrams may be
discarded from further considerations with the help of {\it menu 4}.
One may also modify the parameters of the selected model (see {\it
  menu~3}).  {\it menu~5} is concerned with the graphical output and the
algebraic squaring of the matrix elements for the generated diagrams.

In {\it menu~6}, analytical expressions for the squared matrix elements
are computed. They can be stored to disk either in {\tt C}, {\tt
  FORTRAN}, {\tt REDUCE} or {\tt Mathematica} format (see {\it menu~8}).
Instead of applying the helicity-amplitude technique, {\tt CompHEP} uses
the conventional method of squaring the amplitudes before calculating
traces. Whether this is an advantage or a disadvantage depends on the
specific problem under consideration.  For simple processes a built-in
{\it numerical interpreter} (see {\it menu~7}) is available to perform
the phase space integration. For more complicated problems one has to
initiate the actual numerical part of {\tt CompHEP}. It deals with
processes that exceed the capability of the built-in calculator.

%
%
\begin{figure}
  \begin{center}
    \leavevmode
    \epsfxsize=14.cm
    \epsffile{pukhov1.eps}
    \hfill
    \parbox{\captionwidth}{
    \caption[]{\label{figcomphep1}\sloppy
        Menus of the symbolic part of {\tt CompHEP}~\cite{pukhov}.}}
  \end{center}
\end{figure}
%
\begin{figure}
  \begin{center}
{\small
\vbox{
\centerline{
\begin {tabular}{|ll|}
 \multicolumn{2}{c}{\it menu 1}\\ \hline
 Subprocess & IN state\\
 Model parameters & QCD scale\\
 Breit-Wigner & Cuts\\
 Kinematics & Regularization\\
 Vegas & Simpson\\
 Batch & \\
 \hline
\end{tabular}
}
  }
}
\parbox{\captionwidth}{
\caption[]{\label{figcomphep2}Main menu of the numerical part of {\tt
  CompHEP}~\cite{pukhov}.}}
\end{center}
\end{figure}

The main options of the numerical part of {\tt CompHEP} are displayed in
Fig.~\ref{figcomphep2}.  Before starting the computation, the
environment for the Monte Carlo integration (using {\tt VEGAS}) must be
set.  This includes, for example, the modification of model parameters
and the choice of the center-of-mass energy. Furthermore, the user
decides whether structure functions for the incoming particles should be
used or not.  A central point is represented by the item {\it
  Regularization}, where the integration variables, previously defined
in the item {\it Kinematics}, are mapped in such a way that the
integrand becomes a smooth function.  This is one of the main features
of {\tt CompHEP}: The users task is just to provide possible
singularities in the propagators that are close to the edges of the
phase space region; the mappings themselves are done completely
automatically.  Other items are concerned with cuts over energy, angles,
transverse momenta, squared momentum transfers, and invariant masses or
the rapidity for a set of outgoing particles.  Note that all the
numerical calculations may equally well be performed in batch mode which
is useful as soon as the run-time becomes large.

In order to reduce the CPU time, {\tt CompHEP} saves the matrix elements
computed during a {\tt VEGAS} run into a file. This file is short
because it contains only one number for each event.  Later-on, a special
program called {\tt genEvents} repeats the Monte Carlo evaluations,
reading the previously calculated matrix elements from the file instead
of performing a re-calculation. Thus the CPU time is drastically reduced
for this second run, being typically of the order of only a few minutes
as compared to a few hours for the initial run.  Therefore, it is
possible to study the influence of various additional cuts on the
cross-section and to fill histograms rather quickly by performing
several subsequent runs of {\tt genEvents}.  Each working session
produces two output files: one containing the results of the calculation
together with a list of model parameters and a copy of the screen
report, and a second one containing the computed matrix elements.

%Thus, in order to
%reduce the CPU time, in general one performs a sequence of Monte Carlo
%integration sessions. In a first run, for example, no cuts are applied and the
%generated four-momenta together with the computed matrix elements are
%stored to disk. In a second run cuts on some variables are introduced,
%the random-number generator is called with the same parameters as in the
%first run, but now the results that are most time consuming to obtain,
%namely the squared matrix elements, can be taken over from the first
%run. Thus the CPU time is drastically reduced for this second run, being
%typically of the order of only a few minutes as compared to a few hours
%for the first run.  Each working session produces three output files:
%one containing the results of the calculation together with a list of
%model parameters, another one with a copy of the screen report, and a
%third one containing histograms.




