Merge remote-tracking branch 'remotes/origin/master' into TPCdev
[u/mrichter/AliRoot.git] / TPC / fastSimul / simul.sh
CommitLineData
46a0eaea 1#!/bin/sh
44a0fef0 2main()
3{
4 #
5 # run in proper action depending on the selection
6 #
7 if [[ $# -lt 1 ]]; then
8 if [[ ! "$0" =~ "bash" ]]; then
9 echo " Please select action"
10 fi
11 return
12 fi
13 runMode=$1
14 umask 0002
15 shift
16 case $runMode in
17 "runJob") runJob "$@";;
18 "makeEnvLocal") makeEnvLocal "$@";;
19 "makeSubmitRun") makeSubmitRun "$@";;
20 *)
21 eval "${runMode} $@"
22 ;;
23 esac
24 return;
25}
26
27
28
29exampleCase(){
46a0eaea 30#
44a0fef0 31# Example case to subit Toy MC jobs
32#
fa9e5d19 33 source $ALICE_ROOT/TPC/fastSimul/simul.sh
44a0fef0 34 makeEnvLocal
fa9e5d19 35 makeSubmitRUN 80 400
44a0fef0 36 ls `pwd`/MC*/trackerSimul.root > trackerSimul.list
37
38}
39
40
41
42runJob()
43{
44#runFastMCJob
45 echo $ROOTSYS
46 which root.exe
47 which aliroot
48 echo PWD `pwd`
49 ntracks=$1
50 echo Submitting ntracks = $ntracks
51 echo command aliroot -q -b "$mcPath/simul.C\($ntracks\)"
52 command aliroot -q -b "$mcPath/simul.C($ntracks)"
53 return;
54}
55
56
57makeEnvLocal(){
46a0eaea 58#
46a0eaea 59#
44a0fef0 60# Example usage local
61# jobs to be submitted form the lxb1001 or lxb1002
62#(here we have 80 nodes and user disk)
63#
64 echo makeEnvLocal
65 export baliceTPC=$HOME/.baliceTPC
66 export mcPath=$ALICE_ROOT/TPC/fastSimul
67 export batchCommand="qsub -cwd -V "
68}
69
70makeSubmitRUN(){
46a0eaea 71#
44a0fef0 72# submits jobs
73#
74 wdir=`pwd`;
75 njobs=$1
76 ntracks=$2
77 for (( job=1; job <= $njobs; job++ )); do
78 echo $job;
79 mkdir $wdir/MC$job
80 cd $wdir/MC$job
81 echo $batchCommand -o toyMC.log $mcPath/simul.sh runJob $ntracks
82 $batchCommand -o toyMC.log $mcPath/simul.sh runJob $ntracks
83 cd $wdir
84 done
85}
86
87
46a0eaea 88
44a0fef0 89main "$@"
46a0eaea 90