
The scheme of menus  for the symbolic calculation session 
is presented  in Fig.\ref{s_chain}. 


\subsubsection{Choice of  the model and work with it} 

\paragraph{ Menu 1. } 

This menu  contains a list of available models.  
It offers you  an option to select a model  of 
elementary particle interaction for  subsequent work. 

There are four  models built in \CompHEP:
quantum electrodynamics, the model of electroweak four-fermion
interaction, and two versions  of the Standard Model. 
  The QED model is included  as an example of realization of the simplest 
particle interaction scheme in \CompHEP. The 
four-fermion interaction  model gives an example of realization of the 
four-fermion interaction in the  \CompHEP~ notations. 
The Standard Model
is presented in two gauges: the unitary  one and the t'Hooft-Feynman one.
  We recommend  to choose the latter 
for  calculations because the ultra-violet cancellations
between diagrams caused by  gauge invariance 
are  absent in this case.  See the discussion in   Section \ref{squaring}.
The Standard Model in the unitary gauge  is used for verification 
of  gauge invariance. 
 
 The bottom  menu function  provides you with  a possibility to 
include a new model into the \CompHEP~ list.
New model is created as a copy of one of existing
models.  On the next menu level you can change this copy.
 If you  choose  the "New Model" menu function  you will  be prompted 
for  a new model name  and   a template source.  \CompHEP~
adds the underscore symbol '\_' in front of the  name of new model.
It serves to distinguish  user's models   from the built-in 
ones.  
To choose a template the list of  existing models appears.  




\paragraph{  Menu 2.}

 The first function of this menu lets you  enter the physical process which 
you  wish to deal with. A format of process specification 
is explained below. You can also use the context help facility pressing
the {\it F1} key on any  step of the input.

  Before entering a process you  may  also edit the model
contents by means of  the {\it Edit Model} menu.
Later on you will be able only to browse  the
model contents (by  pressing {\it F3}), but not to
change it. 

If the currently used model is a user-created one,
the menu function {\it Delete model}  removes this model and 
\CompHEP~ returns to {\it Menu~1}.
In the  case of a built-in model   {\it Delete model} 
restores the default version of  model instead. Before the deletion 
or restoration the corresponding
warning appears and you can cancel the operation. 

\paragraph{ Menu 3.}

 Information about a model is  stored in four tables.  
Generally they are text files 
which are  disposed in  user's {\it models}
directory  and may be corrected by an ordinary text editor. 
But we strongly recommend to use \CompHEP~ facilities to edit these files
because in this case \CompHEP~ can control possible mistakes 
of the user input.

  \CompHEP~  displays  a menu of model tables. 
By choosing a position of this menu 
 you can   edit the corresponding  part of the model.  

The {\it Parameters}, {\it Constraints}, {\it Particles} and 
 {\it Vertices}  menu   functions let you browse  and edit
correspondingly:

1.  independent parameters of the chosen model;

2.  parameters depending on the basic ones;

3.  list of particles and their properties;

4.  vertices of interaction.


See  Section \ref{models} for the format of these tables 
and  also  Section \ref{X11interface}  for  the 
explanation of  facilities of the table editor.

\CompHEP~  verifies  the  model when  you try to leave this menu 
after some changes made in one of the tables.
If some error is detected the corresponding  message appears  
and no exit from the menu occurs.
This message  contains the diagnostics, the table name,  and  the
number of line where the error has been detected. You can  recall this
message later on within  the table editor by pressing  the {\it Ctrl E} key.

The check stops  when   the first  error is detected.
You can fix the error and  try to leave the {\it Edit Model} menu
once more.

 When you enter the {\it Edit~Model} menu  the  current  version of the  
model  is saved  and you have a possibility  to return to this version 
forgetting  your corrections. Just answer   {\it N}  the
question \\
\begin{center}
\begin{tabular}{|c|}
\hline
    Save correction ? \\ Y/N? \\
\hline 
\end{tabular}
\end{center}
which appears every time when you try to leave this menu after 
 correcting the model.      

  There is a sequence of   points which are being checked:
