E907 Monte Carlo  Documentation

(E907MC)

Rajendran Raja

Wednesday, January 17, 2001 12:26:01 PM

We will describe here the structure of the data driven Geant geometry used for E907 Physics studies. We will describe the data driven description of geometry using RCP file input into the E907 Geant program. The name of the program is E907MC.

·         ·         Geant Documentation

·         ·         RCP files

·         ·         Preparing your area

·         ·         Linking E907MC

·         ·         Modifying E907MC

·         ·         Analyzing E907MC events

·         ·         Tracking and Pattern recognition

GEANT Documentation

CERN program library provides GEANT 3.21 documentation in postscript and HTML forms. We will assume that the user is familiar with GEANT principles and has read the GEANT manual. We will attempt to give hyperlinks to the appropriate GEANT subroutine documentation when warranted.

RCP files

RCP files are inherited from the D0 experiment Run I code. These are structured ASCII files that can be used to input data to programs in an orderly form. Fortran programs can read in variables from RCP files from any subroutine without use of common blocks. The constants are kept in ZEBRA banks and are made available to the user by means of a fast binary search among the bank contents. RCP files can handle all common data types, Integer *4, Character ,Real*4 and Logicals. The general format of the file is a variable name (up to 32 characters long) followed by a value. Character values are enclosed in single quotes. Exclamation point (!) signifies that the remainder of the line is a comment. In addition to single characters, one can also specify arrays of variables by the declaration

\array real_nums
 0.7   3.9  5.5 ! This line contains an array of 3 real numbers
\end 

The primary RCP file controlling the program is called HANUMAN.RCP. Please browse through it by following the hyperlink.

This file has an array called

\ARRAY DETECTOR_SYSTEMS
 'MOTHERS'              !media 0-99. rot matrices 0-999
 'JGGIANT'              !media 100-199. rot matrices 1000-1999
 'TPC'                  !media 200-299. rot matrices 2000-2999
 'CHAMBERS'             !media 300-399. rot matrices 3000-3999
 'TPLB'                 !media 400-499. rot matrices 4000-4999
 'TOF'                  !media 500-599. rot matrices 5000-5999
 'RICH'                 !media 600-699. rot matrices 6000-6999
 'CALORIMETER'          !media 700-799. rot matrices 7000-7999
\END

This array specifies the list of detector systems used by E907MC. For each system xxx, the user is expected to supply a file called xxx.rcp which describes how the system is setup. In our example we have the systems MOTHERS, JGGIANT,TPC,CHAMBERS,TPLB,TOF,RICH and CALORIMETER, which will require the provision of the RCP files MOTHERS.RCP,JGGIANT.RCP,TPC.RCP,CHAMBERS.RCP,TPLB.RCP,TOF.RCP,RICH.RCP AND CALORIMETER.RCP. Each of these RCP files will have identical structures. So if one understands the structure of one system, all other systems can be understood as well. The RCP file MOTHERS.RCP sets up the mother volumes for E907MC and the materials and media. We then setup the individual systems  The magnetic field is supplied by a routine called GUFLD.

GEANT geometry is defined using shapes made up of tracking media and placed in the mother volumes using translations and rotations defined in terms of rotation matrices. The rotation matrices and media are known to GEANT using integer numbers. In order to avoid conflicts in media and rotation matrix definitions, we define numerical ranges for these for each detector system as illustrated in the comment fields in the above \ARRAY definition.

Structure of detector RCP files

Each detector RCP file must contain the following RCP file structures.

\ARRAY ROTATION_MATRICES      !Interrupt here to read more about this structure
\ARRAY MATERIAL_LIST          !Interrupt here to read more about this structure
\ARRAY MIXTURE_LIST           !Interrupt here to read more about this structure
\ARRAY MEDIA_LIST             !Interrupt here to read more about this structure
\ARRAY VOLUME_LIST            !Interrupt here to read more about this structure
\ARRAY DETECTOR_LIST          !Interrupt here to read more about this structure

These arrays define the rotation matrices, materials, mixtures, tracking media, geometrical volumes and detector sets belonging to the detector subsystem in question.

