]>
Commit | Line | Data |
---|---|---|
871d7b56 CHC |
1 | void |
2 | CreateIndex(const TString& dir, const TString& tree="esdTree") | |
3 | { | |
4 | gROOT->SetMacroPath(Form("$ALICE_ROOT/PWGLF/FORWARD/trains:%s", | |
5 | gROOT->GetMacroPath())); | |
6 | gROOT->LoadMacro("ChainBuilder.C+"); | |
d7a13787 | 7 | gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C"); |
871d7b56 CHC |
8 | |
9 | Bool_t mc = false; | |
10 | if (tree.BeginsWith("mc")) { | |
11 | mc = true; | |
12 | tree.Remove(0,2); | |
13 | } | |
14 | ||
15 | TString pat("*.root"); | |
16 | if (tree.EqualTo("esdTree", TString::kIgnoreCase)) pat="AliESDs*"; | |
17 | else if (tree.EqualTo("aodTree", TString::kIgnoreCase)) pat="AliAOD*"; | |
18 | else Warning("", "Unknown tree: %s, pattern set to *.root", tree.Data()); | |
a19faec0 | 19 | if (mc) { |
20 | pat.Prepend("root_archive.zip@"); | |
21 | pat.ReplaceAll("*", ".root"); | |
22 | } | |
871d7b56 CHC |
23 | |
24 | ||
25 | TString opts; | |
26 | opts.Append(Form("pattern=%s", pat.Data())); | |
27 | opts.Append("&check"); | |
28 | opts.Append("&clean"); | |
29 | opts.Append("&recursive"); | |
d7a13787 | 30 | // opts.Append("&verbose"); |
871d7b56 CHC |
31 | if (mc) opts.Append("&mc"); |
32 | ||
a19faec0 | 33 | TString realDir(gSystem->ExpandPathName(dir.Data())); |
d7a13787 | 34 | if (realDir.EqualTo(".")) realDir = gSystem->WorkingDirectory(); |
a19faec0 | 35 | |
871d7b56 CHC |
36 | TUrl url; |
37 | url.SetProtocol("local"); | |
38 | url.SetPort(0); | |
a19faec0 | 39 | url.SetFile(realDir); |
871d7b56 CHC |
40 | url.SetAnchor(tree); |
41 | url.SetOptions(opts); | |
42 | ||
43 | Printf("Running ChainBuilder::CreateCollection(\"%s/index.root\",\"%s\")", | |
a19faec0 | 44 | realDir.Data(), url.GetUrl()); |
45 | ChainBuilder::CreateCollection(Form("%s/index.root", realDir.Data()), url); | |
871d7b56 CHC |
46 | } |
47 | ||
48 | ||
49 | ||
50 |