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 | cp ${macro} ${outpath}
|
---|
10 |
|
---|
11 | where="(((fNumPedestalTrigger=3000 OR fNumPedestalTrigger=5000) AND fRunTypeKey=2) OR (fNumPedestalTrigger=10000 AND fRunTypeKey=3) OR fRunTypeKey=17)"
|
---|
12 | wheredrs="(drs.fROI=single.fROI AND fDrsStep=2)"
|
---|
13 |
|
---|
14 | query="SELECT Concat(fNight, '_', fRunID, '_', (SELECT fRunID FROM RunInfo \`drs\` WHERE drs.fNight=single.fNight AND "$wheredrs" AND single.fRunID<30+drs.fRunID ORDER BY ABS(CAST(single.fRunID AS SIGNED) - CAST(drs.fRunID AS SIGNED)) ASC LIMIT 0,1)) AS num "
|
---|
15 | query=$query" FROM RunInfo \`single\` WHERE "$where
|
---|
16 |
|
---|
17 | runpairs=( `mysql -u factread --password=r3adfac! --host=lp-fact factdata -s -e "$query"` )
|
---|
18 |
|
---|
19 | for runpair in ${runpairs[@]}
|
---|
20 | do
|
---|
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 | #runpath="/archive/fact/fails/raw/"$year"/"$month"/"$day
|
---|
38 | #drspath="/fact/raw/"$year"/"$month"/"$day
|
---|
39 |
|
---|
40 | runpath="/fact/raw/"$year"/"$month"/"$day
|
---|
41 | drspath="/fact/raw/"$year"/"$month"/"$day
|
---|
42 |
|
---|
43 | runfile=$runpath"/"$night"_"
|
---|
44 | drsfile=$drspath"/"$night"_"$drsnum.drs.fits.gz
|
---|
45 | log=$outpath"/"$night"_"$runnum
|
---|
46 |
|
---|
47 | outfile=$outpath/`basename $runfile`${runnum}_${runnum}.root
|
---|
48 |
|
---|
49 | if [ -e $outfile ]
|
---|
50 | then
|
---|
51 | continue
|
---|
52 | fi
|
---|
53 |
|
---|
54 | # echo "Submitting "${night}"_"${runnum}"["${drsnum}"]"
|
---|
55 |
|
---|
56 | cd ~/Mars
|
---|
57 |
|
---|
58 | cmd="ROOT_HIST=0 ${ROOTSYS}/bin/root -q -b -l ${macro}+\($maxdist,$threshold,\\\"$runfile\\\",$run,$run,\\\"$drsfile\\\",\\\"${outpath}\\\"\)"
|
---|
59 |
|
---|
60 | echo "echo '${cmd}'; date; ${cmd}" | qsub -N e${name}${runnum} -q test -cwd -e ${log}".err" -o ${log}".log"
|
---|
61 |
|
---|
62 | cd - > /dev/null
|
---|
63 | done
|
---|
64 |
|
---|
65 |
|
---|