Grid-friendly Starsim production scripts

Since the production activity of STAR is migrating to, and eventually will end up running mostly in the Grid environment, this necessitates modification (which often means simplification) of the production scripts we use when running on a local or another "traditional" Unix farm facility. Here is an example of the script we have successfully used to run a Pythia simulation on the Grid (utilizing the Fermilab facility), as well as the SunGrid, with cosmetic modifications.

A few things worth noting:

  • The bulk of the script has to do with establishing the Pythia settings which are often required in the simulations requested by the Spin PWG; the starsim proper part is located on top is is uncomplicated; it invloves dynamic loading of the necessary libraries, setting up the beam interaction diamond parameters ets
  • The script needs the contents of the tarball (listed on the bottom of the page) located in its working directory; this "payload" contains the Starsim executable as well as a few shared libraries and accessory scripts necessary for its function. To be able to run on the Grid, therefore, on needs to
    • Transfer the tarball and make provisions for extraction of the files
    • Transfer the script below and configure it for submission with a unique serial number (any integer, really)
  • The script takes only one argument, which is the serial number of the run. The rest of the run parameters are encoded in its body, which minimizes the chances of human error when submitting a large number of scripts, potentially for many different datasets
  • The random number generator is seeded with the serial run number and with the Unix process ID of the script on the target machine, which for all intents and purposes guarantees the uniqueness of a sequence in each run
#!/usr/bin/ksh
echo commencing the simulation
export STAR=.
echo STAR=$STAR
#
run=$1
geom=Y2006C
ntrig=2000
diamond=60
z=120
# >> run.$run.log 2>&1
node=`uname -n`
echo run:$run geom:$geom ntrig:$ntrig diamond:$diamond z:$z node:$node pid:$$
./starsim -w 0 -g 40 -c trace on .<<EOF
trace on
RUNG $run 1 $$
RNDM $$ $run
gfile o gstar.$run.fz
detp geom $geom
vsig 0.01 $diamond
gexec $STAR/geometry.so
gexec $STAR/libpythia_6410.so
gexec $STAR/bpythia.so
gclose all
gkine -1 0 0 100 -6.3 6.3 0 6.28318 -$z $z
ENER 200.0
MSEL 1
CKIN 3=4.0
CKIN 4=5.0
MSTP (51)=7
MSTP (81)=1
MSTP (82)=4
PARP (82)=2.0
PARP (83)=0.5
PARP (84)=0.4
PARP (85)=0.9
PARP (86)=0.95
PARP (89)=1800
PARP (90)=0.25
PARP (91)=1.0
PARP (67)=4.0
MDCY (102,1)=0 ! PI0 111
MDCY (106,1)=0 ! PI+ 211
MDCY (109,1)=0 ! ETA 221
MDCY (116,1)=0 ! K+ 321
MDCY (112,1)=0 ! K_SHORT 310
MDCY (105,1)=0 ! K_LONG 130
MDCY (164,1)=0 ! LAMBDA0 3122
MDCY (167,1)=0 ! SIGMA0 3212
MDCY (162,1)=0 ! SIGMA- 3112
MDCY (169,1)=0 ! SIGMA+ 3222
MDCY (172,1)=0 ! Xi- 3312
MDCY (174,1)=0 ! Xi0 3322
MDCY (176,1)=0 ! OMEGA- 3334
trig $ntrig
exit
EOF

The contents of the "payload" tarfile:

143575 2007-05-31 18:02:47 agetof
65743 2007-05-31 18:02:39 agetof.def
44591 2007-05-31 19:05:34 bpythia.so
5595692 2007-05-31 18:03:10 geometry.so
183148 2007-05-31 18:03:15 gstar.so
4170153 2007-05-31 19:05:27 libpythia_6410.so
0 2007-05-31 18:00:06 StarDb/
0 2007-05-31 18:00:59 StarDb/StMagF/
51229 2007-05-31 18:00:57 StarDb/StMagF/bfield_full_negative_2D.dat
2775652 2007-05-31 18:00:57 StarDb/StMagF/bfield_full_negative_3D.dat
51227 2007-05-31 18:00:57 StarDb/StMagF/bfield_full_positive_2D.dat
2775650 2007-05-31 18:00:58 StarDb/StMagF/bfield_full_positive_3D.dat
51227 2007-05-31 18:00:58 StarDb/StMagF/bfield_half_positive_2D.dat
2775650 2007-05-31 18:00:58 StarDb/StMagF/bfield_half_positive_3D.dat
1530566 2007-05-31 18:00:59 StarDb/StMagF/boundary_13_efield.dat
51231 2007-05-31 18:00:59 StarDb/StMagF/const_full_positive_2D.dat
1585050 2007-05-31 18:00:59 StarDb/StMagF/endcap_efield.dat
1530393 2007-05-31 18:00:59 StarDb/StMagF/membrane_efield.dat
15663993 2007-05-31 18:03:31 starsim
36600 2007-05-31 18:03:37 starsim.bank
1848 2007-05-31 18:03:42 starsim.logon.kumac
21551 2007-05-31 18:03:48 starsim.makefile