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

Last change on this file since 8629 was 8629, checked in by Daniela Dorner, 17 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=$1
50 else
51 name2="20*_Y_*_E.root"
52 fi
53
54 if ! [ "$3" = "" ]
55 then
56 echo "You gave too many arguments."
57 exit
58 fi
59fi
60
61if [ "$outpath" = "" ]
62then
63 echo "You have to give an outpath."
64 exit
65fi
66
67if ! ls $outpath >/dev/null 2>&1
68then
69 echo "Your outpath is not valid."
70 exit
71fi
72
73echo $1
74echo $2
75
76echo $outpath
77echo $name2
78
79calfiles=`find $outpath -name $name2 `
80
81echo "calfiles: "$calfiles
82
83for calfile in ${calfiles[@]}
84do
85 echo "updating $calfile..."
86
87 merpplogpath=$outpath"/merpplogs"
88 if [ ! -d $merpplogpath ]
89 then
90 mkdir -pv $merpplogpath
91 if [ ! -d $merpplogpath ]
92 then
93 echo "could not make merpplogpath "$merpplogpath
94 exit
95 fi
96 fi
97
98 runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
99 date=`date --date \`basename $calfile | cut -d_ -f1\` +%Y/%m/%d`
100 ccfile=`find /magic/subsystemdata/cc/$date -name 20[0-2][0-9][01][0-9][0-3][0-9]_*${runno}_[PDCS]_*_S.rep`
101 cacofile=`find /magic/subsystemdata/caco/$date -name dc_20[0-2][0-9]_[01][0-9]_[0-3][0-9]_*${runno}_*.txt`
102 echo "runno: "$runno
103 echo "ccfile: "$ccfile
104 if [ "$ccfile" = "" ]
105 then
106 echo "no ccfile found for run "$runno
107 break
108 fi
109 if [ "$cacofile" = "" ]
110 then
111 echo "cacofile with no $runno not found"
112 echo "finding cacofile..."
113 for (( i = 0; i <= 10; i++ ))
114 do
115 newrun=`echo $runno - $i | bc`
116 cacofile=`find $cacopath -name *$newrun*`
117 if [ "$cacofile" = "" ]
118 then
119 if [ $i -eq 9 ]
120 then
121 echo "no cacofile found for runno $newrun in $cacopath"
122 break 2
123 fi
124 continue
125 else
126 break
127 fi
128 done
129 fi
130 echo "cacofile: "$cacofile
131 ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile
132 echo "./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile "
133
134 ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile
135 echo "./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile "
136
137done
138
Note: See TracBrowser for help on using the repository browser.