1 enum anaModes {mLocal,mPROOF,mGrid};
2 //mLocal: Analyze locally files in your computer using aliroot
3 //mPROOF: Analyze CAF files with PROOF
4 //mGrid: Analyze files on Grid via AliEn plug-in and using precompiled FLOW libraries
6 // CENTRALITY DEFINITION
7 //Int_t binfirst = 4; //where do we start numbering bins
8 //Int_t binlast = 6; //where do we stop numbering bins
9 //const Int_t numberOfCentralityBins = 9;
10 //Int_t binfirst = 1; //where do we start numbering bins
11 //Int_t binlast = 2; //where do we stop numbering bins
12 //const Int_t numberOfCentralityBins = 9;
13 //Float_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile
14 //Int_t centralityArray[numberOfCentralityBins+1] = {41,80,146,245,384,576,835,1203,1471,10000}; // in terms of TPC only reference multiplicity
16 TString commonOutputFileName = "output"; // e.g.: result for centrality bin 0 will be in the file "outputCentrality0.root", etc
18 void runTaskFlowOnMC(Int_t harmonic = 2,
19 Double_t gImpactParameterMin = 0.0,
20 Double_t gImpactParameterMax = 100.0,
21 Int_t gRefMultMin = 0,
22 Int_t gRefMultMax = 100,
23 Double_t etaMax = 1.3,
24 Double_t ptMin = 0.05,
25 Double_t ptMax = 20.0,
28 Bool_t useFlowParFiles = kFALSE,
29 Bool_t useTender = kFALSE) {
34 // Load needed libraries:
35 LoadLibraries(mode,useFlowParFiles);
38 commonOutputFileName += ".etaMax.";
39 commonOutputFileName += etaMax;
40 commonOutputFileName += ".harmonics.";
41 commonOutputFileName += harmonic;
43 // Create analysis manager:
44 AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager");
48 TChain *chain = new TChain("TE");
49 chain->Add("galice.root");
52 // Connect plug-in to the analysis manager:
54 gROOT->LoadMacro("CreateAlienHandler.C");
55 AliAnalysisGrid *alienHandler = CreateAlienHandler();
56 if(!alienHandler) return;
57 mgr->SetGridHandler(alienHandler);
61 AliVEventHandler* esdH = new AliESDInputHandler;
62 mgr->SetInputEventHandler(esdH);
63 AliMCEventHandler *mc = new AliMCEventHandler();
64 mc->SetReadTR(kFALSE);
65 mgr->SetMCtruthEventHandler(mc);
69 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FLOW/macros/AddTaskTenderFlow.C");
73 // Setup analysis per centrality bin:
74 gROOT->LoadMacro("AddTaskFlowOnMC.C");
75 AddTaskFlowOnMC(commonOutputFileName,
86 // Enable debug printouts:
87 mgr->SetDebugLevel(2);
89 if(!mgr->InitAnalysis()) return;
92 mgr->StartAnalysis("local",chain);
94 else if(mode == mPROOF) {
95 mgr->StartAnalysis("proof",dataDir,nEvents,offset);
97 else if(mode == mGrid) {
98 mgr->StartAnalysis("grid");
101 // Print real and CPU time used for analysis:
105 } // end of void runTaskFlowOnMC(...)
107 //===============================================================================================
109 void CrossCheckUserSettings(Bool_t bData)
111 // Check in this method if the user settings make sense.
112 if(LYZ1SUM && LYZ2SUM) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<<endl; exit(0); }
113 if(LYZ1PROD && LYZ2PROD) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<<endl; exit(0); }
114 if(LYZ2SUM && LYZEP) {cout<<" WARNING: You cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2 !!!!"<<endl; exit(0); }
115 if(LYZ1SUM && LYZEP) {cout<<" WARNING: You cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2 !!!!"<<endl; exit(0); }
116 } // end of void CrossCheckUserSettings()
118 //===============================================================================================
120 void LoadLibraries(const anaModes mode, Bool_t useFlowParFiles ) {
121 //--------------------------------------
122 // Load the needed libraries most of them already loaded by aliroot
123 //--------------------------------------
125 gSystem->Load("libCore");
126 gSystem->Load("libTree");
127 gSystem->Load("libGeom");
128 gSystem->Load("libVMC");
129 gSystem->Load("libXMLIO");
130 gSystem->Load("libPhysics");
131 gSystem->Load("libXMLParser");
132 gSystem->Load("libProof");
133 gSystem->Load("libMinuit");
135 if (mode==mLocal || mode==mGrid)
137 gSystem->Load("libSTEERBase");
138 gSystem->Load("libCDB");
139 gSystem->Load("libRAWDatabase");
140 gSystem->Load("libRAWDatarec");
141 gSystem->Load("libESD");
142 gSystem->Load("libAOD");
143 gSystem->Load("libSTEER");
144 gSystem->Load("libANALYSIS");
145 gSystem->Load("libANALYSISalice");
146 gSystem->Load("libTPCbase");
147 gSystem->Load("libTOFbase");
148 gSystem->Load("libTOFsim");
149 gSystem->Load("libTOFrec");
150 gSystem->Load("libTRDbase");
151 gSystem->Load("libVZERObase");
152 gSystem->Load("libVZEROrec");
153 gSystem->Load("libT0base");
154 gSystem->Load("libT0rec");
155 gSystem->Load("libTENDER");
156 gSystem->Load("libTENDERSupplies");
160 AliAnalysisAlien::SetupPar("PWGflowBase");
161 AliAnalysisAlien::SetupPar("PWGflowTasks");
165 gSystem->Load("libPWGflowBase");
166 gSystem->Load("libPWGflowTasks");
169 else if (mode==mPROOF)
171 TList* list = new TList();
172 list->Add(new TNamed("ALIROOT_MODE", "ALIROOT"));
174 list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "ANALYSIS:ANALYSISalice:TENDER:TENDERSupplies"));
176 list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "ANALYSIS:ANALYSISalice:TENDER:TENDERSupplies:PWG2flowCommon:PWG2flowTasks"));
178 //list->Add(new TNamed("ALIROOT_EXTRA_INCLUDES","PWG2/FLOW/AliFlowCommon:PWG2/FLOW/AliFlowTasks"));
181 printf("*** Connect to PROOF ***\n");
182 gEnv->SetValue("XSec.GSI.DelegProxy","2");
183 //TProof* proof = TProof::Open("alice-caf.cern.ch");
184 TProof* proof = TProof::Open("skaf.saske.sk");
186 // list the data available
187 //gProof->ShowDataSets("/*/*");
188 //gProof->ShowDataSets("/alice/sim/"); //for MC Data
189 //gProof->ShowDataSets("/alice/data/"); //for REAL Data
191 proof->ClearPackages();
192 proof->EnablePackage("VO_ALICE@AliRoot::v4-21-14-AN",list);
196 gProof->UploadPackage("PWG2flowCommon.par");
197 gProof->UploadPackage("PWG2flowTasks.par");
200 // Show enables Packages
201 gProof->ShowEnabledPackages();
203 } // end of void LoadLibraries(const anaModes mode)
205 // Helper macros for creating chains
206 // from: CreateESDChain.C,v 1.10 jgrosseo Exp
207 TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
209 // creates chain of files in a given directory or file containing a list.
210 // In case of directory the structure is expected as:
211 // <aDataDir>/<dir0>/AliESDs.root
212 // <aDataDir>/<dir1>/AliESDs.root
218 Long_t id, size, flags, modtime;
219 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
221 printf("%s not found.\n", aDataDir);
225 TChain* chain = new TChain("esdTree");
226 TChain* chaingAlice = 0;
230 TString execDir(gSystem->pwd());
231 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
232 TList* dirList = baseDir->GetListOfFiles();
233 Int_t nDirs = dirList->GetEntries();
234 gSystem->cd(execDir);
238 for (Int_t iDir=0; iDir<nDirs; ++iDir)
240 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
241 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
250 if (count++ == aRuns)
253 TString presentDirName(aDataDir);
254 presentDirName += "/";
255 presentDirName += presentDir->GetName();
256 chain->Add(presentDirName + "/AliESDs.root/esdTree");
257 // cerr<<presentDirName<<endl;
263 // Open the input stream
269 // Read the input list of files and add them to the chain
274 if (!esdfile.Contains("root")) continue; // protection
282 if (count++ == aRuns)
294 } // end of TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
296 //===============================================================================================
298 TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)
300 // creates chain of files in a given directory or file containing a list.
301 // In case of directory the structure is expected as:
302 // <aDataDir>/<dir0>/AliAOD.root
303 // <aDataDir>/<dir1>/AliAOD.root
309 Long_t id, size, flags, modtime;
310 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
312 printf("%s not found.\n", aDataDir);
316 TChain* chain = new TChain("aodTree");
317 TChain* chaingAlice = 0;
321 TString execDir(gSystem->pwd());
322 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
323 TList* dirList = baseDir->GetListOfFiles();
324 Int_t nDirs = dirList->GetEntries();
325 gSystem->cd(execDir);
329 for (Int_t iDir=0; iDir<nDirs; ++iDir)
331 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
332 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
341 if (count++ == aRuns)
344 TString presentDirName(aDataDir);
345 presentDirName += "/";
346 presentDirName += presentDir->GetName();
347 chain->Add(presentDirName + "/AliAOD.root/aodTree");
348 // cerr<<presentDirName<<endl;
354 // Open the input stream
360 // Read the input list of files and add them to the chain
365 if (!aodfile.Contains("root")) continue; // protection
373 if (count++ == aRuns)
385 } // end of TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)