\begin{itemize}
\item  correctness of identifiers and numbers;
\item  declaration of an identifier before its use in the 
expression;
\item  declaration of a particle  before its use  in the  
vertex;
\item  correctness of algebraic expressions;
\item  compatibility of Lorentz indices;
\item  existence of the conjugated vertex.
\end{itemize}

See Section \ref{models} for a full list of requirements on the model.
 

\subsubsection{Input of the process}

 After  activating   the  {\it Enter process}  function of {\it Menu~3}
the list of particles together with their   
notation conventions is displayed. The notation of  anti-particle is shown in
     parentheses after  that of particle. In the 
    case of  the Standard Model  the corresponding screen is 
shown in  Fig.\ref{screen_ent}.
 If the list is too long one may use the \PgUp~ and \PgDn~ buttons
to scroll it.
           

In the bottom part of the screen the prompt '{\it Enter process:}' appears.
      The  syntax for the input is: \\
\hspace*{2cm} {\tt P1[,P2] \verb|->|  P3,P4 [,...,[N*x]]} 

These  'P1'..'P4'  are  particle names, {\it N} is a  number of inclusive 
particles. The sets of {\it in}- and 
 {\it out}-particles are separated by the  arrow \verb|'->'| formed of two 
printing symbols. The
particles inside of each set are separated by commas.
The total number of particles should not exceed 6. 

  For example,  the input  $u,U $ \verb|->| $ G,G$ 
     denotes the process of annihilation of the $u$-quark and $\bar{u}$-quark 
     into two gluons. 

     One can also construct inclusive processes. For example, the input\\
\hspace*{2cm} {\tt         u,U \verb|->| G,G,2*x }\\
     is a request to construct all processes of 
        annihilation of the $u$-quark and $\bar{u}$-quark
     into two gluons accompanied by  two arbitrary particles. 

         If the program finds an unknown name  among the
     in-particles it will try to  consider it  as a name of composite 
     particle  and will ask you  about its parton contents. For
     instance, after the input\\
\hspace*{2cm} {\tt            e,p \verb|->| 3*x } \\
      the question appears:\\
     \hspace*{2cm}  {\tt  Is 'p' a composite  particle Y/N  ? } \\
     If you choose {\it 'Y'} you  will be prompted to specify the parton
     structure of  {\it 'p'}.  A possible input is\\  
      \hspace*{2cm}{\tt      'p' consists of: $ u,U,d,D,G $ }

     If one  enters a collision process,  the information on 
     total energy of colliding particles in the  center-of-mass system 
     is demanded:\\
     \hspace*{2cm} {\tt  Enter Sqrt(S) in GeV: {\it 300 } }

 
     \CompHEP~ generates only those channels  where 
the total mass of incoming particles and the total mass of
outgoing particles are smaller than  {\it Sqrt(S)}. 
  
     On the next step of input you are prompted  to exclude
diagrams with  specified virtual particles. 
The input should be\\
    \hspace*{2cm}{\tt Exclude diagrams with : $ P1>n1$ [$,P2>n2$ ...] }\\
where $P1,P2,...$ are particle names, $n1,n2,..$ are the quantity  limits.
Such an input means that diagrams where the number of virtual particles 
$P_i$ is more than   $n_i$ will not be constructed. For example:\\
  \hspace*{2cm}{\tt  Exclude diagrams with : $ W+>1 $ }\\
means that  only those diagrams  will be generated  which contain
less than two virtual W-bosons.

 Several restrictions separated by commas are allowed. If one 
has a restriction for a particle, the restriction for the corresponding 
anti-particle is not needed. If one would like to forbid the appearance of
some virtual particle $P$ at all, the input "$P>0$" may be 
shortened to  the "$P$".

This option may be  used to exclude diagrams which
are suppressed due to a large virtual  particle mass, or a small coupling
constant, or for  some other reasons.   Use the empty input to get a
full set of diagrams.

Use the \Esc~ key to return to the previous level of input and
the {\it F1} key to get the online help.

After the  input is completed \CompHEP~  starts the Feynman  diagram
generation. If the number of generated diagrams 
is zero  the corresponding warning appears and you  return 
to the beginning of process input, otherwise  the next menu appears. 


