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

Last change on this file since 7572 was 7486, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.2 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-2006
23#
24#
25# ========================================================================
26#
27# This script is an intermediate solution to process the montecarlo files.
28# As soon as the montecarlo database is running, this script shall be
29# exchanged.
30#
31# The script is processing the montecarlo sequences: callisto and star
32#
33
34user=`whoami`
35program=processmcsequences
36source /home/$user/Mars/datacenter/scripts/sourcefile
37
38set -C
39
40scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
41makedir $scriptlogpath
42scriptlog=$scriptlogpath/$program`date +%F-%H-%M-%S`.log
43
44date >> $scriptlog 2>&1
45
46# check if script is already running
47lockfile=$lockpath/lock-$program.txt
48checklock >> $scriptlog 2>&1
49
50mcpath=/montecarlo/rawfiles
51mccalpath=/montecarlo/callisto
52mcimgpath=/montecarlo/star
53mcsequpath=/montecarlo/sequences
54callistorc=$setuppath/callisto/callisto.rc
55
56cd $mars
57
58# find montecarlo sequence files
59sequfiles=`find $mcsequpath -type f`
60for sequfile in ${sequfiles[@]}
61do
62 sequno=`echo $sequfile | cut -c 36-43`
63 no=`echo $sequno | cut -c 0-4`
64 date=`grep Night $sequfile | cut -c 18-29 | sed -e 's/-/\//g'`
65 caloutpath=$mccalpath/$no/$sequno
66 makedir $caloutpath >> $scriptlog 2>&1
67
68 # continue with next sequence, if sequence is already processed
69 # or processing of sequence is just running
70 if ls $caloutpath/.done >> $scriptlog 2>&1
71 then
72 continue
73 fi
74 if ls $caloutpath/.doing >> $scriptlog 2>&1
75 then
76 continue
77 fi
78
79 # lock file
80 touch $caloutpath/.doing
81 echo "processing sequ $sequfile" >> $scriptlog 2>&1
82 # find callisto.rc file
83 if [ -e $caloutpath/callisto.rc ]
84 then
85 echo "found callisto.rc in $caloutpath -> using this " >> $scriptlog 2>&1
86 callistorcseq=$caloutpath/callisto.rc
87 else
88 echo "no callisto.rc found in $caloutpath -> making link " >> $scriptlog 2>&1
89 ln -vs $callistorc $caloutpath/callisto.rc >> $scriptlog 2>&1
90 callistorcseq=$caloutpath/callisto.rc
91 fi
92 # calibrate data
93 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
94 ./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
95 check1=$?
96 # if calibration worked -> run star for sequence
97 case $check1 in
98 0) echo "check1=$check1 -> everything ok..." >> $scriptlog 2>&1
99 touch $caloutpath/.done
100 rm $caloutpath/.doing
101 imgoutpath=$mccalpath/$no/$sequno
102 makedir $imgoutpath >> $scriptlog 2>&1
103
104 ./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
105 check2=$?
106
107 case $check2 in
108 0) echo "check2=$check2 -> everything ok..." >> $scriptlog 2>&1
109 touch $imgoutpath/.done
110 ;;
111 *) echo "check2=$check2 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
112 ;;
113 esac
114 ;;
115 *) echo "check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1;;
116 esac
117done
118
119rm -v $lockfile >> $scriptlog 2>&1
120
121set +C
122
123date >> $scriptlog 2>&1
124
Note: See TracBrowser for help on using the repository browser.