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

Last change on this file since 7572 was 7572, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.3 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
35user=`whoami`
36program=makecallistolinks
37source /home/$user/Mars/datacenter/scripts/sourcefile
38
39set -C
40
41callistorcseq=callisto.rc
42callistorcnew=callisto_Dec04Jan05.rc
43
44scriptlogpath=$logpath/run/$program/`date +%Y/%m/%d`
45makedir $scriptlogpath
46scriptlog=$scriptlogpath/$program`date +%F`.log
47
48date >> $scriptlog 2>&1
49
50# check if script is already running
51lockfile=$lockpath/lock-$program.txt
52checklock >> $scriptlog 2>&1
53
54# reason why calibration with standard callisto.rc fails
55reason1="Pulse is too much to the right, cannot go beyond logain limits!"
56reason2="Pulse is too much to the left, cannot go below 0!"
57echo "reason: "$reason >> $scriptlog 2>&1
58
59# find files containing reason
60files=`find $datapath/callisto/ -name callisto*.log`
61
62# make links for callisto.rc for which the callisto.log contains reason
63for file in $files
64do
65 pulse=`cat $file | grep "$reason1\|$reason2"` >> $scriptlog 2>&1
66 sequ=`echo $file | cut -d/ -f6`
67
68 if [ ! "$pulse" = "" ]
69 then
70 if ! ls -l $callistorcseq | grep $callistorcnew >> $scriptlog 2>&1
71 then
72 # resetting the calibration
73 echo "resetting the callisto for sequence $sequ" >> $scriptlog 2>&1
74 resetlogpath=$logpath/resetcallisto
75 echo "resetlogpath: $resetlogpath" >> $scriptlog 2>&1
76 makedir $resetlogpath >> $scriptlog 2>&1
77 resetlog=$resetlogpath/reset-callisto-$sequ.log
78
79 check1=`root -q -b $macrospath/resetcolumn.C+\("\"fCallisto\""\,"\"SequenceProcessStatus\""\,"\"$sequ\""\,"\"$sequ\""\,kFALSE\) | tee $resetlog | grep int | sed -e 's/(int)//'`
80 case $check1 in
81 1) echo "check1=$check1 -> everything ok, callisto has been reset " >> $scriptlog 2>&1
82 ;;
83 *) echo "check1=$check1 -> ERROR -> step could not be resetted -> continue " >> $scriptlog 2>&1
84 continue ;;
85 esac
86 #linking callisto.rc
87 path=`dirname $file` >> $scriptlog 2>&1
88 ln -vfs $setuppath/callisto/$callistorcnew $path/$callistorcseq >> $scriptlog 2>&1
89 fi
90 fi
91done
92
93rm -v $lockfile >> $scriptlog 2>&1
94
95set +C
96
97date >> $scriptlog 2>&1
98
Note: See TracBrowser for help on using the repository browser.