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

Annotation of /YodaProfiler/src/YodaProfiler.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations) (download)
Tue Nov 28 13:30:39 2006 UTC (18 years ago) by mocchiut
Branch: MAIN
Changes since 1.13: +36 -38 lines
Help printout reformatted

1 mocchiut 1.1 //
2     #include <iostream>
3     #include <sstream>
4     #include <errno.h>
5     //
6     #include <TSystem.h>
7     //
8     #include <PamelaDBOperations.h>
9     #include <YodaProfilerVerl2.h>
10     //
11     using namespace std;
12     //
13     // Usage subroutine
14     //
15     void usage(){
16     printf("\nUsage:\n");
17 mocchiut 1.2 printf("\n YodaProfiler [options] -rawFile raw_filename -yodaFile yoda_filename \n");
18     printf("\n -rawFile full path to the raw file\n");
19 mocchiut 1.14 printf( " -yodaFile full path to the YODA file\n");
20     printf("\n Options are:\n\n");
21     printf(" --version print informations about compilation and exit\n");
22     printf(" -h | --help print this help and exit \n");
23     printf(" -v | --verbose be verbose [default]\n");
24     printf(" -s | --silent print nothing on STDOUT\n");
25     printf(" -g | --debug be very verbose [default: no]\n");
26     printf(" -boot number CPU boot number [default = taken from VarDump]\n");
27     printf(" -autoboot if no VarDump found try to determine the BOOT number\n");
28     printf(" looking at timesync [default]\n");
29     printf(" -no-autoboot disable previous check\n");
30     printf(" -tsync number timesync (s) [default = taken from data]\n");
31     printf(" -obt0 number obt at timesync (ms) [default = taken from data]\n");
32     printf(" -clean number number in seconds after which the fragment table\n");
33     printf(" can be cleaned and runs validated [default = -1 do not clean],\n");
34     printf(" if 0 force cleaning immediatly, if negative do not clean\n");
35     printf(" -remove file remove file and all related runs and calibrations from DB\n");
36     printf(" file must be the YODA filename (full path is not needed)\n");
37     printf(" 'same' can be used if in conjuction with -yodaFile\n");
38     printf(" -validate file validates runs between the two closest calibration to file \n");
39     printf(" not belonging to file itself. File must be the YODA filename\n");
40     printf(" 'same' can be used if in conjuction with -yodaFile\n");
41     printf(" -cleanfrag file clean run fragments for file only\n");
42     printf(" File must be the YODA filename\n");
43     printf(" 'same' can be used if in conjuction with -yodaFile\n");
44     printf(" -nofrag do not leave runs in the fragment table and look for fragments\n");
45     printf(" in the GL_RUN table.\n");
46     printf(" -force to be used to reprocess a file or to process a file\n");
47     printf(" when already validated the surroundings, it is equivalent to:\n");
48     printf(" -remove same -validate same -cleanfrag same -nofrag\n");
49     printf(" -host name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n");
50     printf(" -user username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n");
51     printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n");
52     printf(" -tle <file> ascii file containing TLE obtained from celestrak.org or space-track.org [default = no]\n");
53 mocchiut 1.2 printf("\n The order of input files and options does not matter. \n");
54 mocchiut 1.14 printf("\n Example: \n");
55     printf(" YodaProfiler -yodaFile /path/to/raw/files/000_000_00000_cln2.pam -rawFile /path/to/filesfromyoda/000_000_00000_cln2.root -v \n\n");
56 mocchiut 1.1 };
57     //
58     int main(int numinp, char *inps[]){
59     //
60     // Variables booking
61     //
62     Int_t signal = 0;
63     Int_t nul = 0;
64     UInt_t boot = 0;
65     UInt_t tsync = 0;
66     UInt_t obt0 = 0;
67 mocchiut 1.12 Long64_t olderthan = -1LL;
68 mocchiut 1.1 //
69     //
70 pam-fi 1.5 TString filerawname = "";
71     TString filerootname = "";
72 mocchiut 1.1 //
73 mocchiut 1.3 TString host = "mysql://localhost/pamelaprod";
74     TString user = "anonymous";
75     TString password = "";
76     //
77 mocchiut 1.10 TString tlefilename = "";
78 mocchiut 1.12 //
79 mocchiut 1.9 const char *pamdbhost = gSystem->Getenv("PAM_DBHOST");
80     const char *pamdbuser = gSystem->Getenv("PAM_DBUSER");
81     const char *pamdbpsw = gSystem->Getenv("PAM_DBPSW");
82     if ( !pamdbhost ) pamdbhost = "";
83     if ( !pamdbuser ) pamdbuser = "";
84     if ( !pamdbpsw ) pamdbpsw = "";
85 mocchiut 1.3 if ( strcmp(pamdbhost,"") ) host = pamdbhost;
86     if ( strcmp(pamdbuser,"") ) user = pamdbuser;
87 mocchiut 1.6 if ( strcmp(pamdbpsw,"") ) password = pamdbpsw;
88 mocchiut 1.1 //
89     //
90 mocchiut 1.3 Bool_t beverbose = true;
91 mocchiut 1.1 Bool_t debug = false;
92 mocchiut 1.13 Bool_t autoboot = true;
93 mocchiut 1.12 //
94     Bool_t remove = false;
95     TString remfile = "";
96     //
97     Bool_t forceclean = false;
98     TString fcleanfile = "";
99     //
100     Bool_t validate = false;
101     TString validfile = "";
102     //
103     Bool_t nofrag = false;
104     //
105     Bool_t force = false;
106 mocchiut 1.10 //
107 mocchiut 1.1 Int_t i = 0;
108     //
109     if ( numinp > 1 ){
110     while ( i < numinp ){
111     if ( !strcmp(inps[i],"--version") ){
112     YodaProfilerInfo(true);
113     exit(0);
114     };
115     if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){
116 pam-fi 1.5
117 mocchiut 1.1 usage();
118     exit(0);
119     };
120     if ( !strcmp(inps[i],"-rawFile") ) {
121     if ( numinp-1 < i+1 ){
122     usage();
123     exit(1);
124     };
125     filerawname = (TString)inps[i+1];
126     };
127     if ( !strcmp(inps[i],"-yodaFile") ) {
128     if ( numinp-1 < i+1 ){
129     usage();
130     exit(1);
131     };
132     filerootname = (TString)inps[i+1];
133     };
134 mocchiut 1.12 if ( !strcmp(inps[i],"-remove") ) {
135     if ( numinp-1 < i+1 ){
136     usage();
137     exit(1);
138     };
139     remfile = (TString)inps[i+1];
140     remove = true;
141     };
142     if ( !strcmp(inps[i],"-cleanfrag") ) {
143     if ( numinp-1 < i+1 ){
144     usage();
145     exit(1);
146     };
147     fcleanfile = (TString)inps[i+1];
148     forceclean = true;
149     };
150     if ( !strcmp(inps[i],"-validate") ) {
151     if ( numinp-1 < i+1 ){
152     usage();
153     exit(1);
154     };
155     validfile = (TString)inps[i+1];
156     validate = true;
157     };
158 mocchiut 1.13 if ( !strcmp(inps[i],"-autoboot") ) {
159     autoboot = true;
160     };
161     if ( !strcmp(inps[i],"-no-autoboot") ) {
162     autoboot = false;
163     };
164 mocchiut 1.1 if ( !strcmp(inps[i],"-boot") ) {
165     if ( numinp-1 < i+1 ){
166     usage();
167     exit(1);
168     };
169     boot = atoi(inps[i+1]);
170     };
171     if ( !strcmp(inps[i],"-tsync") ) {
172     if ( numinp-1 < i+1 ){
173     usage();
174     exit(1);
175     };
176 mocchiut 1.2 tsync = (UInt_t)atoll(inps[i+1]);
177 mocchiut 1.1 };
178     if ( !strcmp(inps[i],"-obt0") ) {
179     if ( numinp-1 < i+1 ){
180     usage();
181     exit(1);
182     };
183 mocchiut 1.2 obt0 = (UInt_t)atoll(inps[i+1]);
184     };
185     if ( !strcmp(inps[i],"-clean") ) {
186     if ( numinp-1 < i+1 ){
187     usage();
188     exit(1);
189     };
190     olderthan = (Long64_t)atoll(inps[i+1]);
191 mocchiut 1.1 };
192     if ( !strcmp(inps[i],"-host") ) {
193     if ( numinp-1 < i+1 ){
194     usage();
195     exit(1);
196     };
197     host = (TString)inps[i+1];
198     };
199     if ( !strcmp(inps[i],"-user") ) {
200     if ( numinp-1 < i+1 ){
201     usage();
202     exit(1);
203     };
204     user = (TString)inps[i+1];
205     };
206     if ( !strcmp(inps[i],"-psw") ) {
207     if ( numinp-1 < i+1 ){
208     usage();
209     exit(1);
210     };
211     password = (TString)inps[i+1];
212     };
213 mocchiut 1.10 if ( !strcmp(inps[i],"-tle") ) {
214     if ( numinp-1 < i+1 ){
215     usage();
216     exit(1);
217     };
218     tlefilename = (TString)inps[i+1];
219     };
220 mocchiut 1.1 //
221     if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;
222     //
223 mocchiut 1.3 if ( !strcmp(inps[i],"-s") || !strcmp(inps[i],"--silent") ) beverbose = false;
224     //
225 mocchiut 1.1 if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ) debug = true;
226     //
227 mocchiut 1.12 if ( !strcmp(inps[i],"-f") || !strcmp(inps[i],"-force") ) force = true;
228     //
229     if ( !strcmp(inps[i],"-nofrag") ) nofrag = true;
230     //
231 mocchiut 1.1 i++;
232     };
233     } else {
234     //
235     // no input parameters exit with error, we need at least the run id.
236     //
237     cout << "\n ERROR: NO INPUT PARAMETERS \n";
238     usage();
239     exit(1);
240     };
241    
242     //
243     // If not in verbose mode redirect to /dev/null the stdout and stderr
244     //
245     if ( !beverbose ){
246     nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
247     dup2(nul,1);
248     dup2(nul,2);
249     };
250     //
251 mocchiut 1.12 if ( !strcmp(filerootname.Data(),"") ){
252     if ( (validate && !strcmp(validfile.Data(),"same")) ||
253     (remove && !strcmp(remfile.Data(),"same")) ||
254     (forceclean && !strcmp(fcleanfile.Data(),"same")) || force ){
255     printf("\n ERROR IN INPUT PARAMETERS \n");
256     usage();
257     exit(1);
258     };
259     } else {
260     if ( validate && !strcmp(validfile.Data(),"same") ) validfile = (TString)gSystem->BaseName(filerootname.Data());
261     if ( remove && !strcmp(remfile.Data(),"same") ) remfile = (TString)gSystem->BaseName(filerootname.Data());
262     if ( forceclean && !strcmp(fcleanfile.Data(),"same") ) fcleanfile = (TString)gSystem->BaseName(filerootname.Data());
263     };
264     //
265     if ( force ){
266     nofrag = true;
267     forceclean = true;
268     remove = true;
269     validate = true;
270     fcleanfile = (TString)gSystem->BaseName(filerootname.Data());
271     remfile = fcleanfile;
272     validfile = fcleanfile;
273     };
274     //
275 mocchiut 1.1 // Start:
276     //
277     TString message;
278     char *version = YodaProfilerInfo(false);
279     PamelaDBOperations *pamDB = 0;
280 mocchiut 1.12 UInt_t sizeofwar = 12;
281     UInt_t WAR[12];
282     memset(WAR, 0, sizeofwar*sizeof(UInt_t));
283 mocchiut 1.1 //
284 mocchiut 1.2 printf("\n Welcome to the PAMELA YodaProfiler, version %s \n\n",version);
285 mocchiut 1.1 try{
286     //
287     //-------------------------------------------------------------------------------------------
288     // Create pamDB object and open SQL connection
289     //-------------------------------------------------------------------------------------------
290 mocchiut 1.2 if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");
291 mocchiut 1.10 pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename);
292 mocchiut 1.7 pamDB->CheckConnection();
293     //-------------------------------------------------------------------------------------------
294 mocchiut 1.1 //
295 mocchiut 1.12 pamDB->SetNoFrag(nofrag);
296 mocchiut 1.13 pamDB->SetAutoBoot(autoboot);
297 mocchiut 1.12 //
298     if ( remove ){
299     //-------------------------------------------------------------------------------------------
300     // Remove a file and, on cascade, all that follows from the DB
301     //-------------------------------------------------------------------------------------------
302     if ( beverbose ) printf(" X => Remove file %s from DB \n",((TString)gSystem->BaseName(remfile)).Data());
303     WAR[11] = pamDB->removeFile((TString)gSystem->BaseName(remfile.Data()));
304     //-------------------------------------------------------------------------------------------
305     };
306     //
307     if( pamDB->InsertRaw() ){
308 mocchiut 1.7 //-------------------------------------------------------------------------------------------
309     //Insert a Raw file in GL_RAW
310     //-------------------------------------------------------------------------------------------
311     if ( beverbose ) printf(" 2 => Insert a RAW file in GL_RAW \n");
312     WAR[0] = pamDB->insertPamelaRawFile();
313     //-------------------------------------------------------------------------------------------
314     };
315 mocchiut 1.12 //
316     if( pamDB->InsertRoot() ){
317     //
318     if( !pamDB->InsertRaw() )printf("=> RAW file not inserted --- the DB might not ( yet ) be filled correctly \n");
319 mocchiut 1.7 pamDB->CheckFile();
320     //
321     //-------------------------------------------------------------------------------------------
322     //Insert an entry in GL_TIMESYNC
323     //-------------------------------------------------------------------------------------------
324 mocchiut 1.13 if ( beverbose ) printf(" 3 => Insert an entry in GL_TIMESYNC \n");
325 mocchiut 1.7 WAR[1] = pamDB->insertPamelaGL_TIMESYNC();
326     //-------------------------------------------------------------------------------------------
327     //
328 mocchiut 1.13 //-------------------------------------------------------------------------------------------
329     //Update a single GL_RAW record with its BOOT_NUMBER
330     //-------------------------------------------------------------------------------------------
331     if ( beverbose ) printf(" 4 => Update a single GL_RAW record with its BOOT_NUMBER \n");
332     WAR[3] = pamDB->assignBOOT_NUMBER();
333     if ( WAR[3] && WAR[3] != 1 && WAR[3] != 8 ) throw -9;
334     //-------------------------------------------------------------------------------------------
335     //
336 mocchiut 1.7 //-------------------------------------------------------------------------------------------
337     //Insert unpack ROOT file in GL_ROOT
338     //-------------------------------------------------------------------------------------------
339     if ( beverbose ) printf(" 5 => Insert unpack ROOT file in GL_ROOT \n");
340     WAR[2] = pamDB->insertPamelaRootFile();
341     //-------------------------------------------------------------------------------------------
342     //
343     //-------------------------------------------------------------------------------------------
344     //Insert in GL_RUN runs information records relative to a single unpack
345     //-------------------------------------------------------------------------------------------
346     if ( beverbose ) printf(" 6 => Scan physics and store runs in the GL_RUN table\n");
347     WAR[4] = pamDB->insertPamelaRUN();
348     //-------------------------------------------------------------------------------------------
349 pam-fi 1.5
350 mocchiut 1.7 //-------------------------------------------------------------------------------------------
351     //Insert in GL_CALO_CALIB calibration information records relative to a single unpack
352     //-------------------------------------------------------------------------------------------
353     if ( beverbose ) printf(" 7 => Insert calorimeter calibrations in the GL_CALO_CALIB table\n");
354     WAR[5] = pamDB->insertCALO_CALIB();
355     //-------------------------------------------------------------------------------------------
356 pam-fi 1.5
357 mocchiut 1.7 //-------------------------------------------------------------------------------------------
358     //Insert in GL_TRK_CALIB calibration information records relative to a single unpack
359     //-------------------------------------------------------------------------------------------
360     if ( beverbose ) printf(" 8 => Insert tracker calibrations in the GL_TRK_CALIB table\n");
361     WAR[6] = pamDB->insertTRK_CALIB();
362     //-------------------------------------------------------------------------------------------
363 pam-fi 1.5
364 mocchiut 1.7 //-------------------------------------------------------------------------------------------
365     //Insert in GL_S4_CALIB calibration information records relative to a single unpack
366     //-------------------------------------------------------------------------------------------
367     if ( beverbose ) printf(" 9 => Insert S4 calibrations in the GL_S4_CALIB table\n");
368     WAR[7] = pamDB->insertS4_CALIB();
369     //-------------------------------------------------------------------------------------------
370     };
371     //
372 mocchiut 1.12 if ( forceclean ){
373     //-------------------------------------------------------------------------------------------
374     //Clean the GL_RUN_FRAGMENTS for the given file
375     //-------------------------------------------------------------------------------------------
376     if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table for file %s \n",fcleanfile.Data());
377     WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS((TString)gSystem->BaseName(fcleanfile.Data()));
378     };
379     //
380     //
381     if ( validate ){
382     //-------------------------------------------------------------------------------------------
383     //Validate runs
384     //-------------------------------------------------------------------------------------------
385     if ( beverbose ) printf(" 11 => Validate runs table for file %s \n",validfile.Data());
386     WAR[9] = pamDB->ValidateRuns((TString)gSystem->BaseName(validfile.Data()));
387     //-------------------------------------------------------------------------------------------
388     };
389     //
390 mocchiut 1.7 pamDB->CheckValidate(olderthan);
391     //
392 mocchiut 1.12 if( pamDB->Validate() ){
393 mocchiut 1.7 //-------------------------------------------------------------------------------------------
394     //Clean the GL_RUN_FRAGMENTS
395     //-------------------------------------------------------------------------------------------
396 mocchiut 1.8 if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table (earlier than %s) \n",pamDB->GetCleanTime() );
397 mocchiut 1.7 WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS();
398 mocchiut 1.12 //-------------------------------------------------------------------------------------------
399 mocchiut 1.7 //-------------------------------------------------------------------------------------------
400     //Validate runs
401     //-------------------------------------------------------------------------------------------
402 mocchiut 1.8 if ( beverbose ) printf(" 11 => Validate runs (earlier than %s)\n",pamDB->GetCleanTime());
403 mocchiut 1.7 WAR[9] = pamDB->ValidateRuns();
404     //-------------------------------------------------------------------------------------------
405     };
406 mocchiut 1.10
407     if(! tlefilename.IsNull() ) {
408     //----------------------------------------------
409     //Populate GL_TLE table using the file provided
410     //----------------------------------------------
411     if ( beverbose ) printf(" 12 => Insert TLE elements in the GL_TLE table from file %s \n",tlefilename.Data());
412     WAR[10] = pamDB->populateTLE();
413     }
414 pam-fi 1.5
415 mocchiut 1.1 } catch (Int_t exc) {
416     signal = exc;
417     switch(exc){
418     case -1: message += " DB connection failure"; break;
419     case -2: message += " Connection failure"; break;
420     case -3: message += " Cannot determine the timesync, use the -tsync and -obt0 options to override"; break;
421     case -4: message += " Error querying DB"; break;
422     case -5: message += " Inconsistent OBT/pkt_num"; break;
423     case -6: message += " The file is not in the database"; break;
424 mocchiut 1.10 case -7: message += " Cannot open TLE file"; break;
425 mocchiut 1.1 case -8: message += " Event file is empty"; break;
426     case -9: message += " No VarDump no BOOT number, use the -boot option to override"; break;
427     case -10: message += " No results from DB"; break;
428     case -11: message += " Raw file not found"; break;
429     case -12: message += " Cannot open Level0 file"; break;
430     case -13: message += " No consistent OBT/PKT_NUM information"; break;
431     case -14: message += " Not supported yet: run with no events, no runtrailer, no runheader"; break;
432     case -15: message += " Not supported yet: run with no runheader at the beginning/end of file not recognized as run fragment"; break;
433     case -16: message += " No Physics tree in Level0 file"; break;
434     case -17: message += " No RunHeader tree in Level0 file"; break;
435     case -18: message += " No RunTrailer tree in Level0 file"; break;
436     case -19: message += " No Mcmd tree in Level0 file"; break;
437     case -20: message += " No VarDump tree in Level0 file"; break;
438     case -21: message += " No CalibCalPed tree in Level0 file"; break;
439     case -22: message += " No CalibTrk1 tree in Level0 file"; break;
440     case -23: message += " No CalibTrk2 tree in Level0 file"; break;
441     case -24: message += " No CalibS4 tree in Level0 file"; break;
442 mocchiut 1.2 case -25: message += " Cannot find the run just inserted"; break;
443     case -26: message += " Raw file not found looking for VarDump"; break;
444 mocchiut 1.11 case -27: message += " Cannot determine downlink orbit, wrong filename format?"; break;
445     case -28: message += " Cannot assign a RUN ID unique number!"; break;
446 mocchiut 1.13 case -29: message += " No VarDump and impossible to find a consistent BOOT number, use the -boot option to override"; break;
447 mocchiut 1.1 default: message += " Unidentified error"; break;
448     };
449     printf("\n");
450     printf(" ERROR (%i) %s \n",exc,message.Data());
451     printf("\n");
452     }
453     //
454     // warnings handlers
455     //
456     Bool_t printwarning = false;
457     message="";
458     for (UInt_t j=0; j<sizeofwar; j++){
459     if ( WAR[j] ){
460     printwarning = true;
461     //
462     if ( j == 0 ){ // insertPamelaRaw warnings
463     for (UInt_t bit=0; bit<32; bit++){
464     if ( WAR[j] & (1 << bit) ){
465     if ( bit == 0 ) message += "=> RAW file already inserted\n";
466 mocchiut 1.2 else message += "=> Unidentified insertPamelaRaw warning\n";
467 mocchiut 1.1 };
468     };
469     };
470     //
471     if ( j == 1 ){ // insertTimeSync warnings
472     for (UInt_t bit=0; bit<32; bit++){
473     if ( WAR[j] & (1 << bit) ){
474     if ( bit == 0 ) message += "=> TIMESYNC already inserted\n";
475 mocchiut 1.2 else if ( bit == 1 ) message += "=> No mcmd timesync in the file\n";
476     else if ( bit == 2 ) message += "=> No runheaders in the file\n";
477     else if ( bit == 3 ) message += "=> No runtrailers in the file\n";
478     else if ( bit == 4 ) message += "=> No mcmd inclination in the file\n";
479     else message += "=> Unidentified insertTimeSync warning\n";
480 mocchiut 1.1 };
481     };
482     };
483     //
484     if ( j == 2 ){ // insertPamelaRoot warnings
485     for (UInt_t bit=0; bit<32; bit++){
486     if ( WAR[j] & (1 << bit) ){
487     if ( bit == 0 ) message += "=> ROOT file already inserted\n";
488 mocchiut 1.2 else message += "=> Unidentified insertPamelaRoot warning\n";
489 mocchiut 1.1 };
490     };
491     };
492     //
493     if ( j == 3 ){ // assignBOOTnumber warnings
494     for (UInt_t bit=0; bit<32; bit++){
495     if ( WAR[j] & (1 << bit) ){
496 mocchiut 1.2 if ( bit == 0 ) message += "=> BOOT number already inserted\n";//
497     else if ( bit == 1 ) message += "=> VarDump event tree is empty, use the -boot option to override\n";//
498     else if ( bit == 2 ) message += "=> No BOOT number in VarDump(!), use the -boot option to override\n";//
499 mocchiut 1.13 else if ( bit == 3 ) message += "=> No VarDump! autoboot option used\n";//
500 mocchiut 1.2 else if ( bit == 4 ) message += "=> The file is not in the database looking for VarDump, use the -boot option to override\n";//
501     else message += "=> Unidentified assignBOOTnumber warning\n";
502 mocchiut 1.1 };
503     };
504     };
505     //
506     if ( j == 4 ){ // insertPamelaRUN
507     for (UInt_t bit=0; bit<32; bit++){
508     if ( WAR[j] & (1 << bit) ){
509 mocchiut 1.2 if ( bit == 0 ) message += "=> Inconsistent PKT/OBT sequence\n";
510     else if ( bit == 1 ) message += "=> No physics events in the file\n";
511     else if ( bit == 2 ) message += "=> Less than 2 physics events in the file\n";
512     else message += "=> Unidentified insertPamelaRun warning\n";
513 mocchiut 1.1 };
514     };
515     };
516     //
517     if ( j == 5 ){ // insertCALO_CALIB
518     for (UInt_t bit=0; bit<32; bit++){
519     if ( WAR[j] & (1 << bit) ){
520 mocchiut 1.2 if ( bit == 0 ) message += "=> No calorimeter calibrations in the file\n";
521     else message += "=> Unidentified insertCaloCalib warning\n";
522 mocchiut 1.1 };
523     };
524     };
525     //
526     //
527     if ( j == 6 ){ // insertTRACKER_CALIB
528     for (UInt_t bit=0; bit<32; bit++){
529     if ( WAR[j] & (1 << bit) ){
530 mocchiut 1.2 if ( bit == 0 ) message += "=> No tracker calibrations in the file\n";
531     else message += "=> Unidentified insertTrkCalib warning\n";
532 mocchiut 1.1 };
533     };
534     };
535     //
536     //
537     if ( j == 7 ){ // insertS4_CALIB
538     for (UInt_t bit=0; bit<32; bit++){
539     if ( WAR[j] & (1 << bit) ){
540 mocchiut 1.2 if ( bit == 0 ) message += "=> No s4 calibrations in the file\n";
541     else message += "=> Unidentified insertS4calib warning\n";
542     };
543     };
544     };
545     //
546     //
547     if ( j == 8 ){ // CleanGL_RUN_FRAGMENTS
548     for (UInt_t bit=0; bit<32; bit++){
549     if ( WAR[j] & (1 << bit) ){
550     if ( bit == 0 ) message += "=> Skip the GL_RUN_FRAGMENTS table cleaning\n";
551 mocchiut 1.12 if ( bit == 1 ) message += "=> Problems retrieving ROOT ID from DB\n";
552 mocchiut 1.2 else message += "=> Unidentified CleanGL_RUN_FRAGMENTS warning\n";
553 mocchiut 1.1 };
554     };
555     };
556     //
557 mocchiut 1.2 if ( j == 9 ){ // ValidateRuns
558     for (UInt_t bit=0; bit<32; bit++){
559     if ( WAR[j] & (1 << bit) ){
560     if ( bit == 0 ) message += "=> Skip the run validation \n";
561 mocchiut 1.12 if ( bit == 1 ) message += "=> Problems retrieving ROOT ID from DB\n";
562 mocchiut 1.2 else message += "=> Unidentified ValidateRuns warning\n";
563     };
564     };
565     };
566 mocchiut 1.10 //
567     if ( j == 10 ){ // populateTLE
568     for (UInt_t bit=0; bit<32; bit++){
569     if ( WAR[j] & (1 << bit) ){
570     if ( bit == 0 ) message += "=> TLE insertion failed\n";
571     if ( bit == 1 ) message += "=> No new TLE available\n";
572     else message += "=> Unidentified populateTle warning\n";
573     };
574     };
575     };
576 mocchiut 1.12 //
577     if ( j == 11 ){ // removeFile
578     for (UInt_t bit=0; bit<32; bit++){
579     if ( WAR[j] & (1 << bit) ){
580     if ( bit == 0 ) message += "=> No file to delete from DB \n";
581     else message += "=> Unidentified populateTle warning\n";
582     };
583     };
584     };
585 mocchiut 1.1 };
586     };
587     //
588     if ( printwarning ){
589     printf("\n");
590     printf(" WARNING(s):\n%s\n",message.Data());
591     printf("\n");
592     if ( !signal ) signal = 1;
593     };
594     //
595     //---------------------------------------------------------------------------------------
596     // Close and exit
597     //---------------------------------------------------------------------------------------
598 mocchiut 1.10 if ( beverbose ) printf(" 13 => Free objects and close SQL connection \n");
599 mocchiut 1.1 pamDB->Close();
600     //
601     printf("\n");
602     printf(" Finished, exiting...\n");
603     printf("\n");
604     //
605     // Close redirection if the case.
606     //
607     if ( !beverbose ) close(nul);
608     //
609     exit(signal);
610     //
611     }

  ViewVC Help
Powered by ViewVC 1.1.23