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 corsika.
|
---|
28 | #
|
---|
29 |
|
---|
30 | source `dirname $0`/sourcefile
|
---|
31 | printprocesslog "INFO starting $0"
|
---|
32 | program=corsika
|
---|
33 | column=fCorsikaFileAvail
|
---|
34 |
|
---|
35 | set -C
|
---|
36 |
|
---|
37 | export FLUPRO='/home/operator/Corsika/Mmcs6500/fluka2006_3'
|
---|
38 |
|
---|
39 | # printing input card to stdout
|
---|
40 | function printinputcard()
|
---|
41 | {
|
---|
42 | echo "RUNNR "$corsikarunno
|
---|
43 | echo "PRMPAR "$primparticle
|
---|
44 | query="SELECT fEnergyMin, fEnergyMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
45 | echo "ERANGE "$erange
|
---|
46 | echo "EVTNR 1"
|
---|
47 | echo "NSHOW "$numevts
|
---|
48 | echo "ESLOPE "$slope
|
---|
49 | echo "THETAP "$zdrange
|
---|
50 | echo "PHIP "$azrange
|
---|
51 | # echo "VIEWCONE 0. 2.3"
|
---|
52 | echo "DIRECT "$outpath
|
---|
53 | echo "SEED "$seed1" 0 0 "
|
---|
54 | echo "SEED "$seed2" 0 0 "
|
---|
55 | echo "SEED "$seed3" 0 0 "
|
---|
56 | echo "OBSLEV 2200.E2"
|
---|
57 | echo "RADNKG 200.E2"
|
---|
58 | echo "MAGNET 29.5 23.0"
|
---|
59 | echo "ECUTS 0.3 0.3 0.02 0.02"
|
---|
60 | echo "MUADDI F"
|
---|
61 | echo "MUMULT T"
|
---|
62 | echo "LONGI T 10. T F"
|
---|
63 | echo "MAXPRT 0"
|
---|
64 | echo "ECTMAP 1.E4"
|
---|
65 | echo "STEPFC 0.1"
|
---|
66 | echo "DEBUG F 6 F 1000000"
|
---|
67 | echo "CWAVLG 290. 600."
|
---|
68 | echo "CSCAT 1 0. "$impact
|
---|
69 | echo "CERSIZ 1."
|
---|
70 | echo "CERFIL T"
|
---|
71 | echo "FIXCHI 280"
|
---|
72 | echo "DATBAS F"
|
---|
73 | echo "CERTEL 1"
|
---|
74 | echo " 0. 0. 0. 0. 0. 1800. 1700."
|
---|
75 | echo "USER operator"
|
---|
76 | echo "ATMOSPHERE 11 T"
|
---|
77 | echo "EXIT"
|
---|
78 | }
|
---|
79 |
|
---|
80 |
|
---|
81 | scriptlog=$runlogpath/run$program-$datetime.log
|
---|
82 | date >> $scriptlog 2>&1
|
---|
83 |
|
---|
84 | # get sequence #
|
---|
85 | gettodo >> $scriptlog 2>&1
|
---|
86 | run=$process
|
---|
87 | # get corsika runno
|
---|
88 | query="SELECT fCorsikaRunNumber FROM MCRunData where fMCRunNumber="$run
|
---|
89 | corsikarunno=`sendquery`
|
---|
90 |
|
---|
91 | # lock sequ
|
---|
92 | lockfile=$lockpath/lock-$table-$column-$corsikarunno.txt
|
---|
93 | checklock >> $scriptlog 2>&1
|
---|
94 |
|
---|
95 | echo "run $program for run $run..." >> $scriptlog 2>&1
|
---|
96 | printprocesslog "INFO starting $program for run $run"
|
---|
97 |
|
---|
98 | primvar=$run
|
---|
99 | setstatus "start" >> $scriptlog 2>&1
|
---|
100 |
|
---|
101 | echo "run $program for run $run " >> $scriptlog 2>&1
|
---|
102 | echo "create input card... " >> $scriptlog 2>&1
|
---|
103 |
|
---|
104 | # get values for inputcard
|
---|
105 | query="SELECT fParticleTypeKEY FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
106 | primparticle=`sendquery`
|
---|
107 | query="SELECT fEnergyMin, fEnergyMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
108 | erange=`sendquery`
|
---|
109 | query="SELECT fNumEvents FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
110 | numevts=`sendquery`
|
---|
111 | query="SELECT fEnergySlope FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
112 | slope=`sendquery`
|
---|
113 | query="SELECT fZenithDistanceMin, fZenithDistanceMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
114 | zdrange=`sendquery`
|
---|
115 | query="SELECT fAzimuthMin, fAzimuthMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
116 | azrange=`sendquery`
|
---|
117 | query="SELECT DATE_FORMAT(fRunStart, '%Y/%m/%d') FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
118 | date=`sendquery`
|
---|
119 | outpath=$mcpath"/"$program"/"$date
|
---|
120 | query="SELECT fCorsikaSeed FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
121 | seed1=`sendquery`
|
---|
122 | query="SELECT fCorsikaSeed+1 FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
123 | seed2=`sendquery`
|
---|
124 | query="SELECT fCorsikaSeed+2 FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
125 | seed3=`sendquery`
|
---|
126 | query="SELECT fImpactParameter FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
---|
127 | impact=`sendquery`
|
---|
128 |
|
---|
129 | echo "" >> $scriptlog 2>&1
|
---|
130 | echo "INPUTCARD:" >> $scriptlog 2>&1
|
---|
131 | echo "----------" >> $scriptlog 2>&1
|
---|
132 | echo "" >> $scriptlog 2>&1
|
---|
133 | echo "" >> $scriptlog 2>&1
|
---|
134 | printinputcard >> $scriptlog 2>&1
|
---|
135 |
|
---|
136 | logfile=$outpath/$program"-"`printf %06d $corsikarunno`".log"
|
---|
137 | makedir $outpath >> $scriptlog 2>&1
|
---|
138 |
|
---|
139 | cd /home/operator/Corsika/Mmcs6500/
|
---|
140 |
|
---|
141 | echo "INPUTCARD:" >> $logfile 2>&1
|
---|
142 | printinputcard >> $logfile 2>&1
|
---|
143 | echo "" >> $logfile 2>&1
|
---|
144 | echo "" >> $logfile 2>&1
|
---|
145 | printinputcard | ./cc6501p-linux >> $logfile 2>&1
|
---|
146 |
|
---|
147 | check1=$?
|
---|
148 |
|
---|
149 | case $check1 in
|
---|
150 | 0) echo " check1=$check1 -> everything ok " >> $scriptlog 2>&1
|
---|
151 | printprocesslog "INFO $program finished successfully for sequence $sequence"
|
---|
152 | ;;
|
---|
153 | *) echo " check1=$check1 -> ERROR -> step has to be repeated" >> $scriptlog 2>&1
|
---|
154 | printprocesslog "ERROR $program failed for sequence $sequence"
|
---|
155 | com=$Fcorsika
|
---|
156 | check=$check1
|
---|
157 | ;;
|
---|
158 | esac
|
---|
159 |
|
---|
160 | setstatus "stop" >> $scriptlog 2>&1
|
---|
161 |
|
---|
162 | finish >> $scriptlog 2>&1
|
---|
163 |
|
---|