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