1) Added "Makefile support": LinkDef + pkg file, made header files compliant
[u/mrichter/AliRoot.git] / PWG0 / CreateESDChain.C
CommitLineData
539b6cb4 1TChain* CreateESDChain(const char* aDataDir, Bool_t aAddHeader = kTRUE)
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
18 for (Int_t iDir=0; iDir<nDirs; ++iDir)
19 {
20 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
21 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
22 continue;
23
24 TString presentDirName(aDataDir);
25 presentDirName += "/";
26 presentDirName += presentDir->GetName();
27
28 chain->Add(presentDirName + "/AliESDs.root/esdTree");
29
30 if (aAddHeader != kFALSE)
31 chaingAlice->Add(presentDirName + "/galice.root/TE");
32 }
33
34 if (aAddHeader != kFALSE)
35 chain->AddFriend(chaingAlice);
36
37 return chain;
38}