35 |
void usage(){ |
void usage(){ |
36 |
printf("\nUsage:\n"); |
printf("\nUsage:\n"); |
37 |
printf("\n DarthVader [-v | --verbose] [-h | --help] [--version] -idRun ID_RUN [-processFile filename]\n"); |
printf("\n DarthVader [-v | --verbose] [-h | --help] [--version] -idRun ID_RUN [-processFile filename]\n"); |
38 |
printf("\n [-host host] [-user username] [-psw password] [+-all] [+-detector [detector options] ]\n"); |
printf("\n [-host host] [-user username] [-psw password] [+-all] [+-detector [ detector options ] ]\n"); |
39 |
printf("\n --version print informations about compilation and exit\n"); |
printf("\n --version print informations about compilation and exit\n"); |
40 |
printf("\n -h | --help print this help and exit \n"); |
printf("\n -h | --help print this help and exit \n"); |
41 |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
44 |
printf("\n -host name for the host [default = mysql://localhost/pamelaprod]\n"); |
printf("\n -host name for the host [default = mysql://localhost/pamelaprod]\n"); |
45 |
printf("\n -user username for the DB [default = anonymous] \n"); |
printf("\n -user username for the DB [default = anonymous] \n"); |
46 |
printf("\n -psw password for the DB [default = \"\"]\n"); |
printf("\n -psw password for the DB [default = \"\"]\n"); |
47 |
printf("\n +all call all detectors software [default]\n"); |
printf("\n +all | +ALL call all detectors software [default]\n"); |
48 |
printf("\n -all call nothing\n"); |
printf("\n -all | -ALL call nothing\n"); |
49 |
printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
50 |
printf("\n -detector do not process detector (as above)\n"); |
printf("\n -detector do not process detector (as above)\n"); |
51 |
|
printf("\n detector options must be included in square parenthesis with spaces, for example:\n"); |
52 |
|
printf("\n +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n"); |
53 |
|
|
54 |
printf("\nExamples: \n"); |
printf("\nExamples: \n"); |
55 |
printf("\nStandard call: DarthVader -idRun 1085 \n"); |
printf("\nStandard call: DarthVader -idRun 1085 \n"); |
56 |
printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
111 |
// |
// |
112 |
// |
// |
113 |
// |
// |
114 |
ULong64_t run = 0; |
UInt_t run = 0; |
115 |
// |
// |
116 |
TString filename; |
TString filename; |
117 |
TString outDir = gSystem->WorkingDirectory(); |
TString outDir = gSystem->WorkingDirectory(); |
129 |
try { |
try { |
130 |
if ( numinp > 1 ){ |
if ( numinp > 1 ){ |
131 |
while ( i < numinp ){ |
while ( i < numinp ){ |
132 |
|
Bool_t found = false; |
133 |
if ( !strcmp(inps[i],"--version") ){ |
if ( !strcmp(inps[i],"--version") ){ |
134 |
DarthVaderInfo(true); |
DarthVaderInfo(true); |
135 |
exit(0); |
exit(0); |
143 |
usage(); |
usage(); |
144 |
throw -3; |
throw -3; |
145 |
}; |
}; |
146 |
|
i++; |
147 |
|
found = true; |
148 |
givenid = true; |
givenid = true; |
149 |
char *pEnd; |
run = atoll(inps[i]); |
|
run = strtoull(inps[i+1],&pEnd,0); |
|
150 |
}; |
}; |
151 |
if ( !strcmp(inps[i],"-processFile") ) { |
if ( !strcmp(inps[i],"-processFile") ) { |
152 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
153 |
usage(); |
usage(); |
154 |
throw -3; |
throw -3; |
155 |
}; |
}; |
156 |
filename = (TString)inps[i+1]; |
i++; |
157 |
|
found = true; |
158 |
|
filename = (TString)inps[i]; |
159 |
}; |
}; |
160 |
if ( !strcmp(inps[i],"-outDir") ) { |
if ( !strcmp(inps[i],"-outDir") ) { |
161 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
162 |
usage(); |
usage(); |
163 |
throw -3; |
throw -3; |
164 |
}; |
}; |
165 |
outDir = (TString)inps[i+1]; |
i++; |
166 |
|
found = true; |
167 |
|
outDir = (TString)inps[i]; |
168 |
}; |
}; |
169 |
if ( !strcmp(inps[i],"-host") ) { |
if ( !strcmp(inps[i],"-host") ) { |
170 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
171 |
usage(); |
usage(); |
172 |
throw -3; |
throw -3; |
173 |
}; |
}; |
174 |
host = (TString)inps[i+1]; |
i++; |
175 |
|
found = true; |
176 |
|
host = (TString)inps[i]; |
177 |
}; |
}; |
178 |
if ( !strcmp(inps[i],"-user") ) { |
if ( !strcmp(inps[i],"-user") ) { |
179 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
180 |
usage(); |
usage(); |
181 |
throw -3; |
throw -3; |
182 |
}; |
}; |
183 |
user = (TString)inps[i+1]; |
i++; |
184 |
|
found = true; |
185 |
|
user = (TString)inps[i]; |
186 |
}; |
}; |
187 |
if ( !strcmp(inps[i],"-psw") ) { |
if ( !strcmp(inps[i],"-psw") ) { |
188 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
189 |
usage(); |
usage(); |
190 |
throw -3; |
throw -3; |
191 |
}; |
}; |
192 |
psw = (TString)inps[i+1]; |
i++; |
193 |
|
found = true; |
194 |
|
psw = (TString)inps[i]; |
195 |
|
}; |
196 |
|
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ){ |
197 |
|
found = true; |
198 |
|
beverbose = true; |
199 |
}; |
}; |
|
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true; |
|
200 |
// |
// |
201 |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ) debug = true; |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ){ |
202 |
|
debug = true; |
203 |
|
found = true; |
204 |
|
}; |
205 |
// |
// |
206 |
if ( !strcmp(inps[i],"-CAL") ) { |
if ( !strcmp(inps[i],"-CAL") ) { |
207 |
|
found = true; |
208 |
CAL = false; |
CAL = false; |
209 |
}; |
}; |
210 |
if ( !strcmp(inps[i],"-TRK") ) { |
if ( !strcmp(inps[i],"-TRK") ) { |
211 |
|
found = true; |
212 |
TRK = false; |
TRK = false; |
213 |
}; |
}; |
214 |
if ( !strcmp(inps[i],"-TOF") ) { |
if ( !strcmp(inps[i],"-TOF") ) { |
215 |
|
found = true; |
216 |
TOF = false; |
TOF = false; |
217 |
}; |
}; |
218 |
if ( !strcmp(inps[i],"-TRG") ) { |
if ( !strcmp(inps[i],"-TRG") ) { |
219 |
|
found = true; |
220 |
TRG = false; |
TRG = false; |
221 |
}; |
}; |
222 |
if ( !strcmp(inps[i],"-S4") ) { |
if ( !strcmp(inps[i],"-S4") ) { |
223 |
|
found = true; |
224 |
S4 = false; |
S4 = false; |
225 |
}; |
}; |
226 |
if ( !strcmp(inps[i],"-ND") ) { |
if ( !strcmp(inps[i],"-ND") ) { |
227 |
|
found = true; |
228 |
ND = false; |
ND = false; |
229 |
}; |
}; |
230 |
if ( !strcmp(inps[i],"-AC") ) { |
if ( !strcmp(inps[i],"-AC") ) { |
231 |
|
found = true; |
232 |
AC = false; |
AC = false; |
233 |
}; |
}; |
234 |
if ( !strcmp(inps[i],"-RUN") ) { |
if ( !strcmp(inps[i],"-RUN") ) { |
235 |
|
found = true; |
236 |
RUN = false; |
RUN = false; |
237 |
}; |
}; |
238 |
if ( !strcmp(inps[i],"-ORB") ) { |
if ( !strcmp(inps[i],"-ORB") ) { |
239 |
|
found = true; |
240 |
ORB = false; |
ORB = false; |
241 |
}; |
}; |
242 |
// |
// |
243 |
if ( !strcmp(inps[i],"-all") ) { |
if ( !strcmp(inps[i],"-all") || !strcmp(inps[i],"-ALL") ) { |
244 |
CAL = false; |
CAL = false; |
245 |
ORB = false; |
ORB = false; |
246 |
TRK = false; |
TRK = false; |
250 |
ND = false; |
ND = false; |
251 |
AC = false; |
AC = false; |
252 |
RUN = false; |
RUN = false; |
253 |
|
found = true; |
254 |
}; |
}; |
255 |
// |
// |
256 |
if ( !strcmp(inps[i],"+all") ) { |
if ( !strcmp(inps[i],"+all") || !strcmp(inps[i],"+ALL") ) { |
257 |
CAL = true; |
CAL = true; |
258 |
ORB = true; |
ORB = true; |
259 |
TRK = true; |
TRK = true; |
263 |
ND = true; |
ND = true; |
264 |
AC = true; |
AC = true; |
265 |
RUN = true; |
RUN = true; |
266 |
|
found = true; |
267 |
}; |
}; |
268 |
// |
// |
269 |
if ( !strcmp(inps[i],"+CAL") ) { |
if ( !strcmp(inps[i],"+CAL") ) { |
270 |
|
found = true; |
271 |
CAL = true; |
CAL = true; |
272 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
273 |
if ( numinp < i+2 ){ |
if ( numinp < i+2 ){ |
288 |
}; |
}; |
289 |
}; |
}; |
290 |
if ( !strcmp(inps[i],"+TRK") ) { |
if ( !strcmp(inps[i],"+TRK") ) { |
291 |
|
found = true; |
292 |
TRK = true; |
TRK = true; |
293 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
294 |
if ( numinp-1 < i+2 ){ |
if ( numinp-1 < i+2 ){ |
309 |
}; |
}; |
310 |
}; |
}; |
311 |
if ( !strcmp(inps[i],"+TOF") ) { |
if ( !strcmp(inps[i],"+TOF") ) { |
312 |
|
found = true; |
313 |
TOF = true; |
TOF = true; |
314 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
315 |
i += 2; |
i += 2; |
326 |
}; |
}; |
327 |
}; |
}; |
328 |
if ( !strcmp(inps[i],"+TRG") ) { |
if ( !strcmp(inps[i],"+TRG") ) { |
329 |
|
found = true; |
330 |
TRG = true; |
TRG = true; |
331 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
332 |
i += 2; |
i += 2; |
343 |
}; |
}; |
344 |
}; |
}; |
345 |
if ( !strcmp(inps[i],"+ORB") ) { |
if ( !strcmp(inps[i],"+ORB") ) { |
346 |
|
found = true; |
347 |
ORB = true; |
ORB = true; |
348 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
349 |
i += 2; |
i += 2; |
360 |
}; |
}; |
361 |
}; |
}; |
362 |
if ( !strcmp(inps[i],"+RUN") ) { |
if ( !strcmp(inps[i],"+RUN") ) { |
363 |
|
found = true; |
364 |
RUN = true; |
RUN = true; |
365 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
366 |
i += 2; |
i += 2; |
377 |
}; |
}; |
378 |
}; |
}; |
379 |
if ( !strcmp(inps[i],"+AC") ) { |
if ( !strcmp(inps[i],"+AC") ) { |
380 |
|
found = true; |
381 |
AC = true; |
AC = true; |
382 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
383 |
i += 2; |
i += 2; |
394 |
}; |
}; |
395 |
}; |
}; |
396 |
if ( !strcmp(inps[i],"+S4") ) { |
if ( !strcmp(inps[i],"+S4") ) { |
397 |
|
found = true; |
398 |
S4 = true; |
S4 = true; |
399 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
400 |
i += 2; |
i += 2; |
411 |
}; |
}; |
412 |
}; |
}; |
413 |
if ( !strcmp(inps[i],"+ND") ) { |
if ( !strcmp(inps[i],"+ND") ) { |
414 |
|
found = true; |
415 |
ND = true; |
ND = true; |
416 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
417 |
i += 2; |
i += 2; |
428 |
}; |
}; |
429 |
}; |
}; |
430 |
// |
// |
431 |
|
if ( !found && i > 0 ){ |
432 |
|
usage(); |
433 |
|
printf(" Unknown input number %i, that is \"%s\" \n",i,inps[i]); |
434 |
|
throw -22; |
435 |
|
}; |
436 |
|
// |
437 |
i++; |
i++; |
438 |
}; |
}; |
439 |
// |
// |
576 |
case -19: message += " No anticounters in the acquisition (use -AC to process anyway)"; break; |
case -19: message += " No anticounters in the acquisition (use -AC to process anyway)"; break; |
577 |
case -20: message += " No S4 in the acquisition (use -S4 to process anyway)"; break; |
case -20: message += " No S4 in the acquisition (use -S4 to process anyway)"; break; |
578 |
case -21: message += " No neutron detector in the acquisition (use -ND to process anyway)"; break; |
case -21: message += " No neutron detector in the acquisition (use -ND to process anyway)"; break; |
579 |
|
case -22: message += " Unknown input or wrong syntax in input paramters!"; break; |
580 |
// |
// |
581 |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
582 |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
643 |
case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; |
case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; |
644 |
case -804: message += " RUNINFO - Unknown detector"; break; |
case -804: message += " RUNINFO - Unknown detector"; break; |
645 |
case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; |
case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; |
646 |
|
case -806: message += " RUNINFO - Can not handle more than 500 runs"; break; |
647 |
// |
// |
648 |
default: message += "Unidentified error or warning"; break; |
default: message += "Unidentified error or warning"; break; |
649 |
}; |
}; |