Notes on running the new STAF-compliant EMC analysis package ems

1-August-1996: original
29-October-1996: revised
5-May-97: revised again
W.J. Llope, Rice University



agi/gst/g2t main page
agi/gst/g2t updates page
staf main page
ems main page
ems updates page


The EMC physics analysis module ems is now running in the STAR analysis shell STAF. In the old shell, TAS, ems consisted of an interface routine (ems_tot), a level-0 trigger module (ems_trig_lvl0), a charged-neutral energy "with tracks" routine (ems_egrid), a jet finder (erj_bar), and a finder of W,Z electrons (ems_elect). The previous(present) full simulations and analysis chain consists of namelist files(AGI), gxintX11(gStar), mct(g2t), and TAS(STAF). The new chain is considerably easier to use and somewhat more powerful than the previous one. Complete documentation on gStar, g2t, and STAF is on the WWW (addresses provided below). As ems was massively revised in the move from TAS to STAF, I'll make comments below that are intended to augment the information on the web for people specifically interested in running ems.



Changes to STAR/STAF environment

If you want to be able to build your own STAF executable, put the following lines into your .tcshrc (or equivalent):

setenv STAR_SYS_LEVEL SL96b
source /afs/rhic/star/login/star_login.csh 


Setting up agi, gst, and g2t

Detailed documentation is available that describes how to set up and run gStar and g2t. To get going, go through this writeup after getting your own copies of gstar and g2t:

     cp -r $STAR_REF/sim/gst .
     cp -r $STAR_REF/sim/g2t .

The Makefiles for gstar and g2t a little different than the usual. To build .../gst/bin/irix/gstar*, make from the .../gst/src directory, and to build .../gst/bin/irix/g2t*, make from the .../g2t/src directory.

When yor run gStar, The geometry files that are used by default are *.sl files that are in $STAR_REF/sim/gst/geo/sl/$STAR_ARCH. You don't need to do anything special to get the default geometry (if you set up your gstar environment correctly).

You can look at the source code for these geometry definitions for the BEMC/BSMD and the EEMC/ESMD in your own area: .../gst/geo/g/calbgeo.g and .../gst/geo/g/ecalgeo.g.

These AGI source files are relatively easy to read, allowing you to see what is defined at the moment. The present geometry is: inner radius=222cm, 2cm aluminum front plate, squished stack, 21 layers, no G10 layers, gaseous SMD (1cm pitch) after 5 scint/pb layers, aluminum SMD box, G10 for SMD onboard electronics, 3cm back plate, equal-(eta,phi) = (0.05,0.05) or (0.1,0.1) towers, 1:4:5:11 depth segmentation in layers (5/16 or 10/11 depth sections can be done in staf), and a 1.5 cm phi gap.

By following the gstar/g2t documentation, produce your own g2t output file. This is what is read into STAF, which will call a STAF PAM (Physics Analysis Module) called ems, which will fill tables that you can easily dump into N-Tuples.



emsStaf

The g2t output file is read with the STAF executable emsStaf, which you can build and run yourself. There is an excellent set of documentation on the WWW for building and running STAF.

You can simply follow the tutorials under this page to get good at building and running STAF executables.

To get the modern ems, just go back to the subdirectory where you put gst and g2t, and then:

        cp -r $STAR_REF/sim/ems .
Get yourself an AFS token, and then
        cd ems
        make config
        cd srcm
        make emsStaf.cc
        cd ..
        make
