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