]>
Commit | Line | Data |
---|---|---|
fdfd93b4 | 1 | void |
2 | CreateFileCollection(const TString& dir="/data/alice/data/ppb/LHC12g/pass1/188359/", | |
3 | const TString& tN="esdTree", | |
4 | const TString& pa="AliESD", | |
5 | Bool_t mc=false, | |
6 | Bool_t recursive=false) | |
7 | ) | |
8 | { | |
9 | gROOT->LoadMacro("ChainBuilder.C+"); | |
10 | ||
11 | UShort_t type = ChainBuilder::CheckSource(dir); | |
12 | Info("", "type=%d", type); | |
13 | TChain* chain = ChainBuilder::Create(dir, tN, pa, mc, recursive); | |
14 | if (!chain) { | |
15 | Error("CreateFileCollection", "Failed to make chain"); | |
16 | return; | |
17 | } | |
18 | Int_t port; | |
19 | TString host; | |
20 | { | |
21 | TUrl u(Form("root://%s//foo", gSystem->HostName())); | |
22 | port = u.GetPort() * 10; | |
23 | host = u.GetHostFQDN(); | |
24 | } | |
25 | ||
26 | ||
27 | TFileCollection* fc = new TFileCollection("files"); | |
28 | TObjArray* cEs = chain->GetListOfFiles(); | |
29 | TChainElement* cE = 0; | |
30 | TIter next(cEs); | |
31 | while ((cE= static_cast<TChainElement*>(next()))) { | |
32 | TString fN(cE->GetTitle()); | |
33 | TFile* f = TFile::Open(fN, "READ"); | |
34 | TTree* t = static_cast<TTree*>(f->Get(tN)); | |
35 | ||
36 | fN.Prepend(Form("root://%s:%d/", host.Data(), port)); | |
37 | TFileInfo* fi = new TFileInfo(Form("%s tree:%s,%d", | |
38 | fN.Data(), tN.Data(), t->GetEntries()), | |
39 | f->GetSize()); | |
40 | f->Close(); | |
41 | fc->Add(fi); | |
42 | } | |
43 | fc->Print("F"); | |
44 | ||
45 | TFile* files = TFile::Open("files.root", "RECREATE"); | |
46 | fc->Write(); | |
47 | files->Close(); | |
48 | ||
49 | } |