Logo coherent WaveBurst  
Config Reference Guide
Logo
cwb_ckchunk.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_ckchunk
7 # exit
8 #endif
9 
10 if ($1 == '') then
11  echo ""
12  echo "-------------------------------------------------------------------------------------------------------------------"
13  echo "What it does: check if the chunk parameters are in agreement with the setting provided in the git config repository"
14  echo "-------------------------------------------------------------------------------------------------------------------"
15  echo ""
16  echo 'cwb_ckchunk --run=... --chunk=... --cal=... --net=... --search=... --type=...'
17  echo ""
18  echo "run : O1, O2, O3"
19  echo "chunk : integer number"
20  echo "cal : C00, C00c, C01, C01c, C02, C02c"
21  echo "net : LH LV HV LHV"
22  echo "search : BurstLF, BurstHF, BurstLD, IMBHB, BBH"
23  echo "type : BKG, SIM"
24  echo ""
25  echo 'Ex: cwb_ckchunk --run=O2 --chunk=03 --cal=C00 --net=LH --search=BurstLF --type=BKG'
26  echo ""
27  echo "cwb_ckchunk without arguments shows help and git config status"
28  echo ""
29  echo "----------------------------------------------------------------------------------"
30  echo ""
31  echo "The local cWB config git repository is:"
32  echo ""
33  echo " " $CWB_CONFIG
34  echo ""
35  echo "and the config symbolic links are:"
36  echo ""
37  if ( -d $CWB_CONFIG/O3 ) then
38  echo -n " " $CWB_CONFIG/O3 " -> "
39  realpath $CWB_CONFIG/O3
40  else
41  echo " link " \'$CWB_CONFIG/O3\' " doesn't exist !"
42  endif
43  echo ""
44  if ( -d $CWB_CONFIG/DATA ) then
45  echo -n " " $CWB_CONFIG/DATA " -> "
46  realpath $CWB_CONFIG/DATA
47  else
48  echo " link " \'$CWB_CONFIG/DATA\' " doesn't exist !"
49  endif
50  echo ""
51  if ( -d $CWB_CONFIG/DATA/O3 ) then
52  echo -n " " $CWB_CONFIG/DATA/O3 " -> "
53  realpath $CWB_CONFIG/DATA/O3
54  else
55  echo " link " \'$CWB_CONFIG/DATA/O3\' " doesn't exist !"
56  endif
57  echo ""
58  exit 1
59 endif
60 
61 setenv CWB_CKCHUNK_RUN
62 setenv CWB_CKCHUNK_CHUNK
63 setenv CWB_CKCHUNK_CAL
64 setenv CWB_CKCHUNK_NET
65 setenv CWB_CKCHUNK_SEARCH
66 setenv CWB_CKCHUNK_TYPE
67 
68 set cmd_line="$0 $argv"
69 
70 set temp=(`getopt -s tcsh -o r:c:C:n:s:t: --long run:,chunk:,cal:,net:,search:,type: -- $argv:q`)
71 if ($? != 0) then
72  echo "Terminating..." >/dev/stderr
73  exit 1
74 endif
75 eval set argv=\‍($temp:q\‍)
76 
77 while (1)
78  switch($1:q)
79  case -r:
80  case --run:
81  setenv CWB_CKCHUNK_RUN $2:q
82  shift ; shift
83  breaksw
84  case -c:
85  case --chunk:
86  setenv CWB_CKCHUNK_CHUNK $2:q
87  shift ; shift
88  breaksw
89  case -C:
90  case --cal:
91  setenv CWB_CKCHUNK_CAL $2:q
92  shift ; shift
93  breaksw
94  case -n:
95  case --net:
96  setenv CWB_CKCHUNK_NET $2:q
97  shift ; shift
98  breaksw
99  case -s:
100  case --search:
101  setenv CWB_CKCHUNK_SEARCH $2:q
102  shift ; shift
103  breaksw
104  case -t:
105  case --type:
106  setenv CWB_CKCHUNK_TYPE $2:q
107  shift ; shift
108  breaksw
109  case --:
110  shift
111  break
112  default:
113  echo "error - missing parameters!" ; exit 1
114  endsw
115 end
116 
117 if ((( $CWB_CKCHUNK_RUN != 'O1' ) && ( $CWB_CKCHUNK_RUN != 'O2' ) && ( $CWB_CKCHUNK_RUN != 'O3' ))) then
118  echo ""
119  echo --run=\'$CWB_CKCHUNK_RUN\' "is a wrong cwb_ckchunk option\n"
120  echo "type cwb_ckchunk to list the available options"
121  echo ""
122  exit 1
123 endif
124 
125 if ( $CWB_CKCHUNK_CHUNK !~ ^[0-9]+$ ) then
126  echo ""
127  echo --chunk=\'$CWB_CKCHUNK_CHUNK\' "is a wrong cwb_ckchunk option\n"
128  echo "type cwb_ckchunk to list the available options"
129  echo ""
130  exit 1
131 endif
132 
133 if ((( $CWB_CKCHUNK_CAL != 'C00' ) && ( $CWB_CKCHUNK_CAL != 'C00c' ) && ( $CWB_CKCHUNK_CAL != 'C01' ) && ( $CWB_CKCHUNK_CAL != 'C01c' ) && ( $CWB_CKCHUNK_CAL != 'C02' ) && ( $CWB_CKCHUNK_CAL != 'C02c' ))) then
134  echo ""
135  echo --cal=\'$CWB_CKCHUNK_CAL\' "is a wrong cwb_ckchunk option\n"
136  echo "type cwb_ckchunk to list the available options"
137  echo ""
138  exit 1
139 endif
140 
141 if ((( $CWB_CKCHUNK_NET != 'LH' ) && ( $CWB_CKCHUNK_NET != 'LV' ) && ( $CWB_CKCHUNK_NET != 'HV' ) && ( $CWB_CKCHUNK_NET != 'LHV' ))) then
142  echo ""
143  echo --net=\'$CWB_CKCHUNK_NET\' "is a wrong cwb_ckchunk option\n"
144  echo "type cwb_ckchunk to list the available options"
145  echo ""
146  exit 1
147 endif
148 
149 if ((( $CWB_CKCHUNK_SEARCH != 'BurstLF' ) && ( $CWB_CKCHUNK_SEARCH != 'BurstHF' ) && ( $CWB_CKCHUNK_SEARCH != 'BurstLD' ) && ( $CWB_CKCHUNK_SEARCH != 'IMBHB' ) && ( $CWB_CKCHUNK_SEARCH != 'BBH' ))) then
150  echo ""
151  echo --search=\'$CWB_CKCHUNK_SEARCH\' "is a wrong cwb_ckchunk option\n"
152  echo "type cwb_ckchunk to list the available options"
153  echo ""
154  exit 1
155 endif
156 
157 if ((( $CWB_CKCHUNK_TYPE == 'BKG' ) || ( $CWB_CKCHUNK_TYPE =~ 'SIM/*' ))) then
158  setenv CWB_CKCHUNK_TYPE $CWB_CKCHUNK_TYPE
159  set CWB_CKCHUNK_SIM=$CWB_CKCHUNK_TYPE
160  set CWB_CKCHUNK_SIM_DIR=`echo $CWB_CKCHUNK_SIM | awk '{print substr($0, 5, length($0)-1)}'`
161 else
162  echo ""
163  echo --type=\'$CWB_CKCHUNK_TYPE\' "is a wrong cwb_ckchunk option\n"
164  echo "type cwb_ckchunk to list the available options"
165  echo ""
166  exit 1
167 endif
168 
169 echo ""
170 echo "--------------------------------------------------------------------------------"
171 echo "Check input configuration stuff ..."
172 echo "--------------------------------------------------------------------------------"
173 
174 if (( $CWB_CKCHUNK_TYPE =~ 'SIM/ONSPE' ) || ( $CWB_CKCHUNK_TYPE =~ 'SIM/OFSPE' )) then
175  setenv CWB_CKCHUNK_PERIOD $CWB_CONFIG/$CWB_CKCHUNK_RUN/CHUNKS/K$CWB_CKCHUNK_CHUNK.period
176 else
177  setenv CWB_CKCHUNK_PERIOD $CWB_CONFIG/$CWB_CKCHUNK_RUN/CHUNKS/$CWB_CKCHUNK_SEARCH/K$CWB_CKCHUNK_CHUNK.period
178 endif
179 
180 if (! -f $CWB_CKCHUNK_PERIOD ) then
181  echo ""
182  echo "the chunk period " "\n"
183  echo " " \'$CWB_CKCHUNK_PERIOD\' "\n"
184  echo "is not present in the config repository " "\n"
185  echo " " \'$CWB_CONFIG\' "\n"
186  echo ""
187  echo "The available chunk periods for search $CWB_CKCHUNK_SEARCH are:"
188  echo ""
189  if (( $CWB_CKCHUNK_TYPE =~ 'SIM/ONSPE' ) || ( $CWB_CKCHUNK_TYPE =~ 'SIM/OFSPE' )) then
190  ls -1 $CWB_CONFIG/$CWB_CKCHUNK_RUN/CHUNKS/K*.period | xargs realpath
191  else
192  ls -1 $CWB_CONFIG/$CWB_CKCHUNK_RUN/CHUNKS/$CWB_CKCHUNK_SEARCH/K*.period | xargs realpath
193  endif
194  echo ""
195  echo "abort execution " "\n"
196  echo ""
197  exit 1
198 endif
199 
200 setenv CWB_CKCHUNK_DIR $CWB_CONFIG/$CWB_CKCHUNK_RUN/SEARCHES/OFFLINE/$CWB_CKCHUNK_SEARCH/$CWB_CKCHUNK_NET/$CWB_CKCHUNK_TYPE
201 
202 if (! -d $CWB_CKCHUNK_DIR ) then
203  echo ""
204  echo "the chunk input config directory " "\n"
205  echo " " \'$CWB_CKCHUNK_DIR\' "\n"
206  echo "is not present in the config repository " "\n"
207  echo " " \'$CWB_CONFIG\' "\n"
208  echo ""
209  echo "abort execution " "\n"
210  echo ""
211  exit 1
212 endif
213 
214 setenv CWB_CKCHUNK_DATA $CWB_CONFIG/DATA/$CWB_CKCHUNK_RUN/DATA/$CWB_CKCHUNK_CAL
215 
216 if (! -d $CWB_CKCHUNK_DATA ) then
217  echo ""
218  echo "the chunk data config directory " "\n"
219  echo " " \'$CWB_CKCHUNK_DATA\' "\n"
220  echo "is not present in the config repository " "\n"
221  echo " " \'$CWB_CONFIG\' "\n"
222  echo ""
223  echo "abort execution " "\n"
224  echo ""
225  exit 1
226 endif
227 
228 echo ''
229 echo 'Check Passed: the chunk parameters are in agreement with the setting provided in the git config repository:' "\n"
230 echo " " \'$CWB_CONFIG\' "\n"
231 echo ''
232 
233 unsetenv CWB_CKCHUNK_RUN
234 unsetenv CWB_CKCHUNK_CHUNK
235 unsetenv CWB_CKCHUNK_CAL
236 unsetenv CWB_CKCHUNK_NET
237 unsetenv CWB_CKCHUNK_SEARCH
238 unsetenv CWB_CKCHUNK_TYPE
239 
240 unsetenv CWB_CKCHUNK_PERIOD
241 unsetenv CWB_CKCHUNK_DIR
242 unsetenv CWB_CKCHUNK_DATA
243 
244 exit 0
245 irq_ctrlc:
246  ps T | grep root | awk '{print $1}' | xargs kill -9
247  exit 1
TString options
shift breaksw case t
Definition: cwb_clchunk.csh:85
shift breaksw case n
Definition: cwb_clchunk.csh:75
string search
Definition: cWB_conf.py:63