source: trunk/MagicSoft/Mars/datacenter/scripts/processmcsequences@ 7452

Last change on this file since 7452 was 7448, checked in by Daniela Dorner, 20 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.1 KB
Line 
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 12/2005 <mailto:dorner@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2004
23#
24#
25# ========================================================================
26#
27#
28
29user=`whoami`
30source /home/$user/Mars/datacenter/scripts/sourcefile
31
32set -C
33
34scriptlogpath=$logpath/run/processmcsequences/`date +%Y/%m/%d`
35makedir $scriptlogpath
36scriptlog=$scriptlogpath/processmcsequences`date +%F-%H-%M-%S`.log
37
38date >> $scriptlog 2>&1
39
40lockfile=$lockpath/lock-processmcsequences.txt
41date > $lockfile >> $scriptlog 2>&1
42checklock0=$?
43case $checklock0 in
44 0) echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
45 1) echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
46 echo "-> linkmc is running -> exit" >> $scriptlog 2>&1
47 date >> $scriptlog 2>&1
48 exit;;
49 *) echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
50esac
51
52
53mcpath=/montecarlo/rawfiles
54mccalpath=/montecarlo/callisto
55mcimgpath=/montecarlo/star
56mcsequpath=/montecarlo/sequences
57callistorc=$setuppath/callisto/callisto.rc
58
59sequfiles=`find $mcsequpath -type f`
60
61cd $mars
62
63for sequfile in ${sequfiles[@]}
64do
65 sequno=`echo $sequfile | cut -c 36-43`
66 no=`echo $sequno | cut -c 0-4`
67 date=`grep Night $sequfile | cut -c 18-29 | sed -e 's/-/\//g'`
68 caloutpath=$mccalpath/$no/$sequno
69 makedir $caloutpath >> $scriptlog 2>&1
70
71 if ls $caloutpath/.done >> $scriptlog 2>&1
72 then
73 continue
74 fi
75
76 if ls $caloutpath/.doing >> $scriptlog 2>&1
77 then
78 continue
79 fi
80
81 touch $caloutpath/.doing
82
83 echo "processing sequ $sequfile" >> $scriptlog 2>&1
84
85 if [ -e $caloutpath/callisto.rc ]
86 then
87 echo "found callisto.rc in $caloutpath -> using this " >> $scriptlog 2>&1
88 callistorcseq=$caloutpath/callisto.rc
89 else
90 echo "no callisto.rc found in $caloutpath -> making link " >> $scriptlog 2>&1
91 ln -vs $callistorc $caloutpath/callisto.rc >> $scriptlog 2>&1
92 callistorcseq=$caloutpath/callisto.rc
93 fi
94
95 echo "./callisto -mc -f -b -q --ind=$mcpath/$date --log=$caloutpath/callisto$sequno.log --html=$caloutpath/callisto$sequno.html --out=$caloutpath --config=$callistorcseq $sequfile 2>> $scriptlog > /dev/null" >> $scriptlog 2>&1
96 ./callisto -mc -f -b -q --ind=$mcpath/$date --log=$caloutpath/callisto$sequno.log --html=$caloutpath/callisto$sequno.html --out=$caloutpath --config=$callistorcseq $sequfile 2>> $scriptlog > /dev/null
97 check1=$?
98
99 case $check1 in
100 0) echo "check1=$check1 -> everything ok..." >> $scriptlog 2>&1
101 touch $caloutpath/.done
102 rm $caloutpath/.doing
103 imgoutpath=$mccalpath/$no/$sequno
104 makedir $imgoutpath >> $scriptlog 2>&1
105 ./star -b -q -v4 -f -mc --log=$imgoutpath/star$sequno.log --html=$imgoutpath/star$sequno.html --ind=$caloutpath --out=$imgoutpath $sequfile 2>> $scriptlog> /dev/null
106 check2=$?
107
108 case $check2 in
109 0) echo "check2=$check2 -> everything ok..." >> $scriptlog 2>&1
110 touch $imgoutpath/.done
111 ;;
112 *) echo "check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
113 ;;
114 esac
115 ;;
116 *) echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
117 esac
118done
119
120
121rm -v $lockfile >> $scriptlog 2>&1
122
123set +C
124
125date >> $scriptlog 2>&1
126
Note: See TracBrowser for help on using the repository browser.