source: trunk/MagicSoft/Mars/datacenter/scripts/runcorsika@ 9170

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