3 // Helper macros for creating chains
5 TChain* CreateESDChain(const char* aDataDir, Int_t aRuns = 20, Int_t offset = 0)
7 // creates chain of files in a given directory or file containing a list.
8 // In case of directory the structure is expected as:
9 // <aDataDir>/<dir0>/AliESDs.root
10 // <aDataDir>/<dir1>/AliESDs.root
16 Long_t id, size, flags, modtime;
17 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
19 print("%s not found.\n", aDataDir);
23 TChain* chain = new TChain("esdTree");
24 TChain* chaingAlice = 0;
28 TString execDir(gSystem->pwd());
29 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
30 TList* dirList = baseDir->GetListOfFiles();
31 Int_t nDirs = dirList->GetEntries();
36 for (Int_t iDir=0; iDir<nDirs; ++iDir)
38 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
39 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
51 TString presentDirName(aDataDir);
52 presentDirName += "/";
53 presentDirName += presentDir->GetName();
55 chain->Add(presentDirName + "/AliESDs.root/esdTree");
60 // Open the input stream
66 // Read the input list of files and add them to the chain
70 if (!esdfile.Contains("root")) continue; // protection