source: trunk/MagicSoft/Mars/datacenter/scripts/makecallistolinks@ 7815

Last change on this file since 7815 was 7815, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.5 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 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2006
23#
24#
25# ========================================================================
26#
27# This script links a special callisto.rc for data, for which the
28# calibration with the standard callisto.rc failes.
29#
30# The sequences with failing calibration are searched by searching for the
31# reason of failure in the callisto.log Then the special callisto.rc is
32# linked to the directory of the sequence.
33#
34
35program=makecallistolinks
36source /home/$USER/Mars/datacenter/scripts/sourcefile
37
38set -C
39
40callistorcseq=callisto.rc
41callistorcnew=callisto_Dec04Jan05.rc
42
43scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
44makedir $scriptlogpath
45scriptlog=$scriptlogpath/$program`date +%F`.log
46
47date >> $scriptlog 2>&1
48
49# check if script is already running
50lockfile=$lockpath/lock-$program.txt
51checklock >> $scriptlog 2>&1
52
53# reason why calibration with standard callisto.rc fails
54reason1="Pulse is too much to the right, cannot go beyond logain limits!"
55reason2="Pulse is too much to the left, cannot go below 0!"
56echo "reason1: "$reason1 >> $scriptlog 2>&1
57echo "reason2: "$reason2 >> $scriptlog 2>&1
58
59# find files containing reason
60files=`find $datapath/callisto/ -name callisto*.log`
61if [ "$files" = "" ]
62then
63 echo "nothing to do -> exit" >> $scriptlog 2>&1
64 rm -v $lockfile >> $scriptlog 2>&1
65fi
66
67column=fCallisto
68table=SequenceProcessStatus
69
70cd $mars
71
72# make links for callisto.rc for which the callisto.log contains reason
73for file in $files
74do
75 pulse=`cat $file | grep "$reason1\|$reason2"`
76 sequ=`echo $file | cut -d/ -f6`
77 path=`dirname $file`
78 callistorc=$path/$callistorcseq
79
80 if [ ! "$pulse" = "" ]
81 then
82 if ! ls -l $callistorc | grep $callistorcnew >> $scriptlog 2>&1
83 then
84 # resetting the calibration
85 echo "resetting the callisto for sequence $sequ" >> $scriptlog 2>&1
86 echo " reason: $pulse" >> $scriptlog 2>&1
87 resetlogpath=$logpath/resetcallisto
88 echo "resetlogpath: $resetlogpath" >> $scriptlog 2>&1
89 makedir $resetlogpath >> $scriptlog 2>&1
90 resetlog=$resetlogpath/reset-callisto-$sequ.log
91
92 check1=`root -q -b $macrospath/resetcolumn.C+\("\"$column\""\,"\"$table\""\,"\"$sequ\""\,"\"$sequ\""\,kFALSE\) | tee $resetlog | grep int | sed -e 's/(int)//'`
93 case $check1 in
94 1) echo "check1=$check1 -> everything ok, callisto has been reset " >> $scriptlog 2>&1
95 ;;
96 *) echo "check1=$check1 -> ERROR -> step could not be resetted -> continue " >> $scriptlog 2>&1
97 continue ;;
98 esac
99 #linking callisto.rc
100 ln -vfs $setuppath/callisto/$callistorcnew $callistorc >> $scriptlog 2>&1
101 fi
102 fi
103done
104
105rm -v $lockfile >> $scriptlog 2>&1
106
107set +C
108
109date >> $scriptlog 2>&1
110
Note: See TracBrowser for help on using the repository browser.