source: trunk/Mars/datacenter/scripts/writemcsequencefile@ 9940

Last change on this file since 9940 was 9592, checked in by Daniela Dorner, 14 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
48# get todo list
49gettodo
50
51cd $mars
52
53printprocesslog "INFO writing sequence files for $num mc sequences"
54# write sequence file for all sequences which don't have one yet
55for (( s=0 ; s < $num ; s++ ))
56do
57 sequence=${primaries[$s]}
58 printprocesslog "INFO write sequence files for sequence $sequence"
59 setstatus "start"
60
61 no=`printf %08d $sequence | cut -c 0-4`
62 no2=`printf %08d $sequence`
63 sequencepath=$mcsequpath/$no
64 makedir $sequencepath
65 sequencefile=$sequencepath/sequence$no2.txt
66
67 query="SELECT CONCAT(fRunNumber, '.', RIGHT(fFileNumber, 3)) FROM CeresInfo WHERE fRunTypeKEY=2 AND fSequenceNumber="$sequence
68 datruns=`sendquery`
69 query="SELECT CONCAT(fRunNumber, '.', RIGHT(fFileNumber, 3)) FROM CeresInfo WHERE fRunTypeKEY=3 AND fSequenceNumber="$sequence
70 pedruns=`sendquery`
71 query="SELECT CONCAT(fRunNumber, '.', RIGHT(fFileNumber, 3)) FROM CeresInfo WHERE fRunTypeKEY=4 AND fSequenceNumber="$sequence
72 calruns=`sendquery`
73
74 printprocesslog "INFO writing sequencefile $sequencefile"
75 echo "Sequence: "$sequence >| $sequencefile
76 echo "" >> $sequencefile
77 echo "CalRuns: "$calruns >> $sequencefile
78 echo "PedRuns: "$pedruns >> $sequencefile
79 echo "DatRuns: "$datruns >> $sequencefile
80 echo "" >> $sequencefile
81 echo "MonteCarlo: Yes" >> $sequencefile
82 echo "" >> $sequencefile
83
84 setstatus "stop"
85done
86
87finish
88
Note: See TracBrowser for help on using the repository browser.