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