16 if (!TGrid::Connect(
"alien://")) {
17 Error(
"GridDownloadAODs",
"Failed to connect to AliEn");
20 Printf(
"Directory: %s", url);
21 Printf(
"Verbosity: %d", verbose);
22 Printf(
"Force: %d", force);
27 TGridResult* r = gGrid->Query(dir,pat);
29 Error(
"GridDownloadAODs",
"No result from query");
36 Int_t n = r->GetEntries();
37 Int_t save = gErrorIgnoreLevel;
38 if (verbose) Printf(
"=== Got a total of %d AOD files",n);
39 for (
Int_t i = 0; i < n; i++) {
40 TString path(r->GetKey(i,
"turl"));
44 TString out = TString::Format(
"AliAOD_%s_%s.root",
45 subsub.Data(),sub.Data());
46 if (!
gSystem->AccessPathName(out.Data()) && !force) {
47 if (verbose) Printf(
"=== Already have %s",out.Data());
50 if (verbose) Printf(
"=== Getting %s %s (%3d/%3d)",
51 subsub.Data(),sub.Data(),i,n);
53 printf(
"%5d/%5d %22s ", i+1, n, out.Data());
57 gErrorIgnoreLevel = kError;
58 if (!TFile::Cp(path, out, verbose)) {
59 gErrorIgnoreLevel = save;
60 Warning(
"DownloadAODs",
"Failed to copy %s -> %s",
61 path.Data(), out.Data());
65 gErrorIgnoreLevel = save;
66 if (verbose)
continue;
72 printf(
"%5.1f%% [%3d copied] ETA: %4d:%02d:%02d (%5.1fs/file)\r",
void GridDownloadAODs(const char *url, Bool_t verbose=false, Bool_t force=false)