\subsubsection{Squaring of diagrams and symbolic calculation}
\paragraph { Menu 5.}

This menu appears on the  screen just after  construction of   
Feynman  diagrams and together with the  information about numbers of diagrams and 
subprocesses generated.

The first function of this menu ({\it Squaring})  is the instruction
for \CompHEP~ to create squared diagrams. \CompHEP~ uses the  squared diagram
technique  for evaluation of squared matrix  elements. See Section
\ref{squaring} for details.

The  {\it View diagrams}  function gives you a tool 
to view a graphic  representation  of  generated  Feynman diagrams,
to  remove some  diagrams before the squaring and to create 
the \LaTeX~ output for undeleted diagrams. 

If a few   subprocesses have been  generated then the subprocess menu  appears
after an activation of the {\it View diagrams}  menu function. There is a
possibility  to remove all diagrams in the  highlighted subprocess by
pressing the {\it F7} button. In its turn  the {\it F8} key  restores all
diagrams of  the highlighted subprocess deleted before. 

When you  choose a subprocess the diagram graphic viewer is 
launched. See  Section \ref{X11interface} for details
or use the $F1$ and   $F2$
functional keys for online help.

Here we would like to note some peculiarities  of constructed diagrams.
\begin{itemize}
\item Incoming particles are drawn on the left side of diagrams,
whereas the outgoing ones are shown on the right. 
\item  Particles with  spins $ 0,\,\frac{1}{2}\,,1 $ are represented
by the dotted, solid, and dashed line correspondingly.
\item Charged particles are  represented by arrow lines. 
The  arrow indicates  the direction of particle (not anti-particle)
propagation.
\item  Incoming and outgoing particles are labeled by 
relevant names in the end of the line. Virtual particles are labeled
by their names at the mid-line. If a particle is not self-conjugated,
the particle's name is used for the labeling (not the anti-particle's one).   
\item In the case of collision process a first colliding particle is
disposed in the top part of picture, whereas the second one is drawn 
in the bottom part.  
\item \CompHEP~ produces only one representative of a  set of diagrams 
which  can be transformed one to another by replacing  the identical
outgoing particles.  For example, \CompHEP~ creates only one diagram for 
the $e1,E1$~\verb|->|~$A,A$  process, whereas all textbooks present two diagrams
in this case. In other words, momenta are not assigned to the outgoing 
particles  on the step of diagrams generation.

\item \CompHEP~ does not generate  diagrams   with  Faddeev-Popov and
Goldstone  ghosts\footnote{In the following text we use  {\it Goldstone  ghost}
instead of commonly used {\it Goldstone boson}. For our convenience we 
name both of these two kinds of fields and the auxiliary tensor field as 
{\it ghosts}.}. Such diagrams are restored on the step of 
squared  diagram evaluation. Any ghost has a real particle as a prototype
(see Section  \ref{ghostFields}). As a rule, a diagram with ghosts has got
the  parent diagram where ghosts are replaced by real particles. 
During the 
calculation of these parent diagrams the  contributions of the corresponding
ghost diagrams  are also  calculated and added to the contribution of the  parent 
one (see Section \ref{squaring}). There exist some exceptions 
from this rule. For example, the 
Standard Model contains the vertex with four Goldstone bosons associated 
with the $Z$-boson, however the $Z^4$ vertex is absent in the theory. 
  To provide a possibility to take into account the ghost diagrams with a
four-Goldstone  vertex \CompHEP~ generates  false diagrams with $Z^4$
interaction.



\item Vertices with a complicated color structure, for example, 
the four-gluon one, are implemented  by means of  unphysical tensor  field.
This field is treated by \CompHEP~ as a special gluon  ghost  and
does not appear in the constructed diagrams. 
A contribution of the four-gluon vertex is restored when
squared diagrams are  evaluated, in the same manner as the contribution of
Faddeev-Popov and Goldstone  ghosts.   
See Sections \ref{ghostFields}, \ref{lagrangian}, \ref{examples} for  further 
explanations.   

\end{itemize} 
 


\paragraph{ Menu  6.} \label{sq_diagrams_menu}

