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