/[PAMELA software]/DarthVader/src/DarthVader.cpp
ViewVC logotype

Contents of /DarthVader/src/DarthVader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Thu Sep 7 08:50:38 2006 UTC (18 years, 3 months ago) by mocchiut
Branch: MAIN
Changes since 1.9: +19 -5 lines
Adapted to profiler version v2r00

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

  ViewVC Help
Powered by ViewVC 1.1.23