How to generate events with CompHep
Getting CompHep
To get the CompHep package go to the site:
http://comphep.sinp.msu.ru/. If this is the first time you do that you have to register yourself (it is free ;-)) before you are allowed to go to the download page. The latest version which can be actually used to produce events suitable for CMSSW is 4.4 (comphep-4.4p3.tgz).
tar -xzf comphep-4.4p3.tgz
You can follow the instructions in the INSTALL text file anyway at least to me it was not clear what exactly you had to do. So basically the main issue is that you have to add these files to the package:
CC,
CFLAGS,
CLIBS (the path has to be adapted). Also check that you have the X11 include/libraries.
Then you can type
./configure
make
make setup WDIR=${HOME}/your_working_dir
the last command creates a working directory.
Running CompHep
To start CompHep go the user directory you have created and type './comphep'. A window will pop up and as a first step you have to choose a model (in our case SM, Feynman gauge)
At this stage you can define particular type of particle (like composite particles) which can be useful for the process you want to study. For example you can define the particle "k" which can be e, mu, or tau at the same time so that selecting a single process you can take into account the three lepton flavors.
The next step is to define the kind of process you want to study and its characteristics. So for example choose Scattering Process and then the type of beam and the energy of the incoming particle: in our case p1 (composite particle, the proton, made of u, U, d, D, g, capital letters refer to anti-particles) and 7000 GeV, finally the PDF (e.g. cteq6l1).
Then you have to define the actual process for example p,p->Z, b, B and this is done by simply writing the desired final state. At this stage we can even choose to exclude some particular type of diagrams or to keep only diagrams containing for example some particle.
The next three steps perform the square of the diagrams and the symbolic calculation which will produce the C functions that we will use to produce events and distributions. The diagrams can also be browsed and selected manually and CompHep has a useful tool to print them in a form suitable for later LATEX compilation. So select Squaring diagrams and then C-Compiler.
Once the calculation are done (an xterm will show up so that you can follow the compilation of the C functions) a new CompHep window will pop up.
This new window will allow the actual generation of events. So first choose the Subprocess (e.g. u, U -> Z, b, B - g, g -> Z, b, B...), you can also set a particular set of cuts for the produced partons (pT, eta...).
Then choose Vega menu to start the cross section calculation for the process. Usually default parameters are fine so that you can click the Start Integration menu directly. During this calculation CompHep can fill some user-defined histograms which can be used to control the generation process for further information look at the CompHep manual. The integration should be repeated until the cross section value converge or in other words until the error is "small enough".
The last two steps are the search of maxima in the phase space and the generation. The Search of maxima will take some time and it is better to do this calculation a couple of time just to be sure that its value is not too low (we are in an bad phase space region). The higher the maximum is the faster will be the generation of course (by the way this maximum cannot be arbitrary high but depends on the process).
Finally we can start the generation of the events by clicking Generator (old format). The old format is needed because the CompHep-CMSSW interface can accept only this kind of ntuple.
In the results subdirectory of your working directory you will find one txt file for each simulated process (events_X.txt).
Preparing CompHep ntuple for Pythia
Before Pythia could perform hadronization with the CompHep events you have to manipulate somehow the generated ntuples. Basically we need a tool to merge the ntuples related to different processes in a random way according to the relative cross sections of each process.
So go again to the CompHep site and download the cpyth utility (cpyth-1.2.7.tgz).
tar -xzf cpyth-1.2.7.tgz
cd cpyth-1.2.7.tgz
./configure
make
make install USERDIR=full_path_to_your_user_work_dir
cd full_path_to_your_user_work_dir
Then copy the events_X.txt in this directory and type:
./mixPEV events_1.txt events_2.txt ...
The mixPEV utility will mix the events according to the cross sections of each process until one of the ntuples is exhausted (by the way remember to generate an appropriate number of events otherwise the process with the lower cross section is not taken into account properly).
The output will be the Mixed.PEV file (a text file) which can be read by the CompHep/Pythia interface written for CMSSW.
--
MatteoSani - 28 Nov 2007