Logo Coherent WaveBurst  
Reference Guide
Logo
 All Namespaces Files Functions Variables Macros Pages
cwb_ppchunk.csh
Go to the documentation of this file.
1 #!/bin/tcsh -f
2 
3 onintr irq_ctrlc
4 
5 if ($1 == '') then
6  echo ""
7  echo 'cwb_ppchunk --run="..." --chunk="..." --cal="..." --net="..." --search="..." --type="..." --tag="..." --mlabel="..." --opt="..."'
8  echo ""
9  echo "run : O1, O2"
10  echo "chunk : integer number"
11  echo "cal : C00, C00c, C01, C02, C02c"
12  echo "net : LH LHV"
13  echo "search : BurstLF, BurstHF, BurstLD, IMBHB, BBH"
14  echo "type : BKG, SIM"
15  echo "tag : user string (Ex: run1, tst1, dev1)"
16  echo 'mlabel : merge label, default="M1"'
17  echo ""
18  echo "options : optional"
19  echo " no options -> report (default)"
20  echo " merge : execute merge"
21  echo " veto : execute veto"
22  echo " cut : execute cut"
23  echo " report: execute report"
24  echo " all : execute merge + veto + cut + report"
25  echo ""
26  echo 'Ex: cwb_ppchunk --run="O2" --chunk="03" --cal="C00" --net="LH" --search="BurstLF" --type="BKG" --tag="dev1" --mlabel="M1"'
27  echo "or"
28  echo 'Ex: cwb_ppchunk --run=O2 --chunk=03 --cal=C00 --net=LH --search=BurstLF --type=BKG --tag=dev1 --mlabel=M1'
29  echo "or"
30  echo 'Ex: cwb_ppchunk --run O2 --chunk 03 --cal C00 --net LH --search BurstLF --type BKG --tag dev1 --mlabel M1'
31  echo ""
32  exit 1
33 endif
34 
35 setenv CWB_PPCHUNK_OPTIONS ""
36 setenv CWB_PPCHUNK_RUN ""
37 setenv CWB_PPCHUNK_CHUNK ""
38 setenv CWB_PPCHUNK_CAL ""
39 setenv CWB_PPCHUNK_NET ""
40 setenv CWB_PPCHUNK_SEARCH ""
41 setenv CWB_PPCHUNK_TYPE ""
42 setenv CWB_PPCHUNK_TAG ""
43 setenv CWB_PPCHUNK_MLABEL "M1"
44 setenv CWB_PPCHUNK_OPTIONS "all"
45 
46 set cmd_line="$0 $argv"
47 
48 set temp=(`getopt -s tcsh -o r:c:C:n:s:t:T:m:o: --long run:,chunk:,cal:,net:,search:,type:,tag:,mlabel:,opt: -- $argv:q`)
49 if ($? != 0) then
50  echo "Terminating..." >/dev/stderr
51  exit 1
52 endif
53 eval set argv=\($temp:q\)
54 
55 while (1)
56  switch($1:q)
57  case -r:
58  case --run:
59  setenv CWB_PPCHUNK_RUN $2:q
60  shift ; shift
61  breaksw
62  case -c:
63  case --chunk:
64  setenv CWB_PPCHUNK_CHUNK $2:q
65  shift ; shift
66  breaksw
67  case -C:
68  case --cal:
69  setenv CWB_PPCHUNK_CAL $2:q
70  shift ; shift
71  breaksw
72  case -n:
73  case --net:
74  setenv CWB_PPCHUNK_NET $2:q
75  shift ; shift
76  breaksw
77  case -s:
78  case --search:
79  setenv CWB_PPCHUNK_SEARCH $2:q
80  shift ; shift
81  breaksw
82  case -t:
83  case --type:
84  setenv CWB_PPCHUNK_TYPE $2:q
85  shift ; shift
86  breaksw
87  case -T:
88  case --tag:
89  setenv CWB_PPCHUNK_TAG $2:q
90  shift ; shift
91  breaksw
92  case -m:
93  case --mlabel:
94  setenv CWB_PPCHUNK_MLABEL $2:q
95  shift ; shift
96  breaksw
97  case -o:
98  case --opt:
99  setenv CWB_PPCHUNK_OPTIONS $2:q
100  shift ; shift
101  breaksw
102  case --:
103  shift
104  break
105  default:
106  echo "error - missing parameters!" ; exit 1
107  endsw
108 end
109 
110 if ((( $CWB_PPCHUNK_RUN != 'O1' ) && ( $CWB_PPCHUNK_RUN != 'O2' ))) then
111  echo ""
112  echo --run=\'$CWB_PPCHUNK_RUN\' "is a wrong cwb_ppchunk option\n"
113  echo "type cwb_ppchunk to list the available options"
114  echo ""
115  exit 1
116 endif
117 
118 if ( $CWB_PPCHUNK_CHUNK !~ ^[0-9]+$ ) then
119  echo ""
120  echo --chunk=\'$CWB_PPCHUNK_CHUNK\' "is a wrong cwb_ppchunk option\n"
121  echo "type cwb_ppchunk to list the available options"
122  echo ""
123  exit 1
124 else
125  if ( $CWB_PPCHUNK_CHUNK == 99 ) then
126  @ CHUNK_START = $O2_CHUNK_START
127  @ CHUNK_STOP = $O2_CHUNK_STOP
128  else
129  @ CHUNK_START = $CWB_PPCHUNK_CHUNK
130  @ CHUNK_STOP = $CWB_PPCHUNK_CHUNK
131  endif
132 endif
133 
134 if ((( $CWB_PPCHUNK_CAL != 'C00' ) && ( $CWB_PPCHUNK_CAL != 'C00c' ) && ( $CWB_PPCHUNK_CAL != 'C01' ) && ( $CWB_PPCHUNK_CAL != 'C02' ) && ( $CWB_PPCHUNK_CAL != 'C02c' ))) then
135  echo ""
136  echo --cal=\'$CWB_PPCHUNK_CAL\' "is a wrong cwb_ppchunk option\n"
137  echo "type cwb_ppchunk to list the available options"
138  echo ""
139  exit 1
140 endif
141 
142 if ((( $CWB_PPCHUNK_NET != 'LH' ) && ( $CWB_PPCHUNK_NET != 'LHV' ))) then
143  echo ""
144  echo --net=\'$CWB_PPCHUNK_NET\' "is a wrong cwb_ppchunk option\n"
145  echo "type cwb_ppchunk to list the available options"
146  echo ""
147  exit 1
148 endif
149 
150 if ((( $CWB_PPCHUNK_SEARCH != 'BurstLF' ) && ( $CWB_PPCHUNK_SEARCH != 'BurstHF' ) && ( $CWB_PPCHUNK_SEARCH != 'BurstLD' ) && ( $CWB_PPCHUNK_SEARCH != 'IMBHB' ) && ( $CWB_PPCHUNK_SEARCH != 'BBH' ))) then
151  echo ""
152  echo --search=\'$CWB_PPCHUNK_SEARCH\' "is a wrong cwb_ppchunk option\n"
153  echo "type cwb_ppchunk to list the available options"
154  echo ""
155  exit 1
156 endif
157 
158 if ((( $CWB_PPCHUNK_TYPE == 'BKG' ) || ( $CWB_PPCHUNK_TYPE =~ 'SIM/*' ))) then
159  setenv CWB_PPCHUNK_TYPE $CWB_PPCHUNK_TYPE
160  set CWB_PPCHUNK_SIM=$CWB_PPCHUNK_TYPE
161  set CWB_PPCHUNK_SIM_DIR=`echo $CWB_PPCHUNK_SIM | awk '{print substr($0, 5, length($0)-1)}'`
162 else
163  echo ""
164  echo --type=\'$CWB_PPCHUNK_TYPE\' "is a wrong cwb_ppchunk option\n"
165  echo "type cwb_ppchunk to list the available options"
166  echo ""
167  exit 1
168 endif
169 
170 if ((( $CWB_PPCHUNK_TAG == '' ))) then
171  echo ""
172  echo --tag=\'$CWB_PPCHUNK_TAG\' "is a wrong cwb_ppchunk option\n"
173  echo "type cwb_ppchunk to list the available options"
174  echo ""
175  exit 1
176 endif
177 
178 if ((( $CWB_PPCHUNK_MLABEL == 'M0' ))) then
179  echo ""
180  echo --mlabel=\'$CWB_PPCHUNK_MLABEL\' "is a wrong cwb_ppchunk option\n"
181  echo "type cwb_ppchunk to list the available options"
182  echo ""
183  exit 1
184 endif
185 
186 if (( $CWB_PPCHUNK_OPTIONS != 'merge' ) && ( $CWB_PPCHUNK_OPTIONS != 'veto' ) && ( $CWB_PPCHUNK_OPTIONS != 'cut' ) && ( $CWB_PPCHUNK_OPTIONS != 'report' ) && ( $CWB_PPCHUNK_OPTIONS != 'all' )) then
187  echo ""
188  echo --opt=\'$CWB_PPCHUNK_OPTIONS\' "is a wrong cwb_ppchunk option\n"
189  echo "type cwb_ppchunk to list the available options"
190  echo ""
191  exit 1
192 endif
193 
194 if (( $CWB_PPCHUNK_TYPE =~ 'SIM/*' )) then
195  setenv CWB_PPCHUNK_DIR $CWB_PPCHUNK_RUN\_K$CWB_PPCHUNK_CHUNK\_$CWB_PPCHUNK_CAL\_$CWB_PPCHUNK_NET\_$CWB_PPCHUNK_SEARCH\_SIM\_$CWB_PPCHUNK_SIM_DIR\_$CWB_PPCHUNK_TAG
196 else
197  setenv CWB_PPCHUNK_DIR $CWB_PPCHUNK_RUN\_K$CWB_PPCHUNK_CHUNK\_$CWB_PPCHUNK_CAL\_$CWB_PPCHUNK_NET\_$CWB_PPCHUNK_SEARCH\_$CWB_PPCHUNK_TYPE\_$CWB_PPCHUNK_TAG
198 endif
199 
200 
201 cd $CWB_PPCHUNK_DIR
202 $CWB_CONFIG/$CWB_PPCHUNK_RUN/SEARCHES/OFFLINE/$CWB_PPCHUNK_SEARCH/$CWB_PPCHUNK_NET/$CWB_PPCHUNK_TYPE/mkpp.csh $CWB_PPCHUNK_MLABEL $CHUNK_START $CHUNK_STOP $CWB_PPCHUNK_OPTIONS
203 if ( $? != 0) exit 1
204 # create cWB_config.log file
205 make -f $CWB_CONFIG/Makefile.log CMD_LINE="$cmd_line" git >& /dev/null
206 
207 cd ..
208 
209 
210 unsetenv CWB_PPCHUNK_RUN
211 unsetenv CWB_PPCHUNK_CHUNK
212 unsetenv CWB_PPCHUNK_CAL
213 unsetenv CWB_PPCHUNK_NET
214 unsetenv CWB_PPCHUNK_SEARCH
215 unsetenv CWB_PPCHUNK_TYPE
216 unsetenv CWB_PPCHUNK_TAG
217 unsetenv CWB_PPCHUNK_MLABEL
218 unsetenv CWB_PPCHUNK_OPTIONS
219 unsetenv CWB_PPCHUNK_DIR
220 
221 exit 0
222 irq_ctrlc:
223  ps T | grep root | awk '{print $1}' | xargs kill -9
224  exit 1
shift breaksw case C
Definition: cwb_ppchunk.csh:70
TString type
shift breaksw case c
Definition: cwb_ppchunk.csh:65
shift breaksw case n
Definition: cwb_ppchunk.csh:75
int chunk[CHUNK_MAX_SIZE]
shift breaksw case r
Definition: cwb_clchunk.csh:55
shift breaksw case T
Definition: cwb_ppchunk.csh:90
shift breaksw case s
Definition: cwb_ppchunk.csh:80
shift breaksw case q
shift breaksw case o
shift breaksw case t
Definition: cwb_ppchunk.csh:85
shift breaksw case m
Definition: cwb_ppchunk.csh:95
search