1 |
mocchiut |
1.1 |
// |
2 |
|
|
// C/C++ headers |
3 |
|
|
// |
4 |
|
|
#include <iostream> |
5 |
|
|
#include <sstream> |
6 |
|
|
// |
7 |
|
|
// ROOT headers |
8 |
|
|
// |
9 |
|
|
#include <TString.h> |
10 |
|
|
#include <TSQLServer.h> |
11 |
|
|
#include <TFile.h> |
12 |
|
|
#include <TSystem.h> |
13 |
mocchiut |
1.19 |
#include <TStopwatch.h> |
14 |
mocchiut |
1.1 |
// |
15 |
|
|
// Detector's package headers |
16 |
|
|
// |
17 |
|
|
#include <RunInfoCore.h> |
18 |
|
|
#include <TrkCore.h> |
19 |
|
|
#include <TrigCore.h> |
20 |
|
|
#include <ToFCore.h> |
21 |
|
|
#include <CaloCore.h> |
22 |
|
|
#include <AcCore.h> |
23 |
|
|
#include <S4Core.h> |
24 |
|
|
#include <NDCore.h> |
25 |
|
|
#include <OrbitalInfoCore.h> |
26 |
mocchiut |
1.4 |
#include <RunInfo.h> |
27 |
mocchiut |
1.1 |
// |
28 |
|
|
using namespace std; |
29 |
|
|
// |
30 |
|
|
// |
31 |
|
|
// |
32 |
|
|
#include <DarthVaderVerl2.h> |
33 |
|
|
// |
34 |
|
|
// Usage subroutine |
35 |
|
|
// |
36 |
|
|
void usage(){ |
37 |
|
|
printf("\nUsage:\n"); |
38 |
mocchiut |
1.19 |
printf("\n DarthVader [ options ] -idRun ID_RUN [+-all] [+-detector [ detector options ] ] \n"); |
39 |
|
|
printf("\n Options are: \n"); |
40 |
|
|
printf("\n --version print informations about compilation and exit\n"); |
41 |
|
|
printf("\n -h | --help print this help and exit \n"); |
42 |
|
|
printf("\n -v | --verbose be verbose [default]\n"); |
43 |
|
|
printf("\n -s | --silent print nothing on STDOUT\n"); |
44 |
|
|
printf("\n -c | --clean remove file if exiting with errors\n"); |
45 |
|
|
printf("\n -b | --benchmark perform and print benchmark test\n"); |
46 |
|
|
printf("\n -auto | -AUTO exclude from processing detector which are NOT in the acquisition [default]\n"); |
47 |
|
|
printf("\n -zerofill if a detector is not in the acquisition the routine is called anyway \n"); |
48 |
|
|
printf("\n but all detector's data will be marked as bad\n"); |
49 |
|
|
printf("\n -tedious exit with error if a detector is not in the acquisition and \n"); |
50 |
|
|
printf("\n it has not been excluded from processing\n"); |
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 -processFile file output filename [default ID_RUN.Level2.root]\n"); |
55 |
|
|
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
56 |
|
|
printf("\n +all | +ALL call all detectors software [default]\n"); |
57 |
|
|
printf("\n -all | -ALL call nothing\n"); |
58 |
|
|
printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
59 |
|
|
printf("\n -detector do not process detector (as above)\n"); |
60 |
|
|
printf("\n detector options must be included in square parenthesis with spaces, for example:\n"); |
61 |
|
|
printf("\n +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n"); |
62 |
mocchiut |
1.1 |
printf("\nExamples: \n"); |
63 |
|
|
printf("\nStandard call: DarthVader -idRun 1085 \n"); |
64 |
|
|
printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
65 |
|
|
printf("\nProcess all and be verbose for calorimeter: DarthVader -idRun 1085 +CAL [ --verbose ] \n\n"); |
66 |
|
|
}; |
67 |
|
|
// |
68 |
|
|
// Here the main |
69 |
|
|
// |
70 |
|
|
int main(int numinp, char *inps[]){ |
71 |
|
|
// |
72 |
|
|
// Variables booking |
73 |
|
|
// |
74 |
mocchiut |
1.19 |
// |
75 |
|
|
// benchmarck variables |
76 |
|
|
// |
77 |
|
|
TStopwatch timer; |
78 |
|
|
TStopwatch dvtimer; |
79 |
|
|
dvtimer.Start(kTRUE); |
80 |
|
|
UInt_t nevents = 0; |
81 |
|
|
UInt_t nruns = 0; |
82 |
|
|
Double_t runtime = 0.; |
83 |
|
|
Double_t cruntime = 0.; |
84 |
|
|
Double_t trktime = 0.; |
85 |
|
|
Double_t ctrktime = 0.; |
86 |
|
|
Double_t caltime = 0.; |
87 |
|
|
Double_t ccaltime = 0.; |
88 |
|
|
Double_t toftime = 0.; |
89 |
|
|
Double_t ctoftime = 0.; |
90 |
|
|
Double_t trgtime = 0.; |
91 |
|
|
Double_t ctrgtime = 0.; |
92 |
|
|
Double_t actime = 0.; |
93 |
|
|
Double_t cactime = 0.; |
94 |
|
|
Double_t s4time = 0.; |
95 |
|
|
Double_t cs4time = 0.; |
96 |
|
|
Double_t ndtime = 0.; |
97 |
|
|
Double_t cndtime = 0.; |
98 |
|
|
Double_t orbtime = 0.; |
99 |
|
|
Double_t corbtime = 0.; |
100 |
|
|
Double_t dvtime = 0.; |
101 |
|
|
Double_t cdvtime = 0.; |
102 |
|
|
// |
103 |
mocchiut |
1.1 |
TString message; |
104 |
|
|
int nul = 0; |
105 |
|
|
Int_t error = 0; |
106 |
|
|
// |
107 |
|
|
Int_t CALSGN = 0; |
108 |
|
|
Int_t TRKSGN = 0; |
109 |
|
|
Int_t TRGSGN = 0; |
110 |
|
|
Int_t TOFSGN = 0; |
111 |
|
|
Int_t RUNSGN = 0; |
112 |
|
|
Int_t ORBSGN = 0; |
113 |
|
|
Int_t ACSGN = 0; |
114 |
|
|
Int_t S4SGN = 0; |
115 |
|
|
Int_t NDSGN = 0; |
116 |
mocchiut |
1.12 |
Int_t DVSGN = 0; |
117 |
mocchiut |
1.1 |
// |
118 |
mocchiut |
1.17 |
Bool_t autom = true; |
119 |
|
|
Bool_t zerofill = false; |
120 |
|
|
Bool_t tedious = false; |
121 |
mocchiut |
1.15 |
Bool_t remfile = false; |
122 |
mocchiut |
1.1 |
Bool_t debug = false; |
123 |
mocchiut |
1.10 |
Bool_t beverbose = true; |
124 |
mocchiut |
1.1 |
Bool_t givenid = false; |
125 |
mocchiut |
1.19 |
Bool_t bench = false; |
126 |
mocchiut |
1.1 |
Bool_t CAL = true; |
127 |
|
|
Bool_t TRK = true; |
128 |
|
|
Bool_t TRG = true; |
129 |
|
|
Bool_t TOF = true; |
130 |
|
|
Bool_t S4 = true; |
131 |
|
|
Bool_t ND = true; |
132 |
|
|
Bool_t AC = true; |
133 |
|
|
Bool_t ORB = true; |
134 |
mocchiut |
1.19 |
Bool_t RUN = true; |
135 |
mocchiut |
1.1 |
// |
136 |
|
|
Int_t calargc = 0; |
137 |
|
|
char *calargv[50]; |
138 |
|
|
Int_t trkargc = 0; |
139 |
|
|
char *trkargv[50]; |
140 |
|
|
Int_t tofargc = 0; |
141 |
|
|
char *tofargv[50]; |
142 |
|
|
Int_t trgargc = 0; |
143 |
|
|
char *trgargv[50]; |
144 |
|
|
Int_t orbargc = 0; |
145 |
|
|
char *orbargv[50]; |
146 |
|
|
Int_t runargc = 0; |
147 |
|
|
char *runargv[50]; |
148 |
|
|
Int_t acargc = 0; |
149 |
|
|
char *acargv[50]; |
150 |
|
|
Int_t s4argc = 0; |
151 |
|
|
char *s4argv[50]; |
152 |
|
|
Int_t ndargc = 0; |
153 |
|
|
char *ndargv[50]; |
154 |
|
|
// |
155 |
|
|
// |
156 |
|
|
// |
157 |
mocchiut |
1.8 |
UInt_t run = 0; |
158 |
mocchiut |
1.1 |
// |
159 |
|
|
TString filename; |
160 |
|
|
TString outDir = gSystem->WorkingDirectory(); |
161 |
|
|
// |
162 |
|
|
TSQLServer *dbc = 0; |
163 |
|
|
TString host = "mysql://localhost/pamelaprod"; |
164 |
|
|
TString user = "anonymous"; |
165 |
|
|
TString psw = ""; |
166 |
|
|
// |
167 |
mocchiut |
1.10 |
// |
168 |
|
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
169 |
|
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
170 |
|
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
171 |
mocchiut |
1.12 |
if ( !pamdbhost ) pamdbhost = ""; |
172 |
|
|
if ( !pamdbuser ) pamdbuser = ""; |
173 |
|
|
if ( !pamdbpsw ) pamdbpsw = ""; |
174 |
mocchiut |
1.10 |
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
175 |
|
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
176 |
|
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
177 |
|
|
// |
178 |
|
|
// |
179 |
mocchiut |
1.1 |
TFile *processFile = 0; |
180 |
|
|
// |
181 |
|
|
// Checking input parameters |
182 |
|
|
// |
183 |
|
|
Int_t i = 0; |
184 |
|
|
try { |
185 |
|
|
if ( numinp > 1 ){ |
186 |
|
|
while ( i < numinp ){ |
187 |
mocchiut |
1.8 |
Bool_t found = false; |
188 |
mocchiut |
1.1 |
if ( !strcmp(inps[i],"--version") ){ |
189 |
|
|
DarthVaderInfo(true); |
190 |
|
|
exit(0); |
191 |
|
|
}; |
192 |
|
|
if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){ |
193 |
|
|
usage(); |
194 |
|
|
exit(0); |
195 |
|
|
}; |
196 |
|
|
if ( !strcmp(inps[i],"-idRun") ) { |
197 |
|
|
if ( numinp-1 < i+1 ) { |
198 |
|
|
usage(); |
199 |
|
|
throw -3; |
200 |
|
|
}; |
201 |
mocchiut |
1.8 |
i++; |
202 |
|
|
found = true; |
203 |
mocchiut |
1.1 |
givenid = true; |
204 |
mocchiut |
1.8 |
run = atoll(inps[i]); |
205 |
mocchiut |
1.1 |
}; |
206 |
|
|
if ( !strcmp(inps[i],"-processFile") ) { |
207 |
|
|
if ( numinp-1 < i+1 ){ |
208 |
|
|
usage(); |
209 |
|
|
throw -3; |
210 |
|
|
}; |
211 |
mocchiut |
1.8 |
i++; |
212 |
|
|
found = true; |
213 |
|
|
filename = (TString)inps[i]; |
214 |
mocchiut |
1.1 |
}; |
215 |
|
|
if ( !strcmp(inps[i],"-outDir") ) { |
216 |
|
|
if ( numinp-1 < i+1 ){ |
217 |
|
|
usage(); |
218 |
|
|
throw -3; |
219 |
|
|
}; |
220 |
mocchiut |
1.8 |
i++; |
221 |
|
|
found = true; |
222 |
|
|
outDir = (TString)inps[i]; |
223 |
mocchiut |
1.1 |
}; |
224 |
|
|
if ( !strcmp(inps[i],"-host") ) { |
225 |
|
|
if ( numinp-1 < i+1 ){ |
226 |
|
|
usage(); |
227 |
|
|
throw -3; |
228 |
|
|
}; |
229 |
mocchiut |
1.8 |
i++; |
230 |
|
|
found = true; |
231 |
|
|
host = (TString)inps[i]; |
232 |
mocchiut |
1.1 |
}; |
233 |
|
|
if ( !strcmp(inps[i],"-user") ) { |
234 |
|
|
if ( numinp-1 < i+1 ){ |
235 |
|
|
usage(); |
236 |
|
|
throw -3; |
237 |
|
|
}; |
238 |
mocchiut |
1.8 |
i++; |
239 |
|
|
found = true; |
240 |
|
|
user = (TString)inps[i]; |
241 |
mocchiut |
1.1 |
}; |
242 |
|
|
if ( !strcmp(inps[i],"-psw") ) { |
243 |
|
|
if ( numinp-1 < i+1 ){ |
244 |
|
|
usage(); |
245 |
|
|
throw -3; |
246 |
|
|
}; |
247 |
mocchiut |
1.8 |
i++; |
248 |
|
|
found = true; |
249 |
|
|
psw = (TString)inps[i]; |
250 |
|
|
}; |
251 |
|
|
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ){ |
252 |
|
|
found = true; |
253 |
|
|
beverbose = true; |
254 |
mocchiut |
1.1 |
}; |
255 |
mocchiut |
1.15 |
if ( !strcmp(inps[i],"-c") || !strcmp(inps[i],"--clean")){ |
256 |
|
|
found = true; |
257 |
|
|
remfile = true; |
258 |
|
|
}; |
259 |
mocchiut |
1.10 |
if ( !strcmp(inps[i],"-s") || !strcmp(inps[i],"--silent") ){ |
260 |
|
|
found = true; |
261 |
|
|
beverbose = false; |
262 |
|
|
}; |
263 |
mocchiut |
1.8 |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ){ |
264 |
|
|
debug = true; |
265 |
|
|
found = true; |
266 |
|
|
}; |
267 |
mocchiut |
1.19 |
if ( !strcmp(inps[i],"-b") || !strcmp(inps[i],"--benchmark") ){ |
268 |
|
|
bench = true; |
269 |
|
|
found = true; |
270 |
|
|
}; |
271 |
mocchiut |
1.17 |
if ( !strcmp(inps[i],"-auto") || !strcmp(inps[i],"-AUTO") ){ |
272 |
|
|
autom = true; |
273 |
|
|
tedious = false; |
274 |
|
|
zerofill = false; |
275 |
|
|
found = true; |
276 |
|
|
}; |
277 |
|
|
if ( !strcmp(inps[i],"-zerofill") ){ |
278 |
|
|
tedious = false; |
279 |
|
|
autom = false; |
280 |
|
|
zerofill = true; |
281 |
|
|
found = true; |
282 |
|
|
}; |
283 |
|
|
if ( !strcmp(inps[i],"-tedious") ){ |
284 |
|
|
tedious = true; |
285 |
|
|
zerofill = false; |
286 |
|
|
autom = false; |
287 |
|
|
found = true; |
288 |
|
|
}; |
289 |
mocchiut |
1.1 |
// |
290 |
|
|
if ( !strcmp(inps[i],"-CAL") ) { |
291 |
mocchiut |
1.8 |
found = true; |
292 |
mocchiut |
1.1 |
CAL = false; |
293 |
|
|
}; |
294 |
|
|
if ( !strcmp(inps[i],"-TRK") ) { |
295 |
mocchiut |
1.8 |
found = true; |
296 |
mocchiut |
1.1 |
TRK = false; |
297 |
|
|
}; |
298 |
|
|
if ( !strcmp(inps[i],"-TOF") ) { |
299 |
mocchiut |
1.8 |
found = true; |
300 |
mocchiut |
1.1 |
TOF = false; |
301 |
|
|
}; |
302 |
|
|
if ( !strcmp(inps[i],"-TRG") ) { |
303 |
mocchiut |
1.8 |
found = true; |
304 |
mocchiut |
1.1 |
TRG = false; |
305 |
|
|
}; |
306 |
|
|
if ( !strcmp(inps[i],"-S4") ) { |
307 |
mocchiut |
1.8 |
found = true; |
308 |
mocchiut |
1.1 |
S4 = false; |
309 |
|
|
}; |
310 |
|
|
if ( !strcmp(inps[i],"-ND") ) { |
311 |
mocchiut |
1.8 |
found = true; |
312 |
mocchiut |
1.1 |
ND = false; |
313 |
|
|
}; |
314 |
|
|
if ( !strcmp(inps[i],"-AC") ) { |
315 |
mocchiut |
1.8 |
found = true; |
316 |
mocchiut |
1.1 |
AC = false; |
317 |
|
|
}; |
318 |
|
|
if ( !strcmp(inps[i],"-RUN") ) { |
319 |
mocchiut |
1.8 |
found = true; |
320 |
mocchiut |
1.1 |
RUN = false; |
321 |
|
|
}; |
322 |
|
|
if ( !strcmp(inps[i],"-ORB") ) { |
323 |
mocchiut |
1.8 |
found = true; |
324 |
mocchiut |
1.1 |
ORB = false; |
325 |
|
|
}; |
326 |
|
|
// |
327 |
mocchiut |
1.8 |
if ( !strcmp(inps[i],"-all") || !strcmp(inps[i],"-ALL") ) { |
328 |
mocchiut |
1.1 |
CAL = false; |
329 |
|
|
ORB = false; |
330 |
|
|
TRK = false; |
331 |
|
|
TRG = false; |
332 |
|
|
TOF = false; |
333 |
|
|
S4 = false; |
334 |
|
|
ND = false; |
335 |
|
|
AC = false; |
336 |
|
|
RUN = false; |
337 |
mocchiut |
1.8 |
found = true; |
338 |
mocchiut |
1.1 |
}; |
339 |
|
|
// |
340 |
mocchiut |
1.8 |
if ( !strcmp(inps[i],"+all") || !strcmp(inps[i],"+ALL") ) { |
341 |
mocchiut |
1.1 |
CAL = true; |
342 |
|
|
ORB = true; |
343 |
|
|
TRK = true; |
344 |
|
|
TRG = true; |
345 |
|
|
TOF = true; |
346 |
|
|
S4 = true; |
347 |
|
|
ND = true; |
348 |
|
|
AC = true; |
349 |
|
|
RUN = true; |
350 |
mocchiut |
1.8 |
found = true; |
351 |
mocchiut |
1.1 |
}; |
352 |
|
|
// |
353 |
|
|
if ( !strcmp(inps[i],"+CAL") ) { |
354 |
mocchiut |
1.8 |
found = true; |
355 |
mocchiut |
1.1 |
CAL = true; |
356 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
357 |
|
|
if ( numinp < i+2 ){ |
358 |
|
|
usage(); |
359 |
|
|
throw -3; |
360 |
|
|
}; |
361 |
|
|
i += 2; |
362 |
|
|
calargc = 0; |
363 |
|
|
while ( strcmp(inps[i],"]") ){ |
364 |
|
|
calargv[calargc] = inps[i]; |
365 |
|
|
calargc++; |
366 |
|
|
i++; |
367 |
|
|
if ( i > numinp-1 ){ |
368 |
|
|
usage(); |
369 |
|
|
throw -3; |
370 |
|
|
}; |
371 |
|
|
}; |
372 |
|
|
}; |
373 |
|
|
}; |
374 |
|
|
if ( !strcmp(inps[i],"+TRK") ) { |
375 |
mocchiut |
1.8 |
found = true; |
376 |
mocchiut |
1.1 |
TRK = true; |
377 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
378 |
|
|
if ( numinp-1 < i+2 ){ |
379 |
|
|
usage(); |
380 |
|
|
throw -3; |
381 |
|
|
}; |
382 |
|
|
i += 2; |
383 |
|
|
trkargc = 0; |
384 |
|
|
while ( strcmp(inps[i],"]") ){ |
385 |
|
|
trkargv[trkargc] = inps[i]; |
386 |
|
|
trkargc++; |
387 |
|
|
i++; |
388 |
|
|
if ( i > numinp-1 ){ |
389 |
|
|
usage(); |
390 |
|
|
throw -3; |
391 |
|
|
}; |
392 |
|
|
}; |
393 |
|
|
}; |
394 |
|
|
}; |
395 |
|
|
if ( !strcmp(inps[i],"+TOF") ) { |
396 |
mocchiut |
1.8 |
found = true; |
397 |
mocchiut |
1.1 |
TOF = true; |
398 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
399 |
|
|
i += 2; |
400 |
|
|
tofargc = 0; |
401 |
|
|
while ( strcmp(inps[i],"]") ){ |
402 |
|
|
tofargv[tofargc] = inps[i]; |
403 |
|
|
tofargc++; |
404 |
|
|
i++; |
405 |
|
|
if ( i > numinp-1 ){ |
406 |
|
|
usage(); |
407 |
|
|
throw -3; |
408 |
|
|
}; |
409 |
|
|
}; |
410 |
|
|
}; |
411 |
|
|
}; |
412 |
|
|
if ( !strcmp(inps[i],"+TRG") ) { |
413 |
mocchiut |
1.8 |
found = true; |
414 |
mocchiut |
1.1 |
TRG = true; |
415 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
416 |
|
|
i += 2; |
417 |
|
|
trgargc = 0; |
418 |
|
|
while ( strcmp(inps[i],"]") ){ |
419 |
|
|
trgargv[trgargc] = inps[i]; |
420 |
|
|
trgargc++; |
421 |
|
|
i++; |
422 |
|
|
if ( i > numinp-1 ){ |
423 |
|
|
usage(); |
424 |
|
|
throw -3; |
425 |
|
|
}; |
426 |
|
|
}; |
427 |
|
|
}; |
428 |
|
|
}; |
429 |
|
|
if ( !strcmp(inps[i],"+ORB") ) { |
430 |
mocchiut |
1.8 |
found = true; |
431 |
mocchiut |
1.1 |
ORB = true; |
432 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
433 |
|
|
i += 2; |
434 |
|
|
orbargc = 0; |
435 |
|
|
while ( strcmp(inps[i],"]") ){ |
436 |
|
|
orbargv[orbargc] = inps[i]; |
437 |
|
|
orbargc++; |
438 |
|
|
i++; |
439 |
|
|
if ( i > numinp-1 ){ |
440 |
|
|
usage(); |
441 |
|
|
throw -3; |
442 |
|
|
}; |
443 |
|
|
}; |
444 |
|
|
}; |
445 |
|
|
}; |
446 |
|
|
if ( !strcmp(inps[i],"+RUN") ) { |
447 |
mocchiut |
1.8 |
found = true; |
448 |
mocchiut |
1.1 |
RUN = true; |
449 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
450 |
|
|
i += 2; |
451 |
|
|
runargc = 0; |
452 |
|
|
while ( strcmp(inps[i],"]") ){ |
453 |
|
|
runargv[runargc] = inps[i]; |
454 |
|
|
runargc++; |
455 |
|
|
i++; |
456 |
|
|
if ( i > numinp-1 ){ |
457 |
|
|
usage(); |
458 |
|
|
throw -3; |
459 |
|
|
}; |
460 |
|
|
}; |
461 |
|
|
}; |
462 |
|
|
}; |
463 |
|
|
if ( !strcmp(inps[i],"+AC") ) { |
464 |
mocchiut |
1.8 |
found = true; |
465 |
mocchiut |
1.1 |
AC = true; |
466 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
467 |
|
|
i += 2; |
468 |
|
|
acargc = 0; |
469 |
|
|
while ( strcmp(inps[i],"]") ){ |
470 |
|
|
acargv[acargc] = inps[i]; |
471 |
|
|
acargc++; |
472 |
|
|
i++; |
473 |
|
|
if ( i > numinp-1 ){ |
474 |
|
|
usage(); |
475 |
|
|
throw -3; |
476 |
|
|
}; |
477 |
|
|
}; |
478 |
|
|
}; |
479 |
|
|
}; |
480 |
|
|
if ( !strcmp(inps[i],"+S4") ) { |
481 |
mocchiut |
1.8 |
found = true; |
482 |
mocchiut |
1.1 |
S4 = true; |
483 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
484 |
|
|
i += 2; |
485 |
|
|
s4argc = 0; |
486 |
|
|
while ( strcmp(inps[i],"]") ){ |
487 |
|
|
s4argv[s4argc] = inps[i]; |
488 |
|
|
s4argc++; |
489 |
|
|
i++; |
490 |
|
|
if ( i > numinp-1 ){ |
491 |
|
|
usage(); |
492 |
|
|
throw -3; |
493 |
|
|
}; |
494 |
|
|
}; |
495 |
|
|
}; |
496 |
|
|
}; |
497 |
|
|
if ( !strcmp(inps[i],"+ND") ) { |
498 |
mocchiut |
1.8 |
found = true; |
499 |
mocchiut |
1.1 |
ND = true; |
500 |
|
|
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
501 |
|
|
i += 2; |
502 |
|
|
ndargc = 0; |
503 |
|
|
while ( strcmp(inps[i],"]") ){ |
504 |
|
|
ndargv[ndargc] = inps[i]; |
505 |
|
|
ndargc++; |
506 |
|
|
i++; |
507 |
|
|
if ( i > numinp-1 ){ |
508 |
|
|
usage(); |
509 |
|
|
throw -3; |
510 |
|
|
}; |
511 |
|
|
}; |
512 |
|
|
}; |
513 |
|
|
}; |
514 |
|
|
// |
515 |
mocchiut |
1.8 |
if ( !found && i > 0 ){ |
516 |
|
|
usage(); |
517 |
|
|
printf(" Unknown input number %i, that is \"%s\" \n",i,inps[i]); |
518 |
|
|
throw -22; |
519 |
|
|
}; |
520 |
|
|
// |
521 |
mocchiut |
1.1 |
i++; |
522 |
|
|
}; |
523 |
|
|
// |
524 |
|
|
} else { |
525 |
|
|
// |
526 |
|
|
// no input parameters exit with error, we need at least the run id. |
527 |
|
|
// |
528 |
|
|
throw -1; |
529 |
|
|
}; |
530 |
|
|
// |
531 |
|
|
// If not in verbose mode redirect to /dev/null the stdout and stderr |
532 |
|
|
// |
533 |
|
|
if ( !beverbose ){ |
534 |
|
|
nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE); |
535 |
|
|
dup2(nul,1); |
536 |
|
|
dup2(nul,2); |
537 |
|
|
}; |
538 |
|
|
// |
539 |
|
|
// Check that an input run number has been given |
540 |
|
|
// |
541 |
|
|
if ( !givenid ) throw -1; |
542 |
|
|
// |
543 |
mocchiut |
1.15 |
TString version = DarthVaderInfo(false); |
544 |
mocchiut |
1.1 |
// |
545 |
|
|
// Start: |
546 |
|
|
// |
547 |
mocchiut |
1.15 |
printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version.Data()); |
548 |
mocchiut |
1.1 |
// |
549 |
|
|
// Connect to the DB |
550 |
|
|
// |
551 |
|
|
if ( debug ) printf("\nConnecting to database... \n"); |
552 |
|
|
// |
553 |
|
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
554 |
|
|
if( !dbc ) throw -2; |
555 |
|
|
// |
556 |
mocchiut |
1.18 |
Bool_t connect = dbc->IsConnected(); |
557 |
mocchiut |
1.1 |
// |
558 |
|
|
if( !connect ) throw -2; |
559 |
|
|
// |
560 |
|
|
if ( debug ) printf("...connected! \n\n"); |
561 |
|
|
// |
562 |
mocchiut |
1.19 |
if ( debug ) printf("\n DB INFORMATIONS:\n SQL: %s Version: %s Host %s Port %i \n\n",dbc->GetDBMS(),dbc->ServerInfo(),dbc->GetHost(),dbc->GetPort()); |
563 |
|
|
// |
564 |
mocchiut |
1.15 |
// Use UTC in the DB |
565 |
|
|
// |
566 |
mocchiut |
1.14 |
stringstream myquery; |
567 |
|
|
myquery.str(""); |
568 |
|
|
myquery << "SET time_zone='+0:00'"; |
569 |
|
|
dbc->Query(myquery.str().c_str()); |
570 |
|
|
// |
571 |
|
|
// |
572 |
mocchiut |
1.1 |
// Create LEVEL2 filename and open it in update mode |
573 |
|
|
// |
574 |
|
|
if ( filename.IsNull() ){ |
575 |
|
|
stringstream strun; |
576 |
|
|
strun.str(""); |
577 |
|
|
strun << run; |
578 |
mocchiut |
1.3 |
filename += outDir; |
579 |
|
|
filename += "/"; |
580 |
mocchiut |
1.1 |
filename += strun.str(); |
581 |
|
|
filename += ".Level2.root"; |
582 |
|
|
}; |
583 |
|
|
processFile = new TFile(filename.Data(),"UPDATE"); |
584 |
|
|
if ( !processFile->IsOpen() ) throw -15; |
585 |
|
|
// |
586 |
|
|
// Run the core program, put any output error in the "error" variable |
587 |
|
|
// |
588 |
mocchiut |
1.19 |
if ( debug ) printf("\n\n Pre-processing:\n\n"); |
589 |
mocchiut |
1.15 |
// |
590 |
mocchiut |
1.19 |
timer.Start(kTRUE); |
591 |
mocchiut |
1.1 |
if ( RUN ) { |
592 |
mocchiut |
1.19 |
if ( debug ) printf(" Retrieve, if the case, the RUN informations from the DB...\n"); |
593 |
mocchiut |
1.15 |
printf(" RunInfo called\n"); |
594 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
595 |
|
|
RUNSGN = RunInfoCore(run,processFile,dbc,version,runargc,runargv); |
596 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
597 |
mocchiut |
1.19 |
if ( debug ) printf(" ...done\n"); |
598 |
mocchiut |
1.1 |
}; |
599 |
mocchiut |
1.19 |
timer.Stop(); |
600 |
|
|
runtime = timer.RealTime(); |
601 |
|
|
cruntime = timer.CpuTime(); |
602 |
mocchiut |
1.4 |
// |
603 |
|
|
// From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not |
604 |
|
|
// |
605 |
mocchiut |
1.19 |
if ( debug ) printf(" Checking if requested detectors are in the acquisition\n"); |
606 |
mocchiut |
1.4 |
ItoRunInfo *runinfo = new ItoRunInfo(processFile); |
607 |
mocchiut |
1.15 |
Int_t sgnl = runinfo->Read(run); |
608 |
|
|
if ( sgnl != 0 ) throw -17; |
609 |
mocchiut |
1.19 |
nevents = runinfo->GetEntries(); |
610 |
|
|
nruns = runinfo->GetNoRun(); |
611 |
|
|
if ( debug ) printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO); |
612 |
mocchiut |
1.17 |
if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ){ |
613 |
|
|
DVSGN += 1; |
614 |
|
|
if ( tedious ) throw -30; |
615 |
|
|
if ( autom ){ |
616 |
|
|
TRK = 0; |
617 |
mocchiut |
1.19 |
if ( debug ) printf(" TRK excluded from processing \n"); |
618 |
mocchiut |
1.17 |
}; |
619 |
mocchiut |
1.19 |
if ( zerofill && debug ) printf(" TRK is not in the acquisition! \n"); |
620 |
mocchiut |
1.17 |
}; |
621 |
|
|
if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ){ |
622 |
|
|
DVSGN += 2; |
623 |
|
|
if ( tedious ) throw -31; |
624 |
|
|
if ( autom ){ |
625 |
|
|
TOF = 0; |
626 |
mocchiut |
1.19 |
if ( debug ) printf(" TOF excluded from processing \n"); |
627 |
mocchiut |
1.17 |
}; |
628 |
mocchiut |
1.19 |
if ( zerofill && debug ) printf(" TOF is not in the acquisition! \n"); |
629 |
mocchiut |
1.17 |
}; |
630 |
|
|
if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ){ |
631 |
|
|
DVSGN += 4; |
632 |
|
|
if ( tedious ) throw -32; |
633 |
|
|
if ( autom ){ |
634 |
|
|
CAL = 0; |
635 |
mocchiut |
1.19 |
if ( debug ) printf(" CAL excluded from processing \n"); |
636 |
mocchiut |
1.17 |
}; |
637 |
mocchiut |
1.19 |
if ( zerofill && debug ) printf(" CAL is not in the acquisition! \n"); |
638 |
mocchiut |
1.17 |
}; |
639 |
|
|
if ( AC && (!(runinfo->ACQ_VAR_INFO & (1 << 1)) || !(runinfo->ACQ_VAR_INFO & (1 << 2))) ){ |
640 |
|
|
DVSGN += 8; |
641 |
|
|
if ( tedious ) throw -33; |
642 |
|
|
if ( autom ){ |
643 |
|
|
AC = 0; |
644 |
mocchiut |
1.19 |
if ( debug ) printf(" AC excluded from processing \n"); |
645 |
mocchiut |
1.17 |
}; |
646 |
mocchiut |
1.19 |
if ( zerofill && debug ) printf(" AC is not in the acquisition! \n"); |
647 |
mocchiut |
1.17 |
}; |
648 |
|
|
if ( S4 && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ){ |
649 |
|
|
DVSGN += 16; |
650 |
|
|
if ( tedious ) throw -34; |
651 |
|
|
if ( autom ){ |
652 |
|
|
S4 = 0; |
653 |
mocchiut |
1.19 |
if ( debug ) printf(" S4 excluded from processing \n"); |
654 |
mocchiut |
1.17 |
}; |
655 |
mocchiut |
1.19 |
if ( zerofill && debug ) printf(" S4 is not in the acquisition! \n"); |
656 |
mocchiut |
1.17 |
}; |
657 |
|
|
if ( ND && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ){ |
658 |
|
|
DVSGN += 32; |
659 |
|
|
if ( tedious ) throw -35; |
660 |
|
|
if ( autom ){ |
661 |
|
|
ND = 0; |
662 |
mocchiut |
1.19 |
if ( debug ) printf(" ND excluded from processing \n"); |
663 |
mocchiut |
1.17 |
}; |
664 |
mocchiut |
1.19 |
if ( zerofill && debug ) printf(" ND is not in the acquisition! \n"); |
665 |
mocchiut |
1.17 |
}; |
666 |
mocchiut |
1.15 |
// |
667 |
|
|
if ( !DVSGN ){ |
668 |
mocchiut |
1.19 |
if ( debug ) printf(" OK! Start processing detector's data. \n"); |
669 |
mocchiut |
1.15 |
} else { |
670 |
mocchiut |
1.19 |
if ( debug ) printf(" WARNING! missing detector(s)! Start anyway processing detector's data. \n"); |
671 |
mocchiut |
1.15 |
}; |
672 |
mocchiut |
1.19 |
if ( debug ) printf("\n End pre-processing \n\n"); |
673 |
mocchiut |
1.4 |
// |
674 |
mocchiut |
1.19 |
timer.Start(kTRUE); |
675 |
mocchiut |
1.1 |
if ( TRK ) { |
676 |
mocchiut |
1.15 |
printf(" TrackerLevel2 called\n"); |
677 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
678 |
mocchiut |
1.1 |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
679 |
mocchiut |
1.11 |
gSystem->Unlink("TrackerFolder"); //patch |
680 |
mocchiut |
1.15 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
681 |
mocchiut |
1.1 |
}; |
682 |
mocchiut |
1.19 |
timer.Stop(); |
683 |
|
|
trktime = timer.RealTime(); |
684 |
|
|
ctrktime = timer.CpuTime(); |
685 |
|
|
// |
686 |
|
|
timer.Start(kTRUE); |
687 |
mocchiut |
1.1 |
if ( TOF ) { |
688 |
mocchiut |
1.15 |
printf(" ToFLevel2 called\n"); |
689 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
690 |
mocchiut |
1.1 |
TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); |
691 |
mocchiut |
1.15 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
692 |
mocchiut |
1.1 |
}; |
693 |
mocchiut |
1.19 |
timer.Stop(); |
694 |
|
|
toftime = timer.RealTime(); |
695 |
|
|
ctoftime = timer.CpuTime(); |
696 |
|
|
// |
697 |
|
|
timer.Start(kTRUE); |
698 |
mocchiut |
1.1 |
if ( CAL ) { |
699 |
mocchiut |
1.15 |
printf(" CalorimeterLevel2 called\n"); |
700 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
701 |
mocchiut |
1.1 |
CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); |
702 |
mocchiut |
1.15 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
703 |
mocchiut |
1.1 |
}; |
704 |
mocchiut |
1.19 |
timer.Stop(); |
705 |
|
|
caltime = timer.RealTime(); |
706 |
|
|
ccaltime = timer.CpuTime(); |
707 |
|
|
// |
708 |
|
|
timer.Start(kTRUE); |
709 |
mocchiut |
1.1 |
if ( TRG ) { |
710 |
mocchiut |
1.15 |
printf(" TriggerLevel2 called\n"); |
711 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
712 |
mocchiut |
1.1 |
TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); |
713 |
mocchiut |
1.15 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
714 |
mocchiut |
1.1 |
}; |
715 |
mocchiut |
1.19 |
timer.Stop(); |
716 |
|
|
trgtime = timer.RealTime(); |
717 |
|
|
ctrgtime = timer.CpuTime(); |
718 |
|
|
// |
719 |
|
|
timer.Start(kTRUE); |
720 |
mocchiut |
1.1 |
if ( AC ) { |
721 |
mocchiut |
1.15 |
printf(" AnticounterLevel2 called\n"); |
722 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
723 |
mocchiut |
1.1 |
ACSGN = AcCore(run,processFile,dbc,acargc,acargv); |
724 |
mocchiut |
1.15 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
725 |
mocchiut |
1.1 |
}; |
726 |
mocchiut |
1.19 |
timer.Stop(); |
727 |
|
|
actime = timer.RealTime(); |
728 |
|
|
cactime = timer.CpuTime(); |
729 |
|
|
// |
730 |
|
|
timer.Start(kTRUE); |
731 |
mocchiut |
1.1 |
if ( S4 ) { |
732 |
mocchiut |
1.15 |
printf(" S4Level2 called\n"); |
733 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
734 |
mocchiut |
1.1 |
S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); |
735 |
mocchiut |
1.15 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
736 |
mocchiut |
1.1 |
}; |
737 |
mocchiut |
1.19 |
timer.Stop(); |
738 |
|
|
s4time = timer.RealTime(); |
739 |
|
|
cs4time = timer.CpuTime(); |
740 |
|
|
// |
741 |
|
|
timer.Start(kTRUE); |
742 |
mocchiut |
1.1 |
if ( ND ) { |
743 |
mocchiut |
1.15 |
printf(" NDLevel2 called\n"); |
744 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
745 |
mocchiut |
1.1 |
NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); |
746 |
mocchiut |
1.15 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
747 |
mocchiut |
1.1 |
}; |
748 |
mocchiut |
1.19 |
timer.Stop(); |
749 |
|
|
ndtime = timer.RealTime(); |
750 |
|
|
cndtime = timer.CpuTime(); |
751 |
|
|
// |
752 |
|
|
timer.Start(kTRUE); |
753 |
mocchiut |
1.1 |
if ( ORB ) { |
754 |
mocchiut |
1.15 |
printf(" OrbitalInfo called\n"); |
755 |
|
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
756 |
mocchiut |
1.1 |
ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); |
757 |
mocchiut |
1.15 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
758 |
mocchiut |
1.1 |
}; |
759 |
mocchiut |
1.19 |
timer.Stop(); |
760 |
|
|
orbtime = timer.RealTime(); |
761 |
|
|
corbtime = timer.CpuTime(); |
762 |
mocchiut |
1.1 |
// |
763 |
|
|
} catch(Int_t signal) { |
764 |
|
|
error = signal; |
765 |
|
|
switch(signal){ |
766 |
|
|
case 51: message += " GLTABLES - TO_TIME < time when querying tables"; break; |
767 |
|
|
case -1: message += " Missing/wrong run ID input parameter"; break; |
768 |
|
|
case -2: message += " DB connection failure"; break; |
769 |
|
|
case -3: message += " Error in input parameters (check format)"; break; |
770 |
|
|
case -4: message += " Request reprocessing of all runs (idRun = 0) but processFile is missing"; break; |
771 |
|
|
case -6: message += " No LEVEL0 file "; break; |
772 |
|
|
case -7: message += " No Physics tree in LEVEL0 file"; break; |
773 |
|
|
case -8: message += " No Header branch in LEVEL0 Physics tree"; break; |
774 |
|
|
case -9: message += " No Registry branch in LEVEL0 Physics tree"; break; |
775 |
|
|
case -11: message += " LEVEL0 Physics tree is empty"; break; |
776 |
mocchiut |
1.9 |
case -12: message += " Too few entries in the tree"; break; |
777 |
mocchiut |
1.1 |
case -13: message += " Cannot create processFolder directory"; break; |
778 |
|
|
case -14: message += " Error querying the DB"; break; |
779 |
|
|
case -15: message += " Cannot open file for writing"; break; |
780 |
mocchiut |
1.15 |
case -17: message += " Error during pre-processing"; break; |
781 |
mocchiut |
1.8 |
case -22: message += " Unknown input or wrong syntax in input paramters!"; break; |
782 |
mocchiut |
1.17 |
case -30: message += " No TRK in the acquisition"; break; |
783 |
|
|
case -31: message += " No TOF in the acquisition"; break; |
784 |
|
|
case -32: message += " No CAL in the acquisition"; break; |
785 |
|
|
case -33: message += " No AC in the acquisition"; break; |
786 |
|
|
case -34: message += " No S4 in the acquisition"; break; |
787 |
|
|
case -35: message += " No ND in the acquisition"; break; |
788 |
mocchiut |
1.1 |
// |
789 |
|
|
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
790 |
|
|
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
791 |
|
|
case -52: message += " GLTABLES - No entries matching GL_PARAM query"; break; |
792 |
|
|
case -53: message += " GLTABLES - No entries matching GL_TRK_CALIB query"; break; |
793 |
|
|
case -54: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; |
794 |
|
|
case -55: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; |
795 |
|
|
// |
796 |
|
|
case -100: message += " CALORIMETERLEVEL2 - No Level2 input file"; break; |
797 |
|
|
case -101: message += " CALORIMETERLEVEL2 - Cannot open Level2 file"; break; |
798 |
|
|
case -102: message += " CALORIMETERLEVEL2 - No Tracker TTree in Level2 file"; break; |
799 |
|
|
case -103: message += " CALORIMETERLEVEL2 - No Calorimeter TBranch in Level0 file"; break; |
800 |
|
|
case -104: message += " CALORIMETERLEVEL2 - No Trigger TTree in Level0 file"; break; |
801 |
|
|
case -105: message += " CALORIMETERLEVEL2 - No Calorimeter ADC2MIP conversion file"; break; |
802 |
|
|
case -106: message += " CALORIMETERLEVEL2 - No Calorimeter alignement file"; break; |
803 |
|
|
case -107: message += " CALORIMETERLEVEL2 - Cannot find Level0 file needed for the calibration"; break; |
804 |
|
|
case -108: message += " CALORIMETERLEVEL2 - Cannot open Level0 file needed for the calibration"; break; |
805 |
|
|
case -109: message += " CALORIMETERLEVEL2 - No CalibCalPed TTree in Level0 file needed for the calibration"; break; |
806 |
|
|
case -110: message += " CALORIMETERLEVEL2 - No calibrations in Level0 file needed for the calibration"; break; |
807 |
|
|
case -111: message += " CALORIMETERLEVEL2 - Corrupted calibration"; break; |
808 |
|
|
case -112: message += " CALORIMETERLEVEL2 - No physics event related to registry entry in Level0 file"; break; |
809 |
|
|
case -113: message += " CALORIMETERLEVEL2 - No tracker event related to registry entry in Level2 file"; break; |
810 |
mocchiut |
1.17 |
case -114: message += " CALORIMETERLEVEL2 - Help called"; break; |
811 |
|
|
case -115: message += " CALORIMETERLEVEL2 - No Calorimeter bad strip offline mask file"; break; |
812 |
mocchiut |
1.18 |
case -116: message += " CALORIMETERLEVEL2 - DB connection problems"; break; |
813 |
mocchiut |
1.20 |
case -117: message += " CALORIMETERLEVEL2 - Cannot reprocess file with Level1 data without calling Level1 routine"; break; |
814 |
|
|
case -118: message += " CALORIMETERLEVEL2 - Cannot reprocess file without Level1 data calling Level1 routine"; break; |
815 |
mocchiut |
1.1 |
// |
816 |
|
|
case -200: message += " TRACKERLEVEL2 - LEVEL1 framework unknown (HBOOK/ROOT)"; break; |
817 |
|
|
case -201: message += " TRACKERLEVEL2 - LEVEL2 framework unknown (HBOOK/ROOT)"; break; |
818 |
|
|
case -202: message += " TRACKERLEVEL2 - Neither LEVEL1 nor LEVEL2 output requested"; break; |
819 |
|
|
case -203: message += " TRACKERLEVEL2 - No Tracker branch in LEVEL0 Physics tree"; break; |
820 |
|
|
case -204: message += " TRACKERLEVEL2 - No reprocessing implemented for LEVEL1 output"; break; |
821 |
|
|
case -205: message += " TRACKERLEVEL2 - Error accessing RunInfo "; break; |
822 |
|
|
case -210: message += " TRACKERLEVEL2 - Error opening/reading trk mask GL_PARAM parameters "; break; |
823 |
|
|
case -211: message += " TRACKERLEVEL2 - Error opening/reading trk alignment GL_PARAM parameters"; break; |
824 |
|
|
case -212: message += " TRACKERLEVEL2 - Error opening/reading trk mip GL_PARAM parameters"; break; |
825 |
|
|
case -213: message += " TRACKERLEVEL2 - Error opening/reading trk charge GL_PARAM parameters"; break; |
826 |
|
|
case -214: message += " TRACKERLEVEL2 - Error opening/reading trk pfa GL_PARAM parameters"; break; |
827 |
|
|
case -215: message += " TRACKERLEVEL2 - Error opening/reading field GL_PARAM parameters"; break; |
828 |
|
|
case -216: message += " TRACKERLEVEL2 - Error opening/reading default calibration GL_PARAM parameters"; break; |
829 |
|
|
case -298: message += " TRACKERLEVEL2 - Reprocessing not implemented in standalone mode"; break; |
830 |
|
|
case -299: message += " TRACKERLEVEL2 - Not yet implemented"; break; |
831 |
|
|
// |
832 |
|
|
case -300: message += " TOFLEVEL2 - No Trigger branch in Level0 tree"; break; |
833 |
|
|
case -301: message += " TOFLEVEL2 - Cannot open file for writing"; break; |
834 |
|
|
case -302: message += " TOFLEVEL2 - No tracker tree in Level2 file"; break; |
835 |
|
|
case -303: message += " TOFLEVEL2 - No Tof branch in Level0 file"; break; |
836 |
|
|
case -313: message += " TOFLEVEL2 - No more tracker events in Level2 file"; break; |
837 |
mocchiut |
1.18 |
case -314: message += " TOFLEVEL2 - DB connection problems"; break; |
838 |
mocchiut |
1.1 |
// |
839 |
|
|
case -401: message += " TRIGGERLEVEL2 - Cannot open file for writing"; break; |
840 |
|
|
case -402: message += " TRIGGERLEVEL2 - No Trigger branch in Level0 tree"; break; |
841 |
mocchiut |
1.18 |
case -403: message += " TRIGGERLEVEL2 - DB connection problems"; break; |
842 |
mocchiut |
1.1 |
// |
843 |
|
|
case -500: message += " S4LEVEL2 - No level2 file"; break; |
844 |
|
|
case -501: message += " S4LEVEL2 - Cannot open file for writing"; break; |
845 |
|
|
case -502: message += " S4LEVEL2 - No result from GL_S4_CALIB"; break; |
846 |
|
|
case -503: message += " S4LEVEL2 - No S4 branch in Level0 tree"; break; |
847 |
mocchiut |
1.18 |
case -504: message += " S4LEVEL2 - DB connection problems"; break; |
848 |
mocchiut |
1.1 |
// |
849 |
|
|
case -600: message += " NDLEVEL2 - No level2 file"; break; |
850 |
|
|
case -601: message += " NDLEVEL2 - Cannot open file for writing"; break; |
851 |
|
|
case -603: message += " NDLEVEL2 - No S4Level2 branch in Level0 tree"; break; |
852 |
mocchiut |
1.18 |
case -604: message += " NDLEVEL2 - DB connection problems"; break; |
853 |
mocchiut |
1.1 |
// |
854 |
mocchiut |
1.17 |
case -701: message += " ACLEVEL2 - Cannot open file for writing"; break; |
855 |
|
|
case -704: message += " ACLEVEL2 - No Anticounter branch in Level0 tree"; break; |
856 |
mocchiut |
1.18 |
case -705: message += " ACLEVEL2 - DB connection problems"; break; |
857 |
mocchiut |
1.1 |
// |
858 |
|
|
case -800: message += " RUNINFO - No such run in the RunInfo list"; break; |
859 |
|
|
case -801: message += " RUNINFO - No RunInfo tree in Level2 file"; break; |
860 |
|
|
case -802: message += " RUNINFO - Cannot open file for writing"; break; |
861 |
|
|
case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; |
862 |
|
|
case -804: message += " RUNINFO - Unknown detector"; break; |
863 |
mocchiut |
1.2 |
case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; |
864 |
mocchiut |
1.7 |
case -806: message += " RUNINFO - Can not handle more than 500 runs"; break; |
865 |
mocchiut |
1.18 |
case -807: message += " RUNINFO - DB connection problems"; break; |
866 |
|
|
// |
867 |
mocchiut |
1.1 |
default: message += "Unidentified error or warning"; break; |
868 |
|
|
}; |
869 |
|
|
printf("\n"); |
870 |
|
|
if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <<endl; |
871 |
|
|
} |
872 |
mocchiut |
1.12 |
// |
873 |
mocchiut |
1.15 |
// Warnings from XCore routines and from DV: |
874 |
|
|
// |
875 |
|
|
if ( debug && DVSGN ) printf(" DVSGN = %i \n",DVSGN); |
876 |
|
|
if ( DVSGN ) printf("\n WARNING DarthVader: \n"); |
877 |
|
|
if ( DVSGN & (1 << 0) ) printf(" - No tracker in the acquisition\n"); |
878 |
|
|
if ( DVSGN & (1 << 1) ) printf(" - No ToF in the acquisition\n"); |
879 |
|
|
if ( DVSGN & (1 << 2) ) printf(" - No calorimeter in the acquisition\n"); |
880 |
|
|
if ( DVSGN & (1 << 3) ) printf(" - No anticounters in the acquisition\n"); |
881 |
|
|
if ( DVSGN & (1 << 4) ) printf(" - No S4 in the acquisition\n"); |
882 |
|
|
if ( DVSGN & (1 << 5) ) printf(" - No neutron detector in the acquisition\n"); |
883 |
|
|
// |
884 |
|
|
// CaloCore: |
885 |
mocchiut |
1.12 |
// |
886 |
mocchiut |
1.1 |
switch(CALSGN){ |
887 |
mocchiut |
1.13 |
case 100: printf("\n WARNING CALORIMETER - Data with no associated calibration\n"); |
888 |
|
|
case 101: printf("\n WARNING CALORIMETER - No tracks or good events in this run\n"); |
889 |
mocchiut |
1.1 |
}; |
890 |
|
|
// |
891 |
mocchiut |
1.15 |
// no other at the moment |
892 |
|
|
// |
893 |
|
|
// |
894 |
mocchiut |
1.1 |
// Close the DB connection |
895 |
|
|
// |
896 |
|
|
if ( dbc ){ |
897 |
|
|
if ( debug ) printf("\nClose the connection to the database... \n"); |
898 |
|
|
dbc->Close(); |
899 |
|
|
if ( debug ) printf("...connection terminated!\n\n"); |
900 |
|
|
}; |
901 |
|
|
if ( processFile ){ |
902 |
|
|
processFile->cd(); |
903 |
|
|
processFile->Close(); |
904 |
|
|
}; |
905 |
|
|
// |
906 |
mocchiut |
1.19 |
// print benchmark results (if the case) |
907 |
|
|
// |
908 |
|
|
dvtimer.Stop(); |
909 |
|
|
dvtime = dvtimer.RealTime(); |
910 |
|
|
cdvtime = dvtimer.CpuTime(); |
911 |
|
|
if ( bench ){ |
912 |
|
|
Float_t runrt = 0.; |
913 |
|
|
Float_t trkrt = 0.; |
914 |
|
|
Float_t calrt = 0.; |
915 |
|
|
Float_t tofrt = 0.; |
916 |
|
|
Float_t trgrt = 0.; |
917 |
|
|
Float_t acrt = 0.; |
918 |
|
|
Float_t s4rt = 0.; |
919 |
|
|
Float_t ndrt = 0.; |
920 |
|
|
Float_t orbrt = 0.; |
921 |
|
|
Float_t dvrt = nevents/dvtime; |
922 |
|
|
if ( RUN ) runrt = nruns/runtime; |
923 |
|
|
if ( TRK ) trkrt = nevents/trktime; |
924 |
|
|
if ( CAL ) calrt = nevents/caltime; |
925 |
|
|
if ( TOF ) tofrt = nevents/toftime; |
926 |
|
|
if ( TRG ) trgrt = nevents/trgtime; |
927 |
|
|
if ( AC ) acrt = nevents/actime; |
928 |
|
|
if ( S4 ) s4rt = nevents/s4time; |
929 |
|
|
if ( ND ) ndrt = nevents/ndtime; |
930 |
|
|
if ( ORB ) orbrt = nevents/orbtime; |
931 |
|
|
// |
932 |
|
|
printf("\n\n################################################################################\n"); |
933 |
|
|
printf("# Benchmark results: nevents = %10u runs = %3u #\n",nevents,nruns); |
934 |
|
|
printf("################################################################################\n"); |
935 |
|
|
printf("# Detector # Core routine called # Real Time # CPU time # Events/s #\n"); |
936 |
|
|
printf("################################################################################\n"); |
937 |
|
|
printf("# RUN # %i # %8.2f # %8.2f # %8.2f #\n",RUN,fabs(runtime),fabs(cruntime),runrt); |
938 |
|
|
printf("# TRK # %i # %8.2f # %8.2f # %8.2f #\n",TRK,fabs(trktime),fabs(ctrktime),trkrt); |
939 |
|
|
printf("# CAL # %i # %8.2f # %8.2f # %8.2f #\n",CAL,fabs(caltime),fabs(ccaltime),calrt); |
940 |
|
|
printf("# TOF # %i # %8.2f # %8.2f # %8.2f #\n",TOF,fabs(toftime),fabs(ctoftime),tofrt); |
941 |
|
|
printf("# TRG # %i # %8.2f # %8.2f # %8.2f #\n",TRG,fabs(trgtime),fabs(ctrgtime),trgrt); |
942 |
|
|
printf("# AC # %i # %8.2f # %8.2f # %8.2f #\n",AC,fabs(actime),fabs(cactime),acrt); |
943 |
|
|
printf("# S4 # %i # %8.2f # %8.2f # %8.2f #\n",S4,fabs(s4time),fabs(cs4time),s4rt); |
944 |
|
|
printf("# ND # %i # %8.2f # %8.2f # %8.2f #\n",ND,fabs(ndtime),fabs(cndtime),ndrt); |
945 |
|
|
printf("# ORB # %i # %8.2f # %8.2f # %8.2f #\n",ORB,fabs(orbtime),fabs(corbtime),orbrt); |
946 |
|
|
printf("################################################################################\n"); |
947 |
|
|
printf("# Total # # %8.2f # %8.2f # %8.2f #\n",fabs(dvtime),fabs(cdvtime),dvrt); |
948 |
|
|
printf("################################################################################\n"); |
949 |
|
|
}; |
950 |
|
|
// |
951 |
|
|
// |
952 |
mocchiut |
1.1 |
if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error); |
953 |
mocchiut |
1.15 |
// |
954 |
|
|
// |
955 |
|
|
// |
956 |
|
|
if ( remfile && error < 0 ){ |
957 |
|
|
printf(" -c or --clean option used, deleting file %s \n\n",filename.Data()); |
958 |
|
|
gSystem->Unlink(filename.Data()); |
959 |
|
|
}; |
960 |
|
|
// |
961 |
|
|
printf("\n Finished, exiting...\n\n"); |
962 |
mocchiut |
1.1 |
// |
963 |
|
|
// Close redirection if the case. |
964 |
|
|
// |
965 |
|
|
if ( !beverbose ) close(nul); |
966 |
|
|
// |
967 |
|
|
// |
968 |
|
|
exit(error); |
969 |
|
|
} |