| 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 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=$corsikapath'/fluka2008_3'
|
|---|
| 38 |
|
|---|
| 39 | # printing input card to stdout
|
|---|
| 40 | function printinputcard()
|
|---|
| 41 | {
|
|---|
| 42 | # Run number
|
|---|
| 43 | echo "RUNNR "$corsikarunno
|
|---|
| 44 | # Starting event number
|
|---|
| 45 | echo "EVTNR 1"
|
|---|
| 46 | # Number of simulated events
|
|---|
| 47 | echo "NSHOW "$numevts
|
|---|
| 48 | # Seed values for simulation
|
|---|
| 49 | echo "SEED "$seed1" 0 0 "
|
|---|
| 50 | echo "SEED "$seed2" 0 0 "
|
|---|
| 51 | echo "SEED "$seed3" 0 0 "
|
|---|
| 52 | # Primary particle
|
|---|
| 53 | echo "PRMPAR "$primparticle
|
|---|
| 54 | echo "ERANGE "$erange
|
|---|
| 55 | echo "ESLOPE "$slope
|
|---|
| 56 | # Simulation range (theta, phi, view cone, starting altitude)
|
|---|
| 57 | echo "THETAP "$zdrange
|
|---|
| 58 | echo "PHIP "$azrange
|
|---|
| 59 | echo "VIEWCONE 0. "$viewconemax
|
|---|
| 60 | echo "FIXCHI "$startalt
|
|---|
| 61 | # Observation level, magnetic field, atmosphere
|
|---|
| 62 | echo "OBSLEV 2200.E2"
|
|---|
| 63 | # From www.noaa.gov/geomagmodels roughly for January 2009. (was 29.5 and 23.0)
|
|---|
| 64 | # MAGNET BX BZ (BX is the horizontal component (muT) to the x-direction of
|
|---|
| 65 | # the detector, BZ is the vertical component (muT) downwards)
|
|---|
| 66 | echo "MAGNET 30.3 24.1"
|
|---|
| 67 | # Rotation angle between array x-direction and magnetic north direction
|
|---|
| 68 | # positive if array x-direction points to the west
|
|---|
| 69 | echo "ARRANG -7.0"
|
|---|
| 70 | # Atmosphere (model, true/false for atmospheric refraction of cer-photons)
|
|---|
| 71 | # Atmosphere read from atmprof11.dat
|
|---|
| 72 | # My current understanding is that only refraction (bending of light
|
|---|
| 73 | # but no absorption of photons is taken into account) setting T.
|
|---|
| 74 | echo "ATMOSPHERE 11 T"
|
|---|
| 75 | # Other parameters
|
|---|
| 76 | echo "RADNKG 200.E2"
|
|---|
| 77 | echo "ECUTS 0.3 0.3 0.02 0.02"
|
|---|
| 78 | echo "ECTMAP 1.E4"
|
|---|
| 79 | echo "STEPFC 0.1"
|
|---|
| 80 | # Don't add muon particle data to output
|
|---|
| 81 | echo "MUADDI F"
|
|---|
| 82 | # Enable muon multiple scattering
|
|---|
| 83 | echo "MUMULT T"
|
|---|
| 84 | # Cherenkov telescope options
|
|---|
| 85 | echo "CWAVLG 290. 600."
|
|---|
| 86 | echo "CSCAT "$reuse" 0. "$impactmax
|
|---|
| 87 | echo "CERSIZ 1."
|
|---|
| 88 | echo "CERFIL T"
|
|---|
| 89 | echo "CERTEL 1"
|
|---|
| 90 | echo " 0. 0. 0. 0. 0. "$diameter" 1700."
|
|---|
| 91 | # How the longitudinal shower development is sampled
|
|---|
| 92 | # echo "LONGI T 10. T F"
|
|---|
| 93 | echo "LONGI F 20 0 F F"
|
|---|
| 94 | # Maximum number of detailed particles to print
|
|---|
| 95 | echo "MAXPRT 0"
|
|---|
| 96 | # Suppress file with partciles reaching ground (DATnnnnnn)
|
|---|
| 97 | # FIXME: Should we make this switchable by the database?
|
|---|
| 98 | echo "PAROUT F F"
|
|---|
| 99 | # Don't write a database file
|
|---|
| 100 | echo "DATBAS F"
|
|---|
| 101 | # Switch off all debugging output
|
|---|
| 102 | echo "DEBUG F 6 F 1000000"
|
|---|
| 103 | # Output path
|
|---|
| 104 | echo "DIRECT "$outpath
|
|---|
| 105 | # User and host (for convinience)
|
|---|
| 106 | echo "USER "`whoami`
|
|---|
| 107 | echo "HOST "`hostname`
|
|---|
| 108 | # End of input card
|
|---|
| 109 | echo "EXIT"
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 | # get sequence #
|
|---|
| 114 | gettodo "1"
|
|---|
| 115 | run=${primaries[0]}
|
|---|
| 116 | # get corsika runno
|
|---|
| 117 | query="SELECT fCorsikaRunNumber FROM MCRunData where fMCRunNumber="$run
|
|---|
| 118 | # to be changed later again, when additional tables are available
|
|---|
| 119 | #corsikarunno=`sendquery`
|
|---|
| 120 | corsikarunno=$run
|
|---|
| 121 |
|
|---|
| 122 | # lock sequ
|
|---|
| 123 | lockfile=$lockpath/lock-$table-$column-$corsikarunno.txt
|
|---|
| 124 | checklock
|
|---|
| 125 |
|
|---|
| 126 | printprocesslog "INFO starting $program for run $run"
|
|---|
| 127 |
|
|---|
| 128 | setstatus "start"
|
|---|
| 129 |
|
|---|
| 130 | printprocesslog "INFO run $program for run $run "
|
|---|
| 131 | printprocesslog "INFO create input card... "
|
|---|
| 132 |
|
|---|
| 133 | # get values for inputcard
|
|---|
| 134 | query="SELECT fParticleTypeKEY FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 135 | primparticle=`sendquery`
|
|---|
| 136 | query="SELECT fEnergyMin, fEnergyMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 137 | erange=`sendquery`
|
|---|
| 138 | query="SELECT fNumEvents FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 139 | numevts=`sendquery`
|
|---|
| 140 | query="SELECT fEnergySlope FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 141 | slope=`sendquery`
|
|---|
| 142 | query="SELECT fZenithDistanceMin, fZenithDistanceMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 143 | zdrange=`sendquery`
|
|---|
| 144 | # Change from the MARS definition (Az=90 -> East) to Corsika (Az=90 -> West)
|
|---|
| 145 | query="SELECT 180-fAzimuthMin, 180-fAzimuthMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 146 | azrange=`sendquery`
|
|---|
| 147 | query="SELECT DATE_FORMAT(fRunStart, '%Y/%m/%d') FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 148 | date=`sendquery`
|
|---|
| 149 | outpath=$mcpath"/"$program"/"$date
|
|---|
| 150 | query="SELECT fCorsikaSeed FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 151 | seed1=`sendquery`
|
|---|
| 152 | query="SELECT fCorsikaSeed+1 FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 153 | seed2=`sendquery`
|
|---|
| 154 | query="SELECT fCorsikaSeed+2 FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 155 | seed3=`sendquery`
|
|---|
| 156 | query="SELECT fImpactMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 157 | impactmax=`sendquery`
|
|---|
| 158 | query="SELECT fViewConeMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 159 | viewconemax=`sendquery`
|
|---|
| 160 | query="SELECT fNumReUseShower FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 161 | reuse=`sendquery`
|
|---|
| 162 | query="SELECT fStartingAltitude FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 163 | startalt=`sendquery`
|
|---|
| 164 | query="SELECT fMirrorDiameter FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
|
|---|
| 165 | diameter=`sendquery`
|
|---|
| 166 |
|
|---|
| 167 | logfile=$outpath/$program"-"`printf %06d $corsikarunno`".log"
|
|---|
| 168 | makedir $outpath
|
|---|
| 169 |
|
|---|
| 170 | cd $corsikapath
|
|---|
| 171 |
|
|---|
| 172 | echo "INPUTCARD:" >| $logfile 2>&1
|
|---|
| 173 | printinputcard >> $logfile 2>&1
|
|---|
| 174 | echo "" >> $logfile 2>&1
|
|---|
| 175 | echo "" >> $logfile 2>&1
|
|---|
| 176 | printinputcard | ./cc6501p-linux >> $logfile 2>&1
|
|---|
| 177 |
|
|---|
| 178 | rm -f $outpath/dat`printf %06d $corsikarunno`
|
|---|
| 179 |
|
|---|
| 180 | check1=$?
|
|---|
| 181 |
|
|---|
| 182 | case $check1 in
|
|---|
| 183 | 0) printprocesslog "INFO $program finished successfully for corsika run number $corsikarunno (check1=$check1)"
|
|---|
| 184 | ;;
|
|---|
| 185 | *) printprocesslog "ERROR $program failed for corsika run number $corsikarunno (check1=$check1)"
|
|---|
| 186 | com=$Fcorsika
|
|---|
| 187 | check=$check1
|
|---|
| 188 | ;;
|
|---|
| 189 | esac
|
|---|
| 190 |
|
|---|
| 191 | setstatus "stop"
|
|---|
| 192 |
|
|---|
| 193 | finish
|
|---|
| 194 |
|
|---|