source: trunk/MagicSoft/Mars/datacenter/scripts/writemcsequencefile@ 9590

Last change on this file since 9590 was 9590, checked in by Daniela Dorner, 11 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.9 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 06/2010 <mailto:daniela.dorner@unige.ch>
21#
22# Copyright: MAGIC Software Development, 2000-2010
23#
24#
25# ========================================================================
26#
27# This script launches the writing of the sequence files for all mc sequences
28# for which this step is needed.
29#
30# After checking if the script is already running the todolist is written.
31# Then the sequence file is written for each sequence in the todolist using
32# the macro writesequencefile.C
33# If this was successful, the status is inserted into the database using
34# the function setstatus.
35#
36
37source `dirname $0`/sourcefile
38printprocesslog "INFO starting $0"
39program=writemcsequencefile
40step=SequenceFile
41
42set -C
43
44# check if script is already running
45lockfile=$lockpath/lock-$program.txt
46checklock
47
48echo "hallo"
49
50# get todo list
51gettodo
52
53echo "hallo2 "
54
55cd $mars
56
57echo "$num steps to do"
58# write sequence file for all sequences which don't have one yet
59for (( s=0 ; s < $num ; s++ ))
60do
61 sequence=${primaries[$s]}
62 printprocesslog "INFO write sequence files for sequence $sequence"
63 setstatus "start"
64
65 no=`printf %08d $sequence | cut -c 0-4`
66 no2=`printf %08d $sequence`
67 sequencepath=$mcsequpath/$no
68 makedir $sequencepath
69 sequencefile=$sequpath/sequence$no2.txt
70
71 query="SELECT CONCAT(fRunNumber, '.', RIGHT(fFileNumber, 3)) FROM CeresInfo WHERE fRunTypeKEY=2 AND fSequenceNumber="$sequence
72 datruns=`sendquery`
73 query="SELECT CONCAT(fRunNumber, '.', RIGHT(fFileNumber, 3)) FROM CeresInfo WHERE fRunTypeKEY=3 AND fSequenceNumber="$sequence
74 pedruns=`sendquery`
75 query="SELECT CONCAT(fRunNumber, '.', RIGHT(fFileNumber, 3)) FROM CeresInfo WHERE fRunTypeKEY=4 AND fSequenceNumber="$sequence
76 calruns=`sendquery`
77
78 echo "Sequence: "$sequence >| $sequencefile
79 echo "" >> $sequencefile
80 echo "CalRuns: "$calruns >> $sequencefile
81 echo "PedRuns: "$pedruns >> $sequencefile
82 echo "DatRuns: "$datruns >> $sequencefile
83 echo "" >> $sequencefile
84 echo "MonteCarlo: Yes" >> $sequencefile
85 echo "" >> $sequencefile
86
87 setstatus "stop"
88done
89
90finish
91
Note: See TracBrowser for help on using the repository browser.