| 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 04/2009 <mailto:daniela.dorner@unige.ch>
|
|---|
| 21 | #
|
|---|
| 22 | # Copyright: MAGIC Software Development, 2000-2009
|
|---|
| 23 | #
|
|---|
| 24 | #
|
|---|
| 25 | # ========================================================================
|
|---|
| 26 | #
|
|---|
| 27 |
|
|---|
| 28 | rootsys=/opt/root5.12.i386
|
|---|
| 29 | source `dirname $0`/sourcefile
|
|---|
| 30 | printprocesslog "INFO starting $0"
|
|---|
| 31 | program=ctastereo
|
|---|
| 32 | case $1 in
|
|---|
| 33 | 2) column=fStereoB
|
|---|
| 34 | Fctastereo=$FctastereoB
|
|---|
| 35 | outpath=$mcpath/stereoB
|
|---|
| 36 | stereopath=/home/dorner/data/stereoB
|
|---|
| 37 | ;;
|
|---|
| 38 | 3) column=fStereoC
|
|---|
| 39 | Fctastereo=$FctastereoC
|
|---|
| 40 | outpath=$mcpath/stereoC
|
|---|
| 41 | stereopath=/home/dorner/data/stereoC
|
|---|
| 42 | ;;
|
|---|
| 43 | 7) column=fStereoG
|
|---|
| 44 | Fctastereo=$FctastereoG
|
|---|
| 45 | outpath=$mcpath/stereoG
|
|---|
| 46 | stereopath=/home/dorner/data/stereoG
|
|---|
| 47 | ;;
|
|---|
| 48 | *) printprocesslog "ERROR Unknown commandline option $1"
|
|---|
| 49 | finish
|
|---|
| 50 | ;;
|
|---|
| 51 | esac
|
|---|
| 52 | bcnmars=/home/dorner/Mars.BCN.2009.03.27.cvs
|
|---|
| 53 |
|
|---|
| 54 | set -C
|
|---|
| 55 |
|
|---|
| 56 | node=`echo $HOSTNAME | sed -e 's/compute-0-//' -e 's/[.]local//'`
|
|---|
| 57 | printprocesslog "INFO $program (for column $column) is running on node $node"
|
|---|
| 58 | # get run #
|
|---|
| 59 | gettodo "1" $node
|
|---|
| 60 | run=${primaries[0]}
|
|---|
| 61 |
|
|---|
| 62 | # lock sequ
|
|---|
| 63 | lockfile=$lockpath/lock-$table-$column-$run.txt
|
|---|
| 64 | checklock
|
|---|
| 65 |
|
|---|
| 66 | printprocesslog "INFO starting $program for run $run"
|
|---|
| 67 |
|
|---|
| 68 | #get particle for file name
|
|---|
| 69 | particles[1]="gamma"
|
|---|
| 70 | particles[14]="proton"
|
|---|
| 71 | particles[6]="muon"
|
|---|
| 72 | particles[3]="electron"
|
|---|
| 73 | query="select fParticleTypeKEY from MCRunData where fMCRunNumber=$run"
|
|---|
| 74 | key=( `mysql -P 3306 -u operator --password=Ics+eMM! --host=mysql.isdc.unige.ch CTA_MC -s -e "$query"` )
|
|---|
| 75 | particle=${particles[$key]}
|
|---|
| 76 | infile=$mcpath/chimp/cta-ultra3/0.0deg/Data/${particle}_20deg_90deg_run${run}___cta-ultra3_desert_I.root
|
|---|
| 77 | inpath=$mcpath/star
|
|---|
| 78 | infile=$inpath/${particle}_20deg_90deg_run${run}___cta-ultra3_desert_I.root
|
|---|
| 79 | outfile=$outpath/${particle}_20deg_90deg_run${run}___cta-ultra3_desert_S.root
|
|---|
| 80 | makedir $stereopath
|
|---|
| 81 | logfile=$outpath/CTAstereo_run${run}.log
|
|---|
| 82 | makedir $outpath
|
|---|
| 83 |
|
|---|
| 84 | setstatus "start"
|
|---|
| 85 |
|
|---|
| 86 | cd $bcnmars
|
|---|
| 87 |
|
|---|
| 88 | printprocesslog "INFO starting: root -q -b macros/CTAstereoSub.C\("\"$infile\""\,"\"$outpath"\"\,"$1"\) | tee $logfile | intgrep"
|
|---|
| 89 | check1=`root -q -b macros/CTAstereoSub.C\(\""$infile\""\,\""$outpath\""\,$1\) 2>&1 | tee $logfile | intgrep`
|
|---|
| 90 |
|
|---|
| 91 | case $check1 in
|
|---|
| 92 | 1) printprocesslog "INFO $program finished successfully for run $run (check1=$check1)"
|
|---|
| 93 | if ! cp $outfile $stereopath
|
|---|
| 94 | then
|
|---|
| 95 | printprocesslog "ERROR copying $outfile to $starpath failed"
|
|---|
| 96 | com=$Fctastereocp
|
|---|
| 97 | check=2
|
|---|
| 98 | else
|
|---|
| 99 | printprocesslog "INFO copied $outfile successfully to $starpath"
|
|---|
| 100 | fi
|
|---|
| 101 | ;;
|
|---|
| 102 | *) printprocesslog "ERROR $program failed for run $run (check1=$check1)"
|
|---|
| 103 | com=$Fctastereo
|
|---|
| 104 | check=$check1
|
|---|
| 105 | ;;
|
|---|
| 106 | esac
|
|---|
| 107 |
|
|---|
| 108 | setstatus "stop"
|
|---|
| 109 |
|
|---|
| 110 | finish
|
|---|
| 111 |
|
|---|