The make procedure will:
1. use the STIC compiler to make .../ems/inc/*.h and *.inc files from the .../ems/idl/*.idl files.
2. compile the sources, *.F and *.cc, and put these into .../ems/lib/irix/libems.a
3. link libems.a with the STAF libraries and the CERN libraries to produce .../ems/bin/irix/emsStaf*.

SPECIAL NOTES ON PAMIGEN PROBLEM...

Once the make finishes, go to your .../ems/wrk area and type emsStaf (the Makefiles have set up a symbolic link in .../ems/wrk that points to .../ems/bin/irix/emsStaf*). Like PAW, AGI, and gStar, help on the usage of STAF commands is available from the STAF prompt.

The kumac .../ems/wrk/emsStaf shows how to run STAF to analyze an event and produce n-tuples. You should edit this file and insert the name of the g2t outfile that you want to read. Not all of the ems tables get filled correctly yet, as global tracks are not yet available in STAF (more on this below).

Notes:

- If the top of a file says "Don't edit this file...", then don't! It is an automatically generated file. Feel free to contact me if you're not sure how to make changes that won't get undone on the next compile.

- the BSMD information is now available.

- strictly speaking ems is a /ana module, not a /sim module. I intend to make this change in the near future (I'll keep you informed).

- If you plan on doing some serious code development that would eventually result in new public ems software, please contact me before you write a lot of code.



ems Routines

Some notes on the ems subroutines are below. More importantly, the definitions on the tables used by ems are shown after that.

ems_interface.F

Input: g2t_event, g2t_vertex, g2t_track, g2t_emc_hit, g2t_smd_hit
Output: ems_hits_bemc, ems_hits_bsmd
This module converts the g2t information into the tables needed by ems. This routine is similar in function to the TAS subroutine ems_tot, but the ems_interface code itself is 100% different.
The endcaps have a defined geometry, but they are not yet in g2t, so no ems tables for the endcap(s) are defined yet.
ems_lvl0.F

Input: ems_hits_bemc, ems_lvl0_thres
Output: ems_lvl0_adcs, ems_lvl0_bits
This is the ported verion of the TAS subroutine emc_trig_lvl0.F, which calculate the various EMC Level-0 trigger information and trigger bits. The definitions of the output tables for this module are the same as they were in TAS.

ems_egrid.F

Input: ems_hits_bemc, egr_globtrk
Output: ems_emecor
This is the ported verion of the TAS subroutine emc_egrid.F, which calculates the neutral and charged energy grid in (eta,phi). ems_erj.F

Input: ems_emecor, ems_jetpar
Output: ems_jetlist
This is the ported verion of the TAS subroutine erj_bar.F, which is the jet finder. the subroutine has provisions for three different jet-finding algorithms, but only one has been coded. ems_elect.F

Input: ems_hits_bemc, egr_globtrk
Output: ems_electron
This is the ported verion of the TAS subroutine emc_elect.F, which looks for W/Z electrons.


ems Tables

Here i just list the definitions of the tables read and written by ems. If you need more of a description than what you see in the comments below, please contact me (or take a look at the source code). The tables are easy to change - just suggest something.

   struct ems_hits_bemc {
       long    tower_eta_bin;  /* Pseudorapidity bin number, -10 -> 10 */
       long    tower_phi_bin;  /* Phi module number, 1 -> 60 */
       long    tower_dep;      /* Depth section, 1 -> 3, or 0=tower total */
       float   eb_sum;         /* Sum of energy with Birk's Law. */
       float   eb_neut;        /* Sum of energy from Neut. part. hits with Birk's Law*/
   };

   struct ems_hits_bsmd {
       long    rl;             /* right/left: =1 for Z<0, =2 for Z>0 */
       long    phi_bin;        /* Phi module number, 1 -> 60 */
       long    pswire;         /* psuedo-wire (0.5cm pitch), gives phi */
       long    psstrip;        /* psuedo-strip (0.5cm pitch), gives eta */
       float   edep;           /* Sum of deposited energy (GeV!)*/
   };

   struct ems_lvl0_thres {
       float     four_tow_thres[3];    /* These 3 #s set the 4 tower thresholds. */
       float     glob_thres[3];        /* These 3 #s set the global thresholds. */
       float     lum_thres[4];         /* These 4 #s set thres. on # of towers. */
       float     one_tow_thres[3];     /* These 3 #s set 1 tower thresholds. */
       float     sixteen_tow_thres[3]; /* These 3 #s set the 16 tower thresholds. */
   };

   struct ems_lvl0_adcs {
       long      eta_bin;    /* Eta bin identifier for isospin patch. */
       long      phi_bin;    /* Phi bin identifier for isospin patch. */
       float     iso_adc;    /* ADC value (energy dep.) for patch. */
   };

   struct ems_lvl0_bits {
       long      four_tow[3];    /* 4 tower trigger bits. */
       long      glob_bits[3];   /* Global energy trigger bits. */
       long      lum_bits[3];    /* Luminosity monitoring trigger bits. */
       long      one_tow[3];     /* Single tower trigger bits. */
       long      sixteen_tow[3]; /* 16 tower trigger bits. */
       float     glob_adc;       /* Global level 0 ADC value. */
   };

   struct ems_jetpar {
       float     cone_rad;   /* jet cone radius in cluster algorithm */
       float     ej_min;     /* energy cut for post-algorithm analysis */
       float     et_min;     /* min energy deposition to be collected */
       float     et_seed;    /* init. transverse energy in algorithm GeV */
       float     par[5];     /* possible extra params in algorithm */
       float     phi_dev;    /* back-to-back phi deviations for 2 jets */
   };

   struct ems_emecor {
       long      eta_bin;    /* Pseudorapidity bin number, -20 -> 20 */
       long      phi_bin;    /* Phi module number, 0 -> 60 */
       float     echar_vert; /* Energy due to charged tracks at vertex. */
       float     eneut_cpr;  /* Neutral Energy deduced by subtracting. */
       float     eneut_mct;  /* Neutral Energy as given by g2t. */
       float     etot_2;     /* Energy due to trks with neutral via g2t */
       float     etot_3;     /* Energy at vertex via MKINE. */
       float     etot_sim;   /* Echarged from trks and E neut via CPR */
       float     num_char;   /* Number of charged trks which hit tower */
   };

   struct ems_jetlist {
       long      id;         /* jet number */
       long      id_b;       /* Id of jet that sat. b-to-b criteria. */
       long      n_cells;    /* number of cells forming a jet */
       long      n_jet;      /* Number of jets in event. */
       float     e_j;        /* jet energy as obtained by jet-finder */
       float     eta;        /* eta position of a jet */
       float     eta_w;      /* weighetd eta position of a jet */
       float     jet_m;      /* jet mass; =0 if e**2-p**2 < 0 */
       float     p_j[3];     /* jet momentum vector */
       float     phi;        /* phi position of a jet */
       float     phi_w;      /* weighted phi position of a jet */
   };

   struct ems_electron {
       long      charge;     /* Charge for the electron trk. */
       long      id;         /* Primary key. */
       long      id_b;       /* Number of b-to-b structures. */
       long      n_cells;    /* Number of EMC towers in cluster. */
       long      n_elect;    /* Number of electrons found in this event. */
       long      pid_kine;   /* Particle id code from kine bank. */
       float     e_elect;    /* Energy of electron. */
       float     edep;       /* Energy deposited by electron in EMC. */
       float     eta;        /* Pseudorapidity of electron. */
       float     eta_trk;    /* Pseudorapidity for the electron trk. */
       float     eta_w;      /* Weighted value of pseudorapidity. */
       float     jet_m;      /* Jet mass. */
       float     p_elect[3]; /* Momentum vector for electron. */
       float     p_kine[3];  /* Momentum vector from kine bank. */
       float     phi;        /* Phi angle for electron */
       float     phi_trk;    /* Phi angle for the electron trk. */
       float     phi_w;      /* Weighted Phi for electron. */
       float     pt;         /* Pt value for the electron trk. */
       float     ptot;       /* Total momentum of the electron trk. */
       float     r_elect;    /* Radius parameter for electron. */
       float     x;          /* X coordinate for electron hit in EMC. */
       float     x_trk;      /* Last point on trk. */
       float     y;          /* Y coordinate for electron hit on EMC. */
       float     y_trk;      /* Last point on trk. */
       float     z;          /* Z coordinate for electron hit on EMC. */
       float     z_trk;      /* Last point on trk */
   };