]>
Commit | Line | Data |
---|---|---|
49dc84d9 | 1 | TChain* CreateESDChain(const char* aDataDir, Int_t aRuns = 20, Bool_t aAddHeader = kTRUE) |
539b6cb4 | 2 | { |
3 | if (!aDataDir) | |
4 | return 0; | |
5 | ||
6 | TChain* chain = new TChain("esdTree"); | |
7 | TChain* chaingAlice = 0; | |
8 | ||
9 | if (aAddHeader != kFALSE) | |
10 | chaingAlice = new TChain("TE"); | |
11 | ||
12 | TString execDir(gSystem->pwd()); | |
13 | TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir); | |
14 | TList* dirList = baseDir->GetListOfFiles(); | |
15 | Int_t nDirs = dirList->GetEntries(); | |
16 | gSystem->cd(execDir); | |
17 | ||
49dc84d9 | 18 | Int_t count = 0; |
19 | ||
539b6cb4 | 20 | for (Int_t iDir=0; iDir<nDirs; ++iDir) |
21 | { | |
22 | TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir); | |
23 | if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0) | |
24 | continue; | |
25 | ||
49dc84d9 | 26 | if (count++ == aRuns) |
27 | break; | |
28 | ||
539b6cb4 | 29 | TString presentDirName(aDataDir); |
30 | presentDirName += "/"; | |
31 | presentDirName += presentDir->GetName(); | |
32 | ||
33 | chain->Add(presentDirName + "/AliESDs.root/esdTree"); | |
34 | ||
35 | if (aAddHeader != kFALSE) | |
36 | chaingAlice->Add(presentDirName + "/galice.root/TE"); | |
37 | } | |
38 | ||
39 | if (aAddHeader != kFALSE) | |
40 | chain->AddFriend(chaingAlice); | |
41 | ||
42 | return chain; | |
43 | } |