source: trunk/Mars/fact/analysis/gain/runanalysis.sh @ 17160

Last change on this file since 17160 was 17160, checked in by tbretz, 7 years ago
Copy macro; no output if nothing happens (for cronjobs); shoerter name
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/bash
2
3threshold=5
4maxdist=14
5macro=$PWD/extract_singles.C
6outpath=$PWD/files
7
8mkdir -p $outpath
9cp ${macro} ${outpath}
10
11where="(((fNumPedestalTrigger=3000 OR fNumPedestalTrigger=5000) AND fRunTypeKEY=2) OR (fNumPedestalTrigger=10000 AND fRunTypeKEY=3) OR fRunTypeKEY=17)"
12wheredrs="(drs.fROI=single.fROI AND fDrsStep=2)"
13
14query="SELECT Concat(fNight, '_', fRunId, '_', (SELECT fRunId FROM RunInfo \`drs\` WHERE drs.fNight=single.fNight AND "$wheredrs" AND (single.fRunId-drs.fRunId)<10 limit 0,1)) AS num "
15query=$query" FROM RunInfo \`single\` WHERE "$where
16
17runpairs=( `mysql -u factread --password=r3adfac! --host=lp-fact factdata -s -e "$query"` )
18
19for runpair in ${runpairs[@]}
20do
21   if [ $runpair = 'NULL' ]
22   then
23      continue
24   fi
25
26   year=`echo $runpair | cut -c1-4`
27   month=`echo $runpair | cut -c5-6`
28   day=`echo $runpair | cut -c7-8`
29   night=`echo $runpair | cut -d_ -f1`
30   run=`echo $runpair | cut -d_ -f2`
31   drs=`echo $runpair | cut -d_ -f3`
32   name=`echo $night | cut -c3-`
33
34   runnum=`printf %03d $run`
35   drsnum=`printf %03d $drs`
36
37   path="/fact/raw/"$year"/"$month"/"$day
38   runfile=$path"/"$night"_"
39   drsfile=$path"/"$night"_"$drsnum.drs.fits.gz
40   log=$outpath"/"$night"_"$runnum
41
42   outfile=$outpath/`basename $runfile`${runnum}_${runnum}.root
43
44   if [ -e $outfile ]
45   then
46      continue
47   fi
48   
49   
50
51   echo "Submitting "${night}"_"${runnum}"["${drsnum}"]"
52
53   cd ~/Mars
54
55   cmd="ROOT_HIST=0 ${ROOTSYS}/bin/root -q -b -l ${macro}+\($maxdist,$threshold,\\\"$runfile\\\",$run,$run,\\\"$drsfile\\\",\\\"${outpath}\\\"\)"
56
57   echo "echo ${cmd}; ${cmd}" | qsub -N e${name}-${runnum} -q test -cwd -e ${log}".err" -o ${log}".log"
58
59   cd - > /dev/null
60done
61
62
Note: See TracBrowser for help on using the repository browser.