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

Annotation of /DarthVader/src/DarthVader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (hide annotations) (download)
Tue Nov 14 14:08:53 2006 UTC (18 years ago) by mocchiut
Branch: MAIN
Changes since 1.16: +91 -11 lines
Major calorimeter release, some news in DarthVader main

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

  ViewVC Help
Powered by ViewVC 1.1.23