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 |
printf("\n YodaProfiler [options] -rawFile raw_filename -yodaFile yoda_filename \n"); |
18 |
printf("\n -rawFile full path to the raw file\n"); |
19 |
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 |
printf("\n The order of input files and options does not matter. \n"); |
54 |
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 |
}; |
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 |
Long64_t olderthan = -1LL; |
68 |
// |
69 |
// |
70 |
TString filerawname = ""; |
71 |
TString filerootname = ""; |
72 |
// |
73 |
TString host = "mysql://localhost/pamelaprod"; |
74 |
TString user = "anonymous"; |
75 |
TString password = ""; |
76 |
// |
77 |
TString tlefilename = ""; |
78 |
// |
79 |
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 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
86 |
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
87 |
if ( strcmp(pamdbpsw,"") ) password = pamdbpsw; |
88 |
// |
89 |
// |
90 |
Bool_t beverbose = true; |
91 |
Bool_t debug = false; |
92 |
Bool_t autoboot = true; |
93 |
// |
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 |
// |
107 |
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 |
|
117 |
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 |
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 |
if ( !strcmp(inps[i],"-autoboot") ) { |
159 |
autoboot = true; |
160 |
}; |
161 |
if ( !strcmp(inps[i],"-no-autoboot") ) { |
162 |
autoboot = false; |
163 |
}; |
164 |
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 |
tsync = (UInt_t)atoll(inps[i+1]); |
177 |
}; |
178 |
if ( !strcmp(inps[i],"-obt0") ) { |
179 |
if ( numinp-1 < i+1 ){ |
180 |
usage(); |
181 |
exit(1); |
182 |
}; |
183 |
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 |
}; |
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 |
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 |
// |
221 |
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true; |
222 |
// |
223 |
if ( !strcmp(inps[i],"-s") || !strcmp(inps[i],"--silent") ) beverbose = false; |
224 |
// |
225 |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ) debug = true; |
226 |
// |
227 |
if ( !strcmp(inps[i],"-f") || !strcmp(inps[i],"-force") ) force = true; |
228 |
// |
229 |
if ( !strcmp(inps[i],"-nofrag") ) nofrag = true; |
230 |
// |
231 |
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 |
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 |
// Start: |
276 |
// |
277 |
TString message; |
278 |
char *version = YodaProfilerInfo(false); |
279 |
PamelaDBOperations *pamDB = 0; |
280 |
UInt_t sizeofwar = 12; |
281 |
UInt_t WAR[12]; |
282 |
memset(WAR, 0, sizeofwar*sizeof(UInt_t)); |
283 |
// |
284 |
printf("\n Welcome to the PAMELA YodaProfiler, version %s \n\n",version); |
285 |
try{ |
286 |
// |
287 |
//------------------------------------------------------------------------------------------- |
288 |
// Create pamDB object and open SQL connection |
289 |
//------------------------------------------------------------------------------------------- |
290 |
if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n"); |
291 |
pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename); |
292 |
pamDB->CheckConnection(); |
293 |
//------------------------------------------------------------------------------------------- |
294 |
// |
295 |
pamDB->SetNoFrag(nofrag); |
296 |
pamDB->SetAutoBoot(autoboot); |
297 |
// |
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 |
//------------------------------------------------------------------------------------------- |
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 |
// |
316 |
if( pamDB->InsertRoot() ){ |
317 |
// |
318 |
if( !pamDB->InsertRaw() )printf("=> RAW file not inserted --- the DB might not ( yet ) be filled correctly \n"); |
319 |
pamDB->CheckFile(); |
320 |
// |
321 |
//------------------------------------------------------------------------------------------- |
322 |
//Insert an entry in GL_TIMESYNC |
323 |
//------------------------------------------------------------------------------------------- |
324 |
if ( beverbose ) printf(" 3 => Insert an entry in GL_TIMESYNC \n"); |
325 |
WAR[1] = pamDB->insertPamelaGL_TIMESYNC(); |
326 |
//------------------------------------------------------------------------------------------- |
327 |
// |
328 |
//------------------------------------------------------------------------------------------- |
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 |
//------------------------------------------------------------------------------------------- |
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 |
|
350 |
//------------------------------------------------------------------------------------------- |
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 |
|
357 |
//------------------------------------------------------------------------------------------- |
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 |
|
364 |
//------------------------------------------------------------------------------------------- |
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 |
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 |
pamDB->CheckValidate(olderthan); |
391 |
// |
392 |
if( pamDB->Validate() ){ |
393 |
//------------------------------------------------------------------------------------------- |
394 |
//Clean the GL_RUN_FRAGMENTS |
395 |
//------------------------------------------------------------------------------------------- |
396 |
if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table (earlier than %s) \n",pamDB->GetCleanTime() ); |
397 |
WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS(); |
398 |
//------------------------------------------------------------------------------------------- |
399 |
//------------------------------------------------------------------------------------------- |
400 |
//Validate runs |
401 |
//------------------------------------------------------------------------------------------- |
402 |
if ( beverbose ) printf(" 11 => Validate runs (earlier than %s)\n",pamDB->GetCleanTime()); |
403 |
WAR[9] = pamDB->ValidateRuns(); |
404 |
//------------------------------------------------------------------------------------------- |
405 |
}; |
406 |
|
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 |
|
415 |
} 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 |
case -7: message += " Cannot open TLE file"; break; |
425 |
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 |
case -25: message += " Cannot find the run just inserted"; break; |
443 |
case -26: message += " Raw file not found looking for VarDump"; break; |
444 |
case -27: message += " Cannot determine downlink orbit, wrong filename format?"; break; |
445 |
case -28: message += " Cannot assign a RUN ID unique number!"; break; |
446 |
case -29: message += " No VarDump and impossible to find a consistent BOOT number, use the -boot option to override"; break; |
447 |
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 |
else message += "=> Unidentified insertPamelaRaw warning\n"; |
467 |
}; |
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 |
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 |
}; |
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 |
else message += "=> Unidentified insertPamelaRoot warning\n"; |
489 |
}; |
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 |
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 |
else if ( bit == 3 ) message += "=> No VarDump! autoboot option used\n";// |
500 |
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 |
}; |
503 |
}; |
504 |
}; |
505 |
// |
506 |
if ( j == 4 ){ // insertPamelaRUN |
507 |
for (UInt_t bit=0; bit<32; bit++){ |
508 |
if ( WAR[j] & (1 << bit) ){ |
509 |
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 |
}; |
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 |
if ( bit == 0 ) message += "=> No calorimeter calibrations in the file\n"; |
521 |
else message += "=> Unidentified insertCaloCalib warning\n"; |
522 |
}; |
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 |
if ( bit == 0 ) message += "=> No tracker calibrations in the file\n"; |
531 |
else message += "=> Unidentified insertTrkCalib warning\n"; |
532 |
}; |
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 |
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 |
if ( bit == 1 ) message += "=> Problems retrieving ROOT ID from DB\n"; |
552 |
else message += "=> Unidentified CleanGL_RUN_FRAGMENTS warning\n"; |
553 |
}; |
554 |
}; |
555 |
}; |
556 |
// |
557 |
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 |
if ( bit == 1 ) message += "=> Problems retrieving ROOT ID from DB\n"; |
562 |
else message += "=> Unidentified ValidateRuns warning\n"; |
563 |
}; |
564 |
}; |
565 |
}; |
566 |
// |
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 |
// |
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 |
}; |
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 |
if ( beverbose ) printf(" 13 => Free objects and close SQL connection \n"); |
599 |
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 |
} |