source: trunk/MagicSoft/Mars/datacenter/scripts/insertdatasets@ 7073

Last change on this file since 7073 was 7051, checked in by Daniela Dorner, 20 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.0 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 08/2004 <mailto:dorner@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2004
23#
24#
25# ========================================================================
26#
27#
28
29source /home/operator/Mars.cvs/datacenter/scripts/sourcefile
30
31set -C
32
33#cd $mars
34
35macrospath=/home/operator/Mars.cvs/datacenter/macros
36cd /home/operator/Mars.cvs
37
38datetime=`date +%F-%H-%M-%S`
39year=`date +%Y`
40
41scriptlogpath=$logpath/run/insertdatasets/`date +%Y/%m`
42if [ ! -d $scriptlogpath ]
43then
44 mkdir -pv $scriptlogpath
45 if [ ! -d $scriptlogpath ]
46 then
47 echo "could not make scriptlogpath "$scriptlogpath
48 exit
49 fi
50fi
51
52scriptlog=$scriptlogpath/insertdatasets-$datetime.log
53
54date >> $scriptlog 2>&1
55
56date > $lockpath/lock-insertdatasets.txt >> $scriptlog 2>&1
57checklock0=$?
58case $checklock0 in
59 0) echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
60 1) echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
61 echo "-> getting list for callisto is running -> exit" >> $scriptlog 2>&1
62 date >> $scriptlog 2>&1
63 exit;;
64 *) echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
65esac
66
67
68datasetfiles=(`ls /magic/datasets/*/*`)
69echo "datasetfiles: "${datasetfiles[@]} >> $scriptlog 2>&1
70echo "" >> $scriptlog 2>&1
71
72for datasetfile in ${datasetfiles[@]}
73do
74 no=`echo $datasetfile | cut -d/ -f5 | cut -c8-99 | cut -d. -f1`
75 no2=`grep 'AnalysisNumber:' $datasetfile | sed -e 's/AnalysisNumber://g' | sed -e 's/ //g'`
76 no3=`printf %08d $no2`
77 if [ "$no" = "$no3" ]
78 then
79 echo "number in filename and in file are the same -> continue" >> $scriptlog 2>&1
80 else
81 echo "number in filename and in file are not the same " >> $scriptlog 2>&1
82 echo " -> continue with next dataset" >> $scriptlog 2>&1
83 continue
84 fi
85 source=`grep 'SourceName:' $datasetfile | sed -e 's/SourceName://g' | sed -e 's/ //g' | sed -e 's/#//g'` >> $scriptlog 2>&1
86 mode=`grep 'WobbleMode:' $datasetfile` >> $scriptlog 2>&1
87 mode2=`echo $mode | grep ^\#` >> $scriptlog 2>&1
88 if [ "$mode2" = "" ]
89 then
90 wobble="Y" >> $scriptlog 2>&1
91 else
92 wobble="N" >> $scriptlog 2>&1
93 fi
94 echo "file: "$datasetfile >> $scriptlog 2>&1
95 echo " datasetno: "$no2 >> $scriptlog 2>&1
96 echo " sourcename: "$source >> $scriptlog 2>&1
97 echo " wobble: "$wobble >> $scriptlog 2>&1
98 echo " " >> $scriptlog 2>&1
99
100 insertdatasetpath=$logpath/insertdataset/$no3
101 if [ ! -d $insertdatasetpath ]
102 then
103 mkdir -pv $insertdatasetpath >> $scriptlog 2>&1
104 if [ ! -d $insertdatasetpath ]
105 then
106 echo "could not make insertdatasetpath "$insertdatasetpath >> $scriptlog 2>&1
107 continue
108 fi
109 fi
110 insertdatasetlog=$insertdatasetpath/insertdataset-$no3.log
111 check0=`root -q -b $macrospath/insertdataset.C+\("\"$no2\""\,"\"$source\""\,"\"$wobble\"",kFALSE\) | tee $insertdatasetlog | grep int | sed -e 's/(int)//'`
112 case $check0 in
113 1) echo "check0=$check0 -> everthing ok " >> $scriptlog 2>&1 ;;
114 *) echo "check0=$check0 -> ERROR " >> $scriptlog 2>&1 ;;
115 esac
116done
117
118rm -v $todofile >> $scriptlog 2>&1
119rm -v $lockpath/lock-insertdatasets.txt >> $scriptlog 2>&1
120
121set +C
122
123date >> $scriptlog 2>&1
124
125
Note: See TracBrowser for help on using the repository browser.