We start with a simple exercise, illustrating the main ideas and features of LanHEP. The first physical model is Quantum Electrodynamics.

The QED Lagrangian is

and the gauge fixing term in Feynman gauge has the form

Here is the spinor electron-positron field, is the electron mass, is the vector photon field, , and is the elementary electric charge.

The LanHEP input file to generate the Feynman rules for QED is shown in Fig. 1.

First of all, the input file consists of statements. Each statement begins with one of the reserved keywords and ends by a full-stop '.' symbol.

First line says that this is a model with the name `QED` and number 1.
This information is supplied for CompHEP, the name `QED` will be
displayed in its list of models.
In CompHEP package each model is described by four files:
'varsN.mdl', 'funcN.mdl', 'prtclsN.mdl', 'lgrngnN.mdl' , where N is the
very number specified in the `model` statement.

The `model` statement stands first in the input file. If this statement
is absent, LanHEP does not generate the four standard CompHEP files, but just
builds the model and prints
a diagnostic, if errors are found.

The second line in the input file contains declaration of the model parameter,
denoting elementary electric charge as `ee`. For each parameter
used in the model one should declare its
numeric value and an optional comment (it is also used in CompHEP menus).

The next two lines declare particles.
Statement names `spinor, vector`
correspond to the particle spin. So, we declare electron
denoted by
`e1` (the corresponding antiparticle name is `E1`) and
photon denoted by `A` (with antiparticle
name being `A`, since the antiparticle for photon is identical
to particle).

After the particle name we give in brackets some options. The first one is the full name of the particle, used in CompHEP; the second option declares the mass of this particle.

The `let` statement in the next line declares the substitution rule
for symbol
`F`.

Predefined name `deriv`, which is reserved for the derivative
, will be replaced after
the Fourier transformation by the momentum of the particle multiplied
by .

The rest of the lines describe terms in the Lagrangian. Here the reserved name
`gamma` denotes Dirac's -matrices.

One can see that the indices are written separated with the caret symbol '^'. Note that in the last two lines we have omitted indices. It means that LanHEP restores omitted indices automatically. Really, one can type the last term in the full format:

It corresponds to with all indices written. Note that the order of objects in the monomial is important to restore indices automatically.lterm ee*E1^a*gamma^a^b^mu*A^mu*e1^b.

Now let us consider the case of Quantum Chromodynamics. The Lagrangian for the gluon fields reads

where

is the gluon field, is the strong coupling constant and are purely imaginary structure constants of the color group.

The quark kinetic term and its interaction with the gluon has the form

where are Gell-Mann matrices.

Gauge fixing terms in Feynman gauge together with the corresponding
Faddev-Popov ghost term are

where are unphysical ghost fields.

The corresponding LanHEP input file is shown in Fig. 2.

Since QCD uses objects with
color indices, one has to declare the indices of these objects.
There are three types of color indices supported by LanHEP. These types
are referred as `color c3` (color triplets), `color c3b`
(color antitriplets), and `color c8` (color octets).
One can see that `color c3` index type appears among the options in
the quark `q` declaration, and the `color c8` one in the gluon
`G` declaration. Antiquark `Q` has got color index of type `color c3b` as antiparticle to quark.
LanHEP allows contraction of an index of type `color c3` only with
another index of type `color c3b`, and two indices of type `color
c8`. Of course, in Lagrangian terms each index
has to be contracted with its partner, since Lagrangian has to be a scalar.

LanHEP allows also to use in the Lagrangian terms a predefined symbol
`lambda` with the three indices of types `color c3, color c3b,
color c8` corresponding to Gell-Mann
-matrices. Symbol `f_SU3` denotes the structure constant
of color
group (all three indices have the type `color c8`).

Option `gauge`
in the declaration of `G` allows to use names `ghost(G)` and `ccghost(G)` for the ghost fields and in Lagrangian terms
and in `let` statements.

Table 1 shows Feynman rules generated by LanHEP in LaTeX format after processing the input file presented in Fig. 2. Four gluon vertex rule is indicated in the last line. Note that the output in CompHEP format has no 4-gluon vertex explicitly; it is expressed effectively through 3-leg vertices by a constant propagator of some auxiliary field (see section 9 for more details).

The third example illustrates using the multiplets
in the framework of LanHEP. Let us consider the
Higgs sector of the Standard Model. The Higgs doublet
can be defined as

where is the sinus of the weak angle, is the Higgs field, and are goldstone bosons corresponding to and gauge fields. The self-interaction of Higgs field read as

where , and the vaccuum expectation value (here and below , .)

The gauge interaction of a Higgs doublet is given by the term
, where

Here is singlet and is triplet,

and is the vector .

The above model can be represented by the LanHEP code shown in Table 3.

New features in this example include the definition of special
symbols for coupling constants , , gauge and Higgs
fields, and the covariant derivative by means of `let` statement.
Note that in the declaration
for the fields we have used dummy indices (vector and isospin).
The multiplets are defined by the components in the curly brackets.

Note that the option `gauge`
in the declaration of gauge fields allows to use the name `gsb(Z)` and `gsb('W+')` for the goldstone bosons.