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-2008
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | # This script runs the reflector.
|
---|
28 | #
|
---|
29 |
|
---|
30 | source `dirname $0`/sourcefile
|
---|
31 | printprocesslog "INFO starting $0"
|
---|
32 | program=camera
|
---|
33 | column=fCameraFileAvail
|
---|
34 |
|
---|
35 | set -C
|
---|
36 |
|
---|
37 | # printing input card to stdout
|
---|
38 | function printinputcard()
|
---|
39 | {
|
---|
40 | echo $cameraversion
|
---|
41 | echo "ct_num 1"
|
---|
42 | echo "ct_geom 1"
|
---|
43 | echo "qe_file 0 $detectordir/Data/qe-emi-coat.RFL.dat"
|
---|
44 | echo "input_file 0 "$mcpath"/reflector/"$date"/"$infile
|
---|
45 | echo "data_file $outpath/"`echo $infile | sed -e 's/rfl/dat/'`
|
---|
46 | echo "root_file $outpath/"`echo $infile | sed -e 's/rfl/root/'`
|
---|
47 | echo "trigger_prop 3.0 0.25 1.0 2.0"
|
---|
48 | echo "trigger_single 0 4 4 2"
|
---|
49 | echo "nsb_on"
|
---|
50 | echo "nsb_mean 0.178 50"
|
---|
51 | echo "fadc_noise 1.3 2.4 1."
|
---|
52 | echo "sigma_xy_cm_spot "$spotsize
|
---|
53 | echo "mirror_fraction 0 0.73"
|
---|
54 | echo "seeds "$seeds
|
---|
55 | echo "nsb_directory $detectordir/StarLight/inner/"
|
---|
56 | echo "nsb_dir_outer $detectordir/StarLight/outer/"
|
---|
57 | echo "fadc_prop 1 7.8 5.0"
|
---|
58 | echo "fadc_outer 1 3.2 5.0"
|
---|
59 | echo "write_McTrig"
|
---|
60 | echo "write_McFadc"
|
---|
61 | echo "end_file"
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 | # get sequence #
|
---|
66 | gettodo
|
---|
67 | run=$process
|
---|
68 |
|
---|
69 | # lock sequ
|
---|
70 | lockfile=$lockpath/lock-$table-$column-$sequence.txt
|
---|
71 | checklock
|
---|
72 |
|
---|
73 | printprocesslog "INFO starting $program for run $run"
|
---|
74 |
|
---|
75 | setstatus "start"
|
---|
76 |
|
---|
77 | printprocesslog "INFO create input card... "
|
---|
78 |
|
---|
79 | # get values for inputcard
|
---|
80 | query="SELECT fMCRunNumber FROM MCRunData where fMCRunNumber="$run
|
---|
81 | reflectorrunno=`sendquery`
|
---|
82 | query="SELECT DATE_FORMAT(fRunStart, '%Y/%m/%d') FROM MCReflectorRunData where fReflectorRunNumber="$reflectorrunno
|
---|
83 | date=`sendquery`
|
---|
84 | query="SELECT fParticleTypeName FROM MCCorsikaRunData "
|
---|
85 | query=$query" LEFT JOIN ParticleType ON MCCorsikaRunData.fParticleTypeKEY=ParticleType.fParticleTypeKEY "
|
---|
86 | query=$query" LEFT JOIN MCRunData ON MCCorsikaRunData.fCorsikaRunNumber=MCRunData.fCorsikaRunNumber "
|
---|
87 | query=$query" WHERE fMCRunNumber="$run
|
---|
88 | particle=`sendquery`
|
---|
89 | outpath=$mcpath"/"$program"/"$date
|
---|
90 | date2=`echo $date | sed -e 's/\///g'`
|
---|
91 | infile=$date2"_"`printf %06d $reflectorrunno`"_"$particle".rfl"
|
---|
92 | query="SELECT fAdditionalSpotSize FROM MCRunData where fMCRunNumber="$run
|
---|
93 | spotsize=`sendquery`
|
---|
94 | query="SELECT fCameraSeed, fCameraSeed+1 FROM MCRunData where fMCRunNumber="$run
|
---|
95 | seeds=`sendquery`
|
---|
96 |
|
---|
97 | logfile=$outpath/$program"-"`printf %06d $run`".log"
|
---|
98 | makedir $outpath
|
---|
99 |
|
---|
100 | cd $detectordir/Camera
|
---|
101 |
|
---|
102 | echo "INPUTCARD:" >| $logfile 2>&1
|
---|
103 | printinputcard >> $logfile 2>&1
|
---|
104 | echo "" >> $logfile 2>&1
|
---|
105 | echo "" >> $logfile 2>&1
|
---|
106 | printinputcard | ./camera >> $logfile 2>&1
|
---|
107 |
|
---|
108 | check1=$?
|
---|
109 |
|
---|
110 | case $check1 in
|
---|
111 | 0) printprocesslog "INFO $program finished successfully for sequence $sequence (check1=$check1)"
|
---|
112 | ;;
|
---|
113 | *) printprocesslog "ERROR $program failed for sequence $sequence (check1=$check1)"
|
---|
114 | com=$Fcamera
|
---|
115 | check=$check1
|
---|
116 | ;;
|
---|
117 | esac
|
---|
118 |
|
---|
119 | setstatus "stop"
|
---|
120 |
|
---|
121 | finish
|
---|
122 |
|
---|