3 // Helper macros for creating chains
5 TChain* CreateESDChainFromDir(const char* aDataDir, Int_t aRuns = 20, Int_t offset = 0)
7 // creates chain of files in a given directory. The structure is expected as:
8 // <aDataDir>/<dir0>/AliESDs.root
9 // <aDataDir>/<dir1>/AliESDs.root
15 TChain* chain = new TChain("esdTree");
16 TChain* chaingAlice = 0;
18 TString execDir(gSystem->pwd());
19 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
20 TList* dirList = baseDir->GetListOfFiles();
21 Int_t nDirs = dirList->GetEntries();
26 for (Int_t iDir=0; iDir<nDirs; ++iDir)
28 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
29 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
41 TString presentDirName(aDataDir);
42 presentDirName += "/";
43 presentDirName += presentDir->GetName();
45 chain->Add(presentDirName + "/AliESDs.root/esdTree");
51 TChain* CreateESDChainFromList(const char* listFile, Int_t aRuns = 20, Int_t offset = 0)
53 // Creates a chain from a file which contains a list of ESD files
58 TChain* chain = new TChain("esdTree");
59 TChain* chaingAlice = 0;
61 // Open the input stream
67 // Read the input list of files and add them to the chain
71 if (!esdfile.Contains("root")) continue; // protection