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

Diff of /DarthVader/src/DarthVader.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by mocchiut, Fri Aug 4 10:31:35 2006 UTC revision 1.46 by mocchiut, Wed Mar 6 14:20:27 2013 UTC
# Line 10  Line 10 
10  #include <TSQLServer.h>  #include <TSQLServer.h>
11  #include <TFile.h>  #include <TFile.h>
12  #include <TSystem.h>  #include <TSystem.h>
13    #include <TStopwatch.h>
14    #include <TObjectTable.h>
15    //
16    #include <GLTables.h>
17  //  //
18  // Detector's package headers  // Detector's package headers
19  //  //
# Line 26  Line 30 
30  //  //
31  using namespace std;  using namespace std;
32  //  //
33    GL_TABLES *glt = NULL;
34  //  //
35  //  //
36  #include <DarthVaderVerl2.h>  #include <DarthVaderVerl2.h>
# Line 34  using namespace std; Line 39  using namespace std;
39  //  //
40  void usage(){  void usage(){
41    printf("\nUsage:\n");    printf("\nUsage:\n");
42    printf("\n DarthVader [-v | --verbose] [-h | --help] [--version] -idRun ID_RUN [-processFile filename]\n");    printf("\n DarthVader [ options ] -idRun ID_RUN [+-all] [+-detector [ detector options ] ] \n");
43    printf("\n            [-host host] [-user username] [-psw password] [+-all] [+-detector [detector options] ]\n");    printf("\n Options are: \n\n");
44    printf("\n --version       print informations about compilation and exit\n");    printf(" --version         print informations about compilation and exit\n");
45    printf("\n -h | --help     print this help and exit \n");    printf(" -h || --help      print this help and exit \n");
46    printf("\n -v | --verbose  be verbose [default: print nothing on STDOUT]\n");    printf(" -v || --verbose   be verbose [default]\n");
47    printf("\n -idRun          ID_RUN: ID number of the run to be processed \n");    printf(" -s || --silent    print nothing on STDOUT\n");
48    printf("\n -processFile    output filename [default ID_RUN.Level2.root]\n");    printf(" -c || --clean     remove file if exiting with errors\n");
49    printf("\n -host           name for the host [default = mysql://localhost/pamelaprod]\n");    printf(" -b || --benchmark perform and print a benchmark test\n");
50    printf("\n -user           username for the DB [default = anonymous] \n");    printf(" -auto || -AUTO    exclude from processing detector which are NOT in the acquisition\n");
51    printf("\n -psw            password for the DB [default = \"\"]\n");    printf(" -zerofill         if a detector is not in the acquisition the routine is called anyway \n");
52    printf("\n +all            call all detectors software [default]\n");    printf("                   but all detector's data will be marked as bad [default]\n");
53    printf("\n -all            call nothing\n");    printf(" -tedious          exit with error if a detector is not in the acquisition and \n");
54    printf("\n +detector       process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n");    printf("                   it has not been excluded from processing\n");
55    printf("\n -detector       do not process detector (as above)\n");    printf(" -host             name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n");
56    printf("\nExamples: \n");    printf(" -user             username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n");
57    printf("\nStandard call: DarthVader -idRun 1085 \n");    printf(" -psw              password for the DB connection [default = $PAM_DBPSW or \"\"]\n");
58    printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n");    printf(" -idRun ID_RUN     ID number (from the DB) of the run to be processed \n");
59    printf("\nProcess all and be verbose for calorimeter: DarthVader -idRun 1085 +CAL [ --verbose ] \n\n");    printf(" -processFile file output filename [default ID_RUN.Level2.root]\n");
60      printf(" +all || +ALL      call all detectors software [default]\n");
61      printf(" -all || -ALL      call nothing\n");
62      printf(" +detector         process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n");
63      printf(" -detector         do not process detector (as above)\n");
64      printf("                   detector options must be included in square parenthesis with spaces, for example:\n");
65      printf("                   +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n");  
66      printf("\n Examples: \n");
67      printf(" Standard call:\n            DarthVader -idRun 1085 \n");
68      printf(" Process only RunInfo and Tracker (be verbose for tracker):\n            DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n");
69      printf(" Process all and be verbose for calorimeter:\n            DarthVader -idRun 1085 +CAL [ --verbose ] \n\n");
70      printf(" Set Tracker to work with simulated data:\n            DarthVader -idRun 1085 +TRK [ --simu ] \n\n");
71  };  };
72    
73  //  //
74  // Here the main  // Here the main
75  //  //
# Line 60  int main(int numinp, char *inps[]){ Line 77  int main(int numinp, char *inps[]){
77    //    //
78    // Variables booking    // Variables booking
79    //    //
80      //
81      // benchmarck variables
82      //
83      TStopwatch timer;
84      TStopwatch dvtimer;
85      dvtimer.Start(kTRUE);
86      UInt_t nevents = 0;
87      UInt_t nruns = 0;
88      Double_t runtime = 0.;
89      Double_t cruntime = 0.;
90      Double_t trktime = 0.;
91      Double_t ctrktime = 0.;
92      Double_t caltime = 0.;
93      Double_t ccaltime = 0.;
94      Double_t toftime = 0.;
95      Double_t ctoftime = 0.;
96      Double_t trgtime = 0.;
97      Double_t ctrgtime = 0.;
98      Double_t actime = 0.;
99      Double_t cactime = 0.;
100      Double_t s4time = 0.;
101      Double_t cs4time = 0.;
102      Double_t ndtime = 0.;
103      Double_t cndtime = 0.;
104      Double_t orbtime = 0.;
105      Double_t corbtime = 0.;
106      Double_t dvtime = 0.;
107      Double_t cdvtime = 0.;
108      //
109    TString message;    TString message;
110    int nul = 0;    int nul = 0;
111    Int_t error = 0;    Int_t error = 0;
# Line 73  int main(int numinp, char *inps[]){ Line 119  int main(int numinp, char *inps[]){
119    Int_t ACSGN = 0;    Int_t ACSGN = 0;
120    Int_t S4SGN = 0;    Int_t S4SGN = 0;
121    Int_t NDSGN = 0;    Int_t NDSGN = 0;
122      Int_t DVSGN = 0;
123      //
124      UInt_t NQRUN = 0;
125      UInt_t NQTRK = 0;
126      UInt_t NQCAL = 0;
127      UInt_t NQTOF = 0;
128      UInt_t NQORB = 0;
129      UInt_t NQTRG = 0;
130      UInt_t NQAC = 0;
131      UInt_t NQND = 0;
132      UInt_t NQS4 = 0;
133      UInt_t NQTOT = 0;
134    //    //
135      Bool_t autom = false;
136      Bool_t zerofill = true;
137      Bool_t tedious = false;
138      Bool_t remfile = false;
139    Bool_t debug = false;    Bool_t debug = false;
140    Bool_t beverbose = false;    Bool_t beverbose = true;
141    Bool_t givenid = false;    Bool_t givenid = false;
142      Bool_t bench = false;
143    Bool_t CAL = true;    Bool_t CAL = true;
144    Bool_t TRK = true;    Bool_t TRK = true;
145    Bool_t TRG = true;    Bool_t TRG = true;
# Line 85  int main(int numinp, char *inps[]){ Line 148  int main(int numinp, char *inps[]){
148    Bool_t ND = true;    Bool_t ND = true;
149    Bool_t AC = true;    Bool_t AC = true;
150    Bool_t ORB = true;    Bool_t ORB = true;
151    Bool_t RUN = true;    Bool_t RUN = true;  
152    //    //
153    Int_t calargc = 0;    Int_t calargc = 0;
154    char *calargv[50];    char *calargv[50];
# Line 108  int main(int numinp, char *inps[]){ Line 171  int main(int numinp, char *inps[]){
171    //    //
172    //    //
173    //    //
174    ULong64_t run = 0;    UInt_t run = 0;
175    //    //
176    TString filename;    TString filename;
177    TString outDir =  gSystem->WorkingDirectory();    TString outDir =  gSystem->WorkingDirectory();
# Line 117  int main(int numinp, char *inps[]){ Line 180  int main(int numinp, char *inps[]){
180    TString host = "mysql://localhost/pamelaprod";    TString host = "mysql://localhost/pamelaprod";
181    TString user = "anonymous";    TString user = "anonymous";
182    TString psw = "";    TString psw = "";
183      //  
184      //
185      const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
186      const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
187      const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
188      if ( !pamdbhost ) pamdbhost = "";
189      if ( !pamdbuser ) pamdbuser = "";
190      if ( !pamdbpsw ) pamdbpsw = "";
191      if ( strcmp(pamdbhost,"") ) host = pamdbhost;
192      if ( strcmp(pamdbuser,"") ) user = pamdbuser;
193      if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
194      //
195    //    //
196    TFile *processFile = 0;    TFile *processFile = 0;
197    //    //
# Line 126  int main(int numinp, char *inps[]){ Line 201  int main(int numinp, char *inps[]){
201    try {    try {
202      if ( numinp > 1 ){      if ( numinp > 1 ){
203        while ( i < numinp ){        while ( i < numinp ){
204            Bool_t found = false;
205          if ( !strcmp(inps[i],"--version") ){          if ( !strcmp(inps[i],"--version") ){
206            DarthVaderInfo(true);            DarthVaderInfo(true);
207            exit(0);            exit(0);
# Line 139  int main(int numinp, char *inps[]){ Line 215  int main(int numinp, char *inps[]){
215              usage();              usage();
216              throw -3;              throw -3;
217            };            };
218              i++;
219              found = true;
220            givenid = true;            givenid = true;
221            char *pEnd;              run = atoll(inps[i]);
           run = strtoull(inps[i+1],&pEnd,0);      
222          };          };
223          if ( !strcmp(inps[i],"-processFile") ) {          if ( !strcmp(inps[i],"-processFile") ) {
224            if ( numinp-1 < i+1 ){            if ( numinp-1 < i+1 ){
225              usage();              usage();
226              throw -3;              throw -3;
227            };            };
228            filename = (TString)inps[i+1];                    i++;
229              found = true;
230              filename = (TString)inps[i];  
231          };          };
232          if ( !strcmp(inps[i],"-outDir") ) {          if ( !strcmp(inps[i],"-outDir") ) {
233            if ( numinp-1 < i+1 ){            if ( numinp-1 < i+1 ){
234              usage();              usage();
235              throw -3;              throw -3;
236            };            };
237            outDir = (TString)inps[i+1];              i++;
238              found = true;
239              outDir = (TString)inps[i];    
240          };          };
241          if ( !strcmp(inps[i],"-host") ) {          if ( !strcmp(inps[i],"-host") ) {
242            if ( numinp-1 < i+1 ){            if ( numinp-1 < i+1 ){
243              usage();              usage();
244              throw -3;              throw -3;
245            };            };
246            host = (TString)inps[i+1];                i++;
247              found = true;
248              host = (TString)inps[i];      
249          };          };
250          if ( !strcmp(inps[i],"-user") ) {          if ( !strcmp(inps[i],"-user") ) {
251            if ( numinp-1 < i+1 ){            if ( numinp-1 < i+1 ){
252              usage();              usage();
253              throw -3;              throw -3;
254            };            };
255            user = (TString)inps[i+1];                i++;
256              found = true;
257              user = (TString)inps[i];      
258          };          };
259          if ( !strcmp(inps[i],"-psw") ) {          if ( !strcmp(inps[i],"-psw") ) {
260            if ( numinp-1 < i+1 ){            if ( numinp-1 < i+1 ){
261              usage();              usage();
262              throw -3;              throw -3;
263            };            };
264            psw = (TString)inps[i+1];                i++;
265              found = true;
266              psw = (TString)inps[i];      
267            };
268            if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ){
269              found = true;
270              beverbose = true;
271            };
272            if ( !strcmp(inps[i],"-c") || !strcmp(inps[i],"--clean")){
273              found = true;
274              remfile = true;
275            };
276            if ( !strcmp(inps[i],"-s") || !strcmp(inps[i],"--silent") ){
277              found = true;
278              beverbose = false;
279            };
280            if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ){
281              debug = true;
282              found = true;
283            };
284            if ( !strcmp(inps[i],"-b") || !strcmp(inps[i],"--benchmark") ){
285              bench = true;
286              found = true;
287            };
288            if ( !strcmp(inps[i],"-auto") || !strcmp(inps[i],"-AUTO") ){
289              autom = true;
290              tedious = false;
291              zerofill = false;
292              found = true;
293            };
294            if ( !strcmp(inps[i],"-zerofill") ){
295              tedious = false;
296              autom = false;
297              zerofill = true;
298              found = true;
299            };
300            if ( !strcmp(inps[i],"-tedious") ){
301              tedious = true;
302              zerofill = false;
303              autom = false;
304              found = true;
305          };          };
         if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;  
         //  
         if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ) debug = true;  
306          //          //
307          if ( !strcmp(inps[i],"-CAL") ) {          if ( !strcmp(inps[i],"-CAL") ) {
308              found = true;
309            CAL = false;            CAL = false;
310          };          };
311          if ( !strcmp(inps[i],"-TRK") ) {          if ( !strcmp(inps[i],"-TRK") ) {
312              found = true;
313            TRK = false;            TRK = false;
314          };          };
315          if ( !strcmp(inps[i],"-TOF") ) {          if ( !strcmp(inps[i],"-TOF") ) {
316              found = true;
317            TOF = false;            TOF = false;
318          };          };
319          if ( !strcmp(inps[i],"-TRG") ) {          if ( !strcmp(inps[i],"-TRG") ) {
320              found = true;
321            TRG = false;            TRG = false;
322          };          };
323          if ( !strcmp(inps[i],"-S4") ) {          if ( !strcmp(inps[i],"-S4") ) {
324              found = true;
325            S4 = false;            S4 = false;
326          };          };
327          if ( !strcmp(inps[i],"-ND") ) {          if ( !strcmp(inps[i],"-ND") ) {
328              found = true;
329            ND = false;            ND = false;
330          };          };
331          if ( !strcmp(inps[i],"-AC") ) {          if ( !strcmp(inps[i],"-AC") ) {
332              found = true;
333            AC = false;            AC = false;
334          };          };
335          if ( !strcmp(inps[i],"-RUN") ) {          if ( !strcmp(inps[i],"-RUN") ) {
336              found = true;
337            RUN = false;            RUN = false;
338          };          };
339          if ( !strcmp(inps[i],"-ORB") ) {          if ( !strcmp(inps[i],"-ORB") ) {
340              found = true;
341            ORB = false;            ORB = false;
342          };          };
343          //          //
344          if ( !strcmp(inps[i],"-all") ) {          if ( !strcmp(inps[i],"-all") || !strcmp(inps[i],"-ALL") ) {
345            CAL = false;            CAL = false;
346            ORB = false;            ORB = false;
347            TRK = false;            TRK = false;
# Line 220  int main(int numinp, char *inps[]){ Line 351  int main(int numinp, char *inps[]){
351            ND = false;            ND = false;
352            AC = false;            AC = false;
353            RUN = false;            RUN = false;
354              found = true;
355          };          };
356          //          //
357          if ( !strcmp(inps[i],"+all") ) {          if ( !strcmp(inps[i],"+all") || !strcmp(inps[i],"+ALL") ) {
358            CAL = true;            CAL = true;
359            ORB = true;            ORB = true;
360            TRK = true;            TRK = true;
# Line 232  int main(int numinp, char *inps[]){ Line 364  int main(int numinp, char *inps[]){
364            ND = true;            ND = true;
365            AC = true;            AC = true;
366            RUN = true;            RUN = true;
367              found = true;
368          };          };
369          //          //
370          if ( !strcmp(inps[i],"+CAL") ) {          if ( !strcmp(inps[i],"+CAL") ) {
371              found = true;
372            CAL = true;            CAL = true;
373            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
374              if ( numinp < i+2 ){              if ( numinp < i+2 ){
# Line 255  int main(int numinp, char *inps[]){ Line 389  int main(int numinp, char *inps[]){
389            };            };
390          };          };
391          if ( !strcmp(inps[i],"+TRK") ) {          if ( !strcmp(inps[i],"+TRK") ) {
392              found = true;
393            TRK = true;            TRK = true;
394            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
395              if ( numinp-1 < i+2 ){              if ( numinp-1 < i+2 ){
# Line 275  int main(int numinp, char *inps[]){ Line 410  int main(int numinp, char *inps[]){
410            };            };
411          };          };
412          if ( !strcmp(inps[i],"+TOF") ) {          if ( !strcmp(inps[i],"+TOF") ) {
413              found = true;
414            TOF = true;            TOF = true;
415            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
416              i += 2;                    i += 2;      
# Line 291  int main(int numinp, char *inps[]){ Line 427  int main(int numinp, char *inps[]){
427            };            };
428          };          };
429          if ( !strcmp(inps[i],"+TRG") ) {          if ( !strcmp(inps[i],"+TRG") ) {
430              found = true;
431            TRG = true;            TRG = true;
432            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
433              i += 2;                    i += 2;      
# Line 307  int main(int numinp, char *inps[]){ Line 444  int main(int numinp, char *inps[]){
444            };            };
445          };          };
446          if ( !strcmp(inps[i],"+ORB") ) {          if ( !strcmp(inps[i],"+ORB") ) {
447              found = true;
448            ORB = true;            ORB = true;
449            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
450              i += 2;                    i += 2;      
# Line 323  int main(int numinp, char *inps[]){ Line 461  int main(int numinp, char *inps[]){
461            };            };
462          };          };
463          if ( !strcmp(inps[i],"+RUN") ) {          if ( !strcmp(inps[i],"+RUN") ) {
464              found = true;
465            RUN = true;            RUN = true;
466            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
467              i += 2;                    i += 2;      
# Line 339  int main(int numinp, char *inps[]){ Line 478  int main(int numinp, char *inps[]){
478            };            };
479          };          };
480          if ( !strcmp(inps[i],"+AC") ) {          if ( !strcmp(inps[i],"+AC") ) {
481              found = true;
482            AC = true;            AC = true;
483            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
484              i += 2;                    i += 2;      
# Line 355  int main(int numinp, char *inps[]){ Line 495  int main(int numinp, char *inps[]){
495            };            };
496          };          };
497          if ( !strcmp(inps[i],"+S4") ) {          if ( !strcmp(inps[i],"+S4") ) {
498              found = true;
499            S4 = true;            S4 = true;
500            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
501              i += 2;                    i += 2;      
# Line 371  int main(int numinp, char *inps[]){ Line 512  int main(int numinp, char *inps[]){
512            };            };
513          };          };
514          if ( !strcmp(inps[i],"+ND") ) {          if ( !strcmp(inps[i],"+ND") ) {
515              found = true;
516            ND = true;            ND = true;
517            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){            if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){
518              i += 2;                    i += 2;      
# Line 387  int main(int numinp, char *inps[]){ Line 529  int main(int numinp, char *inps[]){
529            };            };
530          };          };
531          //          //
532            if ( !found && i > 0 ){
533              usage();
534              printf(" Unknown input number %i, that is \"%s\" \n",i,inps[i]);
535              throw -22;
536            };
537            //
538          i++;          i++;
539        };        };
540        //        //
# Line 400  int main(int numinp, char *inps[]){ Line 548  int main(int numinp, char *inps[]){
548      // If not in verbose mode redirect to /dev/null the stdout and stderr      // If not in verbose mode redirect to /dev/null the stdout and stderr
549      //      //
550      if ( !beverbose ){      if ( !beverbose ){
551        nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);        nul = open("/dev/null", O_CREAT | O_RDWR,S_IRUSR | S_IWUSR);
552        dup2(nul,1);        dup2(nul,1);
553        dup2(nul,2);        dup2(nul,2);
554      };      };
# Line 409  int main(int numinp, char *inps[]){ Line 557  int main(int numinp, char *inps[]){
557      //      //
558      if ( !givenid ) throw -1;      if ( !givenid ) throw -1;
559      //      //
560      char *version = DarthVaderInfo(false);      TString version = DarthVaderInfo(false);
561      //      //
562      // Start:      // Start:
563      //      //
564      printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version);      printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version.Data());
565        if ( run )  printf("\n Processing run number %u \n\n",run);
566      //      //
567      // Connect to the DB      // Connect to the DB
568      //      //
# Line 422  int main(int numinp, char *inps[]){ Line 571  int main(int numinp, char *inps[]){
571      dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());      dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
572      if( !dbc ) throw -2;          if( !dbc ) throw -2;    
573      //      //
574      bool connect = dbc->IsConnected();      Bool_t connect = dbc->IsConnected();
575      //      //
576      if( !connect ) throw -2;          if( !connect ) throw -2;    
577      //      //
578      if ( debug ) printf("...connected! \n\n");      if ( debug ) printf("...connected! \n\n");
579      //      //
580        glt = new GL_TABLES(host,user,psw);
581        //GL_TABLES *glt = new GL_TABLES(host,user,psw);
582        //
583        if ( debug ) printf("\n DB INFORMATIONS:\n SQL: %s Version: %s Host %s Port %i \n\n",dbc->GetDBMS(),dbc->ServerInfo(),dbc->GetHost(),dbc->GetPort());
584        //
585        // Use UTC in the DB
586        //
587        stringstream myquery;
588        myquery.str("");
589        myquery << "SET time_zone='+0:00'";
590        dbc->Query(myquery.str().c_str());
591        myquery.str("");
592        myquery << "SET wait_timeout=173000;";
593        dbc->Query(myquery.str().c_str());
594        //
595        //
596      // Create LEVEL2 filename and open it in update mode      // Create LEVEL2 filename and open it in update mode
597      //      //
598      if ( filename.IsNull() ){      if ( filename.IsNull() ){
# Line 439  int main(int numinp, char *inps[]){ Line 604  int main(int numinp, char *inps[]){
604        filename += strun.str();        filename += strun.str();
605        filename += ".Level2.root";        filename += ".Level2.root";
606      };      };
     //    filename = outDir + "/" + filename;  