The {\it View squared diagrams}   function is similar to 
the {\it View diagram} one of the previous menu
but is applied to the set of squared diagrams. 
Each squared diagram is a graphic representation 
of  $A B^{*}$ 
contribution in   the  squared matrix element,
where $A$ and $B$ are some amplitudes corresponding to 
Feynman diagrams. 

Let us summarize   some features  of \CompHEP~ squared diagrams 
generation:
\begin{itemize}  

\item   \CompHEP~ never constructs both   
$A  B^{*}$ and   $B  A^{*}$ diagrams  but only one of them.
Instead, for simplicity,  \CompHEP~ calculates $2*Re(A  B^{*})$
on the symbolic and numerical levels. 

\item  \CompHEP~  constructs only one representative  of a set of
diagrams which can be transformed one to another by permutation of 
identical outgoing particles. The needed symmetrization  for 
such particles is performed later on,  at the step of
numerical or symbolic summation.

\item  Each \CompHEP~ diagram represents a set of squared 
diagrams where some physical particles are replaced by their  ghosts
in all possible ways according to the  existing vertices of the  model.
To see the ghost  squared diagrams for each displayed one 
just  press  the {\it 'G'} key.
\end{itemize} 

If you   browse the squared diagrams after usage of the 
 {\it Symbolic calculation}  function  you  will see that each of 
the squared diagrams is marked by one of the following  labels 
 {\it CALC, ZERO, Out of memory, Del}. They mean that the
diagram has been  successfully calculated; gives a zero contribution;
cannot be calculated; or has been  deleted,  correspondingly.


The {\it Symbolic calculation}  function starts symbolic 
evaluation of the generated  squared diagrams. This  evaluation
is performed by the built-in symbolic calculator created
specially in the framework of the  \CompHEP~ project.
  

During the calculation the information about a number of 
calculated diagrams and about a step of evaluation of the current
diagram is shown.

The {\it Reduce program}  function creates  a code of  symbolic 
evaluation in the format of 
\REDUCE~ language \cite{REDUCE} separately  for each squared diagram. 
These codes  are not used for the further \CompHEP~ processing, but 
they can be useful for  cross-checking  the  \CompHEP~ software.
On  one hand, one  can  investigate the  \REDUCE~ code to get
conviction that it correctly calculates a contribution of the 
squared diagram. 
On the  other hand, you may compare the  result of the \REDUCE~ evaluation of
diagram code with the result of built-in symbolic calculator. 
There are some tools created for this purpose. See Section \ref{symb-calc-check}
for details.

General purpose of a package like \CompHEP~ is to create the
corresponding \C~ or \FORTRAN~ source code for  further numerical 
processing and compile  this code  using the corresponding 
system facilities. User's control is not necessary  for this  step as well as
for  the step of symbolic calculations. 
\CompHEP~ provides the user with a possibility to perform the above steps 
in a non-interactive mode. To start the non-interactive session  one could activate 
the {\it Make~n\_comphep\_c} or {\it Make~n\_comphep\_f}
menu function. Then  the current interactive session ends and a
new  batch process starts. See  Section 
\ref{blind} for details of the non-interactive  calculations in \CompHEP. 

As the outcome, the executable file {\it n\_comphep\_c} or {\it n\_comphep\_f}
is created for the further numerical precessing. You may find it in the 
{\it results} directory. For the time of batch
calculation the {\it LOCK} file appears in the user working 
directory to prevent a double start of the \CompHEP~ package within the same 
place of the file system.

 As a rule the  System Administrator  requires to start a  large job
in a special batch regime. The execution of  one of the {\it Make n\_comphep\_\* } 
functions  may require large computer resources for some processes
with large number of diagrams. In this case you could correct your
{\it comphep}   command file according to the System Administrator rules.
The corresponding  calls are disposed after labels 24) and 25) in this 
file.


\subsubsection{Output of results and launching of the numerical calculation} 

\paragraph{ Menu  7.} 
The  {\it View~squared~diagrams}  function is identical to 
the  same  function of the previous menu. Following  a logic  of the
program you can  reach this menu only if all squared diagrams are 
marked either as deleted or as calculated. If you undelete some
diagrams  then you will be returned to the previous menu.
 
