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 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
|
---|
21 | #
|
---|
22 | # Copyright: MAGIC Software Development, 2000-2004
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | #
|
---|
28 | #
|
---|
29 | ##############################################################################
|
---|
30 | #
|
---|
31 | # This script can be used to run the following steps for one sequence:
|
---|
32 | # - callisto
|
---|
33 | # - merppupdate
|
---|
34 | # - star
|
---|
35 | #
|
---|
36 | # You have to set the path, where your Mars version can be found, the outpath,
|
---|
37 | # where you want to store the output and the sequencenumber of the sequence
|
---|
38 | # you want to process
|
---|
39 | #
|
---|
40 | ##############################################################################
|
---|
41 |
|
---|
42 | #function to create directory
|
---|
43 | function makedir()
|
---|
44 | {
|
---|
45 | if [ ! -d $@ ]
|
---|
46 | then
|
---|
47 | mkdir -pv $@
|
---|
48 | if [ ! -d $@ ]
|
---|
49 | then
|
---|
50 | echo "could not make dir "$@
|
---|
51 | exit
|
---|
52 | fi
|
---|
53 | fi
|
---|
54 | }
|
---|
55 |
|
---|
56 |
|
---|
57 | #to be set by the user
|
---|
58 | mars=/home/user/Mars
|
---|
59 | outpath=/home/user/outpath
|
---|
60 | sequence=55221
|
---|
61 |
|
---|
62 |
|
---|
63 | #needed if not set in .bashrc or when script is e.g. executed in cronjob
|
---|
64 | export ROOTSYS=/opt/root_v4.04.02g
|
---|
65 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
|
---|
66 | export PATH=$PATH:$ROOTSYS/bin
|
---|
67 |
|
---|
68 |
|
---|
69 | no=`printf %08d $sequence | cut -c 1-4`
|
---|
70 | sequfile="/magic/sequences/"$no"/sequence"`printf %08d $sequence`".txt"
|
---|
71 | calpath=$outpath"/callisto/"`printf %08d $sequence`
|
---|
72 | starpath=$outpath"/star/"`printf %08d $sequence`
|
---|
73 |
|
---|
74 | echo "mars: "$mars
|
---|
75 | echo "outpath: "$outpath
|
---|
76 | echo "sequence: "$sequence
|
---|
77 | echo "sequfile: "$sequfile
|
---|
78 | echo "path where calibration files are stored : "$calpath
|
---|
79 | echo "path where star files are stored : "$starpath
|
---|
80 |
|
---|
81 | makedir $calpath
|
---|
82 | makedir $starpath
|
---|
83 |
|
---|
84 | cd $mars
|
---|
85 |
|
---|
86 | echo "run callisto..."
|
---|
87 | echo "./callisto -b -q -f --log=$calpath/callisto$sequence.log --out=$calpath $sequfile "
|
---|
88 | ./callisto -b -q -f --log=$calpath/callisto$sequence.log --out=$calpath $sequfile
|
---|
89 | echo "callisto is finished "
|
---|
90 | echo ""
|
---|
91 |
|
---|
92 |
|
---|
93 |
|
---|
94 | calfiles=`find $calpath -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*_Y_*.root`
|
---|
95 |
|
---|
96 | echo "run merpp update for calibrated files..."
|
---|
97 | echo "calibrated data files: "$calfiles
|
---|
98 |
|
---|
99 | for calfile in ${calfiles[@]}
|
---|
100 | do
|
---|
101 | echo "calfile: "$calfile
|
---|
102 | outpath=`dirname $calfile`
|
---|
103 | echo "outpath: "$outpath
|
---|
104 |
|
---|
105 | merpplogpath=$outpath"/merpplogs"
|
---|
106 | makedir $merpplogpath
|
---|
107 |
|
---|
108 | runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
|
---|
109 | ccfile=`find /magic/subsystemdata/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep`
|
---|
110 | cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_*.txt`
|
---|
111 | echo "runno: "$runno
|
---|
112 | echo "ccfile: "$ccfile
|
---|
113 | if [ "$ccfile" = "" ]
|
---|
114 | then
|
---|
115 | echo "no ccfile found for run "$runno
|
---|
116 | break
|
---|
117 | fi
|
---|
118 | echo "cacofile: "$cacofile
|
---|
119 | if [ "$cacofile" = "" ]
|
---|
120 | then
|
---|
121 | echo "no cacofile found for run "$runno
|
---|
122 | echo "finding cacofile..."
|
---|
123 | for (( i = 0; i <= 10; i++ ))
|
---|
124 | do
|
---|
125 | newrun=`echo $runno - $i | bc`
|
---|
126 | # echo "$missingcacorun + $i = $newrun"
|
---|
127 | path=`dirname $ccfile`
|
---|
128 | path=`echo $path | sed -e 's/cc/caco/'`
|
---|
129 | echo "path: "$path
|
---|
130 | cacofile=`find $path -name *$newrun*`
|
---|
131 | if [ "$cacofile" = "" ]
|
---|
132 | then
|
---|
133 | continue
|
---|
134 | else
|
---|
135 | break
|
---|
136 | echo "cacofile: "$cacofile
|
---|
137 | fi
|
---|
138 | done
|
---|
139 | fi
|
---|
140 | echo "./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile "
|
---|
141 | ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile
|
---|
142 |
|
---|
143 | echo "./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile "
|
---|
144 | ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile
|
---|
145 | done
|
---|
146 | echo "merppupdate is finished"
|
---|
147 | echo ""
|
---|
148 |
|
---|
149 |
|
---|
150 |
|
---|
151 | echo "run star..."
|
---|
152 | echo "./star -b -q -f --log=$starpath/star$sequence.log --ind=$callistopath --out=$starpath $sequfile "
|
---|
153 | ./star -b -q -f --log=$starpath/star$sequence.log --ind=$callistopath --out=$starpath $sequfile
|
---|
154 | echo "star is finished "
|
---|
155 |
|
---|
156 |
|
---|