1 | #!/bin/bash
|
---|
2 | # Author: Javi Lopez <jlopez@ifae.es>
|
---|
3 | # Update: 2004/05/23
|
---|
4 | # Description: Run the makeHillas program grouping
|
---|
5 | # the data files with the preavious
|
---|
6 | # pedestal run.
|
---|
7 |
|
---|
8 |
|
---|
9 | STARTDATE=$(date)
|
---|
10 |
|
---|
11 | #--DATACARD INFO--
|
---|
12 | NEVENTS=999999999
|
---|
13 | CALFLAG=1
|
---|
14 | CLEANLEVEL1=3.0
|
---|
15 | CLEANLEVEL2=1.5
|
---|
16 | ISLFLAG=0
|
---|
17 | ISLANDCLEAN1=1
|
---|
18 | ISLANDCLEAN2=40
|
---|
19 | SLOWCRT=1
|
---|
20 | HVCONFFILE=/mnt/users/jlopez/Mars/Files4Mars/Config/HVSettings_FF35q.conf
|
---|
21 | CLFILE=/local_disk/CaCoData/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root
|
---|
22 | #------------------
|
---|
23 |
|
---|
24 | MARSPATH=/mnt/users/jlopez/Mars/Mars
|
---|
25 | MACRO=makeHillas.C
|
---|
26 | #BIN=makeHillas
|
---|
27 | CARD=input.datacard
|
---|
28 |
|
---|
29 | LOCALDIR=$(pwd)
|
---|
30 | cd ${MARSPATH}
|
---|
31 |
|
---|
32 | DATAPATH=/local_disk/Data/rootdata/Mrk421/Period016/2004_04_21
|
---|
33 | RUNS=$(ls ${DATAPATH} | gawk -F_ '{print $2}')
|
---|
34 | #RUNS='22999 23000'
|
---|
35 | echo RUNS ${RUNS}
|
---|
36 | PRUNS=$(ls ${DATAPATH} | grep _P_ | gawk -F_ '{print $2}')
|
---|
37 | #PRUNS='23209 22990'
|
---|
38 |
|
---|
39 | #CRUN=$(ls ${DATAPATH} | grep _C_ | gawk -F_ '{print $2}')
|
---|
40 | CRUN=23207
|
---|
41 | echo CRUN ${CRUN}
|
---|
42 |
|
---|
43 | #Look for the closer pedestal run for the calibration
|
---|
44 | MINDIST=99999
|
---|
45 | for PRUN in ${PRUNS}
|
---|
46 | do
|
---|
47 | DIST=$[${PRUN}-${CRUN}]
|
---|
48 | if [ ${DIST} -lt "0" ]; then
|
---|
49 | DIST=$[-${DIST}]
|
---|
50 | fi
|
---|
51 | # echo PRUN ${PRUN}
|
---|
52 | # echo DIST ${DIST}
|
---|
53 | if [ ${DIST} -lt ${MINDIST} ]; then
|
---|
54 | PRUNFORCAL=${PRUN}
|
---|
55 | MINDIST=${DIST}
|
---|
56 | fi
|
---|
57 | done
|
---|
58 | echo PRUNFORCAL ${PRUNFORCAL}
|
---|
59 |
|
---|
60 | FIRSTPRUN=$(echo ${PRUNS} | gawk '{print $1}')
|
---|
61 | for RUN in ${RUNS}
|
---|
62 | do
|
---|
63 | RUNTYPE=$(ls ${DATAPATH} | grep ${RUN} | gawk -F_ '{print $3}')
|
---|
64 | if [ ${RUNTYPE} == "P" ]; then
|
---|
65 | if [ ${RUN} != ${FIRSTPRUN} ]; then
|
---|
66 | if [ ! -z $(echo ${DRUNS} | gawk '{print $1}') ]; then
|
---|
67 | # echo PRUN ${PRUN}
|
---|
68 | # echo DRUNS ${DRUNS} [${FIRSTDRUN}-${LASTDRUN}]
|
---|
69 | DATE=$(ls ${DATAPATH} | grep ${PRUN} | gawk -F_ '{print $1}')
|
---|
70 | SOURCE=$(ls ${DATAPATH} | grep ${PRUN} | gawk -F_ '{print $4}')
|
---|
71 | #produce the datacard and run makeHillas
|
---|
72 | echo "NEVENTS ${NEVENTS}" > ./${CARD}
|
---|
73 | echo "IDIR ${DATAPATH}" >> ./${CARD}
|
---|
74 | echo "PCRUNS ${PRUNFORCAL}" >> ./${CARD}
|
---|
75 | echo "CRUNS ${CRUN}" >> ./${CARD}
|
---|
76 | echo "PRUNS ${PRUN}" >> ./${CARD}
|
---|
77 | echo "DRUNS ${FIRSTDRUN}-${LASTDRUN}" >> ./${CARD}
|
---|
78 | echo "OUTFILE ${DATE}_C_${CRUN}_P_${PRUN}_D_${FIRSTDRUN}-${LASTDRUN}_${SOURCE}_H.root" >> ./${CARD}
|
---|
79 | echo "CALFLAG ${CALFLAG}" >> ./${CARD}
|
---|
80 | echo "CLEANLEVEL ${CLEANLEVEL1} ${CLEANLEVEL2}" >> ./${CARD}
|
---|
81 | echo "ISLFLAG ${ISLFLAG}" >> ./${CARD}
|
---|
82 | echo "ISLANDCLEAN ${ISLANDCLEAN1} ${ISLANDCLEAN2}" >> ./${CARD}
|
---|
83 | echo "SLOWCRT ${SLOWCRT}" >> ./${CARD}
|
---|
84 | echo "HVCONFFILE ${HVCONFFILE}" >> ./${CARD}
|
---|
85 | echo "CLFILE ${CLFILE}" >> ./${CARD}
|
---|
86 | echo "Produced datacard for makeHillas"
|
---|
87 | cat ./${CARD}
|
---|
88 | root -b -q ${MARSSYS}/mtemp/mifae/macros/${MACRO}
|
---|
89 | rm ./${CARD}
|
---|
90 |
|
---|
91 | mv *_H.root ${LOCALDIR}
|
---|
92 | fi
|
---|
93 | fi
|
---|
94 | PRUN=${RUN}
|
---|
95 | DRUNS=""
|
---|
96 | FIRSTDRUN=""
|
---|
97 | else
|
---|
98 | if [ ${RUNTYPE} == "D" ]; then
|
---|
99 | if [ -z ${FIRSTDRUN} ]; then
|
---|
100 | FIRSTDRUN=${RUN}
|
---|
101 | fi
|
---|
102 | LASTDRUN=${RUN}
|
---|
103 | DRUNS="${DRUNS} ${RUN}"
|
---|
104 | fi
|
---|
105 | fi
|
---|
106 | done
|
---|
107 |
|
---|
108 | if [ ! -z $(echo ${DRUNS} | gawk '{print $1}') ]; then
|
---|
109 | # echo PRUN ${PRUN}
|
---|
110 | # echo DRUNS ${DRUNS} [${FIRSTDRUN}-${LASTDRUN}]
|
---|
111 |
|
---|
112 | DATE=$(ls ${DATAPATH} | grep ${RUN} | gawk -F_ '{print $1}')
|
---|
113 | SOURCE=$(ls ${DATAPATH} | grep ${RUN} | gawk -F_ '{print $4}')
|
---|
114 | #produce the datacard and run makeHillas
|
---|
115 | echo "NEVENTS 99999999" > ./${CARD}
|
---|
116 | echo "IDIR ${DATAPATH}" >> ./${CARD}
|
---|
117 | echo "PCRUNS ${PRUNFORCAL}" >> ./${CARD}
|
---|
118 | echo "CRUNS ${CRUN}" >> ./${CARD}
|
---|
119 | echo "PRUNS ${PRUN}" >> ./${CARD}
|
---|
120 | echo "DRUNS ${FIRSTDRUN}-${LASTDRUN}" >> ./${CARD}
|
---|
121 | echo "OUTFILE ${DATE}_C_${CRUN}_P_${PRUN}_D_${FIRSTDRUN}-${LASTDRUN}_${SOURCE}_H.root" >> ./${CARD}
|
---|
122 | echo "CALFLAG ${CALFLAG}" >> ./${CARD}
|
---|
123 | echo "CLEANLEVEL ${CLEANLEVEL1} ${CLEANLEVEL2}" >> ./${CARD}
|
---|
124 | echo "ISLFLAG ${ISLFLAG}" >> ./${CARD}
|
---|
125 | echo "ISLANDCLEAN ${ISLANDCLEAN1} ${ISLANDCLEAN1}" >> ./${CARD}
|
---|
126 | echo "SLOWCRT ${SLOWCRT}" >> ./${CARD}
|
---|
127 | echo "HVCONFFILE ${HVCONFFILE}" >> ./${CARD}
|
---|
128 | echo "CLFILE ${CLFILE}" >> ./${CARD}
|
---|
129 | echo "Last produced datacard for makeHillas"
|
---|
130 | cat ./${CARD}
|
---|
131 | root -b -q ${MARSSYS}/mtemp/mifae/macros/${MACRO}
|
---|
132 | rm ./${CARD}
|
---|
133 |
|
---|
134 | mv *_H.root ${LOCALDIR}
|
---|
135 | fi
|
---|
136 |
|
---|
137 | cd ${LOCALDIR}
|
---|
138 |
|
---|
139 | STOPDATE=$(date)
|
---|
140 |
|
---|
141 | echo "STARTING DATE ${STARTDATE}"
|
---|
142 | echo "STOPING DATE ${STOPDATE}"
|
---|