source: trunk/MagicSoft/Mars/scripts/merppupdate@ 8488

Last change on this file since 8488 was 8488, checked in by Daniela Dorner, 18 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.7 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 05/2007 <mailto:dorner@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2007
23#
24#
25# ========================================================================
26#
27#
28#
29##############################################################################
30#
31# This script can be used to do the merppupdate for already calibrated data.
32#
33# You have to set the path, where your calibrated files are stored.
34#
35##############################################################################
36
37# to be set by the user:
38# the directory, where the *_Y_*-files of your calibration are stored
39outpath=
40
41#regular expression for the filename
42name2=
43
44if ! [ "$1" = "" ]
45then
46 outpath=$1
47 if ! [ "$2" = "" ]
48 then
49 name2=" -name $2"
50 if ! [ "$3" = "" ]
51 then
52 echo "You gave too many arguments."
53 exit
54 fi
55 fi
56fi
57
58if [ "$outpath" = "" ]
59then
60 echo "You have to give an outpath."
61 exit
62fi
63
64if ! ls $outpath >/dev/null 2>&1
65then
66 echo "Your outpath is not valid."
67 exit
68fi
69
70
71calfiles=`find $outpath -name 20*_Y_*_E.root $name2 `
72
73echo "calfiles: "$calfiles
74
75for calfile in ${calfiles[@]}
76do
77 echo "updating $calfile..."
78
79 merpplogpath=$outpath"/merpplogs"
80 if [ ! -d $merpplogpath ]
81 then
82 mkdir -pv $merpplogpath
83 if [ ! -d $merpplogpath ]
84 then
85 echo "could not make merpplogpath "$merpplogpath
86 exit
87 fi
88 fi
89
90 runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
91 date=`date --date \`basename $calfile | cut -d_ -f1\` +%Y/%m/%d`
92 ccfile=`find /magic/subsystemdata/cc/$date -name 20[0-2][0-9][01][0-9][0-3][0-9]_*${runno}_[PDCS]_*_S.rep`
93 cacofile=`find /magic/subsystemdata/caco/$date -name dc_20[0-2][0-9]_[01][0-9]_[0-3][0-9]_*${runno}_*.txt`
94 echo "runno: "$runno
95 echo "ccfile: "$ccfile
96 if [ "$ccfile" = "" ]
97 then
98 echo "no ccfile found for run "$runno
99 break
100 fi
101 if [ "$cacofile" = "" ]
102 then
103 echo "cacofile with no $runno not found" >> $scriptlog 2>&1
104 echo "finding cacofile..." >> $scriptlog 2>&1
105 for (( i = 0; i <= 10; i++ ))
106 do
107 newrun=`echo $runno - $i | bc`
108 cacofile=`find $cacopath -name *$newrun*`
109 if [ "$cacofile" = "" ]
110 then
111 if [ $i -eq 9 ]
112 then
113 echo "no cacofile found for runno $newrun in $cacopath" >> $scriptlog 2>&1
114 break 2
115 fi
116 continue
117 else
118 break
119 fi
120 done
121 fi
122 echo "cacofile: "$cacofile
123 ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile
124 echo "./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile "
125
126 ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile
127 echo "./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile "
128
129done
130
Note: See TracBrowser for help on using the repository browser.