source: trunk/Mars/datacenter/scripts/runctastar@ 18145

Last change on this file since 18145 was 9504, checked in by Daniela Dorner, 15 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.8 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 04/2009 <mailto:daniela.dorner@unige.ch>
21#
22# Copyright: MAGIC Software Development, 2000-2009
23#
24#
25# ========================================================================
26#
27
28rootsys=/opt/root5.12.i386
29source `dirname $0`/sourcefile
30printprocesslog "INFO starting $0"
31program=ctastar
32column=fCTAStar
33bcnmars=/home/dorner/Mars.BCN.2009.03.27.cvs
34
35set -C
36
37node=`echo $HOSTNAME | sed -e 's/compute-0-//' -e 's/[.]local//'`
38printprocesslog "INFO $program is running on node $node"
39# get run #
40gettodo "1" $node
41run=${primaries[0]}
42
43# lock sequ
44lockfile=$lockpath/lock-$table-$column-$run.txt
45checklock
46
47printprocesslog "INFO starting $program for run $run"
48
49#get particle for file name
50particles[1]="gamma"
51particles[14]="proton"
52particles[6]="muon"
53particles[3]="electron"
54query="select fParticleTypeKEY from MCRunData where fMCRunNumber=$run"
55key=( `mysql -P 3306 -u operator --password=Ics+eMM! --host=mysql.isdc.unige.ch CTA_MC -s -e "$query"` )
56particle=${particles[$key]}
57infile=$mcpath/chimp/cta-ultra3/0.0deg/Data/${particle}_20deg_90deg_run`printf '%06d' ${run}`___cta-ultra3_desert.root
58outpath=$mcpath/star
59outfile=$outpath/${particle}_20deg_90deg_run`printf '%06d' ${run}`___cta-ultra3_desert_I.root
60starpath=/home/dorner/data/star
61makedir $starpath
62logfile=$outpath/CTAstar_run`printf '%06d' ${run}`.log
63makedir $outpath
64
65setstatus "start"
66
67cd $bcnmars
68
69printprocesslog "INFO starting: root -q -b macros/CTAstar.C\("\"$infile\""\,"\"$outpath\""\) | tee $logfile | intgrep"
70check1=`root -q -b macros/CTAstar.C\(\""$infile\""\,\""$outpath\""\) | tee $logfile | intgrep`
71
72case $check1 in
73 1) printprocesslog "INFO $program finished successfully for run $run (check1=$check1)"
74 if ! cp $outfile $starpath
75 then
76 printprocesslog "ERROR copying $outfile to $starpath failed"
77 com=$Fctastarcp
78 check=2
79 else
80 printprocesslog "INFO copied $outfile successfully to $starpath"
81 fi
82 ;;
83 *) printprocesslog "ERROR $program failed for run $run (check1=$check1)"
84 com=$Fctastar
85 check=$check1
86 ;;
87esac
88
89setstatus "stop"
90
91finish
92
Note: See TracBrowser for help on using the repository browser.