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