Preparing Your area

Before starting work, one needs to link to D0library and its logicals. This can be achieved by the following by invoking d0local.login and d0local.cshrc from your .login and .cshrc files.

1.      1.      Edit your .cshrc file to include the following lines after the call to fermi.cshrc to execute d0local.cshrc


# execute fermi.cshrc first
if ( -r /usr/local/etc/fermi.cshrc ) then
source /usr/local/etc/fermi.cshrc
endif
#
# execute d0local.cshrc
#
if ( -r /local/data03/d0local.cshrc ) then
source /local/data03/d0local.cshrc
endif

2.      2.      Edit your .login file to include the following lines after the call to fermi.login to execute d0local.login

if ( -r /usr/local/etc/fermi.login ) then
source /usr/local/etc/fermi.login
endif
#
# execute d0local.login
if ( -r local/data03/d0local.login ) then
source local/data03/d0local.login
endif

Linking E907MC

E907MC development work is to be done on the machine PATMU1, which is an LINUX  machine. The development work each user does is termed an ALPHA release. The area ~local/data03/e907mc contains the latest released version of E907MC. That release is termed a BETA release. Once logged in to your account, create a directory ~/e907mc. This is your ALPHA area.

1.           1.           setenv BETA /local/data03/e907mc
2.           2.           setenv ALPHA ~/e907mc
3.           3.           cd $ALPHA                           !This sets the directory to your ALPHA release area. 
4.           4.           cp $BETA/setup_e907mc.csh .    !This file sets up variables for E907MC. Edit this file to
                                      !change the environment variable SCR to point to your scratch area
1.           1.           cp $BETA/e907mc_beta_lnk.csh .    !This file will link your E907MC in the beta release mode
2.           2.           source setup_e907mc.csh           !this sets it up logicals
3.           3.           e907mc_beta_lnk.csh               !will produce the beta release version of 
4.           4.                                               !e907mc.x in your area. You could also
5.           5.                                               !have copied it from the beta area.
6.           6.           e907mc.x                          !executes it 

 

The RCP files needed by E907MC are in the area /local/data03/e907mc. They are referred to by the links setup in setup_e907mc.csh. In order to change an RCP file, copy it over from /local/data03/e907mc to your local area and change it. A file xxx.rcp has to have the link xxx_rcp. The pythia zebra events(obsolete) to be fed into E907MC are in the logical link fort.31. The STDHEP files which are now standard input files, are fed in via the environment variable $STDXIN.

Linking E907MC with new routines

Create a subdirectory ~/E907MC. This is your ALPHA area. Put in it the new user code. These can be UNIX based subroutines with extension .f or VMS based subroutines with extension .for. The VMS based subroutines are converted to UNIX based subroutines with the command userlib *.for. We are now creating our own version of E907MC. This is called an ALPHA release.

1.           1.           libtest -a $cwd inc          !Will include .inc files from local area as well as $d0inc
2.           2.           cp $BETA/*.inc .             !This will copy all the Include files from the Beta area 
3.           3.                                        !to your local area 
4.           4.           echo $doinc                  !Should yield ~e907mc /d0library/test/inc /d0library/inc
5.           5.           userlib *.for                !Will convert all .for files into UNIX based .f files
6.           6.           make                         !will create deb_userlib.a
7.           7.           cp $BETA/e907mc_alpha_lnk.csh .   !Copy Alpha release link file  to area
8.           8.           e907mc_alpha_lnk.csh              !Will create e907mc.x with your changes that will build
9.           9.                                               !on the beta release.

ANALYZING GEANTED events

The philosophy of  E907MC  is to use GEANT to track particles through the  detector with perfect resolution and store the hits using GFOUT and GROUT routines. Detector resolutions are handled in the Analysis phase, where the same framework is used to read in the saved hits. This is done in the RCP file HANUMAN.RCP by changing the RCP control flag ANALYZE_STORED_EVENTS to TRUE . E907MC will then read in the stored hits and permit the user to analyze them in the routine HN_EVENT.