1 | #!/bin/bash
|
---|
2 |
|
---|
3 | threshold=5
|
---|
4 | maxdist=14
|
---|
5 | macro=$PWD/extract_singles.C
|
---|
6 | outpath=$PWD/files
|
---|
7 |
|
---|
8 | mkdir -p $outpath
|
---|
9 |
|
---|
10 | where="(((fNumPedestalTrigger=3000 OR fNumPedestalTrigger=5000) AND fRunTypeKEY=2) OR (fNumPedestalTrigger=10000 AND fRunTypeKEY=3) OR fRunTypeKEY=17)"
|
---|
11 | wheredrs="(drs.fROI=single.fROI AND fDrsStep=2)"
|
---|
12 |
|
---|
13 | query="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 "
|
---|
14 | query=$query" FROM RunInfo \`single\` WHERE "$where
|
---|
15 |
|
---|
16 | echo Query database...
|
---|
17 |
|
---|
18 | runpairs=( `mysql -u factread --password=r3adfac! --host=lp-fact factdata -s -e "$query"` )
|
---|
19 |
|
---|
20 | for runpair in ${runpairs[@]}
|
---|
21 | do
|
---|
22 | if [ $runpair = 'NULL' ]
|
---|
23 | then
|
---|
24 | echo NULL: $runpair
|
---|
25 | continue
|
---|
26 | fi
|
---|
27 |
|
---|
28 | year=`echo $runpair | cut -c1-4`
|
---|
29 | month=`echo $runpair | cut -c5-6`
|
---|
30 | day=`echo $runpair | cut -c7-8`
|
---|
31 | night=`echo $runpair | cut -d_ -f1`
|
---|
32 | run=`echo $runpair | cut -d_ -f2`
|
---|
33 | drs=`echo $runpair | cut -d_ -f3`
|
---|
34 |
|
---|
35 | runnum=`printf %03d $run`
|
---|
36 | drsnum=`printf %03d $drs`
|
---|
37 |
|
---|
38 | path="/fact/raw/"$year"/"$month"/"$day
|
---|
39 | runfile=$path"/"$night"_"
|
---|
40 | drsfile=$path"/"$night"_"$drsnum.drs.fits.gz
|
---|
41 | log=$outpath"/"$night"_"$runnum
|
---|
42 |
|
---|
43 | outfile=$outpath/`basename $runfile`${runnum}_${runnum}.root
|
---|
44 |
|
---|
45 | if [ -e $outfile ]
|
---|
46 | then
|
---|
47 | continue
|
---|
48 | fi
|
---|
49 |
|
---|
50 |
|
---|
51 |
|
---|
52 | echo "Submitting "${night}"_"${runnum}"["${drsnum}"]"
|
---|
53 |
|
---|
54 | cd ~/Mars
|
---|
55 |
|
---|
56 | cmd="ROOT_HIST=0 ${ROOTSYS}/bin/root -q -b -l ${macro}+\($maxdist,$threshold,\\\"$runfile\\\",$run,$run,\\\"$drsfile\\\",\\\"${outpath}\\\"\)"
|
---|
57 |
|
---|
58 | echo "echo ${cmd}; ${cmd}" | qsub -N e${night}-${runnum} -q test -cwd -e ${log}".err" -o ${log}".log"
|
---|
59 |
|
---|
60 | cd - > /dev/null
|
---|
61 | done
|
---|
62 |
|
---|
63 |
|
---|