1 enum anaModes {mLocal,mLocalPAR,mPROOF,mGrid,mGridPAR};
2 //mLocal: Analyze locally files in your computer using aliroot
3 //mLocalPAR: Analyze locally files in your computer using root + PAR files
4 //mPROOF: Analyze CAF files with PROOF
5 //mGrid: Analyze files on Grid via AliEn plug-in and using precompiled FLOW libraries
6 // (Remark: When using this mode set also Bool_t bUseParFiles = kFALSE; in CreateAlienHandler.C)
7 //mGrid + par files: Analyze files on Grid via AliEn plug-in and using par files for FLOW package.
8 // Simply set Int_t mode = mGrid and Bool_t useFlowParFiles = kTRUE as arguments.
10 // CENTRALITY DEFINITION
11 Bool_t kUseCentrality = kFALSE;
12 Int_t binfirst = -1; //if kUseCentrality then change accordingly
13 Int_t binlast = -1; //if kUseCentrality then change accordingly
14 const Int_t numberOfCentralityBins = 9;
15 Float_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile
16 //Int_t centralityArray[numberOfCentralityBins+1] = {41,80,146,245,384,576,835,1203,1471,10000}; // in terms of TPC only reference multiplicity
18 TString commonOutputFileName = "AnalysisResults"; // e.g.: result for centrality bin 0 will be in the file "outputCentrality0.root", etc
21 //void runFlowTask(Int_t mode=mLocal, Int_t nRuns = 10,
22 //Bool_t DATA = kFALSE, const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset = 0)
24 //void runFlowTask(Int_t mode = mGridPAR, Int_t nRuns = 50000000,
25 // Bool_t DATA = kTRUE, const Char_t* dataDir="/alice/data/LHC10h_000137161_p1_plusplusplus", Int_t offset=0)
26 //void runFlowTask(Int_t mode = mLocal, Int_t nRuns = 50000000,
27 // Bool_t DATA = kTRUE, const Char_t* dataDir="./data/", Int_t offset=0)
28 //void runFlowTask(Int_t mode = mGridPAR, Bool_t DATA = kTRUE)
29 void runFlowTask(Int_t mode = mGrid,
30 Bool_t useFlowParFiles = kFALSE,
32 Bool_t useTender = kFALSE)
37 // Cross-check user settings before starting:
38 // CrossCheckUserSettings(DATA);
39 // Load needed libraries:
40 LoadLibraries(mode,useFlowParFiles);
41 // Create and configure the AliEn plug-in:
42 if(mode == mGrid || mode == mGridPAR)
44 gROOT->LoadMacro("CreateAlienHandler.C");
45 AliAnalysisGrid *alienHandler = CreateAlienHandler(useFlowParFiles);
46 if(!alienHandler) return;
49 if(mode == mLocal || mode == mLocalPAR) {
50 TChain *chain = new TChain("esdTree");
51 //chain->Add("/home/pchrist/ALICE/HeavyIons/Data/137161/Set1/AliESDs.root");
52 TChain* chain = CreateESDChain(dataDir, nRuns, offset);
53 //TChain* chain = CreateAODChain(dataDir, nRuns, offset);
56 // Create analysis manager:
57 AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager");
58 // Connect plug-in to the analysis manager:
59 if(mode == mGrid || mode == mGridPAR)
61 mgr->SetGridHandler(alienHandler);
65 AliVEventHandler* esdH = new AliESDInputHandler;
66 mgr->SetInputEventHandler(esdH);
68 AliMCEventHandler *mc = new AliMCEventHandler();
69 mgr->SetMCtruthEventHandler(mc);
72 // Task to check the offline trigger:
73 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
74 AddTaskPhysicsSelection(!DATA);
76 //Add the centrality determination task
78 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
83 //gROOT->LoadMacro("$ALICE_ROOT/PWG/FLOW/macros/AddTaskTenderFlow.C");
84 //AddTaskTenderFlow();
86 // Setup analysis and usage of centrality bins
87 gROOT->LoadMacro("AddTaskFlow.C");
88 Float_t kLowCentralityBin = -1.;
89 Float_t kHighCentralityBin = -1;
91 kLowCentralityBin = centralityArray[binfirst];
92 kHighCentralityBin = centralityArray[binlast];
94 AddTaskFlow(kLowCentralityBin,
96 commonOutputFileName);
98 // Enable debug printouts:
99 mgr->SetDebugLevel(2);
101 if(!mgr->InitAnalysis()) return;
103 if(mode == mLocal || mode == mLocalPAR) {
104 mgr->StartAnalysis("local",chain);
105 } else if(mode == mPROOF) {
106 mgr->StartAnalysis("proof",dataDir,nRuns,offset);
107 } else if(mode == mGrid || mode == mGridPAR) {
108 mgr->StartAnalysis("grid");
111 // Print real and CPU time used for analysis:
115 } // end of void runFlowTask(...)
117 //===============================================================================================
119 void CrossCheckUserSettings(Bool_t bData)
121 // Check in this method if the user settings make sense.
122 if(LYZ1SUM && LYZ2SUM) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<<endl; exit(0); }
123 if(LYZ1PROD && LYZ2PROD) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<<endl; exit(0); }
124 if(LYZ2SUM && LYZEP) {cout<<" WARNING: You cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2 !!!!"<<endl; exit(0); }
125 if(LYZ1SUM && LYZEP) {cout<<" WARNING: You cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2 !!!!"<<endl; exit(0); }
126 } // end of void CrossCheckUserSettings()
128 //===============================================================================================
130 void LoadLibraries(const anaModes mode, Bool_t useFlowParFiles )
132 //--------------------------------------
133 // Load the needed libraries most of them already loaded by aliroot
134 //--------------------------------------
136 gSystem->Load("libCore");
137 gSystem->Load("libTree");
138 gSystem->Load("libGeom");
139 gSystem->Load("libVMC");
140 gSystem->Load("libXMLIO");
141 gSystem->Load("libPhysics");
142 gSystem->Load("libXMLParser");
143 gSystem->Load("libProof");
144 gSystem->Load("libMinuit");
146 if (mode==mLocal || mode==mGrid)
148 gSystem->Load("libSTEERBase");
149 gSystem->Load("libCDB");
150 gSystem->Load("libRAWDatabase");
151 gSystem->Load("libRAWDatarec");
152 gSystem->Load("libESD");
153 gSystem->Load("libAOD");
154 gSystem->Load("libSTEER");
155 gSystem->Load("libANALYSIS");
156 gSystem->Load("libANALYSISalice");
157 gSystem->Load("libTPCbase");
158 gSystem->Load("libTOFbase");
159 gSystem->Load("libTOFrec");
160 gSystem->Load("libTRDbase");
161 gSystem->Load("libVZERObase");
162 gSystem->Load("libVZEROrec");
163 gSystem->Load("libT0base");
164 gSystem->Load("libT0rec");
165 gSystem->Load("libTENDER");
166 gSystem->Load("libTENDERSupplies");
170 AliAnalysisAlien::SetupPar("PWGflowBase");
171 AliAnalysisAlien::SetupPar("PWGflowTasks");
175 gSystem->Load("libPWGflowBase");
176 gSystem->Load("libPWGflowTasks");
179 else if (mode==mPROOF)
181 TList* list = new TList();
182 list->Add(new TNamed("ALIROOT_MODE", "ALIROOT"));
184 list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "ANALYSIS:ANALYSISalice:TENDER:TENDERSupplies"));
186 list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "ANALYSIS:ANALYSISalice:TENDER:TENDERSupplies:PWGflowBase:PWGflowTasks"));
188 //list->Add(new TNamed("ALIROOT_EXTRA_INCLUDES","PWG/FLOW/Base:PWG/FLOW/Tasks"));
191 printf("*** Connect to PROOF ***\n");
192 gEnv->SetValue("XSec.GSI.DelegProxy","2");
193 //TProof* proof = TProof::Open("alice-caf.cern.ch");
194 TProof* proof = TProof::Open("skaf.saske.sk");
196 // list the data available
197 //gProof->ShowDataSets("/*/*");
198 //gProof->ShowDataSets("/alice/sim/"); //for MC Data
199 //gProof->ShowDataSets("/alice/data/"); //for REAL Data
201 proof->ClearPackages();
202 proof->EnablePackage("VO_ALICE@AliRoot::v4-21-14-AN",list);
206 gProof->UploadPackage("PWGflowBase.par");
207 gProof->UploadPackage("PWGflowTasks.par");
210 // Show enables Packages
211 gProof->ShowEnabledPackages();
213 } // end of void LoadLibraries(const anaModes mode)
215 // Helper macros for creating chains
216 // from: CreateESDChain.C,v 1.10 jgrosseo Exp
218 TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
220 // creates chain of files in a given directory or file containing a list.
221 // In case of directory the structure is expected as:
222 // <aDataDir>/<dir0>/AliESDs.root
223 // <aDataDir>/<dir1>/AliESDs.root
229 Long_t id, size, flags, modtime;
230 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
232 printf("%s not found.\n", aDataDir);
236 TChain* chain = new TChain("esdTree");
237 TChain* chaingAlice = 0;
241 TString execDir(gSystem->pwd());
242 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
243 TList* dirList = baseDir->GetListOfFiles();
244 Int_t nDirs = dirList->GetEntries();
245 gSystem->cd(execDir);
249 for (Int_t iDir=0; iDir<nDirs; ++iDir)
251 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
252 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
261 if (count++ == aRuns)
264 TString presentDirName(aDataDir);
265 presentDirName += "/";
266 presentDirName += presentDir->GetName();
267 chain->Add(presentDirName + "/AliESDs.root/esdTree");
268 // cerr<<presentDirName<<endl;
274 // Open the input stream
280 // Read the input list of files and add them to the chain
284 if (!esdfile.Contains("root")) continue; // protection
292 if (count++ == aRuns)
304 } // end of TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
306 //===============================================================================================
308 TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)
310 // creates chain of files in a given directory or file containing a list.
311 // In case of directory the structure is expected as:
312 // <aDataDir>/<dir0>/AliAOD.root
313 // <aDataDir>/<dir1>/AliAOD.root
319 Long_t id, size, flags, modtime;
320 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
322 printf("%s not found.\n", aDataDir);
326 TChain* chain = new TChain("aodTree");
327 TChain* chaingAlice = 0;
331 TString execDir(gSystem->pwd());
332 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
333 TList* dirList = baseDir->GetListOfFiles();
334 Int_t nDirs = dirList->GetEntries();
335 gSystem->cd(execDir);
339 for (Int_t iDir=0; iDir<nDirs; ++iDir)
341 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
342 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
351 if (count++ == aRuns)
354 TString presentDirName(aDataDir);
355 presentDirName += "/";
356 presentDirName += presentDir->GetName();
357 chain->Add(presentDirName + "/AliAOD.root/aodTree");
358 // cerr<<presentDirName<<endl;
364 // Open the input stream
370 // Read the input list of files and add them to the chain
374 if (!aodfile.Contains("root")) continue; // protection
382 if (count++ == aRuns)
394 } // end of TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)