]>
Commit | Line | Data |
---|---|---|
8080da75 | 1 | #!/bin/sh |
2 | ||
3 | ############################################################################### | |
4 | # | |
5 | # Aim is to submit simulation/reconstruction jobs for multiplicity dependence check | |
6 | # For local running one can use the instructions in runSim() function. | |
7 | # submitMultiplicityScan() --> main function to submit jobs for each event with a given multiplicity | |
8 | # runSim() --> runs the macros for simulation and reconstruction | |
9 | # To see how to run these functions look below | |
10 | # | |
11 | ############################################################################### | |
12 | ||
13 | # global variables to be set | |
14 | DATE=`date +%Y_%m_%d_%H` | |
15 | nEvents=1 #fixed to 1 to make an event by event job submission | |
16 | ############################################################################### | |
17 | submitIonTailXTalkScan() | |
18 | { | |
19 | ||
20 | # | |
21 | # cals the submitMultiplicityScan fuction for | |
22 | # --> IonTail ON/OFF, XTALK ON/OFF, in reconstruction and MC | |
23 | ############################################################################### | |
24 | ## example --> for 5 multiplicity bins, each most central event having 15000 track multiplicity. | |
25 | ## For each multiplicity bin total statistic is 75000 | |
26 | if [ 1 -eq 0 ]; then | |
27 | cd $ALICE_ROOT/test/testdEdx | |
28 | source submitSimJobs.sh | |
29 | submitIonTailXTalkScan 8 1000000 50 /hera/alice/marsland/software/bin/set_private_TPCdev.sh > out.log 2>&1 & | |
30 | fi | |
31 | ############################################################################### | |
32 | ||
33 | # inputs | |
34 | nMultBins=$1 | |
35 | maxNTracks=$2 | |
36 | nEventsCentral=$3 | |
37 | alirootSourceFile=$4 | |
38 | ||
39 | if [ $# -ne 4 ]; then | |
40 | echo "4 parameters needed --> multiplicity bins, maximum number of tracks, maximum number of central events, source file for root" | |
41 | return 1 | |
42 | fi | |
43 | ||
44 | baseDir=$(pwd) | |
45 | testDir=$baseDir/test_$nMultBins\_$maxNTracks\_$nEventsCentral\_$DATE | |
46 | DirCheckCreate $testDir | |
47 | cd $testDir | |
48 | ||
49 | for ((iontail=0; iontail<2 ; iontail=iontail+1)) | |
50 | do | |
51 | for ((xtalk=0; xtalk<2 ; xtalk=xtalk+1)) | |
52 | do | |
53 | ||
54 | MultiplicityScan $nMultBins $maxNTracks $nEventsCentral $alirootSourceFile $iontail $xtalk | |
55 | ||
56 | done | |
57 | done | |
58 | ||
59 | } | |
60 | ############################################################################### | |
61 | runSim(){ | |
62 | ||
63 | # | |
64 | # Function which runs rec.C and sim.C for given multiplicity and event number. | |
65 | # (if submitMultiplicityScan function is called, this parameter is always fixed to 1, i.e event by event) | |
66 | # Input parameters are | |
67 | # 1) total track multiplicity | |
68 | # 2) number of events to be processed for given total track multiplicity (if submitMultiplicityScan() is called, it is 1) | |
69 | # 3) script to source a specific aliroot | |
70 | # | |
71 | ############################################################################### | |
72 | ## example --> 2 events with total multiplicity of 1000 tracks | |
73 | if [ 1 -eq 0 ]; then | |
74 | cd $ALICE_ROOT/test/testdEdx | |
75 | source submitSimJobs.sh | |
76 | runSim 100 1 0 0 /hera/alice/marsland/software/bin/set_private_TPCdev.sh > out.log 2>&1 & | |
77 | fi | |
78 | ############################################################################### | |
79 | ||
80 | export TestdEdxNTracks=$1 | |
81 | nevents=$2 | |
82 | ionTail=$3 | |
83 | xTalk=$4 | |
84 | alirootSourceFile=$5 | |
85 | ||
86 | if [ $# -ne 4 ]; then | |
87 | echo "5 parameters needed --> multiplicity, number of events, source file for aliroot, iontail switch (0 or 1), xTalk switch (0 or 1)" | |
88 | return 1 | |
89 | fi | |
90 | ||
91 | echo " Running dEdx digitzer test job" | |
92 | echo " NEvents = $nevents" | |
93 | echo " NTracks per event $TestdEdxNTracks" | |
94 | ||
95 | ||
96 | ## main body of the simulation part | |
97 | rm -rf *.root *.dat *.log fort* hlt hough raw* recraw/*.root recraw/*.log | |
98 | echo aliroot -b -q sim.C\($nevents,$ionTail,$xTalk\) | |
99 | aliroot -b -q sim.C\($nevents,$ionTail,$xTalk\) 2>&1 | tee sim.log | |
100 | mv syswatch.log simwatch.log | |
101 | echo aliroot -b -q rec.C\($ionTail\,$xTalk\) | |
102 | aliroot -b -q rec.C\($ionTail\,$xTalk\) 2>&1 | tee rec.log | |
103 | mv syswatch.log recwatch.log | |
104 | ||
105 | ## OCDB entries to be dumped in human readable format | |
106 | source $ALICE_ROOT/PWGPP/CalibMacros/AliOCDBtoolkit.sh | |
107 | ocdbMakeTable AliESDs.root "ESD" OCDBrec.list | |
108 | ocdbMakeTable galice.root MC OCDBsim.list | |
109 | ocdbFileName=$(cat OCDBrec.list | grep "TPC/Calib/RecoParam" | gawk '{print $2"/"$3}' ) | |
110 | dumpObject $ocdbFileName "object" "XML" RecoParam | |
111 | ||
112 | return 1; | |
113 | ||
114 | } | |
115 | ############################################################################### | |
116 | MultiplicityScan(){ | |
117 | # | |
118 | # Here we submit the jobs for the simulation//reconstruction for one setting of IonTail and XTalk configuration | |
119 | # Parameters: | |
120 | # 1. multiplicity bins to be investigated (default 5) | |
121 | # 2. max multiplicity for whole processing (default 75000 tracks --> 5 central PbPb event ) | |
122 | # 3. number of central events to be used (default 5) | |
123 | # 4. file to source aliroot | |
124 | # (2)/(3) should be a reasonable multiplicity estimate (e.g. 15000 tracks which is 1 central PbPb event) | |
125 | # Jobs will be submitted per event | |
126 | # | |
127 | # For each setting new directory will be created - indicating muiltiplicity | |
128 | # dir<ntracks>/dir<eventNr> | |
129 | # | |
130 | ############################################################################### | |
131 | ## example --> for 5 multiplicity bins, each most central event having 15000 track multiplicity. | |
132 | ## For each multiplicity bin total statistic is 75000 | |
133 | if [ 1 -eq 0 ]; then | |
134 | cd $ALICE_ROOT/test/testdEdx | |
135 | source submitSimJobs.sh | |
136 | MultiplicityScan 8 1000000 50 /hera/alice/marsland/software/bin/set_private_TPCdev.sh 0 1 > out.log 2>&1 & | |
137 | fi | |
138 | ############################################################################### | |
139 | ||
140 | # inputs | |
141 | nMultBins=$1 | |
142 | maxNTracks=$2 | |
143 | nEventsCentral=$3 | |
144 | alirootSourceFile=$4 | |
145 | ionTail=$5 | |
146 | xTalk=$6 | |
147 | ||
148 | if [ $# -ne 6 ]; then | |
149 | echo "6 parameters needed --> multiplicity bins, maximum number of tracks, maximum number of central events, source file for root, iontail switch (0 or 1), xTalk switch (0 or 1)" | |
150 | return 1 | |
151 | fi | |
152 | ||
153 | baseDir=$(pwd) | |
154 | testDir=$baseDir/IonTail_XTalk_$ionTail\_$xTalk | |
155 | DirCheckCreate $testDir | |
156 | cd $testDir | |
157 | ||
158 | # create multiplicity bins | |
159 | multPerCentralEvent=$(echo $maxNTracks/$nEventsCentral | bc) | |
160 | echo "multiplicity per most central event is $multPerCentralEvent" | |
161 | for ((i=0; i<$nMultBins ; i=i+1)) | |
162 | do | |
163 | ||
164 | multSteps=$(echo $multPerCentralEvent/$nMultBins | bc) | |
165 | multBin=$(echo $multPerCentralEvent - $multSteps*$i | bc) | |
166 | multBinDir=$testDir/mult_$multBin | |
167 | DirCheckCreate $multBinDir | |
168 | cd $multBinDir | |
169 | echo $multBinDir | |
170 | ||
171 | nEventsPerMultBin=$(echo $maxNTracks/$multBin | bc) | |
172 | echo $nEventsPerMultBin | |
173 | for ((j=1; j<$(echo $nEventsPerMultBin+1 | bc) ; j=j+1)) | |
174 | do | |
175 | ||
176 | eventDir=$multBinDir/event_$j | |
177 | DirCheckCreate $eventDir | |
178 | cd $eventDir | |
179 | cp -r $ALICE_ROOT/test/testdEdx/GRP $ALICE_ROOT/test/testdEdx/OCDB* $ALICE_ROOT/test/testdEdx/*.* . | |
180 | #cp $ALICE_ROOT/test/testdEdx/*.* . | |
181 | ||
182 | qsub -V -cwd -l h_rt=24:0:0,h_rss=6G -P alice -b y -r y -o outSim.log -e errSim.log $baseDir/submitSimJobs.sh runSim $multBin $nEvents $4 $5 $6 | |
183 | ||
184 | done | |
185 | done | |
186 | ||
187 | cd $baseDir | |
188 | } | |
189 | ############################################################################### | |
190 | DirCheckCreate() | |
191 | { | |
192 | ||
193 | # | |
194 | # check if the directory exist. If so, delete it | |
195 | # | |
196 | ||
197 | dirName=$1 | |
198 | if [ -d "$dirName" ]; then | |
199 | echo " $dirName already exist delete it and create a new one " | |
200 | rm -rf $dirName | |
201 | fi | |
202 | mkdir $dirName | |
203 | ||
204 | } | |
205 | ############################################################################### | |
206 | main() | |
207 | { | |
208 | eval "$@" | |
209 | } | |
210 | ||
211 | main $@ | |
212 |