source: trunk/MagicSoft/Mars/mtemp/mwuerzburg/scripts/runmerpp@ 6724

Last change on this file since 6724 was 4086, checked in by merck, 21 years ago
Merck. Changed comments for clarity
  • 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): Martin Merck 05/2004 <mailto:merck@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2004
23#
24#
25# ========================================================================
26
27#/////////////////////////////////////////////////////////////////////////////
28#
29# runmerpp
30#
31# This scripts is used to run merpp on a full Period of data. It will run merpp
32# on the raw-data file. Then it will update the root file by merpping in the CC
33# and CACO data.
34# As for some rawdata files no CaCo data files exist (due to DAQ restarting a run)
35# we need to use the previous CaCo file. This will add to much dc-current infos
36# to the merpped file, but will gaurantee that the right dc-currents are always
37# available.
38#
39# TODO:
40# Due to problems with the DB the automatic DB update option is still disabled.
41#
42
43# ------------------------------------
44# Which Period to use
45INDIR=/data/MAGIC/Period015
46# ------------------------------------
47#
48# For each day of this Period
49#
50DATES=`ls -d -1 $INDIR/rawdata2/20* | cut -d/ -f6 '-'`
51for DATE in $DATES
52do
53 OUTDIR=$INDIR/rootdata2/$DATE
54# Create Output Directory
55 if [ ! -d $OUTDIR ]
56 then
57 echo $DATE
58 mkdir $OUTDIR
59 fi
60
61#
62# Loop over all raw files for this day
63#
64 RAWFILES=`ls -1 $INDIR/rawdata2/$DATE/*.raw`
65 LOGFILE=$OUTDIR/merpp.log
66 TIME=`date`
67 echo "-----------------------------------------------------------------" > $LOGFILE
68 echo " MERPP run started $TIME" >> $LOGFILE
69 echo "-----------------------------------------------------------------" >> $LOGFILE
70
71 PREVIOUS_CACO=
72 for i in $RAWFILES
73 do
74 TIMER=$SECONDS
75 IN_FILE=$i
76 RUN_NUM=`echo $i | cut -d_ -f4`
77 CC_FILE=`ls -1 $INDIR/ccdata/$DATE/*$RUN_NUM*.rep`
78 CACO_FILE=`ls -1 $INDIR/cacodata/$DATE/*$RUN_NUM*.txt 2> /dev/null`
79 OUT_FILE=$OUTDIR/`echo $i | cut -d/ -s -f7 '-' | cut -d. -s -f1 '-'`.root
80# merpp -a -f --sql=mysql://hercules:d99swMT\!@hercules $IN_FILE $OUT_FILE >> $LOGFILE
81
82# MERPP the raw data file
83 merpp -a -f $IN_FILE $OUT_FILE >> $LOGFILE
84
85# MERPP the CC report file
86 merpp -a -u $CC_FILE $OUT_FILE >> $LOGFILE
87
88# If a CACO file exists for this run
89# MERPP the CACO file.
90 if [ -n "$CACO_FILE" ]
91 then
92 merpp -a -u $CACO_FILE $OUT_FILE >> $LOGFILE
93 PERVIOUS_CACO=$CACOFILE
94 fi
95
96# If no CACO file is available for this run
97# we use the previous CACO file
98# CACO only nows when CC starts a new run and creates 1 file for this run
99# however the DAQ may create more subruns due to errors or limitaation on the
100# filesize. The relevant CACO information should be in the CACO file created
101# when CC started this run (e.g. the previous CACO file)
102 if [ -z "$CACO_FILE" ]
103 then
104 if [ -n "$PREVIOUS_CACO" ]
105 then
106 merpp -a -u $PREVIOUS_CACO $OUT_FILE >> $LOGFILE
107 fi
108 fi
109 echo "Processed file $IN_FILE in $(( $SECONDS - $TIMER)) secs."
110 done
111done
Note: See TracBrowser for help on using the repository browser.