source: trunk/MagicSoft/Mars/mtemp/mifae/scripts/makeHillas.sh@ 4450

Last change on this file since 4450 was 4431, checked in by jlopez, 20 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.3 KB
Line 
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
9STARTDATE=$(date)
10
11#--DATACARD INFO--
12NEVENTS=999999999
13CALFLAG=1
14CLEANLEVEL1=3.0
15CLEANLEVEL2=1.5
16ISLFLAG=0
17ISLANDCLEAN1=1
18ISLANDCLEAN2=40
19SLOWCRT=1
20HVCONFFILE=/mnt/users/jlopez/Mars/Files4Mars/Config/HVSettings_FF35q.conf
21CLFILE=/local_disk/CaCoData/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root
22#------------------
23
24MARSPATH=/mnt/users/jlopez/Mars/Mars
25MACRO=makeHillas.C
26#BIN=makeHillas
27CARD=input.datacard
28
29LOCALDIR=$(pwd)
30cd ${MARSPATH}
31
32DATAPATH=/local_disk/Data/rootdata/Mrk421/Period016/2004_04_21
33RUNS=$(ls ${DATAPATH} | gawk -F_ '{print $2}')
34#RUNS='22999 23000'
35echo RUNS ${RUNS}
36PRUNS=$(ls ${DATAPATH} | grep _P_ | gawk -F_ '{print $2}')
37#PRUNS='23209 22990'
38
39#CRUN=$(ls ${DATAPATH} | grep _C_ | gawk -F_ '{print $2}')
40CRUN=23207
41echo CRUN ${CRUN}
42
43#Look for the closer pedestal run for the calibration
44MINDIST=99999
45for PRUN in ${PRUNS}
46do
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
57done
58echo PRUNFORCAL ${PRUNFORCAL}
59
60FIRSTPRUN=$(echo ${PRUNS} | gawk '{print $1}')
61for RUN in ${RUNS}
62do
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
106done
107
108if [ ! -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}
135fi
136
137cd ${LOCALDIR}
138
139STOPDATE=$(date)
140
141echo "STARTING DATE ${STARTDATE}"
142echo "STOPING DATE ${STOPDATE}"
Note: See TracBrowser for help on using the repository browser.