source: branches/Mars_MC/scripts/merppupdate@ 17038

Last change on this file since 17038 was 8645, checked in by tbretz, 17 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.6 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=$2
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
73calfiles=`find $outpath -name "$name2"`
74
75echo "calfiles: "$calfiles
76
77for calfile in ${calfiles[@]}
78do
79 echo "updating $calfile..."
80
81 merpplogpath=$outpath"/merpplogs"
82 if [ ! -d $merpplogpath ]
83 then
84 mkdir -pv $merpplogpath
85 if [ ! -d $merpplogpath ]
86 then
87 echo "could not make merpplogpath "$merpplogpath
88 exit
89 fi
90 fi
91
92 runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
93 date=`date --date \`basename $calfile | cut -d_ -f1\` +%Y/%m/%d`
94 ccfile=`find /magic/subsystemdata/cc/$date -name 20[0-2][0-9][01][0-9][0-3][0-9]_*${runno}_[PDCS]_*_S.rep`
95 cacofile=`find /magic/subsystemdata/caco/$date -name dc_20[0-2][0-9]_[01][0-9]_[0-3][0-9]_*${runno}_*.txt`
96 echo "runno: "$runno
97 echo "ccfile: "$ccfile
98 if [ "$ccfile" = "" ]
99 then
100 echo "no ccfile found for run "$runno
101 break
102 fi
103 if [ "$cacofile" = "" ]
104 then
105 echo "cacofile with no $runno not found"
106 echo "finding cacofile..."
107 for (( i = 0; i <= 10; i++ ))
108 do
109 newrun=`echo $runno - $i | bc`
110 cacofile=`find $cacopath -name *$newrun*`
111 if [ "$cacofile" = "" ]
112 then
113 if [ $i -eq 9 ]
114 then
115 echo "no cacofile found for runno $newrun in $cacopath"
116 break 2
117 fi
118 continue
119 else
120 break
121 fi
122 done
123 fi
124 echo "cacofile: "$cacofile
125 ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile
126 echo "./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile "
127
128 ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile
129 echo "./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile "
130
131done
132
Note: See TracBrowser for help on using the repository browser.