(Prepared by Iwona Sakrejda and Ken Wilson and edited by Lanny Ray)
GSTAR is a framework in which to run STAR detector simulations using the CERN detector simulation code GEANT. GSTAR provides an enhanced version of the interactive GEANT-PAW program which the user controls with the KUIP interface. The STAF specific program, g2t is a converter code which reads the GEANT output in the CERN based ZEBRA data format and fills STAF datasets and tables and outputs the results as an external xdf file. In this tutorial example the standard STAR detector geometry files and default physics process parameters will be used. For more information about GSTAR, g2t and the Advanced Geometry Interface language which defines the physical detector for GEANT, please refer to the GSTAR Web pages.
The general steps involved in running GSTAR/g2t in this tutorial are the following:
Step 1: - The new user is strongly advised to begin these exercises using small events with a few 10s of tracks in order to minimize cpu demand and to expedite the learning process by permiting you to get quick results. For example, the STAR Trigger group has many proton + proton minimum bias collision events at 200 GeV stored in the MDS facility in the file:
/star/mds/data/SD97/pp200/evg/b1/hijing/set0001/regular/xdf/
hij_pp_mb_1000.xdf
Change directories to this location and retrieve the above file from the MDS tapes by typing:
head hij_pp_mb_1000.xdf
Once the header information is listed the file will be ready for you to use.
Step 2: - Create a safe working directory for this exercise. For example, you may want to use the directory from the preceding event generator tutorial. Please type:
cd /scrXX/``your_name''
where /scrXX is the scratch disk you used for the preceding event generator tutorial (i.e. scrXX = scr20, scr21, scr22 etc.) and ``your_name'' is the directory name you previously created. Then create a working subdirectory for this GSTAR tutorial:
mkdir gstar
and change to that directory
cd /scrXX/``your_name''/gstar
Create a soft link to the event file by typing (all on one line):
ln -s /star/mds/data/SD97/pp200/evg/b1/hijing/set0001/regular/
xdf/hij_pp_mb_1000.xdf hij_pp_mb_1000.xdf
Step 3: - Setup the work area to run GSTAR by executing the following script by typing:
$STAR_LIB/dev/sim/bin/setup_gstar
which creates many soft links to the geometry files (*.g). If any of the geometry files need to be changed remove the soft link, copy the necessary *.g file from /afs/rhic/star/starlib/ref/sim/gst/geo/g/ to the local working directory and edit it. If the file detm.rz exists, remove it before running GSTAR by typing:
rm detm.rz
Step 4: - To run GSTAR interactively type:
gstar
and enter the ID number (usually a 1) at the `Workstation type' prompt for your x-terminal's internet address. This should be the same as you did in the previous tutorial. Execute a kumac file which will initialize parameters, thresholds and cut-offs for the physics processes by typing:
exec $STAR_REF/sim/gst/exa/set_hadr_phys_on.kumac
and initialize the detector geometry by typing:
exec $STAR_REF/sim/gst/exa/load_star_geom.kumac
Open the input and output files by typing, for example:
user/input xdf hij_pp_mb_1000.xdf
for an xdf format input file and
user/input txold evg_output_file.txt
for a text file format, followed by (for example)
user/output O hij_pp_mb_5events.fzd
for the GEANT output file in ZEBRA (fzd) format.
Step 5: - Process 5 events by typing:
trig 5
After the completion, close the output file:
user/output C hij_pp_mb_5events.fzd
and exit GSTAR by typing,
exit
Step 6: - Once GEANT output is produced you have to convert it to STAF tables. To do this you need to run g2t. The command line is:
g2t -i output_from_gstar -o converted_output_from_gstar -n number_events
where
For example if hij_pp_mb_5events.fzd was produced by GSTAR and you want to convert the first 3 events, this command would be:
g2t -i hij_pp_mb_5events.fzd -o hij_pp_mb_3_gstar-events.xdf -n 3
Step 7: - Examine the STAF datasets and tables by starting a generic STAF executable under SL97b, for example tpcStaf from the preceding tutorial or tpcStaf97b. Run this on rpro00 or any other that will work. We will read the g2t output tables into STAF and briefly examine the tables structures and the data in the tables. For now, just do the following steps. After completing the later STAF tutorials, return to this part to be sure you understand everything. To see the datasets, tables and the actual numerical values, type the following and look carefully at the results of each step. Start the STAF executable by typing
tpcStaf
at the UNIX prompt and enter the x-term address number (1) at the `Workstation type' prompt. Create an input file stream to STAF:
dio/newfilestream input hij_pp_mb_3_gstar-events.xdf R
Read in the run header and look at two of the tables:
dio/stream/getevent input
ls
ls Run
tdm/table/print Run/g2t_run
tdm/table/print Run/g2t_gepart
Get the first event and look at the tracks and TPC hits:
dio/stream/getevent input
ls
ls Event
tdm/table/print Event/g2t_track
tdm/table/print Event/g2t_tpc_hit
where only the first 10 rows are displayed by default. Repeat the `dio/stream/getevent input' command to read in the next event and so on. When you have finished examining the data quit the STAF session by typing:
quit
It is possible to generate GSTAR/g2t output by executing scripts in the background mode. Also, GSTAR-PAW provides many graphics tools for examining the detector and the particle distributions. Examples of this sort will be included in later versions of these tutorials.