1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # ========================================================================
|
---|
4 | #
|
---|
5 | # *
|
---|
6 | # * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
7 | # * Software. It is distributed to you in the hope that it can be a useful
|
---|
8 | # * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
9 | # * It is distributed WITHOUT ANY WARRANTY.
|
---|
10 | # *
|
---|
11 | # * Permission to use, copy, modify and distribute this software and its
|
---|
12 | # * documentation for any purpose is hereby granted without fee,
|
---|
13 | # * provided that the above copyright notice appear in all copies and
|
---|
14 | # * that both that copyright notice and this permission notice appear
|
---|
15 | # * in supporting documentation. It is provided "as is" without express
|
---|
16 | # * or implied warranty.
|
---|
17 | # *
|
---|
18 | #
|
---|
19 | #
|
---|
20 | # Author(s): Daniela Dorner 04/2009 <mailto:daniela.dorner@unige.ch>
|
---|
21 | #
|
---|
22 | # Copyright: MAGIC Software Development, 2000-2009
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 |
|
---|
28 | rootsys=/opt/root5.12.i386
|
---|
29 | source `dirname $0`/sourcefile
|
---|
30 | printprocesslog "INFO starting $0"
|
---|
31 | program=ctastar
|
---|
32 | column=fCTAStar
|
---|
33 | bcnmars=/home/dorner/Mars.BCN.2009.03.27.cvs
|
---|
34 |
|
---|
35 | set -C
|
---|
36 |
|
---|
37 | node=`echo $HOSTNAME | sed -e 's/compute-0-//' -e 's/[.]local//'`
|
---|
38 | printprocesslog "INFO $program is running on node $node"
|
---|
39 | # get run #
|
---|
40 | gettodo "1" $node
|
---|
41 | run=${primaries[0]}
|
---|
42 |
|
---|
43 | # lock sequ
|
---|
44 | lockfile=$lockpath/lock-$table-$column-$run.txt
|
---|
45 | checklock
|
---|
46 |
|
---|
47 | printprocesslog "INFO starting $program for run $run"
|
---|
48 |
|
---|
49 | #get particle for file name
|
---|
50 | particles[1]="gamma"
|
---|
51 | particles[14]="proton"
|
---|
52 | particles[6]="muon"
|
---|
53 | particles[3]="electron"
|
---|
54 | query="select fParticleTypeKEY from MCRunData where fMCRunNumber=$run"
|
---|
55 | key=( `mysql -P 3306 -u operator --password=Ics+eMM! --host=mysql.isdc.unige.ch CTA_MC -s -e "$query"` )
|
---|
56 | particle=${particles[$key]}
|
---|
57 | infile=$mcpath/chimp/cta-ultra3/0.0deg/Data/${particle}_20deg_90deg_run`printf '%06d' ${run}`___cta-ultra3_desert.root
|
---|
58 | outpath=$mcpath/star
|
---|
59 | outfile=$outpath/${particle}_20deg_90deg_run`printf '%06d' ${run}`___cta-ultra3_desert_I.root
|
---|
60 | starpath=/home/dorner/data/star
|
---|
61 | makedir $starpath
|
---|
62 | logfile=$outpath/CTAstar_run`printf '%06d' ${run}`.log
|
---|
63 | makedir $outpath
|
---|
64 |
|
---|
65 | setstatus "start"
|
---|
66 |
|
---|
67 | cd $bcnmars
|
---|
68 |
|
---|
69 | printprocesslog "INFO starting: root -q -b macros/CTAstar.C\("\"$infile\""\,"\"$outpath\""\) | tee $logfile | intgrep"
|
---|
70 | check1=`root -q -b macros/CTAstar.C\(\""$infile\""\,\""$outpath\""\) | tee $logfile | intgrep`
|
---|
71 |
|
---|
72 | case $check1 in
|
---|
73 | 1) printprocesslog "INFO $program finished successfully for run $run (check1=$check1)"
|
---|
74 | if ! cp $outfile $starpath
|
---|
75 | then
|
---|
76 | printprocesslog "ERROR copying $outfile to $starpath failed"
|
---|
77 | com=$Fctastarcp
|
---|
78 | check=2
|
---|
79 | else
|
---|
80 | printprocesslog "INFO copied $outfile successfully to $starpath"
|
---|
81 | fi
|
---|
82 | ;;
|
---|
83 | *) printprocesslog "ERROR $program failed for run $run (check1=$check1)"
|
---|
84 | com=$Fctastar
|
---|
85 | check=$check1
|
---|
86 | ;;
|
---|
87 | esac
|
---|
88 |
|
---|
89 | setstatus "stop"
|
---|
90 |
|
---|
91 | finish
|
---|
92 |
|
---|