Ignore:
Timestamp:
06/11/10 17:36:11 (15 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/scripts/runcorsika

    r9355 r9585  
    1818#
    1919#
    20 #   Author(s): Daniela Dorner  05/2007 <mailto:dorner@astro.uni-wuerzburg.de>
    21 #
    22 #   Copyright: MAGIC Software Development, 2000-2008
     20#   Author(s): Daniela Dorner  05/2007 <mailto:daniela.dorner@unige.ch>
     21#
     22#   Copyright: MAGIC Software Development, 2000-2010
    2323#
    2424#
     
    3131printprocesslog "INFO starting $0"
    3232program=corsika
    33 column=fCorsikaFileAvail
     33step=Corsika
    3434
    3535set -C
     
    4141{
    4242   # Run number
    43    echo "RUNNR "$corsikarunno
     43   echo "RUNNR "$file
    4444   # Starting event number
    4545   echo "EVTNR 1"
     
    6060   echo "FIXCHI "$startalt
    6161   # Observation level, magnetic field, atmosphere
    62    echo "OBSLEV 2200.E2"
     62   echo "OBSLEV "$obslev".E2"
    6363   # From www.noaa.gov/geomagmodels roughly for January 2009. (was 29.5 and 23.0)
    6464   # MAGNET BX BZ (BX is the horizontal component (muT) to the x-direction of
    6565   # the detector, BZ is the vertical component (muT) downwards)
    66    echo "MAGNET 30.3 24.1"
     66   echo "MAGNET "$magnet
    6767   # Rotation angle between array x-direction and magnetic north direction
    6868   # positive if array x-direction points to the west
    69    echo "ARRANG -7.0"
     69   echo "ARRANG "$magnetrot
    7070   # Atmosphere (model, true/false for atmospheric refraction of cer-photons)
    7171   # Atmosphere read from atmprof11.dat
    7272   # My current understanding is that only refraction (bending of light
    7373   # but no absorption of photons is taken into account) setting T.
    74    echo "ATMOSPHERE 11 T"
     74   echo "ATMOSPHERE "$atm" T"
     75
     76   # Current boundaries in reflector program
     77   # echo "ATMLAY 400000 1000000 4000000 10000000"
     78
     79   # Boundaries as determined by CORSIKA
     80   # Until we can read the result from the corsika fit we fix the
     81   # values which come out of the fit. This is not ideal but forces
     82   # things to be consistent. Be careful is using a different model -
     83   # the fit might not be ideal.
     84   echo "ATMLAY 775000 1650000 5000000 10500000"
     85
    7586   # Other parameters
    7687   echo "RADNKG 200.E2"
     
    8293   # Enable muon multiple scattering
    8394   echo "MUMULT T"
    84    # Cherenkov telescope options
    85    echo "CWAVLG 290. 600."
    86    echo "CSCAT "$reuse" 0. "$impactmax
     95   # Wavelength range (was originally 600)
     96   echo "CWAVLG "$wavelengths
     97   # MMCS
     98   echo "CSCAT 1 0. "$impactmax
     99   # CORSIKA
     100   # echo "CSCAT "$reuse" "$impactmax" 0."
    87101   echo "CERSIZ 1."
     102   # Write Cherenkov photons to cer-file
    88103   echo "CERFIL T"
     104   # Number of telescopes
    89105   echo "CERTEL 1"
    90    echo " 0. 0. 0. 0. 0. "$diameter" 1700."
     106   # MMCS
     107   echo " 0. 0. 0. 0. 0. "$diameter" "$diameter
     108   # CORSIKA (x, y, z, r)
     109   # echo "TELESCOPE 0. 0. 0. "$diameter
     110   # This keyword has no relevance but allows to store the
     111   # maximum simulated impact parameter. The "magic" is that
     112   # ceres interpretes the third and fourth argument as
     113   # maximum simulated impact if they are identical and
     114   # the other four arguments are 1
     115   # echo "CERARY 1 1 "$diameter" "$diameter" 1 1"
    91116   # How the longitudinal shower development is sampled
    92117   # echo "LONGI T 10. T F"
     
    103128   # Output path
    104129   echo "DIRECT "$outpath
    105    # User and host (for convinience)
     130   # DIRECT /dev/null
     131   # TELFIL filename
     132   # TELFIL | gzip
     133   # TELESCOPE X Y Z R
     134   # User and host (for convenience)
    106135   echo "USER "`whoami`
    107136   echo "HOST "`hostname`
     
    114143gettodo "1"
    115144run=${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
     145file=${primaries[1]}
    121146
    122147# lock sequ
    123 lockfile=$lockpath/lock-$table-$column-$corsikarunno.txt
     148lockfile=$lockpath/lock-$step-$run.$file.txt
    124149checklock
    125150
    126 printprocesslog "INFO starting $program for run $run"
     151printprocesslog "INFO starting $program for run $run and file $file"
    127152
    128153setstatus "start"
    129154
    130 printprocesslog "INFO run $program for run $run "
    131 printprocesslog "INFO create input card... "
     155printprocesslog "INFO run $program for run $run  and file $file"
     156printprocesslog "INFO create input card for run $run  and file $file"
    132157
    133158# get values for inputcard
    134 query="SELECT fParticleTypeKEY FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     159query="SELECT fParticleTypeKEY FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    135160primparticle=`sendquery`
    136 query="SELECT fEnergyMin, fEnergyMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     161query="SELECT fEnergyMin, fEnergyMax FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    137162erange=`sendquery`
    138 query="SELECT fNumEvents FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     163query="SELECT fNumEvents FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    139164numevts=`sendquery`
    140 query="SELECT fEnergySlope FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     165query="SELECT fEnergySlope FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    141166slope=`sendquery`
    142 query="SELECT fZenithDistanceMin, fZenithDistanceMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     167query="SELECT fZenithDistanceMin, fZenithDistanceMax FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    143168zdrange=`sendquery`
    144169# 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
     170query="SELECT 180-fAzimuthMin, 180-fAzimuthMax FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    146171azrange=`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
     172query="SELECT fCorsikaSeed1 FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    151173seed1=`sendquery`
    152 query="SELECT fCorsikaSeed+1 FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     174query="SELECT fCorsikaSeed2 FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    153175seed2=`sendquery`
    154 query="SELECT fCorsikaSeed+2 FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     176query="SELECT fCorsikaSeed3 FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    155177seed3=`sendquery`
    156 query="SELECT fImpactMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     178query="SELECT fImpactMax FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    157179impactmax=`sendquery`
    158 query="SELECT fViewConeMax FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     180query="SELECT fViewConeMax FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    159181viewconemax=`sendquery`
    160 query="SELECT fNumReUseShower FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
    161 reuse=`sendquery`
    162 query="SELECT fStartingAltitude FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     182query="SELECT fStartingAltitude FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    163183startalt=`sendquery`
    164 query="SELECT fMirrorDiameter FROM MCCorsikaRunData where fCorsikaRunNumber="$corsikarunno
     184query="SELECT fMirrorDiameter FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
    165185diameter=`sendquery`
    166 
    167 logfile=$outpath/$program"-"`printf %06d $corsikarunno`".log"
     186query="SELECT fAtmosphericModelKEY FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
     187atm=`sendquery`
     188query="SELECT fObsLevel FROM CorsikaInfo LEFT JOIN Observatory USING(fObservatoryKEY) WHERE fRunNumber=$run AND fFileNumber=$file"
     189obslev=`sendquery`
     190query="SELECT fMagnetBX, fMagnetBZ FROM CorsikaInfo LEFT JOIN Observatory USING(fObservatoryKEY) WHERE fRunNumber=$run AND fFileNumber=$file"
     191magnet=`sendquery`
     192query="SELECT fMagnetRotation FROM CorsikaInfo LEFT JOIN Observatory USING(fObservatoryKEY) WHERE fRunNumber=$run AND fFileNumber=$file"
     193magnetrot=`sendquery`
     194query="SELECT fWavelengthMin, fWavelengthMax FROM CorsikaInfo WHERE fRunNumber=$run AND fFileNumber=$file"
     195wavelengths=`sendquery`
     196
     197outpath=$mcpath"/"$program"/"`printf %08d $run | cut -c 0-4`/`printf %08d $run | cut -c 5-8`
    168198makedir $outpath
     199logfile=$outpath/cer000`printf %06d $file | cut -c 4-6`".log"
    169200
    170201cd $corsikapath
    171202
    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`
     203printinputcard | ./cc6501p-linux >| $logfile 2>&1
    179204
    180205check1=$?
    181 
    182206case $check1 in
    183    0)   printprocesslog "INFO $program finished successfully for corsika run number $corsikarunno (check1=$check1)"
     207   0)   printprocesslog "INFO $program finished successfully for run $run file $file (check1=$check1)"
    184208        ;;
    185    *)   printprocesslog "ERROR $program failed for corsika run number $corsikarunno (check1=$check1)"
     209   *)   printprocesslog "ERROR $program failed for run $run file $file (check1=$check1)"
    186210        com=$Fcorsika
    187211        check=$check1
     
    189213esac
    190214
     215# removing empty datnnnnnn file
     216rm -f $outpath/dat`printf %06d $file`
     217
    191218setstatus "stop"
    192219
Note: See TracChangeset for help on using the changeset viewer.