Logo coherent WaveBurst  
Config Reference Guide
Logo
cwb_obchunk.csh
Go to the documentation of this file.
1 #!/bin/tcsh -f
2 
3 onintr irq_ctrlc
4 
5 if ( $1 == '' ) then
6  $CWB_SCRIPTS/cwb_help.csh cwb_obchunk
7  exit
8 endif
9 
10 if ($1 == '') then
11  echo ""
12  echo 'cwb_obchunk --run="..." --search="..." --bin="..." --wlabel="..." --list="..." --trials="..." --bbh="..." --chunk="..." --lag="..." --slag="..." --merge="..." --opt="..."'
13  echo ""
14  echo "run : O1, O2, O3 (def=O2)"
15  echo "search : BurstLF, BurstHF, BurstLD, IMBHB, BBH (def=BBH)"
16  echo "bin : 1,2,... -> bin1_cut, bin2_cut, ..."
17  echo "wlabel : working directory label -> O2_K03_C00_LH_BurstLF_BKG_dev1"
18  echo "list : list of root files used to merge together the chunks"
19  echo "trials : trials to applied to the detected events"
20  echo "bbh : true/false (def=true)"
21  echo "chunk : chunk number: integer number, Ex 02,03,...,15 "
22  echo "merge : merge id: integer number"
23  echo "mlabel : post merge label: Used when non standard labels are used in post-production"
24  echo " Ex: for M1.V_hvetoLH.C_bin1_cut it is V_hvetoLH.C_bin1_cut"
25  echo "rlabel : report label: Used when non standard labels are used in post-production reports"
26  echo " Ex: for M1.V_hvetoLH.C_bin1_cut.R_rMRA_hveto_i0cc00_i1rho0_freq16_512 it is R_rMRA_hveto_i0cc00_i1rho0_freq16_512"
27  echo "lag : lag number: integer number"
28  echo "slag : slag number: integer number"
29  echo ""
30  echo "opt : optional"
31  echo " no options -> disable (default)"
32  echo " mkdir : creates open box directory"
33  echo " report : creates report for lag e slag"
34  echo " ced : submit CEDs"
35  echo " plot : creates plots"
36  echo " html : creates chunk html report"
37  echo " all : mkdir+report+ced+plot+html"
38  echo ""
39  echo "question: if not blank then skip question -> Open Box Result, do you want to procede (y/n)? "
40  echo ""
41  echo 'Ex: cwb_obchunk --wlabel="O2_K03_C00_LH_BurstLF_BKG_dev1" --chunk="03" --lag="1" --slag="0" --merge="1" --opt="create"'
42  echo ""
43  exit 1
44 endif
45 
46 setenv CWB_OBCHUNK_RUN "O2"
47 setenv CWB_OBCHUNK_NET ""
48 setenv CWB_OBCHUNK_SEARCH "BBH"
49 setenv CWB_OBCHUNK_BIN 1
50 setenv CWB_OBCHUNK_WLABEL ""
51 setenv CWB_OBCHUNK_LIST ""
52 setenv CWB_OBCHUNK_TRIALS 1
53 setenv CWB_OBCHUNK_BBH "true"
54 setenv CWB_OBCHUNK_CHUNK ""
55 setenv CWB_OBCHUNK_LAG ""
56 setenv CWB_OBCHUNK_SLAG ""
57 setenv CWB_OBCHUNK_MERGE ""
58 setenv CWB_OBCHUNK_MLABEL ""
59 setenv CWB_OBCHUNK_RLABEL ""
60 setenv CWB_OBCHUNK_OPTIONS ""
61 setenv CWB_OBCHUNK_QUESTION ""
62 
63 set cmd_line="$0 $argv"
64 
65 set temp=(`getopt -s tcsh -o r:n:S:b:w:c:l:s:m:M:R:o:q:B:L:T: --long run:,net:,search:,bin:,wlabel:,chunk:,lag:,slag:,merge:,mlabel:,rlabel:,opt:,question:,bbh:,list:,trials: -- $argv:q`)
66 if ($? != 0) then
67  echo "Terminating..." >/dev/stderr
68  exit 1
69 endif
70 eval set argv=\‍($temp:q\‍)
71 
72 while (1)
73  switch($1:q)
74  case -r:
75  case --run:
76  setenv CWB_OBCHUNK_RUN $2:q
77  shift ; shift
78  breaksw
79  case -n:
80  case --net:
81  setenv CWB_OBCHUNK_NET $2:q
82  shift ; shift
83  breaksw
84  case -S:
85  case --search:
86  setenv CWB_OBCHUNK_SEARCH $2:q
87  shift ; shift
88  breaksw
89  case -b:
90  case --bin:
91  setenv CWB_OBCHUNK_BIN $2:q
92  shift ; shift
93  breaksw
94  case -w:
95  case --wlabel:
96  setenv CWB_OBCHUNK_WLABEL $2:q
97  shift ; shift
98  breaksw
99  case -L:
100  case --list:
101  setenv CWB_OBCHUNK_LIST $2:q
102  shift ; shift
103  breaksw
104  case -T:
105  case --trials:
106  setenv CWB_OBCHUNK_TRIALS $2:q
107  shift ; shift
108  breaksw
109  case -c:
110  case --chunk:
111  setenv CWB_OBCHUNK_CHUNK $2:q
112  shift ; shift
113  breaksw
114  case -l:
115  case --lag:
116  setenv CWB_OBCHUNK_LAG $2:q
117  shift ; shift
118  breaksw
119  case -s:
120  case --slag:
121  setenv CWB_OBCHUNK_SLAG $2:q
122  shift ; shift
123  breaksw
124  case -m:
125  case --merge:
126  setenv CWB_OBCHUNK_MERGE $2:q
127  shift ; shift
128  breaksw
129  case -M:
130  case --mlabel:
131  setenv CWB_OBCHUNK_MLABEL $2:q
132  shift ; shift
133  breaksw
134  case -R:
135  case --rlabel:
136  setenv CWB_OBCHUNK_RLABEL $2:q
137  shift ; shift
138  breaksw
139  case -o:
140  case --opt:
141  setenv CWB_OBCHUNK_OPTIONS $2:q
142  shift ; shift
143  breaksw
144  case -q:
145  case --question:
146  setenv CWB_OBCHUNK_QUESTION $2:q
147  shift ; shift
148  breaksw
149  case -B:
150  case --bbh:
151  setenv CWB_OBCHUNK_BBH $2:q
152  shift ; shift
153  breaksw
154  case --:
155  shift
156  break
157  default:
158  echo "error - missing parameters!" ; exit 1
159  endsw
160 end
161 
162 if ((( $CWB_OBCHUNK_RUN != 'O1' ) && ( $CWB_OBCHUNK_RUN != 'O2' ) && ( $CWB_OBCHUNK_RUN != 'O3' ))) then
163  echo ""
164  echo --run=\'$CWB_OBCHUNK_RUN\' "is a wrong cwb_obchunk option\n"
165  echo "type cwb_obchunk to list the available options"
166  echo ""
167  exit 1
168 endif
169 
170 if ((( $CWB_OBCHUNK_SEARCH != 'BurstLF' ) && ( $CWB_OBCHUNK_SEARCH != 'BurstHF' ) && ( $CWB_OBCHUNK_SEARCH != 'BurstLD' ) && ( $CWB_OBCHUNK_SEARCH != 'IMBHB' ) && ( $CWB_OBCHUNK_SEARCH != 'BBH' ))) then
171  echo ""
172  echo --search=\'$CWB_OBCHUNK_SEARCH\' "is a wrong cwb_obchunk option\n"
173  echo "type cwb_obchunk to list the available options"
174  echo ""
175  exit 1
176 endif
177 
178 if ( $CWB_OBCHUNK_BIN !~ ^[0-9]+$ ) then
179  echo ""
180  echo --bin=\'$CWB_OBCHUNK_BIN\' "is a wrong cwb_obchunk option\n"
181  echo "type cwb_obchunk to list the available options"
182  echo ""
183  exit 1
184 endif
185 
186 if ( $CWB_OBCHUNK_TRIALS !~ ^[0-9]+$ ) then
187  echo ""
188  echo --trials=\'$CWB_OBCHUNK_TRIALS\' "is a wrong cwb_obchunk option\n"
189  echo "type cwb_obchunk to list the available options"
190  echo ""
191  exit 1
192 endif
193 
194 if (! -d $CWB_OBCHUNK_WLABEL ) then
195  echo ""
196  echo --wlabel=\'$CWB_OBCHUNK_WLABEL\' "working directory do not exist\n"
197  echo "type cwb_obchunk to list the available options"
198  echo ""
199  exit 1
200 endif
201 
202 if ((( $CWB_OBCHUNK_BBH != 'true' ) && ( $CWB_OBCHUNK_BBH != 'false' ))) then
203  echo ""
204  echo --run=\'$CWB_OBCHUNK_BBH\' "is a wrong cwb_obchunk option\n"
205  echo "type cwb_obchunk to list the available options"
206  echo ""
207  exit 1
208 endif
209 
210 if ( $CWB_OBCHUNK_CHUNK !~ ^[0-9]+$ ) then
211  echo ""
212  echo --chunk=\'$CWB_OBCHUNK_CHUNK\' "is a wrong cwb_obchunk option\n"
213  echo "type cwb_obchunk to list the available options"
214  echo ""
215  exit 1
216 endif
217 
218 if ( $CWB_OBCHUNK_MERGE !~ ^[0-9]+$ ) then
219  echo ""
220  echo --merge=\'$CWB_OBCHUNK_MERGE\' "is not an integer\n"
221  echo "type cwb_obchunk to list the available options"
222  echo ""
223  exit 1
224 endif
225 
226 if ( $CWB_OBCHUNK_LAG !~ ^[0-9]+$ ) then
227  echo ""
228  echo --lag=\'$CWB_OBCHUNK_LAG\' "is not an integer\n"
229  echo "type cwb_obchunk to list the available options"
230  echo ""
231  exit 1
232 endif
233 
234 if ( $CWB_OBCHUNK_SLAG !~ ^[0-9]+$ ) then
235  echo ""
236  echo --slag=\'$CWB_OBCHUNK_SLAG\' "is not an integer\n"
237  echo "type cwb_obchunk to list the available options"
238  echo ""
239  exit 1
240 endif
241 
242 if ((( $CWB_OBCHUNK_OPTIONS != 'mkdir' ) && ( $CWB_OBCHUNK_OPTIONS != 'plot' ) && ( $CWB_OBCHUNK_OPTIONS != 'report' ) && ( $CWB_OBCHUNK_OPTIONS != 'ced' ) && ( $CWB_OBCHUNK_OPTIONS != 'html' ) && ( $CWB_OBCHUNK_OPTIONS != 'all' ))) then
243  echo ""
244  echo --opt=\'$CWB_OBCHUNK_OPTIONS\' "is a wrong cwb_obchunk option\n"
245  echo "type cwb_obchunk to list the available options"
246  echo ""
247  exit 1
248 endif
249 
250 if (( $CWB_OBCHUNK_LAG == 0 ) && ( $CWB_OBCHUNK_SLAG == 0 ) && ( $CWB_OBCHUNK_QUESTION == "" )) then
251  echo "Open Box Result, do you want to procede (y/n)?"
252  set answer = $<
253  if ( $answer == "n" ) then
254  echo ""
255  exit 1
256  endif
257 endif
258 
259 if ( $CWB_OBCHUNK_MLABEL == '' ) then
260  set PMERGE_LABEL = V_hvetoLH.C_bin$CWB_OBCHUNK_BIN\_cut
261 else
262  set PMERGE_LABEL = $CWB_OBCHUNK_MLABEL
263 endif
264 
265 if ( $CWB_OBCHUNK_SEARCH == 'BurstLF' ) then
266  if ( $CWB_OBCHUNK_RLABEL == '' ) then
267  set PP_LABEL = $PMERGE_LABEL.R_rMRA_hveto_i0cc00_i0rho0_freq16_1024
268  else
269  set PP_LABEL = $PMERGE_LABEL.$CWB_OBCHUNK_RLABEL
270  endif
271  set DIR_REP = report/dump/M$CWB_OBCHUNK_MERGE.$PMERGE_LABEL.Box_Result_Bin$CWB_OBCHUNK_BIN\_Lag$CWB_OBCHUNK_LAG\_Slag$CWB_OBCHUNK_SLAG
272 endif
273 
274 if ( $CWB_OBCHUNK_SEARCH == 'BurstHF' ) then
275  if ( $CWB_OBCHUNK_RLABEL == '' ) then
276  set PP_LABEL = $PMERGE_LABEL.R_rMRA_hveto_i0cc00_i0rho0_freq512_4096
277  else
278  set PP_LABEL = $PMERGE_LABEL.$CWB_OBCHUNK_RLABEL
279  endif
280  set DIR_REP = report/dump/M$CWB_OBCHUNK_MERGE.$PMERGE_LABEL.Box_Result_Bin$CWB_OBCHUNK_BIN\_Lag$CWB_OBCHUNK_LAG\_Slag$CWB_OBCHUNK_SLAG
281 endif
282 
283 if ( $CWB_OBCHUNK_SEARCH == 'BurstLD' ) then
284  if ( $CWB_OBCHUNK_RLABEL == '' ) then
285  set PP_LABEL = $PMERGE_LABEL.R_rMRA_hveto_i0cc00_i0rho0_freq16_2048
286  else
287  set PP_LABEL = $PMERGE_LABEL.$CWB_OBCHUNK_RLABEL
288  endif
289  set DIR_REP = report/dump/M$CWB_OBCHUNK_MERGE.$PMERGE_LABEL.Box_Result_Bin$CWB_OBCHUNK_BIN\_Lag$CWB_OBCHUNK_LAG\_Slag$CWB_OBCHUNK_SLAG
290 endif
291 
292 if (( $CWB_OBCHUNK_SEARCH == 'IMBHB' ) || ( $CWB_OBCHUNK_SEARCH == 'BBH' )) then
293  if ( $CWB_OBCHUNK_RLABEL == '' ) then
294  set PP_LABEL = $PMERGE_LABEL.R_rMRA_hveto_i0cc00_i1rho0_freq16_512
295  else
296  set PP_LABEL = $PMERGE_LABEL.$CWB_OBCHUNK_RLABEL
297  endif
298  set DIR_REP = report/dump/M$CWB_OBCHUNK_MERGE.$PMERGE_LABEL.Box_Result_Lag$CWB_OBCHUNK_LAG\_Slag$CWB_OBCHUNK_SLAG
299 endif
300 
301 set DIR_PWD = $PWD
302 
303 
304 if (( $CWB_OBCHUNK_OPTIONS == 'plot' ) && ( $CWB_OBCHUNK_LIST != '' ) && ( $CWB_OBCHUNK_CHUNK == 99 )) then # create IFAR plots using a list of output root files
305  root -l -b -q $CWB_CONFIG/MACROS/Make_PP_IFAR.C\‍(\"$CWB_OBCHUNK_LIST\",\"--search=$CWB_OBCHUNK_SEARCH\:bin$CWB_OBCHUNK_BIN\ --run=$CWB_OBCHUNK_RUN\ --bbh=true\ --trials=$CWB_OBCHUNK_TRIALS\ --lag=$CWB_OBCHUNK_LAG\ --slag=$CWB_OBCHUNK_SLAG\ --chunk=$CWB_OBCHUNK_CHUNK\ --pfname=$DIR_PWD/$CWB_OBCHUNK_WLABEL/$DIR_REP/CumulativeNumberVsIFAR.png\"\‍)
306  root -l -b -q $CWB_CONFIG/MACROS/Make_PP_IFAR.C\‍(\"$CWB_OBCHUNK_LIST\",\"--search=$CWB_OBCHUNK_SEARCH\:bin$CWB_OBCHUNK_BIN\ --run=$CWB_OBCHUNK_RUN\ --bbh=false\ --trials=$CWB_OBCHUNK_TRIALS\ --lag=$CWB_OBCHUNK_LAG\ --slag=$CWB_OBCHUNK_SLAG\ --chunk=$CWB_OBCHUNK_CHUNK\ --pfname=$DIR_PWD/$CWB_OBCHUNK_WLABEL/$DIR_REP/CumulativeNumberVsIFAR.png\"\‍)
307  exit 0
308 endif
309 if (( $CWB_OBCHUNK_OPTIONS == 'html' ) && ( $CWB_OBCHUNK_LIST != '' ) && ( $CWB_OBCHUNK_CHUNK == 99 )) then # create html using a list of output root files
310  root -l -b -q $CWB_CONFIG/MACROS/cwb_mkhtml_all.C\‍(\"$CWB_OBCHUNK_LIST\",\"$CWB_OBCHUNK_RUN\",\"$CWB_OBCHUNK_RUN\:$CWB_OBCHUNK_NET\:$CWB_OBCHUNK_SEARCH\:Bin$CWB_OBCHUNK_BIN\",$CWB_OBCHUNK_LAG,$CWB_OBCHUNK_SLAG,\"$CWB_OBCHUNK_WLABEL\",\"$DIR_PWD/$CWB_OBCHUNK_WLABEL/$DIR_REP/CumulativeNumberVsIFAR.png\"\‍)
311  exit 0
312 endif
313 
314 
315 set DIR_BKG = postprod/M$CWB_OBCHUNK_MERGE.$PP_LABEL
316 set DIR_FRG = postprod/M$CWB_OBCHUNK_MERGE.$PP_LABEL\_lag$CWB_OBCHUNK_LAG\_slag$CWB_OBCHUNK_SLAG
317 
318 if ("$PMERGE_LABEL" !~ "*.S_*") then
319  set WAVE_FILE = ../../../merge/wave_$CWB_OBCHUNK_WLABEL.M$CWB_OBCHUNK_MERGE.$PMERGE_LABEL.S_ifar.root
320 else
321  set WAVE_FILE = ../../../merge/wave_$CWB_OBCHUNK_WLABEL.M$CWB_OBCHUNK_MERGE.$PMERGE_LABEL.root
322 endif
323 set RHO_FREQ_FILE = ../../$DIR_BKG/data/rho_frequency.gif
324 set RHO_TIME_FILE = ../../$DIR_BKG/data/rho_time.gif
325 
326 if (( $CWB_OBCHUNK_OPTIONS == 'mkdir' ) || ( $CWB_OBCHUNK_OPTIONS == 'all' )) then
327  echo $CWB_OBCHUNK_WLABEL/$DIR_REP
328  mkdir $CWB_OBCHUNK_WLABEL/$DIR_REP
329 endif
330 
331 if (( $CWB_OBCHUNK_OPTIONS == 'report' ) || ( $CWB_OBCHUNK_OPTIONS == 'all' )) then
332  cd $CWB_OBCHUNK_WLABEL
333  ${CWB_SCRIPTS}/cwb_report.csh M$CWB_OBCHUNK_MERGE.$PMERGE_LABEL create $CWB_OBCHUNK_LAG $CWB_OBCHUNK_SLAG
334 endif
335 
336 set CED_DAG = condor/$CWB_OBCHUNK_WLABEL.M$CWB_OBCHUNK_MERGE.$PP_LABEL.ced.dag
337 
338 if (( $CWB_OBCHUNK_OPTIONS == 'ced' ) || ( $CWB_OBCHUNK_OPTIONS == 'all' )) then
339  cd $DIR_PWD/$CWB_OBCHUNK_WLABEL
340  if ( $? != 0) then
341  echo "do you wat to force submit (y/n)?"
342  set answer = $<
343  if ( $answer == "n" ) then
344  echo ""
345  exit 1
346  endif
347  endif
348  rm $CED_DAG.*
349  ${CWB_SCRIPTS}/cwb_condor.csh submit $CED_DAG
350 endif
351 
352 if (( $CWB_OBCHUNK_OPTIONS == 'plot' ) || ( $CWB_OBCHUNK_OPTIONS == 'all' )) then
353 
354  if (! -f $DIR_PWD/$CWB_OBCHUNK_WLABEL/$DIR_REP/$WAVE_FILE ) then
355  echo ""
356  echo $DIR_PWD/$CWB_OBCHUNK_WLABEL/$DIR_REP/$WAVE_FILE " not exist\n"
357  echo ""
358  exit 1
359  endif
360 
361  cd $DIR_PWD/$CWB_OBCHUNK_WLABEL/$DIR_REP
362  ln -sf $RHO_TIME_FILE
363  ln -sf $RHO_FREQ_FILE
364 
365  root -l -b $CWB_CONFIG/MACROS/Make_PP_IFAR.C\‍(\"$WAVE_FILE\",\"--search=$CWB_OBCHUNK_SEARCH\:bin$CWB_OBCHUNK_BIN\ --run=$CWB_OBCHUNK_RUN\ --bbh=$CWB_OBCHUNK_BBH\ --lag=$CWB_OBCHUNK_LAG\ --slag=$CWB_OBCHUNK_SLAG\ --chunk=$CWB_OBCHUNK_CHUNK\ --pfname=CumulativeNumberVsIFAR.png\"\‍)
366  root -l -b $CWB_CONFIG/MACROS/Draw_FARvsRHO.C\‍(\"../../$DIR_BKG/data/far_rho.txt\",\"../../$DIR_FRG/data/far_rho.txt\",\"FARvsRank\"\‍)
367 endif
368 
369 if (( $CWB_OBCHUNK_OPTIONS == 'html' ) || ( $CWB_OBCHUNK_OPTIONS == 'all' )) then
370  cd $DIR_PWD/$CWB_OBCHUNK_WLABEL/$DIR_REP
371 
372  # Remove leading zeroes from CWB_OBCHUNK_CHUNK (08 -> 8)
373  set CWB_OBCHUNK_XCHUNK=`echo $CWB_OBCHUNK_CHUNK | sed 's/^0*//'`
374 
375  root -l -b $CWB_CONFIG/MACROS/cwb_mkhtml_chunk.C\(\"$CWB_OBCHUNK_RUN\",\"$CWB_OBCHUNK_SEARCH\",\"$CWB_OBCHUNK_BIN\",$CWB_OBCHUNK_XCHUNK,$CWB_OBCHUNK_BBH,\"$DIR_BKG\",\"$DIR_FRG\",\"$DIR_PWD/$CWB_OBCHUNK_WLABEL/$DIR_REP\",\"$CWB_OBCHUNK_WLABEL\",\"$WAVE_FILE\",$CWB_OBCHUNK_LAG,$CWB_OBCHUNK_SLAG,2\‍)
376 endif
377 
378 # create cWB_config.log file
379 # make -f $CWB_CONFIG/Makefile.log CMD_LINE="$cmd_line" git >& /dev/null
380 
381 cd $DIR_PWD
382 
383 unsetenv CWB_OBCHUNK_RUN
384 unsetenv CWB_OBCHUNK_NET
385 unsetenv CWB_OBCHUNK_SEARCH
386 unsetenv CWB_OBCHUNK_BIN
387 unsetenv CWB_OBCHUNK_WLABEL
388 unsetenv CWB_OBCHUNK_CHUNK
389 unsetenv CWB_OBCHUNK_LAG
390 unsetenv CWB_OBCHUNK_SLAG
391 unsetenv CWB_OBCHUNK_MERGE
392 unsetenv CWB_OBCHUNK_MLABEL
393 unsetenv CWB_OBCHUNK_RLABEL
394 unsetenv CWB_OBCHUNK_OPTIONS
395 unsetenv CWB_OBCHUNK_QUESTION
396 
397 exit 0
398 irq_ctrlc:
399  ps T | grep root | awk '{print $1}' | xargs kill -9
400  exit 1
shift breaksw case r
Definition: cwb_clchunk.csh:60
void cwb_mkhtml_chunk(TString run, TString search, TString ibin, int ichunk, bool bbh, TString dir_bkg, TString dir_frg, TString odir, TString wlabel, TString net_file_name, int lag, int slag, int nIFO)
shift breaksw case R
shift breaksw case o
shift breaksw case M
shift breaksw case T
shift breaksw case w
Definition: cwb_obchunk.csh:97
shift breaksw case n
Definition: cwb_obchunk.csh:82
shift breaksw case q
shift breaksw case s
shift breaksw case m
shift breaksw case B
shift breaksw case c
shift breaksw case l
shift breaksw case b
Definition: cwb_obchunk.csh:92
shift breaksw case L
shift breaksw case S
Definition: cwb_obchunk.csh:87
string search
Definition: cWB_conf.py:63
string run
Definition: cWB_conf.py:6