607      processFile = new TFile(filename.Data(),"UPDATE");      processFile = new TFile(filename.Data(),"UPDATE");
608      if ( !processFile->IsOpen() ) throw -15;          if ( !processFile->IsOpen() ) throw -15;    
609      //      //
610        Long64_t maxsize = 10000000000LL;  
611        TTree::SetMaxTreeSize(maxsize);
612        processFile->SetCompressionLevel(1);
613        //
614        //
615      // Run the core program, put any output error in the "error" variable      // Run the core program, put any output error in the "error" variable
616      //      //
617        if ( debug ) printf("\n\n Pre-processing:\n\n");
618        //
619        timer.Start(kTRUE);
620      if ( RUN ) {      if ( RUN ) {
621        printf(" Calling RunInfo... ");        glt->ResetCounters();
622        RUNSGN = RunInfoCore(run,processFile,dbc,runargc,runargv);        if ( debug ) printf(" Retrieve, if the case, the RUN informations from the DB...\n");
623        printf("done\n");        printf(" RunInfo called\n");
624          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n");
625          RUNSGN = RunInfoCore(run,processFile,dbc,version,runargc,runargv);
626          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end RunInfoCore STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
627          if ( debug ) printf(" ...done\n");
628          NQRUN = glt->GetNqueries();
629      };      };
630        timer.Stop();
631        runtime = timer.RealTime();
632        cruntime = timer.CpuTime();
633      //      //
634      // From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not      // From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not
635      //      //
636      printf(" Checking if requested detectors are in the acquisition\n");      if ( debug ) printf(" Checking if requested detectors are in the acquisition\n");
637      ItoRunInfo *runinfo = new ItoRunInfo(processFile);      ItoRunInfo *runinfo = new ItoRunInfo(processFile);
638      runinfo->Read(run);      Int_t sgnl = runinfo->Read(run);
639      printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO);      if ( sgnl != 0 ) throw -17;
640      if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ) throw -16;      nevents = runinfo->GetEntries();
641      if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ) throw -17;      nruns = runinfo->GetNoRun();
642      if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ) throw -18;      if ( debug ) printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO);
643      if ( AC  && !(runinfo->ACQ_VAR_INFO & (1 << 1)) && !(runinfo->ACQ_VAR_INFO & (1 << 2)) ) throw -19;      if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ){
644      if ( S4  && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ) throw -20;        DVSGN += 1;
645      if ( ND  && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ) throw -21;        if ( tedious ) throw -30;
646      printf(" OK! start processing detector's data. \n");        if ( autom ){
647            TRK = 0;
648            if ( debug ) printf(" TRK excluded from processing \n");
649          };
650          if ( zerofill && debug ) printf(" TRK is not in the acquisition! \n");
651        };
652        if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ){
653          DVSGN += 2;
654          if ( tedious ) throw -31;
655          if ( autom ){
656            TOF = 0;
657            if ( debug ) printf(" TOF excluded from processing \n");
658          };      
659          if ( zerofill && debug ) printf(" TOF is not in the acquisition! \n");
660        };
661        if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ){
662          DVSGN += 4;
663          if ( tedious ) throw -32;
664          if ( autom ){
665            CAL = 0;
666            if ( debug ) printf(" CAL excluded from processing \n");
667          };
668          if ( zerofill && debug ) printf(" CAL is not in the acquisition! \n");
669        };
670        if ( AC  && (!(runinfo->ACQ_VAR_INFO & (1 << 1)) || !(runinfo->ACQ_VAR_INFO & (1 << 2))) ){
671          DVSGN += 8;
672          if ( tedious ) throw -33;
673          if ( autom ){
674            AC = 0;
675            if ( debug ) printf(" AC excluded from processing \n");
676          };
677          if ( zerofill && debug ) printf(" AC is not in the acquisition! \n");
678        };
679        if ( S4  && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ){
680          DVSGN += 16;
681          if ( tedious ) throw -34;
682          if ( autom ){
683            S4 = 0;
684            if ( debug ) printf(" S4 excluded from processing \n");
685          };
686          if ( zerofill && debug ) printf(" S4 is not in the acquisition! \n");
687        };
688        if ( ND  && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ){
689          DVSGN += 32;
690          if ( tedious ) throw -35;
691          if ( autom ){
692            ND = 0;
693            if ( debug ) printf(" ND excluded from processing \n");
694          };
695          if ( zerofill && debug ) printf(" ND is not in the acquisition! \n");
696        };
697        //
698        if ( !DVSGN ){
699          if ( debug ) printf(" OK! Start processing detector's data. \n");
700        } else {
701          if ( debug ) printf(" WARNING! missing detector(s)! Start anyway processing detector's data. \n");
702        };
703        if ( debug ) printf("\n End pre-processing \n\n");
704        //
705        dbc->Close();
706        //
707        //
708        timer.Start(kTRUE);
709        if ( TRG ) {
710          glt->ResetCounters();
711          printf(" TriggerLevel2 called\n");
712          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n");
713          TRGSGN = TrigCore(run,processFile,glt,trgargc,trgargv);
714          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end TrigCore STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
715          NQTRG = glt->GetNqueries();
716        };
717        timer.Stop();
718        trgtime = timer.RealTime();
719        ctrgtime = timer.CpuTime();
720      //      //
721        timer.Start(kTRUE);
722      if ( TRK ) {      if ( TRK ) {
723        printf(" Calling TrackerLevel2... ");        glt->ResetCounters();
724        TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv);        printf(" TrackerLevel2 called\n");                
725        printf("done\n");        if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n");
726          TRKSGN = TrkCore(run,processFile,glt,trkargc,trkargv);
727          gSystem->Unlink("TrackerFolder"); //patch
728          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end TrkCore STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
729          NQTRK = glt->GetNqueries();
730      };      };
731        timer.Stop();
732        trktime = timer.RealTime();
733        ctrktime = timer.CpuTime();
734        //
735        timer.Start(kTRUE);
736      if ( TOF ) {      if ( TOF ) {
737        printf(" Calling ToFLevel2... ");        glt->ResetCounters();
738        TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv);        printf(" ToFLevel2 called\n");
739        printf("done\n");        if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n");
740          TOFSGN = ToFCore(run,processFile,glt,tofargc,tofargv);
741          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end ToFCore STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
742          NQTOF = glt->GetNqueries();
743      };      };
744        timer.Stop();
745        toftime = timer.RealTime();
746        ctoftime = timer.CpuTime();
747        //
748        timer.Start(kTRUE);
749      if ( CAL ) {      if ( CAL ) {
750        printf(" Calling CalorimeterLevel2... ");        glt->ResetCounters();
751        CALSGN = CaloCore(run,processFile,dbc,calargc,calargv);        printf(" CalorimeterLevel2 called\n");
752        printf("done\n");        if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n");
753      };        CALSGN = CaloCore(run,processFile,glt,calargc,calargv);
754      if ( TRG ) {        if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end CaloCore STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
755        printf(" Calling TriggerLevel2... ");        NQCAL = glt->GetNqueries();
       TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv);  
       printf("done\n");  
756      };      };
757        timer.Stop();
758        caltime = timer.RealTime();
759        ccaltime = timer.CpuTime();
760        //
761        timer.Start(kTRUE);
762      if ( AC ) {      if ( AC ) {
763        printf(" Calling AnticounterLevel2... ");        glt->ResetCounters();
764        ACSGN = AcCore(run,processFile,dbc,acargc,acargv);        printf(" AnticounterLevel2 called\n");
765        printf("done\n");        if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n");
766          ACSGN = AcCore(run,processFile,glt,acargc,acargv);
767          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end AcCore STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
768          NQAC = glt->GetNqueries();
769      };      };
770        timer.Stop();
771        actime = timer.RealTime();
772        cactime = timer.CpuTime();
773        //
774        timer.Start(kTRUE);
775      if ( S4 ) {      if ( S4 ) {
776        printf(" Calling S4Level2 ... ");        glt->ResetCounters();
777        S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv);        printf(" S4Level2 called\n");
778        printf("done\n");        if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start S4Core STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
779          S4SGN = S4Core(run,processFile,glt,s4argc,s4argv);
780          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end S4Core STDOUT   |<<<<<<<<<<<<<<<<<<<\n");
781          NQS4 = glt->GetNqueries();
782      };      };
783        timer.Stop();
784        s4time = timer.RealTime();
785        cs4time = timer.CpuTime();
786        //
787        timer.Start(kTRUE);
788      if ( ND ) {      if ( ND ) {
789        printf(" Calling NDLevel2... ");        glt->ResetCounters();
790        NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv);        printf(" NDLevel2 called\n");
791        printf("done\n");        if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start NDCore STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
792          NDSGN = NDCore(run,processFile,glt,ndargc,ndargv);
793          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end NDCore STDOUT   |<<<<<<<<<<<<<<<<<<<\n");
794          NQND = glt->GetNqueries();
795      };      };
796        timer.Stop();
797        ndtime = timer.RealTime();
798        cndtime = timer.CpuTime();
799        //
800        timer.Start(kTRUE);
801      if ( ORB ) {      if ( ORB ) {
802        printf(" Calling OrbitalInfo... ");        glt->ResetCounters();
803        ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv);        printf(" OrbitalInfo called\n");
804        printf("done\n");        if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>| start OrbitalInfoCore STDOUT  |<<<<<<<<<<<<<<<<<<<\n");
805          ORBSGN = OrbitalInfoCore(run,processFile,glt,orbargc,orbargv);
806          if ( debug ) printf("                      >>>>>>>>>>>>>>>>>>>|  end OrbitalInfoCore STDOUT   |<<<<<<<<<<<<<<<<<<<\n");
807          NQORB = glt->GetNqueries();
808      };          };    
809        timer.Stop();
810        orbtime = timer.RealTime();
811        corbtime = timer.CpuTime();
812        //
813        NQTOT = 2 + NQRUN + NQTRK + NQCAL + NQND + NQS4 + NQAC + NQTRG + NQTOF + NQORB;
814        //
815        delete glt;
816        delete runinfo;
817      //      //
818    } catch(Int_t signal) {        } catch(Int_t signal) {    
819      error = signal;      error = signal;
# Line 514  int main(int numinp, char *inps[]){ Line 823  int main(int numinp, char *inps[]){
823      case -2:   message += " DB connection failure"; break;      case -2:   message += " DB connection failure"; break;
824      case -3:   message += " Error in input parameters (check format)"; break;      case -3:   message += " Error in input parameters (check format)"; break;
825      case -4:   message += " Request reprocessing of all runs (idRun = 0) but processFile is missing"; break;      case -4:   message += " Request reprocessing of all runs (idRun = 0) but processFile is missing"; break;
826        case -5:   message += " RUNINFO - ERROR: no run with this ID_RUN (ID_RUN mismatch?) "; break;
827      case -6:   message += " No LEVEL0 file "; break;      case -6:   message += " No LEVEL0 file "; break;
828      case -7:   message += " No Physics tree in LEVEL0 file"; break;      case -7:   message += " No Physics tree in LEVEL0 file"; break;
829      case -8:   message += " No Header branch in LEVEL0 Physics tree"; break;      case -8:   message += " No Header branch in LEVEL0 Physics tree"; break;
830      case -9:   message += " No Registry branch in LEVEL0 Physics tree"; break;      case -9:   message += " No Registry branch in LEVEL0 Physics tree"; break;
831      case -11:  message += " LEVEL0 Physics tree is empty"; break;      case -11:  message += " LEVEL0 Physics tree is empty"; break;
832      case -12:  message += " Too few entries in the registry tree"; break;      case -12:  message += " Too few entries in the tree"; break;
833      case -13:  message += " Cannot create processFolder directory"; break;      case -13:  message += " Cannot create processFolder directory"; break;
834      case -14:  message += " Error querying the DB"; break;      case -14:  message += " Error querying the DB"; break;
835      case -15:  message += " Cannot open file for writing"; break;      case -15:  message += " Cannot open file for writing"; break;
836      case -16:  message += " No tracker in the acquisition (use -TRK to process anyway)"; break;      case -17:  message += " Error during pre-processing"; break;
837      case -17:  message += " No ToF in the acquisition (use -TOF to process anyway)"; break;      case -22:  message += " Unknown input or wrong syntax in input paramters!"; break;
838      case -18:  message += " No calorimeter in the acquisition (use -CAL to process anyway)"; break;      case -30:  message += " No TRK in the acquisition"; break;
839      case -19:  message += " No anticounters in the acquisition (use -AC to process anyway)"; break;      case -31:  message += " No TOF in the acquisition"; break;
840      case -20:  message += " No S4 in the acquisition (use -S4 to process anyway)"; break;      case -32:  message += " No CAL in the acquisition"; break;
841      case -21:  message += " No neutron detector in the acquisition (use -ND to process anyway)"; break;      case -33:  message += " No AC in the acquisition"; break;
842        case -34:  message += " No S4 in the acquisition"; break;
843        case -35:  message += " No ND in the acquisition"; break;
844        case -36:  message += " I/O error or missing entry"; break;
845      
846        //        //
847      case -50:  message += " GLTABLES - No entries matching GL_RUN query"; break;      case -50:  message += " GLTABLES - No entries matching GL_RUN query"; break;
848      case -51:  message += " GLTABLES - No entries matching GL_ROOT query"; break;      case -51:  message += " GLTABLES - No entries matching GL_ROOT query"; break;
849      case -52:  message += " GLTABLES - No entries matching GL_PARAM query"; break;      case -52:  message += " GLTABLES - No entries matching GL_PARAM query"; break;
850      case -53:  message += " GLTABLES - No entries matching GL_TRK_CALIB query"; break;      case -53:  message += " GLTABLES - No entries matching GL_TRK_CALIB query"; break;
851      case -54:  message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break;      case -54:  message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break;
852      case -55:  message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break;      case -55:  message += " GLTABLES - No entries matching GL_S4_CALIB query"; break;
853        case -56:  message += " GLTABLES - No entries matching GL_TLE query"; break;
854        case -57:  message += " GLTABLES - DB connection gone and not able to reconnect"; break;
855        //              //      
856      case -100: message += " CALORIMETERLEVEL2 - No Level2 input file"; break;      case -100: message += " CALORIMETERLEVEL2 - No Level2 input file"; break;
857      case -101: message += " CALORIMETERLEVEL2 -  Cannot open Level2 file"; break;      case -101: message += " CALORIMETERLEVEL2 -  Cannot open Level2 file"; break;
# Line 551  int main(int numinp, char *inps[]){ Line 867  int main(int numinp, char *inps[]){
867      case -111: message += " CALORIMETERLEVEL2 -  Corrupted calibration"; break;      case -111: message += " CALORIMETERLEVEL2 -  Corrupted calibration"; break;
868      case -112: message += " CALORIMETERLEVEL2 -  No physics event related to registry entry in Level0 file"; break;      case -112: message += " CALORIMETERLEVEL2 -  No physics event related to registry entry in Level0 file"; break;
869      case -113: message += " CALORIMETERLEVEL2 -  No tracker event related to registry entry in Level2 file"; break;      case -113: message += " CALORIMETERLEVEL2 -  No tracker event related to registry entry in Level2 file"; break;
870        case -114: message += " CALORIMETERLEVEL2 -  Help called"; break;
871        case -115: message += " CALORIMETERLEVEL2 -  No Calorimeter bad strip offline mask file"; break;
872        case -116: message += " CALORIMETERLEVEL2 -  DB connection problems"; break;
873        case -117: message += " CALORIMETERLEVEL2 -  Cannot reprocess file with Level1 data without calling Level1 routine"; break;
874        case -118: message += " CALORIMETERLEVEL2 -  Cannot reprocess file without Level1 data calling Level1 routine"; break;
875        case -119: message += " CALORIMETERLEVEL2 -  No CalibCalPulse2 TTree in Level0 file needed for the calibration"; break;
876        case -120: message += " CALORIMETERLEVEL2 -  No CalibCalPulse1 TTree in Level0 file needed for the calibration"; break;
877        case -121: message += " CALORIMETERLEVEL2 -  Cannot open calorimeter neighbour crosstalk correction table file"; break;
878        case -122: message += " CALORIMETERLEVEL2 -  Cannot open calorimeter second neighbour crosstalk correction table file"; break;
879        case -123: message += " CALORIMETERLEVEL2 -  Cannot open calorimeter special calibration file"; break;
880        case -124: message += " CALORIMETERLEVEL2 -  Cannot open calorimeter max rms file"; break;
881        case -125: message += " CALORIMETERLEVEL2 -  Cannot open calorimeter silicon crosstalk correction table file"; break;
882        //        //
883      case -200: message += " TRACKERLEVEL2 - LEVEL1 framework unknown (HBOOK/ROOT)"; break;      case -200: message += " TRACKERLEVEL2 - LEVEL1 framework unknown (HBOOK/ROOT)"; break;
884      case -201: message += " TRACKERLEVEL2 - LEVEL2 framework unknown (HBOOK/ROOT)"; break;      case -201: message += " TRACKERLEVEL2 - LEVEL2 framework unknown (HBOOK/ROOT)"; break;
# Line 572  int main(int numinp, char *inps[]){ Line 900  int main(int numinp, char *inps[]){
900      case -301: message += " TOFLEVEL2 - Cannot open file for writing"; break;      case -301: message += " TOFLEVEL2 - Cannot open file for writing"; break;
901      case -302: message += " TOFLEVEL2 - No tracker tree in Level2 file"; break;      case -302: message += " TOFLEVEL2 - No tracker tree in Level2 file"; break;
902      case -303: message += " TOFLEVEL2 - No Tof branch in Level0 file"; break;      case -303: message += " TOFLEVEL2 - No Tof branch in Level0 file"; break;
903        case -304: message += " TOFLEVEL2 - No trigger tree in Level2 file"; break;
904      case -313: message += " TOFLEVEL2 - No more tracker events in Level2 file"; break;      case -313: message += " TOFLEVEL2 - No more tracker events in Level2 file"; break;
905        case -314: message += " TOFLEVEL2 - DB connection problems"; break;
906        case -315: message += " TOFLEVEL2 - Problems with dE/dx II order correction file parameter"; break;
907        case -316: message += " TOFLEVEL2 - Problems with dE/dx II order correction, dividing by zero!"; break;
908        case -317: message += " TOFLEVEL2 - Problems with dE/dx II order correction, outside time limits!"; break;
909        case -318: message += " TOFLEVEL2 - Problems with dE/dx II order correction, too many time intervals!"; break;
910        case -319: message += " TOFLEVEL2 - No more trigger events in Level2 file"; break;
911        //        //
912      case -401: message += " TRIGGERLEVEL2 - Cannot open file for writing"; break;      case -401: message += " TRIGGERLEVEL2 - Cannot open file for writing"; break;
913      case -402: message += " TRIGGERLEVEL2 - No Trigger branch in Level0 tree"; break;      case -402: message += " TRIGGERLEVEL2 - No Trigger branch in Level0 tree"; break;
914        case -403: message += " TRIGGERLEVEL2 - DB connection problems"; break;
915        //        //
916      case -500: message += " S4LEVEL2 - No level2 file"; break;      case -500: message += " S4LEVEL2 - No level2 file"; break;
917      case -501: message += " S4LEVEL2 - Cannot open file for writing"; break;      case -501: message += " S4LEVEL2 - Cannot open file for writing"; break;
918      case -502: message += " S4LEVEL2 - No result from GL_S4_CALIB"; break;      case -502: message += " S4LEVEL2 - No result from GL_S4_CALIB"; break;
919      case -503: message += " S4LEVEL2 - No S4 branch in Level0 tree"; break;      case -503: message += " S4LEVEL2 - No S4 branch in Level0 tree"; break;
920        case -504: message += " S4LEVEL2 - DB connection problems"; break;
921        //        //
922      case -600: message += " NDLEVEL2 - No level2 file"; break;      case -600: message += " NDLEVEL2 - No level2 file"; break;
923      case -601: message += " NDLEVEL2 - Cannot open file for writing"; break;      case -601: message += " NDLEVEL2 - Cannot open file for writing"; break;
924      case -603: message += " NDLEVEL2 - No S4Level2 branch in Level0 tree"; break;      case -603: message += " NDLEVEL2 - No S4Level2 branch in Level0 tree"; break;
925        case -604: message += " NDLEVEL2 - DB connection problems"; break;
926        //        //
927      case -701: message += " NDLEVEL2 - Cannot open file for writing"; break;      case -701: message += " ACLEVEL2 - Cannot open file for writing"; break;
928      case -704: message += " NDLEVEL2 - No Anticounter branch in Level0 tree"; break;      case -704: message += " ACLEVEL2 - No Anticounter branch in Level0 tree"; break;
929        case -705: message += " ACLEVEL2 - DB connection problems"; break;
930        //        //
931      case -800: message += " RUNINFO - No such run in the RunInfo list"; break;      case -800: message += " RUNINFO - No such run in the RunInfo list"; break;
932      case -801: message += " RUNINFO - No RunInfo tree in Level2 file"; break;      case -801: message += " RUNINFO - No RunInfo tree in Level2 file"; break;
# Line 596  int main(int numinp, char *inps[]){ Line 935  int main(int numinp, char *inps[]){
935      case -804: message += " RUNINFO - Unknown detector"; break;      case -804: message += " RUNINFO - Unknown detector"; break;
936      case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break;      case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break;
937      case -806: message += " RUNINFO - Can not handle more than 500 runs"; break;      case -806: message += " RUNINFO - Can not handle more than 500 runs"; break;
938        case -807: message += " RUNINFO - DB connection problems"; break;
939        //        //
940        case -900: message += " OrbitalInfo - no ToF tree"; break;
941         //
942      default: message += "Unidentified error or warning"; break;      default: message += "Unidentified error or warning"; break;
943      };      };
944      printf("\n");      printf("\n");
945      if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <<endl;      if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <<endl;
946    }    }
947    //  switch(RUNSGN){    //
948    //  };    // Warnings from XCore routines and from DV:
949      //
950      if ( debug && DVSGN ) printf(" DVSGN = %i \n",DVSGN);
951      if ( DVSGN ) printf("\n WARNING DarthVader: \n");
952      if ( DVSGN & (1 << 0) ) printf(" - No tracker in the acquisition\n");
953      if ( DVSGN & (1 << 1) ) printf(" - No ToF in the acquisition\n");
954      if ( DVSGN & (1 << 2) ) printf(" - No calorimeter in the acquisition\n");
955      if ( DVSGN & (1 << 3) ) printf(" - No anticounters in the acquisition\n");
956      if ( DVSGN & (1 << 4) ) printf(" - No S4 in the acquisition\n");
957      if ( DVSGN & (1 << 5) ) printf(" - No neutron detector in the acquisition\n");
958      //
959      // CaloCore:
960      //
961    switch(CALSGN){    switch(CALSGN){
962    case 100: printf("\n WARNING CALORIMETER - Data with no associated calibration\n"); break;    case 100: printf("\n WARNING CALORIMETER - Data with no associated calibration\n");
963    case 101: printf("\n WARNING CALORIMETER - No tracks or good events in this run\n"); break;    case 101: printf("\n WARNING CALORIMETER - No tracks or good events in this run\n");
964      };
965      //
966      // OrbitalInfoCore:
967      //
968      switch(ORBSGN){
969      case 900: printf("\n WARNING ORBITALINFO - No inclination MCMDs\n");
970    };    };
971    //    //
972      // no other at the moment
973      //
974      //
975    // Close the DB connection    // Close the DB connection
976    //    //
977    if ( dbc ){    if ( dbc ){
# Line 618  int main(int numinp, char *inps[]){ Line 981  int main(int numinp, char *inps[]){
981    };    };
982    if ( processFile ){    if ( processFile ){
983      processFile->cd();      processFile->cd();
984        processFile->WriteStreamerInfo();
985        if ( debug ) processFile->ls();
986      processFile->Close();      processFile->Close();
987    };    };
988    //    //
989      // print benchmark results (if the case)
990      //
991      dvtimer.Stop();
992      dvtime = dvtimer.RealTime();
993      cdvtime = dvtimer.CpuTime();
994      if ( bench ){
995        Float_t runrt = 0.;
996        Float_t trkrt = 0.;
997        Float_t calrt = 0.;
998        Float_t tofrt = 0.;
999        Float_t trgrt = 0.;
1000        Float_t acrt = 0.;
1001        Float_t s4rt = 0.;
1002        Float_t ndrt = 0.;
1003        Float_t orbrt = 0.;
1004        Float_t dvrt = (nevents+1)/dvtime;
1005        if ( RUN ) runrt = nruns/runtime;
1006        if ( TRK ) trkrt = (nevents+1)/trktime;
1007        if ( CAL ) calrt = (nevents+1)/caltime;
1008        if ( TOF ) tofrt = (nevents+1)/toftime;
1009        if ( TRG ) trgrt = (nevents+1)/trgtime;
1010        if ( AC ) acrt = (nevents+1)/actime;
1011        if ( S4 ) s4rt = (nevents+1)/s4time;
1012        if ( ND ) ndrt = (nevents+1)/ndtime;
1013        if ( ORB ) orbrt = (nevents+1)/orbtime;
1014        //
1015        printf("\n\n###########################################################################################\n");
1016        printf("#              Benchmark results:      nevents = %10u     runs = %3u                #\n",(nevents+1),nruns);
1017        printf("###########################################################################################\n");
1018        printf("# Detector # Core routine called # Queries  #     Real Time   #   CPU time   #  Events/s  #\n");
1019        printf("###########################################################################################\n");
1020        printf("# RUN      #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",RUN,NQRUN,fabs(runtime),fabs(cruntime),runrt);
1021        printf("# TRK      #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",TRK,NQTRK,fabs(trktime),fabs(ctrktime),trkrt);
1022        printf("# CAL      #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",CAL,NQCAL,fabs(caltime),fabs(ccaltime),calrt);
1023        printf("# TOF      #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",TOF,NQTOF,fabs(toftime),fabs(ctoftime),tofrt);
1024        printf("# TRG      #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",TRG,NQTRG,fabs(trgtime),fabs(ctrgtime),trgrt);
1025        printf("# AC       #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",AC,NQAC,fabs(actime),fabs(cactime),acrt);
1026        printf("# S4       #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",S4,NQS4,fabs(s4time),fabs(cs4time),s4rt);
1027        printf("# ND       #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",ND,NQND,fabs(ndtime),fabs(cndtime),ndrt);
1028        printf("# ORB      #         %i           #   %3u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",ORB,NQORB,fabs(orbtime),fabs(corbtime),orbrt);
1029        printf("###########################################################################################\n");
1030        printf("# Total    #                     #  %4u    #      %8.2f   #    %8.2f  #  %8.2f  #\n",NQTOT,fabs(dvtime),fabs(cdvtime),dvrt);
1031        printf("###########################################################################################\n");
1032      };
1033      //
1034      //
1035    if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error);    if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error);
1036    printf("\n");    //
1037    printf("Finished, exiting...\n");    //
1038    printf("\n");    //
1039      if ( remfile && error < 0 ){
1040        printf(" -c or --clean option used, deleting file %s \n\n",filename.Data());
1041        gSystem->Unlink(filename.Data());
1042      };
1043      //
1044      if ( !error && (CALSGN || TRKSGN || TRGSGN || TOFSGN || RUNSGN || ORBSGN || ACSGN || S4SGN || NDSGN || DVSGN) ) error = 1;
1045      //
1046      printf("\n Finished, exiting...\n\n");
1047    //    //
1048    // Close redirection if the case.    // Close redirection if the case.
1049    //    //
1050    if ( !beverbose ) close(nul);    if ( !beverbose ) close(nul);
1051    //    //
1052    //    //
1053    exit(error);    if ( !error ) exit(0);       // no errors
1054      if ( error == 1 ) exit(255);  // warnings
1055      exit(1);                     // errors
1056  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.46

  ViewVC Help
Powered by ViewVC 1.1.23