1 |
// |
2 |
// C/C++ headers |
3 |
// |
4 |
#include <iostream> |
5 |
#include <sstream> |
6 |
// |
7 |
// ROOT headers |
8 |
// |
9 |
#include <TString.h> |
10 |
#include <TSQLServer.h> |
11 |
#include <TFile.h> |
12 |
#include <TSystem.h> |
13 |
// |
14 |
// Detector's package headers |
15 |
// |
16 |
#include <RunInfoCore.h> |
17 |
#include <TrkCore.h> |
18 |
#include <TrigCore.h> |
19 |
#include <ToFCore.h> |
20 |
#include <CaloCore.h> |
21 |
#include <AcCore.h> |
22 |
#include <S4Core.h> |
23 |
#include <NDCore.h> |
24 |
#include <OrbitalInfoCore.h> |
25 |
#include <RunInfo.h> |
26 |
// |
27 |
using namespace std; |
28 |
// |
29 |
// |
30 |
// |
31 |
#include <DarthVaderVerl2.h> |
32 |
// |
33 |
// Usage subroutine |
34 |
// |
35 |
void usage(){ |
36 |
printf("\nUsage:\n"); |
37 |
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"); |
39 |
printf("\n --version print informations about compilation and exit\n"); |
40 |
printf("\n -h | --help print this help and exit \n"); |
41 |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
42 |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
43 |
printf("\n -processFile output filename [default ID_RUN.Level2.root]\n"); |
44 |
printf("\n -processFolder folder for output data but the processFile [default \"calorimeterFolder\"]\n"); |
45 |
printf("\n -host name for the host [default = mysql://localhost/pamelaprod]\n"); |
46 |
printf("\n -user username for the DB [default = anonymous] \n"); |
47 |
printf("\n -psw password for the DB [default = \"\"]\n"); |
48 |
printf("\n +all call all detectors software [default]\n"); |
49 |
printf("\n -all call nothing\n"); |
50 |
printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
51 |
printf("\n -detector do not process detector (as above)\n"); |
52 |
printf("\nExamples: \n"); |
53 |
printf("\nStandard call: DarthVader -idRun 1085 \n"); |
54 |
printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
55 |
printf("\nProcess all and be verbose for calorimeter: DarthVader -idRun 1085 +CAL [ --verbose ] \n\n"); |
56 |
}; |
57 |
// |
58 |
// Here the main |
59 |
// |
60 |
int main(int numinp, char *inps[]){ |
61 |
// |
62 |
// Variables booking |
63 |
// |
64 |
TString message; |
65 |
int nul = 0; |
66 |
Int_t error = 0; |
67 |
// |
68 |
Int_t CALSGN = 0; |
69 |
Int_t TRKSGN = 0; |
70 |
Int_t TRGSGN = 0; |
71 |
Int_t TOFSGN = 0; |
72 |
Int_t RUNSGN = 0; |
73 |
Int_t ORBSGN = 0; |
74 |
Int_t ACSGN = 0; |
75 |
Int_t S4SGN = 0; |
76 |
Int_t NDSGN = 0; |
77 |
// |
78 |
Bool_t debug = false; |
79 |
Bool_t beverbose = false; |
80 |
Bool_t givenid = false; |
81 |
Bool_t CAL = true; |
82 |
Bool_t TRK = true; |
83 |
Bool_t TRG = true; |
84 |
Bool_t TOF = true; |
85 |
Bool_t S4 = true; |
86 |
Bool_t ND = true; |
87 |
Bool_t AC = true; |
88 |
Bool_t ORB = true; |
89 |
Bool_t RUN = true; |
90 |
// |
91 |
Int_t calargc = 0; |
92 |
char *calargv[50]; |
93 |
Int_t trkargc = 0; |
94 |
char *trkargv[50]; |
95 |
Int_t tofargc = 0; |
96 |
char *tofargv[50]; |
97 |
Int_t trgargc = 0; |
98 |
char *trgargv[50]; |
99 |
Int_t orbargc = 0; |
100 |
char *orbargv[50]; |
101 |
Int_t runargc = 0; |
102 |
char *runargv[50]; |
103 |
Int_t acargc = 0; |
104 |
char *acargv[50]; |
105 |
Int_t s4argc = 0; |
106 |
char *s4argv[50]; |
107 |
Int_t ndargc = 0; |
108 |
char *ndargv[50]; |
109 |
// |
110 |
// |
111 |
// |
112 |
ULong64_t run = 0; |
113 |
// |
114 |
TString filename; |
115 |
TString outDir = gSystem->WorkingDirectory(); |
116 |
// |
117 |
TSQLServer *dbc = 0; |
118 |
TString host = "mysql://localhost/pamelaprod"; |
119 |
TString user = "anonymous"; |
120 |
TString psw = ""; |
121 |
// |
122 |
TFile *processFile = 0; |
123 |
// |
124 |
// Checking input parameters |
125 |
// |
126 |
Int_t i = 0; |
127 |
try { |
128 |
if ( numinp > 1 ){ |
129 |
while ( i < numinp ){ |
130 |
if ( !strcmp(inps[i],"--version") ){ |
131 |
DarthVaderInfo(true); |
132 |
exit(0); |
133 |
}; |
134 |
if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){ |
135 |
usage(); |
136 |
exit(0); |
137 |
}; |
138 |
if ( !strcmp(inps[i],"-idRun") ) { |
139 |
if ( numinp-1 < i+1 ) { |
140 |
usage(); |
141 |
throw -3; |
142 |
}; |
143 |
givenid = true; |
144 |
char *pEnd; |
145 |
run = strtoull(inps[i+1],&pEnd,0); |
146 |
}; |
147 |
if ( !strcmp(inps[i],"-processFile") ) { |
148 |
if ( numinp-1 < i+1 ){ |
149 |
usage(); |
150 |
throw -3; |
151 |
}; |
152 |
filename = (TString)inps[i+1]; |
153 |
}; |
154 |
if ( !strcmp(inps[i],"-outDir") ) { |
155 |
if ( numinp-1 < i+1 ){ |
156 |
usage(); |
157 |
throw -3; |
158 |
}; |
159 |
outDir = (TString)inps[i+1]; |
160 |
}; |
161 |
if ( !strcmp(inps[i],"-host") ) { |
162 |
if ( numinp-1 < i+1 ){ |
163 |
usage(); |
164 |
throw -3; |
165 |
}; |
166 |
host = (TString)inps[i+1]; |
167 |
}; |
168 |
if ( !strcmp(inps[i],"-user") ) { |
169 |
if ( numinp-1 < i+1 ){ |
170 |
usage(); |
171 |
throw -3; |
172 |
}; |
173 |
user = (TString)inps[i+1]; |
174 |
}; |
175 |
if ( !strcmp(inps[i],"-psw") ) { |
176 |
if ( numinp-1 < i+1 ){ |
177 |
usage(); |
178 |
throw -3; |
179 |
}; |
180 |
psw = (TString)inps[i+1]; |
181 |
}; |
182 |
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true; |
183 |
// |
184 |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ) debug = true; |
185 |
// |
186 |
if ( !strcmp(inps[i],"-CAL") ) { |
187 |
CAL = false; |
188 |
}; |
189 |
if ( !strcmp(inps[i],"-TRK") ) { |
190 |
TRK = false; |
191 |
}; |
192 |
if ( !strcmp(inps[i],"-TOF") ) { |
193 |
TOF = false; |
194 |
}; |
195 |
if ( !strcmp(inps[i],"-TRG") ) { |
196 |
TRG = false; |
197 |
}; |
198 |
if ( !strcmp(inps[i],"-S4") ) { |
199 |
S4 = false; |
200 |
}; |
201 |
if ( !strcmp(inps[i],"-ND") ) { |
202 |
ND = false; |
203 |
}; |
204 |
if ( !strcmp(inps[i],"-AC") ) { |
205 |
AC = false; |
206 |
}; |
207 |
if ( !strcmp(inps[i],"-RUN") ) { |
208 |
RUN = false; |
209 |
}; |
210 |
if ( !strcmp(inps[i],"-ORB") ) { |
211 |
ORB = false; |
212 |
}; |
213 |
// |
214 |
if ( !strcmp(inps[i],"-all") ) { |
215 |
CAL = false; |
216 |
ORB = false; |
217 |
TRK = false; |
218 |
TRG = false; |
219 |
TOF = false; |
220 |
S4 = false; |
221 |
ND = false; |
222 |
AC = false; |
223 |
RUN = false; |
224 |
}; |
225 |
// |
226 |
if ( !strcmp(inps[i],"+all") ) { |
227 |
CAL = true; |
228 |
ORB = true; |
229 |
TRK = true; |
230 |
TRG = true; |
231 |
TOF = true; |
232 |
S4 = true; |
233 |
ND = true; |
234 |
AC = true; |
235 |
RUN = true; |
236 |
}; |
237 |
// |
238 |
if ( !strcmp(inps[i],"+CAL") ) { |
239 |
CAL = true; |
240 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
241 |
if ( numinp < i+2 ){ |
242 |
usage(); |
243 |
throw -3; |
244 |
}; |
245 |
i += 2; |
246 |
calargc = 0; |
247 |
while ( strcmp(inps[i],"]") ){ |
248 |
calargv[calargc] = inps[i]; |
249 |
calargc++; |
250 |
i++; |
251 |
if ( i > numinp-1 ){ |
252 |
usage(); |
253 |
throw -3; |
254 |
}; |
255 |
}; |
256 |
}; |
257 |
}; |
258 |
if ( !strcmp(inps[i],"+TRK") ) { |
259 |
TRK = true; |
260 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
261 |
if ( numinp-1 < i+2 ){ |
262 |
usage(); |
263 |
throw -3; |
264 |
}; |
265 |
i += 2; |
266 |
trkargc = 0; |
267 |
while ( strcmp(inps[i],"]") ){ |
268 |
trkargv[trkargc] = inps[i]; |
269 |
trkargc++; |
270 |
i++; |
271 |
if ( i > numinp-1 ){ |
272 |
usage(); |
273 |
throw -3; |
274 |
}; |
275 |
}; |
276 |
}; |
277 |
}; |
278 |
if ( !strcmp(inps[i],"+TOF") ) { |
279 |
TOF = true; |
280 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
281 |
i += 2; |
282 |
tofargc = 0; |
283 |
while ( strcmp(inps[i],"]") ){ |
284 |
tofargv[tofargc] = inps[i]; |
285 |
tofargc++; |
286 |
i++; |
287 |
if ( i > numinp-1 ){ |
288 |
usage(); |
289 |
throw -3; |
290 |
}; |
291 |
}; |
292 |
}; |
293 |
}; |
294 |
if ( !strcmp(inps[i],"+TRG") ) { |
295 |
TRG = true; |
296 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
297 |
i += 2; |
298 |
trgargc = 0; |
299 |
while ( strcmp(inps[i],"]") ){ |
300 |
trgargv[trgargc] = inps[i]; |
301 |
trgargc++; |
302 |
i++; |
303 |
if ( i > numinp-1 ){ |
304 |
usage(); |
305 |
throw -3; |
306 |
}; |
307 |
}; |
308 |
}; |
309 |
}; |
310 |
if ( !strcmp(inps[i],"+ORB") ) { |
311 |
ORB = true; |
312 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
313 |
i += 2; |
314 |
orbargc = 0; |
315 |
while ( strcmp(inps[i],"]") ){ |
316 |
orbargv[orbargc] = inps[i]; |
317 |
orbargc++; |
318 |
i++; |
319 |
if ( i > numinp-1 ){ |
320 |
usage(); |
321 |
throw -3; |
322 |
}; |
323 |
}; |
324 |
}; |
325 |
}; |
326 |
if ( !strcmp(inps[i],"+RUN") ) { |
327 |
RUN = true; |
328 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
329 |
i += 2; |
330 |
runargc = 0; |
331 |
while ( strcmp(inps[i],"]") ){ |
332 |
runargv[runargc] = inps[i]; |
333 |
runargc++; |
334 |
i++; |
335 |
if ( i > numinp-1 ){ |
336 |
usage(); |
337 |
throw -3; |
338 |
}; |
339 |
}; |
340 |
}; |
341 |
}; |
342 |
if ( !strcmp(inps[i],"+AC") ) { |
343 |
AC = true; |
344 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
345 |
i += 2; |
346 |
acargc = 0; |
347 |
while ( strcmp(inps[i],"]") ){ |
348 |
acargv[acargc] = inps[i]; |
349 |
acargc++; |
350 |
i++; |
351 |
if ( i > numinp-1 ){ |
352 |
usage(); |
353 |
throw -3; |
354 |
}; |
355 |
}; |
356 |
}; |
357 |
}; |
358 |
if ( !strcmp(inps[i],"+S4") ) { |
359 |
S4 = true; |
360 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
361 |
i += 2; |
362 |
s4argc = 0; |
363 |
while ( strcmp(inps[i],"]") ){ |
364 |
s4argv[s4argc] = inps[i]; |
365 |
s4argc++; |
366 |
i++; |
367 |
if ( i > numinp-1 ){ |
368 |
usage(); |
369 |
throw -3; |
370 |
}; |
371 |
}; |
372 |
}; |
373 |
}; |
374 |
if ( !strcmp(inps[i],"+ND") ) { |
375 |
ND = true; |
376 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
377 |
i += 2; |
378 |
ndargc = 0; |
379 |
while ( strcmp(inps[i],"]") ){ |
380 |
ndargv[ndargc] = inps[i]; |
381 |
ndargc++; |
382 |
i++; |
383 |
if ( i > numinp-1 ){ |
384 |
usage(); |
385 |
throw -3; |
386 |
}; |
387 |
}; |
388 |
}; |
389 |
}; |
390 |
// |
391 |
i++; |
392 |
}; |
393 |
// |
394 |
} else { |
395 |
// |
396 |
// no input parameters exit with error, we need at least the run id. |
397 |
// |
398 |
throw -1; |
399 |
}; |
400 |
// |
401 |
// If not in verbose mode redirect to /dev/null the stdout and stderr |
402 |
// |
403 |
if ( !beverbose ){ |
404 |
nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE); |
405 |
dup2(nul,1); |
406 |
dup2(nul,2); |
407 |
}; |
408 |
// |
409 |
// Check that an input run number has been given |
410 |
// |
411 |
if ( !givenid ) throw -1; |
412 |
// |
413 |
char *version = DarthVaderInfo(false); |
414 |
// |
415 |
// Start: |
416 |
// |
417 |
printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version); |
418 |
// |
419 |
// Connect to the DB |
420 |
// |
421 |
if ( debug ) printf("\nConnecting to database... \n"); |
422 |
// |
423 |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
424 |
if( !dbc ) throw -2; |
425 |
// |
426 |
bool connect = dbc->IsConnected(); |
427 |
// |
428 |
if( !connect ) throw -2; |
429 |
// |
430 |
if ( debug ) printf("...connected! \n\n"); |
431 |
// |
432 |
// Create LEVEL2 filename and open it in update mode |
433 |
// |
434 |
if ( filename.IsNull() ){ |
435 |
stringstream strun; |
436 |
strun.str(""); |
437 |
strun << run; |
438 |
filename += outDir; |
439 |
filename += "/"; |
440 |
filename += strun.str(); |
441 |
filename += ".Level2.root"; |
442 |
}; |
443 |
// filename = outDir + "/" + filename; |
444 |
processFile = new TFile(filename.Data(),"UPDATE"); |
445 |
if ( !processFile->IsOpen() ) throw -15; |
446 |
// |
447 |
// Run the core program, put any output error in the "error" variable |
448 |
// |
449 |
if ( RUN ) { |
450 |
printf(" Calling RunInfo... "); |
451 |
RUNSGN = RunInfoCore(run,processFile,dbc,runargc,runargv); |
452 |
printf("done\n"); |
453 |
}; |
454 |
// |
455 |
// From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not |
456 |
// |
457 |
printf(" Checking if requested detectors are in the acquisition\n"); |
458 |
ItoRunInfo *runinfo = new ItoRunInfo(processFile); |
459 |
runinfo->Read(run); |
460 |
printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO); |
461 |
if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ) throw -16; |
462 |
if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ) throw -17; |
463 |
if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ) throw -18; |
464 |
if ( AC && !(runinfo->ACQ_VAR_INFO & (1 << 1)) && !(runinfo->ACQ_VAR_INFO & (1 << 2)) ) throw -19; |
465 |
if ( S4 && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ) throw -20; |
466 |
if ( ND && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ) throw -21; |
467 |
printf(" OK! start processing detector's data. \n"); |
468 |
// |
469 |
if ( TRK ) { |
470 |
printf(" Calling TrackerLevel2... "); |
471 |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
472 |
printf("done\n"); |
473 |
}; |
474 |
if ( TOF ) { |
475 |
printf(" Calling ToFLevel2... "); |
476 |
TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); |
477 |
printf("done\n"); |
478 |
}; |
479 |
if ( CAL ) { |
480 |
printf(" Calling CalorimeterLevel2... "); |
481 |
CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); |
482 |
printf("done\n"); |
483 |
}; |
484 |
if ( TRG ) { |
485 |
printf(" Calling TriggerLevel2... "); |
486 |
TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); |
487 |
printf("done\n"); |
488 |
}; |
489 |
if ( AC ) { |
490 |
printf(" Calling AnticounterLevel2... "); |
491 |
ACSGN = AcCore(run,processFile,dbc,acargc,acargv); |
492 |
printf("done\n"); |
493 |
}; |
494 |
if ( S4 ) { |
495 |
printf(" Calling S4Level2 ... "); |
496 |
S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); |
497 |
printf("done\n"); |
498 |
}; |
499 |
if ( ND ) { |
500 |
printf(" Calling NDLevel2... "); |
501 |
NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); |
502 |
printf("done\n"); |
503 |
}; |
504 |
if ( ORB ) { |
505 |
printf(" Calling OrbitalInfo... "); |
506 |
ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); |
507 |
printf("done\n"); |
508 |
}; |
509 |
// |
510 |
} catch(Int_t signal) { |
511 |
error = signal; |
512 |
switch(signal){ |
513 |
case 51: message += " GLTABLES - TO_TIME < time when querying tables"; break; |
514 |
case -1: message += " Missing/wrong run ID input parameter"; break; |
515 |
case -2: message += " DB connection failure"; break; |
516 |
case -3: message += " Error in input parameters (check format)"; break; |
517 |
case -4: message += " Request reprocessing of all runs (idRun = 0) but processFile is missing"; break; |
518 |
case -6: message += " No LEVEL0 file "; break; |
519 |
case -7: message += " No Physics tree in LEVEL0 file"; break; |
520 |
case -8: message += " No Header branch in LEVEL0 Physics tree"; break; |
521 |
case -9: message += " No Registry branch in LEVEL0 Physics tree"; break; |
522 |
case -11: message += " LEVEL0 Physics tree is empty"; break; |
523 |
case -12: message += " Too few entries in the registry tree"; break; |
524 |
case -13: message += " Cannot create processFolder directory"; break; |
525 |
case -14: message += " Error querying the DB"; break; |
526 |
case -15: message += " Cannot open file for writing"; break; |
527 |
case -16: message += " No tracker in the acquisition (use -TRK to process anyway)"; break; |
528 |
case -17: message += " No ToF in the acquisition (use -TOF to process anyway)"; break; |
529 |
case -18: message += " No calorimeter in the acquisition (use -CAL to process anyway)"; break; |
530 |
case -19: message += " No anticounters in the acquisition (use -AC to process anyway)"; break; |
531 |
case -20: message += " No S4 in the acquisition (use -S4 to process anyway)"; break; |
532 |
case -21: message += " No neutron detector in the acquisition (use -ND to process anyway)"; break; |
533 |
// |
534 |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
535 |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
536 |
case -52: message += " GLTABLES - No entries matching GL_PARAM query"; break; |
537 |
case -53: message += " GLTABLES - No entries matching GL_TRK_CALIB query"; break; |
538 |
case -54: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; |
539 |
case -55: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; |
540 |
// |
541 |
case -100: message += " CALORIMETERLEVEL2 - No Level2 input file"; break; |
542 |
case -101: message += " CALORIMETERLEVEL2 - Cannot open Level2 file"; break; |
543 |
case -102: message += " CALORIMETERLEVEL2 - No Tracker TTree in Level2 file"; break; |
544 |
case -103: message += " CALORIMETERLEVEL2 - No Calorimeter TBranch in Level0 file"; break; |
545 |
case -104: message += " CALORIMETERLEVEL2 - No Trigger TTree in Level0 file"; break; |
546 |
case -105: message += " CALORIMETERLEVEL2 - No Calorimeter ADC2MIP conversion file"; break; |
547 |
case -106: message += " CALORIMETERLEVEL2 - No Calorimeter alignement file"; break; |
548 |
case -107: message += " CALORIMETERLEVEL2 - Cannot find Level0 file needed for the calibration"; break; |
549 |
case -108: message += " CALORIMETERLEVEL2 - Cannot open Level0 file needed for the calibration"; break; |
550 |
case -109: message += " CALORIMETERLEVEL2 - No CalibCalPed TTree in Level0 file needed for the calibration"; break; |
551 |
case -110: message += " CALORIMETERLEVEL2 - No calibrations in Level0 file needed for the calibration"; break; |
552 |
case -111: message += " CALORIMETERLEVEL2 - Corrupted calibration"; break; |
553 |
case -112: message += " CALORIMETERLEVEL2 - No physics event related to registry entry in Level0 file"; break; |
554 |
case -113: message += " CALORIMETERLEVEL2 - No tracker event related to registry entry in Level2 file"; break; |
555 |
// |
556 |
case -200: message += " TRACKERLEVEL2 - LEVEL1 framework unknown (HBOOK/ROOT)"; break; |
557 |
case -201: message += " TRACKERLEVEL2 - LEVEL2 framework unknown (HBOOK/ROOT)"; break; |
558 |
case -202: message += " TRACKERLEVEL2 - Neither LEVEL1 nor LEVEL2 output requested"; break; |
559 |
case -203: message += " TRACKERLEVEL2 - No Tracker branch in LEVEL0 Physics tree"; break; |
560 |
case -204: message += " TRACKERLEVEL2 - No reprocessing implemented for LEVEL1 output"; break; |
561 |
case -205: message += " TRACKERLEVEL2 - Error accessing RunInfo "; break; |
562 |
case -210: message += " TRACKERLEVEL2 - Error opening/reading trk mask GL_PARAM parameters "; break; |
563 |
case -211: message += " TRACKERLEVEL2 - Error opening/reading trk alignment GL_PARAM parameters"; break; |
564 |
case -212: message += " TRACKERLEVEL2 - Error opening/reading trk mip GL_PARAM parameters"; break; |
565 |
case -213: message += " TRACKERLEVEL2 - Error opening/reading trk charge GL_PARAM parameters"; break; |
566 |
case -214: message += " TRACKERLEVEL2 - Error opening/reading trk pfa GL_PARAM parameters"; break; |
567 |
case -215: message += " TRACKERLEVEL2 - Error opening/reading field GL_PARAM parameters"; break; |
568 |
case -216: message += " TRACKERLEVEL2 - Error opening/reading default calibration GL_PARAM parameters"; break; |
569 |
case -298: message += " TRACKERLEVEL2 - Reprocessing not implemented in standalone mode"; break; |
570 |
case -299: message += " TRACKERLEVEL2 - Not yet implemented"; break; |
571 |
// |
572 |
case -300: message += " TOFLEVEL2 - No Trigger branch in Level0 tree"; break; |
573 |
case -301: message += " TOFLEVEL2 - Cannot open file for writing"; break; |
574 |
case -302: message += " TOFLEVEL2 - No tracker tree in Level2 file"; break; |
575 |
case -303: message += " TOFLEVEL2 - No Tof branch in Level0 file"; break; |
576 |
case -313: message += " TOFLEVEL2 - No more tracker events in Level2 file"; break; |
577 |
// |
578 |
case -401: message += " TRIGGERLEVEL2 - Cannot open file for writing"; break; |
579 |
case -402: message += " TRIGGERLEVEL2 - No Trigger branch in Level0 tree"; break; |
580 |
// |
581 |
case -500: message += " S4LEVEL2 - No level2 file"; break; |
582 |
case -501: message += " S4LEVEL2 - Cannot open file for writing"; break; |
583 |
case -502: message += " S4LEVEL2 - No result from GL_S4_CALIB"; break; |
584 |
case -503: message += " S4LEVEL2 - No S4 branch in Level0 tree"; break; |
585 |
// |
586 |
case -600: message += " NDLEVEL2 - No level2 file"; break; |
587 |
case -601: message += " NDLEVEL2 - Cannot open file for writing"; break; |
588 |
case -603: message += " NDLEVEL2 - No S4Level2 branch in Level0 tree"; break; |
589 |
// |
590 |
case -701: message += " NDLEVEL2 - Cannot open file for writing"; break; |
591 |
case -704: message += " NDLEVEL2 - No Anticounter branch in Level0 tree"; break; |
592 |
// |
593 |
case -800: message += " RUNINFO - No such run in the RunInfo list"; break; |
594 |
case -801: message += " RUNINFO - No RunInfo tree in Level2 file"; break; |
595 |
case -802: message += " RUNINFO - Cannot open file for writing"; break; |
596 |
case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; |
597 |
case -804: message += " RUNINFO - Unknown detector"; break; |
598 |
case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; |
599 |
// |
600 |
default: message += "Unidentified error or warning"; break; |
601 |
}; |
602 |
printf("\n"); |
603 |
if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <<endl; |
604 |
} |
605 |
// switch(RUNSGN){ |
606 |
// }; |
607 |
switch(CALSGN){ |
608 |
case 100: printf("\n WARNING CALORIMETER - Data with no associated calibration\n"); break; |
609 |
case 101: printf("\n WARNING CALORIMETER - No tracks or good events in this run\n"); break; |
610 |
}; |
611 |
// |
612 |
// Close the DB connection |
613 |
// |
614 |
if ( dbc ){ |
615 |
if ( debug ) printf("\nClose the connection to the database... \n"); |
616 |
dbc->Close(); |
617 |
if ( debug ) printf("...connection terminated!\n\n"); |
618 |
}; |
619 |
if ( processFile ){ |
620 |
processFile->cd(); |
621 |
processFile->Close(); |
622 |
}; |
623 |
// |
624 |
if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error); |
625 |
printf("\n"); |
626 |
// |
627 |
// Close redirection if the case. |
628 |
// |
629 |
if ( !beverbose ) close(nul); |
630 |
// |
631 |
// |
632 |
exit(error); |
633 |
} |