AliPhysics  251aa1e (251aa1e)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CreateIndex.C
Go to the documentation of this file.
1 void
2 CreateIndex(const TString& dir, const TString& tree="esdTree",
3  const char* remote=0)
4 {
5  gROOT->SetMacroPath(Form("$ALICE_PHYSICS/PWGLF/FORWARD/trains:%s",
6  gROOT->GetMacroPath()));
7  gROOT->LoadMacro("ChainBuilder.C+");
8  gROOT->Macro("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
9 
10  Bool_t mc = false;
11  Bool_t zip = false;
12  if (tree.BeginsWith("mc")) {
13  mc = true;
14  zip = true;
15  tree.Remove(0,2);
16  }
17  if (tree.BeginsWith("zip")) {
18  zip = true;
19  tree.Remove(0,3);
20  }
21 
22  TString pat("*.root");
23  if (tree.EqualTo("esdTree", TString::kIgnoreCase)) pat="AliESDs*";
24  else if (tree.EqualTo("aodTree", TString::kIgnoreCase)) pat="AliAOD*";
25  else Warning("", "Unknown tree: %s, pattern set to *.root", tree.Data());
26  if (zip) {
27  pat.Prepend("root_archive.zip@");
28  pat.ReplaceAll("*", ".root");
29  }
30 
31 
32  TString opts;
33  opts.Append(Form("pattern=%s", pat.Data()));
34  opts.Append("&check");
35  opts.Append("&clean");
36  opts.Append("&recursive");
37  opts.Append("&verbose");
38  if (mc) opts.Append("&mc");
39 
40  TString realDir(dir);
41  if (!remote) realDir = gSystem->ExpandPathName(dir.Data());
42  if (realDir.EqualTo(".")) realDir = gSystem->WorkingDirectory();
43 
44  TUrl url;
45  url.SetProtocol("local");
46  url.SetPort(0);
47  url.SetFile(realDir);
48  url.SetAnchor(tree);
49  url.SetOptions(opts);
50 
51  Printf("Running ChainBuilder::CreateCollection(\"%s/index.root\",\"%s\")",
52  realDir.Data(), url.GetUrl());
53  TString out(Form("%s/%s.root", realDir.Data(),
54  !remote ? "index" : "remote"));
55  ChainBuilder::CreateCollection(out, url, remote);
56 }
57 
58 
59 
60 
const char * url
TSystem * gSystem
Definition: External.C:92
static void CreateCollection(const TString &output, const TUrl &url, const char *remote=0)
Definition: ChainBuilder.C:364
bool Bool_t
Definition: External.C:53
void CreateIndex(const TString &dir, const TString &tree="esdTree", const char *remote=0)
Definition: CreateIndex.C:2