]>
Commit | Line | Data |
---|---|---|
f5731d66 | 1 | /* |
2 | * this macros connects to ALIEN and searches for TOFQA.root | |
3 | * files in the provided search dir. the files are merged in | |
4 | * a single local TOFQA.root file. | |
5 | * the output file can be used both to check QA histos merged | |
6 | * over more files and to use them to provide reference QA | |
7 | * histos merged over more runs (the starting reference histos | |
8 | * will be histo from MC production/reconstruction process). | |
9 | */ | |
10 | ||
11 | MergeQAHistos(const Char_t *searchDir = "/alice/sim/PDC_09/LHC09a4/80050", Int_t maxFiles = kMaxInt) | |
12 | { | |
13 | ||
14 | const Char_t *fileName = "TOFQA.root"; | |
15 | ||
16 | TGrid *gGrid = TGrid::Connect("alien"); | |
17 | if (!gGrid || !gGrid->IsConnected()) { | |
18 | AliError("cannot connect to ALIEN"); | |
19 | return; | |
20 | } | |
21 | ||
22 | TGridResult *gr = gGrid->Query(searchDir, fileName); | |
23 | if (gr->GetEntries() < 1) { | |
24 | printf("less than one input files: abort\n"); | |
25 | return; | |
26 | } | |
27 | printf("%d files found\n", gr->GetEntries()); | |
28 | ||
29 | TFileMerger merger; | |
30 | merger.OutputFile(fileName); | |
31 | ||
32 | Int_t mergedFiles = 0; | |
33 | Int_t nFiles = gr->GetEntries(); | |
34 | for (Int_t i = 0; i < nFiles && i < maxFiles; i++) { | |
35 | ||
36 | if (merger.AddFile(gr->GetKey(i, "turl"))) | |
37 | mergedFiles++; | |
38 | ||
39 | } | |
40 | ||
41 | merger.Merge(); | |
42 | printf("merged %d files\n", mergedFiles); | |
43 | printf("output written on %s\n", fileName); | |
44 | } | |
45 |