source: trunk/MagicSoft/Mars/scripts/processsequence@ 7977

Last change on this file since 7977 was 7732, checked in by Daniela Dorner, 19 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.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 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2004
23#
24#
25# ========================================================================
26#
27#
28#
29##############################################################################
30#
31# This script can be used to run the following steps for one sequence:
32# - callisto
33# - merppupdate
34# - star
35#
36# You have to set the path, where your Mars version can be found, the outpath,
37# where you want to store the output and the sequencenumber of the sequence
38# you want to process
39#
40##############################################################################
41
42#function to create directory
43function makedir()
44{
45 if [ ! -d $@ ]
46 then
47 mkdir -pv $@
48 if [ ! -d $@ ]
49 then
50 echo "could not make dir "$@
51 exit
52 fi
53 fi
54}
55
56
57#to be set by the user
58mars=/home/user/Mars
59outpath=/home/user/outpath
60sequence=55221
61
62
63#needed if not set in .bashrc or when script is e.g. executed in cronjob
64export ROOTSYS=/opt/root_v4.04.02g
65export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
66export PATH=$PATH:$ROOTSYS/bin
67
68
69no=`printf %08d $sequence | cut -c 1-4`
70sequfile="/magic/sequences/"$no"/sequence"`printf %08d $sequence`".txt"
71calpath=$outpath"/callisto/"`printf %08d $sequence`
72starpath=$outpath"/star/"`printf %08d $sequence`
73
74echo "mars: "$mars
75echo "outpath: "$outpath
76echo "sequence: "$sequence
77echo "sequfile: "$sequfile
78echo "path where calibration files are stored : "$calpath
79echo "path where star files are stored : "$starpath
80
81makedir $calpath
82makedir $starpath
83
84cd $mars
85
86echo "run callisto..."
87echo "./callisto -b -q -f --log=$calpath/callisto$sequence.log --out=$calpath $sequfile "
88./callisto -b -q -f --log=$calpath/callisto$sequence.log --out=$calpath $sequfile
89echo "callisto is finished "
90echo ""
91
92
93
94calfiles=`find $calpath -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*_Y_*.root`
95
96echo "run merpp update for calibrated files..."
97echo "calibrated data files: "$calfiles
98
99for calfile in ${calfiles[@]}
100do
101 echo "calfile: "$calfile
102 outpath=`dirname $calfile`
103 echo "outpath: "$outpath
104
105 merpplogpath=$outpath"/merpplogs"
106 makedir $merpplogpath
107
108 runno=`echo $calfile | cut -d_ -f2 | sed -e 's/^0//' | sed -e 's/^0//' | sed -e 's/^0//' `
109 ccfile=`find /magic/subsystemdata/cc/ -name [2][0][0-2][0-9][0,1][0-9][0-3][0-9]_*${runno}_[P,D,C,S]_*_S.rep`
110 cacofile=`find /magic/subsystemdata/caco/ -name dc_[2][0][0-2][0-9]_[0,1][0-9]_[0-3][0-9]_*${runno}_*.txt`
111 echo "runno: "$runno
112 echo "ccfile: "$ccfile
113 if [ "$ccfile" = "" ]
114 then
115 echo "no ccfile found for run "$runno
116 break
117 fi
118 echo "cacofile: "$cacofile
119 if [ "$cacofile" = "" ]
120 then
121 echo "no cacofile found for run "$runno
122 echo "finding cacofile..."
123 for (( i = 0; i <= 10; i++ ))
124 do
125 newrun=`echo $runno - $i | bc`
126 # echo "$missingcacorun + $i = $newrun"
127 path=`dirname $ccfile`
128 path=`echo $path | sed -e 's/cc/caco/'`
129 echo "path: "$path
130 cacofile=`find $path -name *$newrun*`
131 if [ "$cacofile" = "" ]
132 then
133 continue
134 else
135 break
136 echo "cacofile: "$cacofile
137 fi
138 done
139 fi
140 echo "./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile "
141 ./merpp -u --log=$merpplogpath/merppccupdate$runno.log --runfile=$runno $ccfile $calfile
142
143 echo "./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile "
144 ./merpp -u --log=$merpplogpath/merppcacoupdate$runno.log --auto-time $cacofile $calfile
145done
146echo "merppupdate is finished"
147echo ""
148
149
150
151echo "run star..."
152echo "./star -b -q -f --log=$starpath/star$sequence.log --ind=$callistopath --out=$starpath $sequfile "
153./star -b -q -f --log=$starpath/star$sequence.log --ind=$callistopath --out=$starpath $sequfile
154echo "star is finished "
155
156
Note: See TracBrowser for help on using the repository browser.