1 // from CreateESDChain.C - instead of #include "CreateESDChain.C"
2 TChain* CreateESDChain(const char* aDataDir = "ESDfiles.txt", Int_t aRuns = 20, Int_t offset = 0) ;
3 void LookupWrite(TChain* chain, const char* target) ;
5 void runAliAnalysisTaskCumulants(Int_t nRuns = 100, TString type = "ESD", const Char_t* dataDir="/data/alice2/ab2/", Int_t offset = 0)
6 //void runAliAnalysisTaskCumulants(Int_t nRuns = 2, TString type = "MC", const Char_t* dataDir="/Users/snelling/alice_data/TherminatorFix", Int_t offset = 0)
11 // include path (to find the .h files when compiling)
12 gSystem->AddIncludePath("-I$ALICE_ROOT/include") ;
13 gSystem->AddIncludePath("-I$ROOTSYS/include") ;
15 // load needed libraries
16 gSystem->Load("libTree.so");
17 gSystem->Load("libESD.so");
18 cerr<<"libESD loaded..."<<endl;
19 gSystem->Load("libANALYSIS.so");
20 cerr<<"libANALYSIS.so loaded..."<<endl;
21 gSystem->Load("libPWG2flow.so");
23 // gROOT->LoadMacro("AliFlowLYZConstants.cxx+");
24 // gROOT->LoadMacro("AliFlowCommonConstants.cxx+");
25 // gROOT->LoadMacro("AliFlowVector.cxx+");
26 // gROOT->LoadMacro("AliFlowTrackSimple.cxx+");
27 // gROOT->LoadMacro("AliFlowEventSimple.cxx+");
28 // gROOT->LoadMacro("AliFlowEventSimpleMaker.cxx+");
29 // gROOT->LoadMacro("AliFlowCommonHist.cxx+");
30 // gROOT->LoadMacro("AliFlowCommonHistResults.cxx+");
31 // gROOT->LoadMacro("AliFlowLYZHist1.cxx+");
32 // gROOT->LoadMacro("AliFlowLYZHist2.cxx+");
33 // gROOT->LoadMacro("AliFlowAnalysisWithLeeYangZeros.cxx+");
34 // gROOT->LoadMacro("AliAnalysisTaskLeeYangZeros.cxx+");
36 // create the TChain. CreateESDChain() is defined in CreateESDChain.C
37 TChain* chain = CreateESDChain(dataDir, nRuns, offset);
38 cout<<"chain ("<<chain<<")"<<endl;
40 //____________________________________________//
41 // Make the analysis manager
42 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
43 AliVEventHandler* esdH = new AliESDInputHandler;
44 mgr->SetInputEventHandler(esdH);
45 AliMCEventHandler *mc = new AliMCEventHandler();
46 mgr->SetMCtruthEventHandler(mc);
47 //____________________________________________//
49 AliAnalysisTaskCumulants *task1 = new AliAnalysisTaskCumulants("TaskCumulants");
50 task1->SetAnalysisType(type);
53 // Create containers for input/output
54 AliAnalysisDataContainer *cinput1 =
55 mgr->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
56 AliAnalysisDataContainer *coutput1 =
57 mgr->CreateContainer("cobj1", TList::Class(),AliAnalysisManager::kOutputContainer);
59 //____________________________________________//
60 mgr->ConnectInput(task1,0,cinput1);
61 mgr->ConnectOutput(task1,0,coutput1);
63 if (!mgr->InitAnalysis()) return;
65 mgr->StartAnalysis("local",chain);
72 // Helper macros for creating chains
73 // from: CreateESDChain.C,v 1.10 jgrosseo Exp
75 TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
77 // creates chain of files in a given directory or file containing a list.
78 // In case of directory the structure is expected as:
79 // <aDataDir>/<dir0>/AliESDs.root
80 // <aDataDir>/<dir1>/AliESDs.root
86 Long_t id, size, flags, modtime;
87 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
89 printf("%s not found.\n", aDataDir);
93 TChain* chain = new TChain("esdTree");
94 TChain* chaingAlice = 0;
98 TString execDir(gSystem->pwd());
99 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
100 TList* dirList = baseDir->GetListOfFiles();
101 Int_t nDirs = dirList->GetEntries();
102 gSystem->cd(execDir);
106 for (Int_t iDir=0; iDir<nDirs; ++iDir)
108 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
109 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
118 if (count++ == aRuns)
121 TString presentDirName(aDataDir);
122 presentDirName += "/";
123 presentDirName += presentDir->GetName();
124 chain->Add(presentDirName + "/AliESDs.root/esdTree");
125 cerr<<presentDirName<<endl;
131 // Open the input stream
137 // Read the input list of files and add them to the chain
141 if (!esdfile.Contains("root")) continue; // protection
149 if (count++ == aRuns)
162 void LookupWrite(TChain* chain, const char* target)
164 // looks up the chain and writes the remaining files to the text file target
168 TObjArray* list = chain->GetListOfFiles();
169 TIterator* iter = list->MakeIterator();
173 outfile.open(target);
175 while ((obj = iter->Next()))
176 outfile << obj->GetTitle() << "#AliESDs.root" << endl;