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

Annotation of /DarthVader/src/DarthVader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (hide annotations) (download)
Thu Nov 9 14:44:09 2006 UTC (18 years ago) by mocchiut
Branch: MAIN
Changes since 1.14: +83 -44 lines
RunInfo updated + added -c option to DV

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

  ViewVC Help
Powered by ViewVC 1.1.23