]>
Commit | Line | Data |
---|---|---|
8a94851d | 1 | #!/bin/bash |
8080da75 | 2 | |
3 | ############################################################################### | |
4 | # | |
5 | # Aim is to submit simulation/reconstruction jobs for multiplicity dependence check | |
8a94851d | 6 | # Functions |
7 | # IonTailXTalkScan() --> runs over IonTail ON/OFF, XTALK ON/OFF cases in rec.C and sim.C | |
8080da75 | 8 | # submitMultiplicityScan() --> main function to submit jobs for each event with a given multiplicity |
9 | # runSim() --> runs the macros for simulation and reconstruction | |
8a94851d | 10 | # RunCallgrind() --> runs callgrind for a given setting of IonTail ON/OFF, XTALK ON/OFF |
11 | # RunValgrind() --> runs valgrind for a given setting of IonTail ON/OFF, XTALK ON/OFF | |
12 | # To see how to run each functions individually look at the instructions written in the function itself | |
8080da75 | 13 | # |
14 | ############################################################################### | |
15 | ||
8a94851d | 16 | ############################################################################### |
17 | #### global variables to be set | |
18 | onlyValgrind=0 # to run only callgrind and valgrind | |
19 | nEventsPerJob=1 # fixed to 1 to make an event by event job submission | |
20 | valgrindNEvents=1 # fixed to 1 for fast output valgrind test | |
21 | valgrindNTracks=100 # fixed to 50 for fast output valgrind test | |
22 | #alirootSource="source /hera/alice/marsland/software/bin/set_private_TPCdev.sh" # either an alias or a "source" statement | |
23 | alirootSource="" # either an alias or a "source" statement | |
24 | callgrindCommand="/usr/bin/valgrind --tool=callgrind --log-file=cpu.txt --num-callers=40 -v --trace-children=yes" | |
25 | valgrindCommand="/usr/bin/valgrind --leak-check=full --leak-resolution=high --num-callers=40 --error-limit=no --show-reachable=yes --log-file=xxx.txt --suppressions=$ROOTSYS/etc/valgrind-root.supp -v" | |
26 | qsubCommand="qsub -V -cwd -l h_rt=24:0:0,h_rss=6G -P alice -b y -r y -o outSim.log -e errSim.log" | |
27 | workDir=`pwd` | |
28 | ||
29 | ## meaning of the lookup array settings [ON:1, OFF:0] | |
30 | # 0 --> XtalkMC ON, others OFF | |
31 | # 1 --> XtalkMC and XtalkRec ON, others OFF | |
32 | # 2 --> IonTailMC ON, others OFF | |
33 | # 3 --> IonTailMC and IonTailRec ON, others OFF | |
34 | # 4 --> ALL OFF | |
35 | # 5 --> All ON | |
36 | arrayXTalkSwitchMC=(1 1 0 0 0 1) | |
37 | arrayXTalkSwitchRec=(0 1 0 0 0 1) | |
38 | arrayIonTailSwitchMC=(0 0 1 1 0 1) | |
39 | arrayIonTailSwitchRec=(0 0 0 1 0 1) | |
40 | DATE=`date +%Y%m%d_%H` # for naming of a specific test | |
41 | ############################################################################### | |
533f5c16 | 42 | |
8080da75 | 43 | ############################################################################### |
8a94851d | 44 | ####################### Rest of the Script is generic ######################### |
45 | ############################################################################### | |
46 | IonTailXTalkScan() | |
8080da75 | 47 | { |
48 | ||
49 | # | |
8a94851d | 50 | # Scans over the cases of IonTail:ON/OFF, XTALK:ON/OFF, and for each calls submitMultiplicityScan() |
8080da75 | 51 | ############################################################################### |
8a94851d | 52 | # Parameters: |
53 | # 1) number os multiplicity bins | |
54 | # 2) total track multiplicity which is fixed for each multbin | |
55 | # 3) number of central events to be analysed | |
56 | # (e.g. (2)=75000, (3)=5 for a central event of 15000) | |
57 | ############################################################################### | |
58 | # how to run: | |
8080da75 | 59 | if [ 1 -eq 0 ]; then |
8080da75 | 60 | source submitSimJobs.sh |
8a94851d | 61 | IonTailXTalkScan 2 1000 2 > outIonTailXTalkScan.log 2>&1 & |
8080da75 | 62 | fi |
63 | ############################################################################### | |
64 | ||
65 | # inputs | |
66 | nMultBins=$1 | |
67 | maxNTracks=$2 | |
68 | nEventsCentral=$3 | |
8080da75 | 69 | |
8a94851d | 70 | if [ $# -ne 3 ]; then |
71 | echo "IonTailXTalkScan: 3 parameters needed --> multiplicity bins, maximum number of tracks, maximum number of central events" | |
8080da75 | 72 | return 1 |
73 | fi | |
74 | ||
75 | baseDir=$(pwd) | |
76 | testDir=$baseDir/test_$nMultBins\_$maxNTracks\_$nEventsCentral\_$DATE | |
77 | DirCheckCreate $testDir | |
78 | cd $testDir | |
79 | ||
8a94851d | 80 | arrayLength=${#arrayXTalkSwitchMC[@]} |
81 | for ((i=0; i<$arrayLength ; i=i+1)) | |
8080da75 | 82 | do |
8a94851d | 83 | $baseDir/submitSimJobs.sh MultiplicityScan $nMultBins $maxNTracks $nEventsCentral ${arrayXTalkSwitchMC[$i]} ${arrayXTalkSwitchRec[$i]} ${arrayIonTailSwitchMC[$i]} ${arrayIonTailSwitchRec[$i]} |
84 | echo " settings are = " $nMultBins $maxNTracks $nEventsCentral ${arrayXTalkSwitchMC[$i]} ${arrayXTalkSwitchRec[$i]} ${arrayIonTailSwitchMC[$i]} ${arrayIonTailSwitchRec[$i]} | |
85 | ||
86 | done | |
87 | ||
88 | } | |
89 | ############################################################################### | |
90 | MultiplicityScan(){ | |
91 | # | |
92 | # Here we submit the jobs for the simulation//reconstruction for one setting of IonTail and XTalk configuration | |
93 | # Parameters: | |
94 | # 1) multiplicity bins to be investigated (default 5) | |
95 | # 2) max multiplicity for whole processing (default 75000 tracks --> 5 central PbPb event ) | |
96 | # 3) number of central events to be used (default 5) | |
97 | # 4) Xtalk MC switch | |
98 | # 5) Xtalk Rec switch | |
99 | # 6) IonTail MC switch | |
100 | # 7) IonTail Rec switch | |
101 | # (2)/(3) should be a reasonable multiplicity estimate (e.g. 15000 tracks which is 1 central PbPb event) | |
102 | # Jobs will be submitted per event | |
103 | # | |
104 | # For each setting new directory will be created - indicating muiltiplicity | |
105 | # dir<ntracks>/dir<eventNr> | |
106 | # | |
107 | ############################################################################### | |
108 | ## how to run --> for 5 multiplicity bins, each most central event having 15000 track multiplicity. | |
109 | ## For each multiplicity bin total statistic is 75000 | |
110 | ## xtalkMC is ON, xtalkRec is OFF, iontailMC is OFF, iontailRec OFF | |
111 | if [ 1 -eq 0 ]; then | |
112 | cd $ALICE_ROOT/test/testdEdx | |
113 | source submitSimJobs.sh | |
114 | MultiplicityScan 2 1000000 2 1 0 0 0 > outMultiplicityScan.log 2>&1 & | |
115 | fi | |
116 | ############################################################################### | |
117 | ||
118 | # inputs | |
119 | nMultBins=$1 | |
120 | maxNTracks=$2 | |
121 | nEventsCentral=$3 | |
122 | xTalkMCswitch=$4 | |
123 | xTalkRecswitch=$5 | |
124 | ionTailMCswitch=$6 | |
125 | ionTailRecswitch=$7 | |
126 | ||
127 | ||
128 | if [ $# -ne 7 ]; then | |
129 | echo "MultiplicityScan: 7 parameters needed --> multiplicity bins, maximum number of tracks, maximum number of central events, xTalkMCswitch, xTalkRecswitch, ionTailMCswitch, ionTailRecswitch" | |
130 | return 1 | |
131 | fi | |
132 | ||
133 | baseDir=$(pwd) | |
134 | testDir=$baseDir/XTalk_mc$xTalkMCswitch\-rec$xTalkRecswitch\_IONTAIL_mc$ionTailMCswitch\-rec$ionTailRecswitch | |
135 | DirCheckCreate $testDir | |
136 | cd $testDir | |
137 | ||
138 | echo " ====================================================== " | |
139 | echo " first submit valgrind and callgrind jobs for debugging " | |
140 | valDir=$testDir/valgrind; DirCheckCreate $valDir; cd $valDir; cp -r $workDir/*.* . | |
141 | eval $qsubCommand $workDir/submitSimJobs.sh RunValgrind $valgrindNTracks $valgrindNEvents $4 $5 $6 $7 | |
142 | callDir=$testDir/callgrind; DirCheckCreate $callDir; cd $callDir; cp -r $workDir/*.* . | |
143 | eval $qsubCommand $workDir/submitSimJobs.sh RunCallgrind $valgrindNTracks $valgrindNEvents $4 $5 $6 $7 | |
144 | echo " ====================================================== " | |
145 | ||
146 | if [ $onlyValgrind == 0 ]; then | |
147 | # create multiplicity bins | |
148 | cd $testDir | |
149 | multPerCentralEvent=$(echo $maxNTracks/$nEventsCentral | bc) | |
150 | echo "multiplicity per most central event is $multPerCentralEvent" | |
151 | for ((i=0; i<$nMultBins ; i=i+1)) | |
8080da75 | 152 | do |
153 | ||
8a94851d | 154 | multSteps=$(echo $multPerCentralEvent/$nMultBins | bc) |
155 | multBin=$(echo $multPerCentralEvent - $multSteps*$i | bc) | |
156 | multBinDir=$testDir/mult_$multBin | |
157 | DirCheckCreate $multBinDir | |
158 | cd $multBinDir | |
159 | echo $multBinDir | |
8080da75 | 160 | |
8a94851d | 161 | nEventsPerMultBin=$(echo $maxNTracks/$multBin | bc) |
162 | echo $nEventsPerMultBin | |
163 | for ((j=1; j<$(echo $nEventsPerMultBin+1 | bc) ; j=j+1)) | |
164 | do | |
165 | ||
166 | eventDir=$multBinDir/event_$j | |
167 | DirCheckCreate $eventDir | |
168 | cd $eventDir | |
169 | cp -r $workDir/*.* . | |
8080da75 | 170 | |
8a94851d | 171 | eval $qsubCommand $workDir/submitSimJobs.sh runSim $multBin $nEventsPerJob $4 $5 $6 $7 |
172 | ||
173 | done | |
174 | done | |
175 | fi | |
176 | ||
177 | cd $baseDir | |
8080da75 | 178 | } |
179 | ############################################################################### | |
180 | runSim(){ | |
181 | ||
182 | # | |
8a94851d | 183 | # Function which runs rec.C and sim.C for given multiplicity and event number. |
8080da75 | 184 | # (if submitMultiplicityScan function is called, this parameter is always fixed to 1, i.e event by event) |
185 | # Input parameters are | |
186 | # 1) total track multiplicity | |
187 | # 2) number of events to be processed for given total track multiplicity (if submitMultiplicityScan() is called, it is 1) | |
8a94851d | 188 | # 3) Xtalk MC switch |
189 | # 4) Xtalk Rec switch | |
190 | # 5) IonTail MC switch | |
191 | # 6) IonTail Rec switch | |
8080da75 | 192 | ############################################################################### |
8a94851d | 193 | ## how to run --> 2 events with total multiplicity of 1000 tracks |
8080da75 | 194 | if [ 1 -eq 0 ]; then |
195 | cd $ALICE_ROOT/test/testdEdx | |
196 | source submitSimJobs.sh | |
8a94851d | 197 | runSim 100 1 1 0 0 0 > outRunSim.log 2>&1 & |
8080da75 | 198 | fi |
199 | ############################################################################### | |
200 | ||
201 | export TestdEdxNTracks=$1 | |
8a94851d | 202 | nEventsPerJob=$2 |
203 | xTalkMCswitch=$3 | |
204 | xTalkRecswitch=$4 | |
205 | ionTailMCswitch=$5 | |
206 | ionTailRecswitch=$6 | |
207 | ||
208 | if [ $# -ne 6 ]; then | |
209 | echo "runSim: 6 parameters needed --> multiplicity, number of events, xTalkMCswitch, xTalkRecswitch, ionTailMCswitch, ionTailRecswitch" | |
8080da75 | 210 | return 1 |
211 | fi | |
212 | ||
213 | echo " Running dEdx digitzer test job" | |
8a94851d | 214 | echo " NEvents = $nEventsPerJob" |
8080da75 | 215 | echo " NTracks per event $TestdEdxNTracks" |
216 | ||
8a94851d | 217 | # source aliroot environment |
218 | eval $alirootSource | |
219 | echo " ==================== ALIROOT environment used ======================== " | |
220 | cd $ALICE_ROOT | |
221 | which aliroot | |
222 | echo $(pwd) | |
223 | git describe --all | |
224 | git describe --dirty | |
225 | cd - | |
226 | echo " ====================================================================== " | |
227 | ||
8080da75 | 228 | |
229 | ## main body of the simulation part | |
8a94851d | 230 | rm -rf *.root *.dat *.log fort* hlt hough raw* recraw/*.root recraw/*.log |
533f5c16 | 231 | printf "\n ======================================================================\n\n" |
8a94851d | 232 | echo Running: aliroot -b -q sim.C\(-1,$ionTailMCswitch,$xTalkMCswitch\) |
233 | aliroot -b -q sim.C\(-1,$ionTailMCswitch,$xTalkMCswitch\) # make a specific OCDB for simulation | |
234 | ||
235 | echo Running: aliroot -b -q sim.C\($nEventsPerJob,$ionTailMCswitch,$xTalkMCswitch\) | |
236 | aliroot -b -q sim.C\($nEventsPerJob,$ionTailMCswitch,$xTalkMCswitch\) 2>&1 | tee sim.log | |
8080da75 | 237 | mv syswatch.log simwatch.log |
533f5c16 | 238 | printf "\n ======================================================================\n\n" |
8a94851d | 239 | |
240 | echo Running: aliroot -b -q rec.C\($ionTailRecswitch\,$xTalkRecswitch\) | |
241 | aliroot -b -q rec.C\($ionTailRecswitch\,$xTalkRecswitch\) 2>&1 | tee rec.log | |
8080da75 | 242 | mv syswatch.log recwatch.log |
8a94851d | 243 | |
8080da75 | 244 | ## OCDB entries to be dumped in human readable format |
245 | source $ALICE_ROOT/PWGPP/CalibMacros/AliOCDBtoolkit.sh | |
533f5c16 | 246 | printf "\n ======================================================================\n\n" |
247 | echo Running: ocdbMakeTable AliESDs.root "ESD" OCDBrec.list | |
8080da75 | 248 | ocdbMakeTable AliESDs.root "ESD" OCDBrec.list |
533f5c16 | 249 | printf "\n ======================================================================\n\n" |
250 | echo Running: ocdbMakeTable galice.root MC OCDBsim.list | |
8080da75 | 251 | ocdbMakeTable galice.root MC OCDBsim.list |
252 | ocdbFileName=$(cat OCDBrec.list | grep "TPC/Calib/RecoParam" | gawk '{print $2"/"$3}' ) | |
533f5c16 | 253 | printf "\n ======================================================================\n\n" |
254 | echo Running: dumpObject $ocdbFileName "object" "XML" RecoParam | |
8080da75 | 255 | dumpObject $ocdbFileName "object" "XML" RecoParam |
256 | ||
257 | return 1; | |
258 | ||
259 | } | |
260 | ############################################################################### | |
8a94851d | 261 | RunCallgrind() |
262 | { | |
263 | # Run Callgrind | |
264 | # Input parameters are | |
265 | # 1) total track multiplicity | |
266 | # 2) number of events to be processed for given total track multiplicity | |
267 | # 3) Xtalk MC switch; 0 or 1 | |
268 | # 4) Xtalk Rec switch; 0 or 1 | |
269 | # 5) IonTail MC switch; 0 or 1 | |
270 | # 6) IonTail Rec switch; 0 or 1 | |
8080da75 | 271 | ############################################################################### |
8a94851d | 272 | ## how to run |
8080da75 | 273 | if [ 1 -eq 0 ]; then |
8a94851d | 274 | source submitSimJobs.sh |
275 | RunCallgrind 100 1 1 0 0 0 > outRunCallgrind.log 2>&1 & | |
8080da75 | 276 | fi |
277 | ############################################################################### | |
278 | ||
8a94851d | 279 | export TestdEdxNTracks=$1 |
280 | nEventsPerJob=$2 | |
281 | xTalkMCswitch=$3 | |
282 | xTalkRecswitch=$4 | |
283 | ionTailMCswitch=$5 | |
284 | ionTailRecswitch=$6 | |
285 | ||
286 | if [ $# -ne 6 ]; then | |
287 | echo "runSim: 6 parameters needed --> multiplicity, number of events, xTalkMCswitch, xTalkRecswitch, ionTailMCswitch, ionTailRecswitch" | |
8080da75 | 288 | return 1 |
289 | fi | |
290 | ||
8a94851d | 291 | eval $alirootSource |
8080da75 | 292 | |
8a94851d | 293 | ## main body of the simulation part |
294 | rm -rf *.root *.dat *.log fort* hlt hough raw* recraw/*.root recraw/*.log | |
295 | printf "\n ======================================================================\n\n" | |
296 | echo Running: aliroot -b -q sim.C\(-1,$ionTailMCswitch,$xTalkMCswitch\) | |
297 | aliroot -b -q sim.C\(-1,$ionTailMCswitch,$xTalkMCswitch\) # make a specific OCDB for simulation | |
298 | ||
299 | # run callgrind for sim.C | |
300 | echo Running: callgrind aliroot -b -q sim.C\($nEventsPerJob,$ionTailMCswitch,$xTalkMCswitch\) | |
301 | $callgrindCommand aliroot -b -q sim.C\($nEventsPerJob,$ionTailMCswitch,$xTalkMCswitch\) 2>&1 | tee sim.log | |
302 | mv syswatch.log simwatch.log | |
303 | printf "\n ======================================================================\n\n" | |
8080da75 | 304 | |
8a94851d | 305 | # new directory for valgrind of the rec |
306 | callDirRec=$(pwd)/callgrind_Rec | |
307 | mkdir $callDirRec | |
308 | cp -rf $(pwd)/GRP $(pwd)/OCDB* $(pwd)/*.* $callDirRec/ | |
309 | cd $callDirRec | |
8080da75 | 310 | |
8a94851d | 311 | # run callgrind for rec.C |
312 | echo Running: callgrind aliroot -b -q rec.C\($ionTailRecswitch\,$xTalkRecswitch\) | |
313 | $callgrindCommand aliroot -b -q rec.C\($ionTailRecswitch\,$xTalkRecswitch\) 2>&1 | tee rec.log | |
314 | mv syswatch.log recwatch.log | |
8080da75 | 315 | |
8a94851d | 316 | return 1; |
8080da75 | 317 | |
8a94851d | 318 | } |
319 | ############################################################################### | |
320 | ################### | |
321 | RunValgrind() | |
322 | { | |
323 | # | |
324 | # Run Valgrind | |
325 | # Input parameters are | |
326 | # Input parameters are | |
327 | # 1) total track multiplicity | |
328 | # 2) number of events to be processed for given total track multiplicity (if submitMultiplicityScan() is called, it is 1) | |
329 | # 3) Xtalk MC switch | |
330 | # 4) Xtalk Rec switch | |
331 | # 5) IonTail MC switch | |
332 | # 6) IonTail Rec switch | |
333 | ############################################################################### | |
334 | ## how to run | |
335 | if [ 1 -eq 0 ]; then | |
336 | cd $ALICE_ROOT/test/testdEdx | |
337 | source submitSimJobs.sh | |
338 | RunValgrind 100 1 1 0 0 0 > outRunValgrind.log 2>&1 & | |
339 | fi | |
340 | ############################################################################### | |
8080da75 | 341 | |
8a94851d | 342 | export TestdEdxNTracks=$1 |
343 | nEventsPerJob=$2 | |
344 | xTalkMCswitch=$3 | |
345 | xTalkRecswitch=$4 | |
346 | ionTailMCswitch=$5 | |
347 | ionTailRecswitch=$6 | |
348 | ||
349 | if [ $# -ne 6 ]; then | |
350 | echo "runSim: 6 parameters needed --> multiplicity, number of events, xTalkMCswitch, xTalkRecswitch, ionTailMCswitch, ionTailRecswitch" | |
351 | return 1 | |
352 | fi | |
353 | ||
354 | eval $alirootSource | |
355 | ||
356 | ## main body of the simulation part | |
357 | rm -rf *.root *.dat *.log fort* hlt hough raw* recraw/*.root recraw/*.log | |
358 | printf "\n ======================================================================\n\n" | |
359 | echo Running: aliroot -b -q sim.C\(-1,$ionTailMCswitch,$xTalkMCswitch\) | |
360 | aliroot -b -q sim.C\(-1,$ionTailMCswitch,$xTalkMCswitch\) # make a specific OCDB for simulation | |
361 | ||
362 | # run valgrind for sim.C | |
363 | echo Running: valgrind aliroot -b -q sim.C\($nEventsPerJob,$ionTailMCswitch,$xTalkMCswitch\) | |
364 | $valgrindCommand aliroot -b -q sim.C\($nEventsPerJob,$ionTailMCswitch,$xTalkMCswitch\) 2>&1 | tee sim.log | |
365 | mv syswatch.log simwatch.log | |
366 | printf "\n ======================================================================\n\n" | |
367 | ||
368 | # new directory for valgrind of the rec | |
369 | valDirRec=$(pwd)/valgrind_Rec | |
370 | mkdir $valDirRec | |
371 | cp -r $(pwd)/GRP $(pwd)/OCDB* $(pwd)/*.* $valDirRec/ | |
372 | cd $valDirRec | |
373 | ||
374 | # run valgrind for rec.C | |
375 | echo Running: valgrind aliroot -b -q rec.C\($ionTailRecswitch\,$xTalkRecswitch\) | |
376 | $valgrindCommand aliroot -b -q rec.C\($ionTailRecswitch\,$xTalkRecswitch\) 2>&1 | tee rec.log | |
377 | mv syswatch.log recwatch.log | |
378 | ||
379 | return 1; | |
380 | ||
8080da75 | 381 | } |
382 | ############################################################################### | |
383 | DirCheckCreate() | |
384 | { | |
385 | ||
386 | # | |
387 | # check if the directory exist. If so, delete it | |
388 | # | |
389 | ||
390 | dirName=$1 | |
391 | if [ -d "$dirName" ]; then | |
392 | echo " $dirName already exist delete it and create a new one " | |
393 | rm -rf $dirName | |
394 | fi | |
395 | mkdir $dirName | |
396 | ||
397 | } | |
398 | ############################################################################### | |
399 | main() | |
400 | { | |
401 | eval "$@" | |
402 | } | |
403 | ||
404 | main $@ | |
405 |