| 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.20.x86_64
|
|---|
| 29 | source `dirname $0`/sourcefile
|
|---|
| 30 | printprocesslog "INFO starting $0"
|
|---|
| 31 | program=chimp
|
|---|
| 32 | column=fChimp
|
|---|
| 33 | chimpdir=/home/dorner/Chimp
|
|---|
| 34 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$chimpdir/hessioxxx/lib:.
|
|---|
| 35 |
|
|---|
| 36 | set -C
|
|---|
| 37 |
|
|---|
| 38 | node=`echo $HOSTNAME | sed -e 's/compute-0-//' -e 's/[.]local//'`
|
|---|
| 39 | #printprocesslog "INFO $program is running on node $node"
|
|---|
| 40 | # get run #
|
|---|
| 41 | gettodo "1" $node
|
|---|
| 42 | run=${primaries[0]}
|
|---|
| 43 |
|
|---|
| 44 | # lock sequ
|
|---|
| 45 | lockfile=$lockpath/lock-$table-$column-$run.txt
|
|---|
| 46 | checklock
|
|---|
| 47 |
|
|---|
| 48 | printprocesslog "INFO starting $program for run $run"
|
|---|
| 49 |
|
|---|
| 50 | #get particle for file name
|
|---|
| 51 | particles[1]="gamma"
|
|---|
| 52 | particles[14]="proton"
|
|---|
| 53 | particles[6]="muon"
|
|---|
| 54 | particles[3]="electron"
|
|---|
| 55 | query="select fParticleTypeKEY from MCRunData where fMCRunNumber=$run"
|
|---|
| 56 | key=( `mysql -P 3306 -u operator --password=Ics+eMM! --host=mysql.isdc.unige.ch CTA_MC -s -e "$query"` )
|
|---|
| 57 | particle=${particles[$key]}
|
|---|
| 58 | infile=$mcpath/simtel/cta-ultra3/0.0deg/Data/${particle}_20deg_90deg_run`printf '%06d' ${run}`___cta-ultra3_desert.simtel.gz
|
|---|
| 59 | outfile=$mcpath/chimp/cta-ultra3/0.0deg/Data/${particle}_20deg_90deg_run`printf '%06d' ${run}`___cta-ultra3_desert.root
|
|---|
| 60 | outpath=$mcpath/chimp/cta-ultra3/0.0deg/Data
|
|---|
| 61 | logfile=$outpath/chimp_run`printf '%06d' ${run}`.log
|
|---|
| 62 | makedir $outpath
|
|---|
| 63 | chimppath=/home/dorner/data/chimp
|
|---|
| 64 | clusterchimppath=/state/cta/chimp
|
|---|
| 65 | makedir $chimppath
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | setstatus "start"
|
|---|
| 69 |
|
|---|
| 70 | cd $chimpdir
|
|---|
| 71 |
|
|---|
| 72 | printprocesslog "INFO ./chimp $infile >| $logfile 2>&1 "
|
|---|
| 73 | ./chimp $infile >| $logfile 2>&1
|
|---|
| 74 | check1=$?
|
|---|
| 75 |
|
|---|
| 76 | case $check1 in
|
|---|
| 77 | 0) printprocesslog "INFO $program finished successfully for run $run (check1=$check1)"
|
|---|
| 78 | # if ! cp $outfile $chimppath
|
|---|
| 79 | if ! scp $outfile $clusterchimppath
|
|---|
| 80 | then
|
|---|
| 81 | printprocesslog "ERROR copying $outfile to $chimppath failed"
|
|---|
| 82 | com=$Fchimpcp
|
|---|
| 83 | check=2
|
|---|
| 84 | else
|
|---|
| 85 | printprocesslog "INFO copied $outfile successfully to $chimppath"
|
|---|
| 86 | fi
|
|---|
| 87 | ;;
|
|---|
| 88 | *) printprocesslog "ERROR $program failed for run $run (check1=$check1)"
|
|---|
| 89 | com=$Fchimp
|
|---|
| 90 | check=$check1
|
|---|
| 91 | ;;
|
|---|
| 92 | esac
|
|---|
| 93 |
|
|---|
| 94 | setstatus "stop"
|
|---|
| 95 |
|
|---|
| 96 | finish
|
|---|
| 97 |
|
|---|