DEPRECATED - PLEASE REFER TO https://eic.github.io/software/rapgap.html



Documentation on RAPGAP

RAPGAP is a MC generator which can be used to generate both DIS and Diffractive e+p events.

Running RAPGAP

This has been installed in the eic region at:

/afs/rhic.bnl.gov/eic/PACKAGES/RAPGAP-3.2/

When you run RAPGAP, you will create large text files as output. Therefore, in order to run this, you should do so from the DATA directory.
So, firstly, create a directory in this region:

mkdir /afs/rhic.bnl.gov/eic/DATA/<username>

Once this is done, inside the directory, you should create a soft link to the rapgap executable code:

ln -s /afs/rhic.bnl.gov/eic/PACKAGES/RAPGAP-3.2-32BIT/bin/rapgap rapgap

Now, you need to copy the steer file from the RAPGAP directory to your own directory, so you can edit it and run what you wish.

This is done via:

cp /afs/rhic.bnl.gov/eic/PACKAGES/RAPGAP-3.2-32BIT/data/steer .

Once this is done, you are ready to run. Once you have edited the file, then you run with the command:

./rapgap < steer >&! rapgap.log

This creates a text file named rapgap.txt with the raw rapgap output. At this point, you are ready to create a ROOT tree and analyse your data.

Output file structure

the output file (rapgap.txt) is in a text format which has the following structure.

  • 1st line: RAPGAP EVENT FILE
  • 2nd line: "============================================"


  • 3rd line: Information on event wise variables stored in the file
I: 0 (line index)
ievent: eventnumber running from 1 to XXX
genevent: trials to generate this event
subprocess: generated subprocess, for details see page in the rapgap-manual
idir: select type of events to be generated
= 1 standard inelastic scattering
= 0 diffractive and pion exchange processes
idisdif: mixing of standard inelastic scattering, diffractive and pion exchange processes according to cross section
0 generates only the processes selected by IDIR.
1 mixing of standard inelastic and diffractive processes.
2 mixing of standard inelastic, diffractive and pion exchange processes
cross section: integrated cross section
error on cross section: standard deviation of integrated cross section
s: total center of mass energy
Q2, y: in lepto-production: actual Q2 of γ; energy fraction lost by incident electron
If radiative corrections are turned on they are different from what is calculated from the scattered lepton.
If radiative corrections are turned off they are the same as what is calculated from the scattered lepton
xgam: energy fraction of parton on electron side
xpr: energy fraction of parton on proton side
pt_hat: phat_⊥ [GeV/c] of parton in hard subprocess cm system
pt2_hat: phat^2_⊥ [GeV2/c2] of parton in hard subprocess cm system
s_hat: invariant mass ˆs [GeV2] of hard subprocess
t_hat: for diffractive processes T2GKI = t [GeV2]
x_pom: for diffractive processes XFGKI = xIP
s_hat: shat of hard subprocess
z: z = p_i*p_f/p_i*q = ZQGKI
x: xp = Q2/2p_i*q = XPGKI
phi: φ = PHIGKI azimuthal angle
nrTracks: number of tracks in this event, includes also virtual particles


  • 4th line: "============================================"


  • 5th line: Information on track wise variables stored in the file
I: line index, runs from 1 to nrTracks
K(I,1): status code KS (1: stable particles 11: particles which decay 55; radiative photon)
K(I,2): particle KF code (211: pion, 2112:n, ....)
K(I,3): line number of parent particle
K(I,4): normally the line number of the first daughter; it is 0 for an undecayed particle or unfragmented parton
K(I,5): normally the line number of the last daughter; it is 0 for an undecayed particle or unfragmented parton.
P(I,1): px of particle
P(I,2): py of particle
P(I,3): pz of particle
P(I,4): Energy of particle
P(I,5): mass of particle
V(I,1): x vertex information
V(I,2): y vertex information
V(I,3): z vertex information
  • 6th line: "============================================"
  • 7th line: event information for first event
  • 8th line: "============================================"
  • 9th to X-1 line: trackwise info of 1st event
  • Xth line "=============== Event finished ==============="

the information from line 7 to X repeats for each event.

How to analyze events

  • create a root tree

there are root macros available to convert the output txt-files into root trees.
Details how to run the macros can be found [here]


Additional Information

A number of completed RAPGAP data files for various e+p energies are stored under /eic/data/RAPGAP/TXTFILES. Before creating new files, which can be time consuming, check this directory to see if the file you need is there. There are also ready-made trees available for use under /eic/data/RAPGAP/TREES.
If working with a preexisting file or tree, please refrain from altering or moving the file from its original directory. It is best to edit your macro so that it reads the target file directly from its home in either TXTFILES or TREES under /eic/data/RAPGAP.
Warning these files have a slightly different structure than described above. The main difference the event wise info is missing.