1 enum anaModes {mLocal,mPROOF,mGrid};
2 Int_t binfirst = 0; //where do we start numbering bins
3 Int_t binlast = 8; //where do we stop numbering bins
4 const Int_t numberOfCentralityBins = 9;
5 Float_t centralityArray[numberOfCentralityBins+1] = {0.,5.,10.,20.,30.,40.,50.,60.,70.,80.}; // in centrality percentile
6 //Int_t centralityArray[numberOfCentralityBins+1] = {41,80,146,245,384,576,835,1203,1471,10000}; // in terms of TPC only reference multiplicity
8 TString commonOutputFileName = "outputCentrality"; // e.g.: result for centrality bin 0 will be in the file "outputCentrality0.root", etc
10 void runFlowTaskCentralityKinkTrain( Int_t mode = mLocal,
11 Bool_t useFlowParFiles = kFALSE,
13 const Char_t* dataDir="fileList",
21 // Load needed libraries:
22 LoadLibraries(mode,useFlowParFiles);
24 // Create analysis manager:
25 AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager");
30 gROOT->LoadMacro("$ALICE_ROOT/PWGUD/macros/CreateESDChain.C");
31 TChain* chain = CreateESDChain(dataDir, nEvents, offset);
32 //TChain* chain = CreateAODChain(dataDir, nEvents, offset);
35 // Connect plug-in to the analysis manager:
38 gROOT->LoadMacro("CreateAlienHandler.C");
39 AliAnalysisGrid *alienHandler = CreateAlienHandler(useFlowParFiles);
40 if(!alienHandler) return;
41 mgr->SetGridHandler(alienHandler);
45 AliVEventHandler* esdH = new AliESDInputHandler;
46 mgr->SetInputEventHandler(esdH);
49 AliMCEventHandler *mc = new AliMCEventHandler();
50 mgr->SetMCtruthEventHandler(mc);
53 // Task to check the offline trigger:
54 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
55 AddTaskPhysicsSelection(!DATA);
57 //Add the centrality determination task
58 gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C");
59 AliCentralitySelectionTask* centSelTask = AddTaskCentrality();
60 if (!DATA) centSelTask->SetMCInput();
62 //add the PID response task
63 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
64 AliAnalysisTaskPIDResponse* pidresponsetask = AddTaskPIDResponse(!DATA);
67 //gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/AddTaskTenderTOF.C");
70 // Setup kink analysis per centrality bin:
71 gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityKink.C");
72 for (Int_t i=binfirst; i<binlast+1; i++)
74 Float_t lowCentralityBinEdge = centralityArray[i];
75 Float_t highCentralityBinEdge = centralityArray[i+1];
76 AddTaskFlowCentralityKink( lowCentralityBinEdge,
77 highCentralityBinEdge,
80 AliFlowTrackCuts::kTOFbeta,
82 AddTaskFlowCentralityKink( lowCentralityBinEdge,
83 highCentralityBinEdge,
86 AliFlowTrackCuts::kTOFbeta,
88 AddTaskFlowCentralityKink( lowCentralityBinEdge,
89 highCentralityBinEdge,
92 AliFlowTrackCuts::kTOFbeta,
94 AddTaskFlowCentralityKink( lowCentralityBinEdge,
95 highCentralityBinEdge,
98 AliFlowTrackCuts::kTOFbeta,
100 } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)
102 // Setup kaon analysis per centrality bin:
103 gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityPID.C");
104 for (Int_t i=binfirst; i<binlast+1; i++)
106 Float_t lowCentralityBinEdge = centralityArray[i];
107 Float_t highCentralityBinEdge = centralityArray[i+1];
108 AddTaskFlowCentralityPID( lowCentralityBinEdge,
109 highCentralityBinEdge,
110 commonOutputFileName,
112 AliFlowTrackCuts::kTOFbeta,
114 AddTaskFlowCentralityPID( lowCentralityBinEdge,
115 highCentralityBinEdge,
116 commonOutputFileName,
118 AliFlowTrackCuts::kTOFbeta,
120 AddTaskFlowCentralityPID( lowCentralityBinEdge,
121 highCentralityBinEdge,
122 commonOutputFileName,
124 AliFlowTrackCuts::kTOFbeta,
126 AddTaskFlowCentralityPID( lowCentralityBinEdge,
127 highCentralityBinEdge,
128 commonOutputFileName,
130 AliFlowTrackCuts::kTOFbeta,
132 } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)
134 // Setup He3 analysis per centrality bin:
135 gROOT->LoadMacro("$ALICE_ROOT/PWGCF/FLOW/macros/Kinks/AddTaskFlowCentralityPID.C");
136 for (Int_t i=binfirst; i<binlast+1; i++)
138 Float_t lowCentralityBinEdge = centralityArray[i];
139 Float_t highCentralityBinEdge = centralityArray[i+1];
140 AddTaskFlowCentralityPID( lowCentralityBinEdge,
141 highCentralityBinEdge,
142 commonOutputFileName,
144 AliFlowTrackCuts::kTPCNuclei,
146 AddTaskFlowCentralityPID( lowCentralityBinEdge,
147 highCentralityBinEdge,
148 commonOutputFileName,
150 AliFlowTrackCuts::kTPCNuclei,
152 AddTaskFlowCentralityPID( lowCentralityBinEdge,
153 highCentralityBinEdge,
154 commonOutputFileName,
156 AliFlowTrackCuts::kTPCNuclei,
158 AddTaskFlowCentralityPID( lowCentralityBinEdge,
159 highCentralityBinEdge,
160 commonOutputFileName,
162 AliFlowTrackCuts::kTPCNuclei,
164 } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)
166 // Enable debug printouts:
167 mgr->SetDebugLevel(2);
169 if(!mgr->InitAnalysis()) return;
173 mgr->StartAnalysis("local",chain);
175 else if(mode == mPROOF)
177 mgr->StartAnalysis("proof",dataDir,nEvents,offset);
179 else if(mode == mGrid)
181 mgr->StartAnalysis("grid");
184 // Print real and CPU time used for analysis:
188 } // end of void runFlowTaskCentralityPIDTrain(...)
190 //===============================================================================================
192 void CrossCheckUserSettings(Bool_t bData)
194 // Check in this method if the user settings make sense.
195 if(LYZ1SUM && LYZ2SUM) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<<endl; exit(0); }
196 if(LYZ1PROD && LYZ2PROD) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<<endl; exit(0); }
197 if(LYZ2SUM && LYZEP) {cout<<" WARNING: You cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2 !!!!"<<endl; exit(0); }
198 if(LYZ1SUM && LYZEP) {cout<<" WARNING: You cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2 !!!!"<<endl; exit(0); }
199 } // end of void CrossCheckUserSettings()
201 //===============================================================================================
203 void LoadLibraries(const anaModes mode, Bool_t useFlowParFiles )
205 //--------------------------------------
206 // Load the needed libraries most of them already loaded by aliroot
207 //--------------------------------------
209 gSystem->Load("libCore");
210 gSystem->Load("libTree");
211 gSystem->Load("libGeom");
212 gSystem->Load("libVMC");
213 gSystem->Load("libXMLIO");
214 gSystem->Load("libPhysics");
215 gSystem->Load("libXMLParser");
216 gSystem->Load("libProof");
217 gSystem->Load("libMinuit");
219 if (mode==mLocal || mode==mGrid)
221 gSystem->Load("libSTEERBase");
222 gSystem->Load("libCDB");
223 gSystem->Load("libRAWDatabase");
224 gSystem->Load("libRAWDatarec");
225 gSystem->Load("libESD");
226 gSystem->Load("libAOD");
227 gSystem->Load("libSTEER");
228 gSystem->Load("libANALYSIS");
229 gSystem->Load("libANALYSISalice");
230 gSystem->Load("libTPCbase");
231 gSystem->Load("libTOFbase");
232 gSystem->Load("libTOFrec");
233 gSystem->Load("libTRDbase");
234 gSystem->Load("libVZERObase");
235 gSystem->Load("libVZEROrec");
236 gSystem->Load("libT0base");
237 gSystem->Load("libT0rec");
238 gSystem->Load("libTender");
239 gSystem->Load("libTenderSupplies");
243 AliAnalysisAlien::SetupPar("PWGflowBase");
244 AliAnalysisAlien::SetupPar("PWGflowTasks");
248 gSystem->Load("libPWGflowBase");
249 gSystem->Load("libPWGflowTasks");
252 else if (mode==mPROOF)
254 TList* list = new TList();
255 list->Add(new TNamed("ALIROOT_MODE", "ALIROOT"));
257 list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "ANALYSIS:ANALYSISalice:Tender:TenderSupplies"));
259 list->Add(new TNamed("ALIROOT_EXTRA_LIBS", "ANALYSIS:ANALYSISalice:Tender:TenderSupplies:PWGflowBase:PWGflowTasks"));
261 //list->Add(new TNamed("ALIROOT_EXTRA_INCLUDES","PWG/FLOW/Base:PWG/FLOW/Tasks"));
264 printf("*** Connect to PROOF ***\n");
265 gEnv->SetValue("XSec.GSI.DelegProxy","2");
266 //TProof* proof = TProof::Open("alice-caf.cern.ch");
267 TProof* proof = TProof::Open("skaf.saske.sk");
269 // list the data available
270 //gProof->ShowDataSets("/*/*");
271 //gProof->ShowDataSets("/alice/sim/"); //for MC Data
272 //gProof->ShowDataSets("/alice/data/"); //for REAL Data
274 proof->ClearPackages();
275 proof->EnablePackage("VO_ALICE@AliRoot::v4-21-14-AN",list);
279 gProof->UploadPackage("PWGflowBase.par");
280 gProof->UploadPackage("PWGflowTasks.par");
283 // Show enables Packages
284 gProof->ShowEnabledPackages();
286 } // end of void LoadLibraries(const anaModes mode)
288 //===============================================================================================
290 TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)
292 // creates chain of files in a given directory or file containing a list.
293 // In case of directory the structure is expected as:
294 // <aDataDir>/<dir0>/AliAOD.root
295 // <aDataDir>/<dir1>/AliAOD.root
301 Long_t id, size, flags, modtime;
302 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
304 printf("%s not found.\n", aDataDir);
308 TChain* chain = new TChain("aodTree");
309 TChain* chaingAlice = 0;
313 TString execDir(gSystem->pwd());
314 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
315 TList* dirList = baseDir->GetListOfFiles();
316 Int_t nDirs = dirList->GetEntries();
317 gSystem->cd(execDir);
321 for (Int_t iDir=0; iDir<nDirs; ++iDir)
323 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
324 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
333 if (count++ == aRuns)
336 TString presentDirName(aDataDir);
337 presentDirName += "/";
338 presentDirName += presentDir->GetName();
339 chain->Add(presentDirName + "/AliAOD.root/aodTree");
340 // cerr<<presentDirName<<endl;
346 // Open the input stream
352 // Read the input list of files and add them to the chain
357 if (!aodfile.Contains("root")) continue; // protection
365 if (count++ == aRuns)
377 } // end of TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)