42 |
printf(" --version print informations about compilation and exit\n"); |
printf(" --version print informations about compilation and exit\n"); |
43 |
printf(" -h | --help print this help and exit \n"); |
printf(" -h | --help print this help and exit \n"); |
44 |
printf(" -g | --debug set debug flag\n"); |
printf(" -g | --debug set debug flag\n"); |
45 |
|
printf(" -p | --pedantic merge only when all level2 run files are present (default NOT pedantic, merge whatever it finds)\n"); |
46 |
printf(" -idRun run merge all runs in the directory which have the same date of run \"run\"\n"); |
printf(" -idRun run merge all runs in the directory which have the same date of run \"run\"\n"); |
47 |
printf(" -outdir dir output directory \"dir\"\n"); |
printf(" -outdir dir output directory \"dir\"\n"); |
|
printf(" -castor the output directory is a CASTOR path, use RFIO\n"); |
|
48 |
printf(" -dir dir merge all runs in the directory \"dir\"\n"); |
printf(" -dir dir merge all runs in the directory \"dir\"\n"); |
49 |
printf(" -d | -delete delete original DarthVader runs once merged\n"); |
printf(" -d | -delete delete original DarthVader runs once merged\n"); |
50 |
printf(" -no-DBupdate do not update the DB\n"); |
printf(" -no-DBupdate do not update the DB\n"); |
77 |
Bool_t debug = false; |
Bool_t debug = false; |
78 |
Bool_t delop = false; |
Bool_t delop = false; |
79 |
Bool_t dbup = true; |
Bool_t dbup = true; |
80 |
Bool_t castor = false; |
Bool_t pedantic = false; |
81 |
// |
// |
82 |
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
83 |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
110 |
if ( !strcmp(inps[i],"-d") || !strcmp(inps[i],"-delete") ){ |
if ( !strcmp(inps[i],"-d") || !strcmp(inps[i],"-delete") ){ |
111 |
delop = true; |
delop = true; |
112 |
}; |
}; |
113 |
if ( !strcmp(inps[i],"-castor") ){ |
if ( !strcmp(inps[i],"-p") || !strcmp(inps[i],"--pedantic") ){ |
114 |
castor = true; |
pedantic = true; |
115 |
}; |
} |
116 |
if ( !strcmp(inps[i],"-no-DBupdate") ){ |
if ( !strcmp(inps[i],"-no-DBupdate") ){ |
117 |
dbup = false; |
dbup = false; |
118 |
}; |
}; |
203 |
if ( !strcmp(inps[i],"+all") || !strcmp(inps[i],"+ALL") ) { |
if ( !strcmp(inps[i],"+all") || !strcmp(inps[i],"+ALL") ) { |
204 |
dectlist +=" +ALL"; |
dectlist +=" +ALL"; |
205 |
}; |
}; |
206 |
|
if ( !strcmp(inps[i],"+auto") || !strcmp(inps[i],"+AUTO") ) { |
207 |
|
dectlist +=" +AUTO"; |
208 |
|
}; |
209 |
if ( !strcmp(inps[i],"+CAL") ) { |
if ( !strcmp(inps[i],"+CAL") ) { |
210 |
dectlist +=" +CAL"; |
dectlist +=" +CAL"; |
211 |
}; |
}; |
278 |
}; |
}; |
279 |
// |
// |
280 |
myquery.str(""); |
myquery.str(""); |
281 |
myquery << "SET time_zone='+0:00'"; |
myquery << "SET time_zone='+0:00';"; |
282 |
dbc->Query(myquery.str().c_str()); |
delete dbc->Query(myquery.str().c_str()); |
283 |
|
delete dbc->Query("SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';"); |
284 |
// |
// |
285 |
RunGlue *rg = new RunGlue(dbc,run,dir,outdir,castor); |
RunGlue *rg = new RunGlue(dbc,run,dir,outdir); |
286 |
// |
// |
287 |
if ( debug ) rg->SetDebug(true); |
if ( debug ) rg->SetDebug(true); |
288 |
|
if ( !dbup ) rg->SetUpgrade(false); |
289 |
rg->SetDList(dectlist); |
rg->SetDList(dectlist); |
290 |
// |
// |
291 |
TList *l = 0; |
TList *l = 0; |
292 |
// |
// |
293 |
TString treelist="+ALL"; |
Int_t RET=0; |
294 |
|
// |
295 |
|
// TString treelist="+AUTO"; |
296 |
// |
// |
297 |
while ( !rg->End() ){ |
while ( !rg->End() ){ |
298 |
// |
// |
299 |
l = rg->GetRunList(); |
l = rg->GetRunList(); |
300 |
// |
// |
301 |
|
if ( rg->HasDiscardedRuns() && pedantic ) exit(10); |
302 |
if ( l ){ |
if ( l ){ |
303 |
// |
// |
304 |
// if ( rg->OpenFile() ){ |
// if ( rg->OpenFile() ){ |
312 |
// |
// |
313 |
rg->Clean(); |
rg->Clean(); |
314 |
// |
// |
315 |
|
} else { |
316 |
|
RET = 255; |
317 |
}; |
}; |
318 |
|
} else { |
319 |
|
RET = 255; |
320 |
}; |
}; |
321 |
delete l; |
delete l; |
322 |
// |
// |
328 |
// |
// |
329 |
if ( dbc ) dbc->Close(); |
if ( dbc ) dbc->Close(); |
330 |
// |
// |
331 |
|
if ( debug ) printf(" exit with error code %i \n",RET); |
332 |
|
// |
333 |
printf("\n"); |
printf("\n"); |
334 |
// |
// |
335 |
exit(0); |
exit(RET); |
336 |
} |
} |