The {\it Write~results} function lets  you   save the
results of symbolic calculation in terms of one of computer languages 
for further numerical or symbolic evaluation. See  {\it Menu~8}  for details.
 The files are saved in the user's {\it results} sub-directory.

The next three menu functions   realize  numerical calculations 
in  \CompHEP, particularly Monte Carlo sessions. The  first one calls the built-in numerical
interpreter of the  obtained symbolic expression. This program has 
almost the same possibilities as the numerical code produced by the
$C$-compiler, but works slower than the compiled option.

The menu function {\it C-compiler}/{\it Fortran~ compiler}
calls the corresponding compiler to create and launch an executable file 
{\it n\_comphep\_c}/{\it n\_comphep\_f } in the directory {\it results}.
It is assumed that the corresponding source code was created earlier
using the {\it Write results} menu function.



\paragraph { Menu 8.}

This menu provides the user a possibility to save the obtained 
symbolic results in different formats. The \REDUCE~  and \MATHEMATICA~ 
%and \FORM~ 
outputs may be used for further symbolic manipulation. 
For example, you can get  symbolic representation of a
  sum of all diagrams, perform some substitutions or  
expansions, evaluate the symbolic expression  for the total
cross-section or width  of the process. As a rule such manipulations are
possible and reasonable for the processes with a small number of final particles.
The structure of the symbolic output and  some programs for manipulation 
with the  \REDUCE~ output are described  in  Section \ref{output}. 


  Otherwise the \C~ and \FORTRAN~ outputs are used  to get numerical results.
They may be compiled and linked with the library  of  
\CompHEP~ routines for phase space integration.
 The produced executable program allows one to obtain numerical values of the
total cross-section or width, distributions and an event flow, taking into
account a variety of cuts.
 In order to  create an executable file  for numerical
calculations based on the \C/\FORTRAN~ output  
use  functions of  {\it Menu~6} or 
launch the {\it \$COMPHEP/make\_\_n\_comphep} program as it has been explained 
in Section \ref{file-commands}.

\subsubsection{Non-interactive session} \label{blind}

   \CompHEP~ was created as a program for calculation in the interactive
regime. But in practice  long-time calculations are typical. Due to this 
circumstance we have implemented the batch (or, say, `blind') calculation 
mode into \CompHEP.

If one launches  {\it s\_comphep} with an option "-blind", e.g.\\
\hspace*{2cm} {\tt   \$COMPHEP/s\_comphep -blind STRING }\\
then \CompHEP~ does not open the X11 window and  reads  the control characters 
from  {\it STRING}.
For imitating functional keys the following control characters are
defined:\\
\hspace*{2cm} '\{':  Escape key\\
\hspace*{2cm} ']':   Right Arrow\\ 
\hspace*{2cm} '[':   Left Arrow key\\
\hspace*{2cm} '\}':  Enter key

%These characters work in the same manner during the interactive session 
%too: for instance, you may always push '\}' instead of the  \Enter~ key.

  So, the user has a possibility to concatenate into  {\it STRING}
a  list of commands  which simulate the keyboard and execute 
{\it s\_comphep} in the non-interactive mode.

The work of {\it s\_comphep} in the blind mode is simplified a little. 
It automatically passes by all  warnings and  messages  answering 'Y' (Yes)
any question itself. The  \CompHEP~ title screen  is missed in 
this mode and the  simulation of keyboard hit, which is used to leave the
first  screen, is not needed.

An   example of the blind session is 
realized in  your {\it comphep} command  file.  
When  you activate the  {\it Make n\_comphep\_c}  function of {\it  Menu~6}
then  {\it s\_comphep} ends with an exit code 24 and \\
\hspace*{2cm}{\tt   \$COMPHEP/s\_comphep -blind "]\}\}]]]\}9" }\\
is launched. The above command performs  symbolical calculations  
and writes down the C-code for the squared matrix element
into the directory {\it results}. Note that the last symbol '9' simulates 
the work of the {\it F9} functional key which in its turn completes the session
(See Section \ref{X11interface}).


Another utilization of the {\it blind} mode is a check of \CompHEP~ for some 
huge set of processes (Section  \ref{symb-calc-check}). 
