]>
Commit | Line | Data |
---|---|---|
73160af6 | 1 | ///////////////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // HOW TO USE THIS MACRO: | |
4 | // | |
5 | // With this macro several flow analysis can be run. | |
6 | // SP = Scalar Product (for PbPb or pp) | |
7 | // LYZ1 = Lee Yang Zeroes first run (for PbPb) | |
8 | // LYZ2 = Lee Yang Zeroes second run (for PbPb) | |
9 | // LYZEP = Lee Yang Zeroes Event Plane (for PbPb) | |
10 | // GFC = Cumulants (for PbPb) | |
11 | // QC = Q-cumulants (for PbPb or pp) | |
12 | // FQD = Fitting q-distribution (for PbPb) | |
13 | // MCEP = Flow calculated from the real MC event plane (for PbPb only) | |
14 | // | |
15 | // The LYZ analysis should be done in the following order; | |
16 | // LYZ1 -> LYZ2 -> LYZEP, | |
17 | // because LYZ2 depends on the outputfile of LYZ1 and LYZEP on the outputfile | |
18 | // of LYZ2. | |
19 | // | |
20 | // The MCEP method is a reference method. | |
21 | // It can only be run when MC information (kinematics.root & galice.root file) | |
22 | // is available in which the reaction plane is stored. | |
23 | // | |
24 | // One can run on ESD, AOD or MC. | |
25 | // Additional options are ESDMC0, ESDMC1. In these options the ESD and MC | |
26 | // information is combined. Tracks are selected in the ESD, the PID information | |
27 | // is taken from the MC (perfect PID). For ESDMC0 the track kinematics is taken | |
28 | // from the ESD and for ESDMC1 it is taken from the MC information. | |
29 | // | |
30 | // the macro can be used to run local in aliroot or root, on the grid and on caf | |
31 | /////////////////////////////////////////////////////////////////////////////////// | |
32 | ||
33 | enum anaModes {mLocal,mLocalPAR,mPROOF,mGRID}; | |
34 | //mLocal: Analyze locally files in your computer using aliroot | |
35 | //mLocalPAR: Analyze locally files in your computer using root + PAR files | |
36 | //mPROOF: Analyze CAF files with PROOF | |
37 | ||
38 | // Analysis type can be ESD, AOD, MC, ESDMC0, ESDMC1 | |
39 | const TString type = "ESD"; | |
40 | ||
41 | // RUN SETTINGS | |
42 | // Flow analysis method can be:(set to kTRUE or kFALSE) | |
43 | Bool_t SP = kTRUE; | |
44 | Bool_t LYZ1 = kTRUE; | |
45 | Bool_t LYZ2 = kFALSE; | |
46 | Bool_t LYZEP = kFALSE; | |
47 | Bool_t GFC = kTRUE; | |
48 | Bool_t QC = kTRUE; | |
49 | Bool_t FQD = kTRUE; | |
50 | Bool_t MCEP = kTRUE; | |
51 | ||
52 | // Boolean to fill/not fill the QA histograms | |
53 | Bool_t QA = kFALSE; | |
54 | ||
55 | // Weights | |
56 | //Use weights for Q vector | |
57 | Bool_t usePhiWeights = kFALSE; //Phi | |
58 | Bool_t usePtWeights = kFALSE; //v'(pt) | |
59 | Bool_t useEtaWeights = kFALSE; //v'(eta) | |
60 | Bool_t useWeights = usePhiWeights||usePtWeights||useEtaWeights; | |
61 | ||
62 | ||
63 | void runFlowTask(Int_t mode=mLocal, Int_t nRuns = -1, const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset=0) | |
64 | { | |
65 | ||
66 | TStopwatch timer; | |
67 | timer.Start(); | |
68 | ||
69 | if (LYZ1 && LYZ2) {cout<<"WARNING: you cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1."<<endl; exit(); } | |
70 | if (LYZ2 && LYZEP) {cout<<"WARNING: you cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl; exit(); } | |
71 | if (LYZ1 && LYZEP) {cout<<"WARNING: you cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl; exit(); } | |
72 | ||
73 | LoadLibraries(mode); | |
74 | ||
75 | if (mode==mLocal || mode == mLocalPAR || mode == mGRID) { | |
76 | if (type!="AOD") {TChain* chain = CreateESDChain(dataDir, nRuns, offset);} | |
77 | else { TChain* chain = CreateAODChain(dataDir, nRuns, offset);} | |
78 | } | |
79 | ||
80 | //____________________________________________// | |
81 | //external input files | |
82 | //weights: | |
83 | TFile *weightsFile = NULL; | |
84 | TList *weightsList = NULL; | |
85 | ||
86 | if(useWeights) { | |
87 | //open the file with the weights: | |
88 | weightsFile = TFile::Open("weights.root","READ"); | |
89 | if(weightsFile) { | |
90 | //access the list which holds the histos with weigths: | |
91 | weightsList = (TList*)weightsFile->Get("weights"); | |
92 | } | |
93 | else { | |
94 | cout<<" WARNING: the file <weights.root> with weights from the previous run was not available."<<endl; | |
95 | break; | |
96 | } | |
97 | } | |
98 | ||
99 | if (LYZ2){ | |
100 | // read the input file from the first run | |
101 | TString inputFileNameLYZ2 = "outputLYZ1analysis" ; | |
102 | inputFileNameLYZ2 += type; | |
103 | inputFileNameLYZ2 += ".root"; | |
104 | cout<<"The input file is "<<inputFileNameLYZ2.Data()<<endl; | |
105 | TFile* fInputFileLYZ2 = new TFile(inputFileNameLYZ2.Data(),"READ"); | |
106 | if(!fInputFileLYZ2 || fInputFileLYZ2->IsZombie()) { | |
107 | cerr << " ERROR: NO First Run file... " << endl ; | |
108 | break; | |
109 | } | |
110 | else { | |
111 | TList* fInputListLYZ2 = (TList*)fInputFileLYZ2->Get("cobjLYZ1"); | |
112 | if (!fInputListLYZ2) {cout<<"list is NULL pointer!"<<endl;} | |
113 | } | |
114 | cout<<"LYZ2 input file/list read..."<<endl; | |
115 | } | |
116 | ||
117 | if (LYZEP) { | |
118 | // read the input file from the second LYZ run | |
119 | TString inputFileNameLYZEP = "outputLYZ2analysis" ; | |
120 | inputFileNameLYZEP += type; | |
121 | inputFileNameLYZEP += ".root"; | |
122 | cout<<"The input file is "<<inputFileNameLYZEP.Data()<<endl; | |
123 | TFile* fInputFileLYZEP = new TFile(inputFileNameLYZEP.Data(),"READ"); | |
124 | if(!fInputFileLYZEP || fInputFileLYZEP->IsZombie()) { | |
125 | cerr << " ERROR: NO First Run file... " << endl ; | |
126 | break; | |
127 | } | |
128 | else { | |
129 | TList* fInputListLYZEP = (TList*)fInputFileLYZEP->Get("cobjLYZ2"); | |
130 | if (!fInputListLYZEP) {cout<<"list is NULL pointer!"<<endl;} | |
131 | } | |
132 | cout<<"LYZEP input file/list read..."<<endl; | |
133 | } | |
134 | ||
135 | ||
136 | //____________________________________________// | |
137 | // Make the analysis manager | |
138 | AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager"); | |
139 | ||
140 | if (type == "ESD"){ | |
141 | AliVEventHandler* esdH = new AliESDInputHandler; | |
142 | mgr->SetInputEventHandler(esdH); | |
143 | if (MCEP) { | |
144 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
145 | mgr->SetMCtruthEventHandler(mc);} } | |
146 | ||
147 | if (type == "AOD"){ | |
148 | AliVEventHandler* aodH = new AliAODInputHandler; | |
149 | mgr->SetInputEventHandler(aodH); | |
150 | if (MCEP) { | |
151 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
152 | mgr->SetMCtruthEventHandler(mc);} } | |
153 | ||
154 | if (type == "MC" || type == "ESDMC0" || type == "ESDMC1"){ | |
155 | AliVEventHandler* esdH = new AliESDInputHandler; | |
156 | mgr->SetInputEventHandler(esdH); | |
157 | ||
158 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
159 | mgr->SetMCtruthEventHandler(mc); } | |
160 | ||
161 | //____________________________________________// | |
162 | // tasks | |
163 | AliAnalysisTaskFlowEvent *taskFE = NULL; | |
164 | if (QA) { | |
165 | taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kTRUE); | |
166 | taskFE->SetAnalysisType(type); | |
167 | mgr->AddTask(taskFE); | |
168 | } | |
169 | else { | |
170 | taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kFALSE); | |
171 | taskFE->SetAnalysisType(type); | |
172 | mgr->AddTask(taskFE); | |
173 | } | |
174 | if (FQD){ | |
175 | AliAnalysisTaskFittingQDistribution *taskFQD = new AliAnalysisTaskFittingQDistribution("TaskFittingQDistribution",kFALSE); | |
176 | taskFQD->SetUsePhiWeights(usePhiWeights); | |
177 | mgr->AddTask(taskFQD); | |
178 | } | |
179 | if (SP){ | |
180 | AliAnalysisTaskScalarProduct *taskSP = new AliAnalysisTaskScalarProduct("TaskScalarProduct"); | |
181 | mgr->AddTask(taskSP); | |
182 | } | |
183 | if (LYZ1){ | |
184 | AliAnalysisTaskLeeYangZeros *taskLYZ1 = new AliAnalysisTaskLeeYangZeros("TaskLeeYangZeros",kTRUE); | |
185 | taskLYZ1->SetFirstRunLYZ(kTRUE); | |
186 | taskLYZ1->SetUseSumLYZ(kTRUE); | |
187 | mgr->AddTask(taskLYZ1); | |
188 | } | |
189 | if (LYZ2){ | |
190 | AliAnalysisTaskLeeYangZeros *taskLYZ2 = new AliAnalysisTaskLeeYangZeros("TaskLeeYangZeros",kFALSE); | |
191 | taskLYZ2->SetFirstRunLYZ(kFALSE); | |
192 | taskLYZ2->SetUseSumLYZ(kTRUE); | |
193 | mgr->AddTask(taskLYZ2); | |
194 | } | |
195 | if (LYZEP){ | |
196 | AliAnalysisTaskLYZEventPlane *taskLYZEP = new AliAnalysisTaskLYZEventPlane("TaskLYZEventPlane"); | |
197 | mgr->AddTask(taskLYZEP); | |
198 | } | |
199 | if (GFC){ | |
200 | AliAnalysisTaskCumulants *taskGFC = new AliAnalysisTaskCumulants("TaskCumulants",useWeights); | |
201 | taskGFC->SetUsePhiWeights(usePhiWeights); | |
202 | taskGFC->SetUsePtWeights(usePtWeights); | |
203 | taskGFC->SetUseEtaWeights(useEtaWeights); | |
204 | mgr->AddTask(taskGFC); | |
205 | } | |
206 | if (QC){ | |
207 | AliAnalysisTaskQCumulants *taskQC = new AliAnalysisTaskQCumulants("TaskQCumulants",kFALSE); | |
208 | taskQC->SetUsePhiWeights(usePhiWeights); | |
209 | taskQC->SetUsePtWeights(usePtWeights); | |
210 | taskQC->SetUseEtaWeights(useEtaWeights); | |
211 | mgr->AddTask(taskQC); | |
212 | } | |
213 | if (MCEP){ | |
214 | AliAnalysisTaskMCEventPlane *taskMCEP = new AliAnalysisTaskMCEventPlane("TaskMCEventPlane"); | |
215 | mgr->AddTask(taskMCEP); | |
216 | } | |
217 | ||
218 | ||
219 | // Create containers for input/output | |
220 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); | |
221 | // TString outputFE = "outputFlowEvent"; | |
222 | // outputFE+= type; | |
223 | // outputFE+= ".root"; | |
224 | AliAnalysisDataContainer *coutputFE = mgr->CreateContainer("cobjFlowEventSimple", AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer); | |
225 | ||
226 | if (useWeights) { | |
227 | AliAnalysisDataContainer *cinputWeights = mgr->CreateContainer("cobjWeights",TList::Class(),AliAnalysisManager::kInputContainer); | |
228 | } | |
229 | ||
230 | if (LYZ2){ | |
231 | AliAnalysisDataContainer *cinputLYZ2 = mgr->CreateContainer("cobjLYZ2in",TList::Class(),AliAnalysisManager::kInputContainer); } | |
232 | if (LYZEP){ | |
233 | AliAnalysisDataContainer *cinputLYZEP = mgr->CreateContainer("cobjLYZEPin",TList::Class(),AliAnalysisManager::kInputContainer); } | |
234 | ||
235 | if(SP) { | |
236 | TString outputSP = "outputSPanalysis"; | |
237 | outputSP+= type; | |
238 | outputSP+= ".root"; | |
239 | AliAnalysisDataContainer *coutputSP = mgr->CreateContainer("cobjSP", TList::Class(),AliAnalysisManager::kOutputContainer,outputSP); | |
240 | } | |
241 | ||
242 | if(LYZ1) { | |
243 | TString outputLYZ1 = "outputLYZ1analysis"; | |
244 | outputLYZ1+= type; | |
245 | outputLYZ1+= ".root"; | |
246 | AliAnalysisDataContainer *coutputLYZ1 = mgr->CreateContainer("cobjLYZ1", TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1); | |
247 | } | |
248 | ||
249 | if(LYZ2) { | |
250 | TString outputLYZ2 = "outputLYZ2analysis"; | |
251 | outputLYZ2+= type; | |
252 | outputLYZ2+= ".root"; | |
253 | AliAnalysisDataContainer *coutputLYZ2 = mgr->CreateContainer("cobjLYZ2", TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2); | |
254 | } | |
255 | ||
256 | if(LYZEP) { | |
257 | TString outputLYZEP = "outputLYZEPanalysis"; | |
258 | outputLYZEP+= type; | |
259 | outputLYZEP+= ".root"; | |
260 | AliAnalysisDataContainer *coutputLYZEP = mgr->CreateContainer("cobjLYZEP", TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZEP); | |
261 | } | |
262 | ||
263 | if(GFC) { | |
264 | TString outputGFC = "outputGFCanalysis"; | |
265 | outputGFC+= type; | |
266 | outputGFC+= ".root"; | |
267 | AliAnalysisDataContainer *coutputGFC = mgr->CreateContainer("cobjGFC", TList::Class(),AliAnalysisManager::kOutputContainer,outputGFC); | |
268 | } | |
269 | ||
270 | if(QC) { | |
271 | TString outputQC = "outputQCanalysis"; | |
272 | outputQC+= type; | |
273 | outputQC+= ".root"; | |
274 | AliAnalysisDataContainer *coutputQC = mgr->CreateContainer("cobjQC", TList::Class(),AliAnalysisManager::kOutputContainer,outputQC); | |
275 | } | |
276 | ||
277 | if(FQD) { | |
278 | TString outputFQD = "outputFQDanalysis"; | |
279 | outputFQD+= type; | |
280 | outputFQD+= ".root"; | |
281 | AliAnalysisDataContainer *coutputFQD = mgr->CreateContainer("cobjFQD", TList::Class(),AliAnalysisManager::kOutputContainer,outputFQD); | |
282 | } | |
283 | ||
284 | if(MCEP) { | |
285 | TString outputMCEP = "outputMCEPanalysis"; | |
286 | outputMCEP+= type; | |
287 | outputMCEP+= ".root"; | |
288 | AliAnalysisDataContainer *coutputMCEP = mgr->CreateContainer("cobjMCEP", TList::Class(),AliAnalysisManager::kOutputContainer,outputMCEP); | |
289 | } | |
290 | ||
291 | if (QA) { | |
292 | TString qaNameIntFE = "QAforInt_FE_"; | |
293 | qaNameIntFE += type; | |
294 | qaNameIntFE += ".root"; | |
295 | AliAnalysisDataContainer *coutputQA1FE = | |
296 | mgr->CreateContainer("QAintFE", TList::Class(),AliAnalysisManager::kOutputContainer,qaNameIntFE); | |
297 | ||
298 | TString qaNameDiffFE = "QAforDiff_FE_"; | |
299 | qaNameDiffFE += type; | |
300 | qaNameDiffFE += ".root"; | |
301 | AliAnalysisDataContainer *coutputQA2FE = | |
302 | mgr->CreateContainer("QAdiffFE", TList::Class(),AliAnalysisManager::kOutputContainer,qaNameDiffFE); | |
303 | } | |
304 | //____________________________________________// | |
305 | ||
306 | ||
307 | // the flow event simple is produced here | |
308 | mgr->ConnectInput(taskFE,0,cinput1); | |
309 | mgr->ConnectOutput(taskFE,0,coutputFE); | |
310 | if (QA) { | |
311 | mgr->ConnectOutput(taskFE,1,coutputQA1FE); | |
312 | mgr->ConnectOutput(taskFE,2,coutputQA2FE); | |
313 | } | |
314 | ||
315 | if (FQD) { | |
316 | mgr->ConnectInput(taskFQD,0,coutputFE); | |
317 | mgr->ConnectOutput(taskFQD,0,coutputFQD); | |
318 | if(useWeights) { | |
319 | mgr->ConnectInput(taskFQD,1,cinputWeights); | |
320 | cinputWeights->SetData(weightsList); | |
321 | } | |
322 | } | |
323 | if (SP) { | |
324 | mgr->ConnectInput(taskSP,0,coutputFE); | |
325 | mgr->ConnectOutput(taskSP,0,coutputSP); | |
326 | } | |
327 | if (LYZ1) { | |
328 | mgr->ConnectInput(taskLYZ1,0,coutputFE); | |
329 | mgr->ConnectOutput(taskLYZ1,0,coutputLYZ1); | |
330 | } | |
331 | if (LYZ2) { | |
332 | mgr->ConnectInput(taskLYZ2,0,coutputFE); | |
333 | mgr->ConnectInput(taskLYZ2,1,cinputLYZ2); | |
334 | mgr->ConnectOutput(taskLYZ2,0,coutputLYZ2); | |
335 | cinputLYZ2->SetData(fInputListLYZ2); | |
336 | } | |
337 | if (LYZEP) { | |
338 | mgr->ConnectInput(taskLYZEP,0,coutputFE); | |
339 | mgr->ConnectInput(taskLYZEP,1,cinputLYZEP); | |
340 | mgr->ConnectOutput(taskLYZEP,0,coutputLYZEP); | |
341 | cinputLYZEP->SetData(fInputListLYZEP); | |
342 | } | |
343 | if (GFC) { | |
344 | mgr->ConnectInput(taskGFC,0,coutputFE); | |
345 | mgr->ConnectOutput(taskGFC,0,coutputGFC); | |
346 | if (useWeights) { | |
347 | mgr->ConnectInput(taskGFC,1,cinputWeights); | |
348 | cinputWeights->SetData(weightsList); | |
349 | } | |
350 | } | |
351 | if (QC) { | |
352 | mgr->ConnectInput(taskQC,0,coutputFE); | |
353 | mgr->ConnectOutput(taskQC,0,coutputQC); | |
354 | if (useWeights) { | |
355 | mgr->ConnectInput(taskQC,1,cinputWeights); | |
356 | cinputWeights->SetData(weightsList); | |
357 | } | |
358 | } | |
359 | if (MCEP) { | |
360 | mgr->ConnectInput(taskMCEP,0,coutputFE); | |
361 | mgr->ConnectOutput(taskMCEP,0,coutputMCEP); | |
362 | } | |
363 | ||
364 | //---------------------------------------------------------- | |
365 | // Run the analysis | |
366 | //---------------------------------------------------------- | |
367 | ||
368 | if (!mgr->InitAnalysis()) return; | |
369 | mgr->PrintStatus(); | |
370 | ||
371 | if (mode==mLocal || mode == mLocalPAR) { | |
372 | mgr->StartAnalysis("local",chain); | |
373 | } | |
374 | else if (mode==mPROOF) { | |
375 | // mgr->StartAnalysis("proof",chain); | |
376 | mgr->StartAnalysis("proof",dataDir,nRuns,offset); | |
377 | } | |
378 | else if (mode==mGRID) { | |
379 | mgr->StartAnalysis("local",chain); | |
380 | } | |
381 | ||
382 | timer.Stop(); | |
383 | timer.Print(); | |
384 | } | |
385 | ||
386 | void LoadLibraries(const anaModes mode) { | |
387 | ||
388 | //-------------------------------------- | |
389 | // Load the needed libraries most of them already loaded by aliroot | |
390 | //-------------------------------------- | |
391 | gSystem->Load("libTree.so"); | |
392 | gSystem->Load("libGeom.so"); | |
393 | gSystem->Load("libVMC.so"); | |
394 | gSystem->Load("libXMLIO.so"); | |
395 | gSystem->Load("libPhysics.so"); | |
396 | ||
397 | //---------------------------------------------------------- | |
398 | // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< | |
399 | //---------------------------------------------------------- | |
400 | if (mode==mLocal) { | |
401 | //-------------------------------------------------------- | |
402 | // If you want to use already compiled libraries | |
403 | // in the aliroot distribution | |
404 | //-------------------------------------------------------- | |
405 | gSystem->Load("libSTEERBase"); | |
406 | gSystem->Load("libESD"); | |
407 | gSystem->Load("libAOD"); | |
408 | gSystem->Load("libANALYSIS"); | |
409 | gSystem->Load("libANALYSISalice"); | |
410 | gSystem->Load("libCORRFW.so"); | |
411 | cerr<<"libCORRFW.so loaded..."<<endl; | |
412 | gSystem->Load("libPWG2flowCommon.so"); | |
413 | cerr<<"libPWG2flowCommon.so loaded..."<<endl; | |
414 | gSystem->Load("libPWG2flowTasks.so"); | |
415 | cerr<<"libPWG2flowTasks.so loaded..."<<endl; | |
416 | ||
417 | gSystem->AddIncludePath("-I$ALICE_ROOT/include -I$ALICE_ROOT/CORRFW -I$ALICE_ROOT/PWG2/FLOW/AliFlowTasks"); | |
418 | gROOT->LoadMacro("ConfigFlowAnalysis.C++"); | |
419 | ||
420 | ||
421 | } | |
422 | ||
423 | else if (mode == mLocalPAR || mode == mGRID) { | |
424 | //-------------------------------------------------------- | |
425 | //If you want to use root and par files from aliroot | |
426 | //-------------------------------------------------------- | |
427 | SetupPar("STEERBase"); | |
428 | SetupPar("ESD"); | |
429 | SetupPar("AOD"); | |
430 | SetupPar("ANALYSIS"); | |
431 | SetupPar("ANALYSISalice"); | |
432 | SetupPar("PWG2AOD"); | |
433 | SetupPar("CORRFW"); | |
434 | SetupPar("PWG2flowCommon"); | |
435 | cerr<<"PWG2flowCommon.par loaded..."<<endl; | |
436 | SetupPar("PWG2flowTasks"); | |
437 | cerr<<"PWG2flowTasks.par loaded..."<<endl; | |
438 | ||
439 | gSystem->AddIncludePath("-I./PWG2FlowTasks -I./CORRFW"); | |
440 | gROOT->LoadMacro("ConfigFlowAnalysis.C++"); | |
441 | ||
442 | } | |
443 | ||
444 | //--------------------------------------------------------- | |
445 | // <<<<<<<<<< PROOF mode >>>>>>>>>>>> | |
446 | //--------------------------------------------------------- | |
447 | else if (mode==mPROOF) { | |
448 | // | |
449 | ||
450 | // set to debug root versus if needed | |
451 | // TProof::Mgr("alicecaf")->SetROOTVersion("v5-21-01-alice_dbg"); | |
452 | // TProof::Mgr("alicecaf")->SetROOTVersion("v5-21-01-alice"); | |
453 | ||
454 | // Connect to proof | |
455 | // Put appropriate username here | |
456 | // TProof::Reset("proof://snelling@alicecaf.cern.ch"); | |
457 | printf("*** Connect to PROOF ***\n"); | |
458 | //TProof::Open("abilandz@alicecaf.cern.ch"); | |
459 | //TProof::Open("nkolk@alicecaf.cern.ch"); | |
460 | TProof::Open("snelling@localhost"); | |
461 | ||
462 | // Enable the STEERBase Package | |
463 | gProof->ClearPackage("STEERBase.par"); | |
464 | gProof->UploadPackage("STEERBase.par"); | |
465 | gProof->EnablePackage("STEERBase"); | |
466 | // Enable the ESD Package | |
467 | gProof->ClearPackage("ESD.par"); | |
468 | gProof->UploadPackage("ESD.par"); | |
469 | gProof->EnablePackage("ESD"); | |
470 | // Enable the AOD Package | |
471 | gProof->ClearPackage("AOD.par"); | |
472 | gProof->UploadPackage("AOD.par"); | |
473 | gProof->EnablePackage("AOD"); | |
474 | // Enable the Analysis Package | |
475 | gProof->ClearPackage("ANALYSIS.par"); | |
476 | gProof->UploadPackage("ANALYSIS.par"); | |
477 | gProof->EnablePackage("ANALYSIS"); | |
478 | // Enable the Analysis Package alice | |
479 | gProof->ClearPackage("ANALYSISalice.par"); | |
480 | gProof->UploadPackage("ANALYSISalice.par"); | |
481 | gProof->EnablePackage("ANALYSISalice"); | |
482 | // Load the PWG2 AOD | |
483 | gProof->ClearPackage("PWG2AOD.par"); | |
484 | gProof->UploadPackage("PWG2AOD.par"); | |
485 | gProof->EnablePackage("PWG2AOD"); | |
486 | // Enable the Correction Framework | |
487 | gProof->ClearPackage("CORRFW.par"); | |
488 | gProof->UploadPackage("CORRFW.par"); | |
489 | gProof->EnablePackage("CORRFW"); | |
490 | // Enable Flow Analysis | |
491 | gProof->ClearPackage("PWG2flowCommon"); | |
492 | gProof->UploadPackage("PWG2flowCommon.par"); | |
493 | gProof->EnablePackage("PWG2flowCommon"); | |
494 | gProof->ClearPackage("PWG2flowTasks"); | |
495 | gProof->UploadPackage("PWG2flowTasks.par"); | |
496 | gProof->EnablePackage("PWG2flowTasks"); | |
497 | // | |
498 | gProof->ShowEnabledPackages(); | |
499 | ||
500 | gSystem->AddIncludePath("-I./PWG2flowTasks -I./CORRFW"); | |
501 | gProof->Load("ConfigFlowAnalysis.C++"); | |
502 | } | |
503 | ||
504 | } | |
505 | ||
506 | void SetupPar(char* pararchivename) { | |
507 | //Load par files, create analysis libraries | |
508 | //For testing, if par file already decompressed and modified | |
509 | //classes then do not decompress. | |
510 | ||
511 | TString cdir(Form("%s", gSystem->WorkingDirectory() )) ; | |
512 | TString parpar(Form("%s.par", pararchivename)) ; | |
513 | if ( gSystem->AccessPathName(parpar.Data()) ) { | |
514 | gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ; | |
515 | TString processline(Form(".! make %s", parpar.Data())) ; | |
516 | gROOT->ProcessLine(processline.Data()) ; | |
517 | gSystem->ChangeDirectory(cdir) ; | |
518 | processline = Form(".! mv /tmp/%s .", parpar.Data()) ; | |
519 | gROOT->ProcessLine(processline.Data()) ; | |
520 | } | |
521 | if ( gSystem->AccessPathName(pararchivename) ) { | |
522 | TString processline = Form(".! tar xvzf %s",parpar.Data()) ; | |
523 | gROOT->ProcessLine(processline.Data()); | |
524 | } | |
525 | ||
526 | TString ocwd = gSystem->WorkingDirectory(); | |
527 | gSystem->ChangeDirectory(pararchivename); | |
528 | ||
529 | // check for BUILD.sh and execute | |
530 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
531 | printf("*******************************\n"); | |
532 | printf("*** Building PAR archive ***\n"); | |
533 | cout<<pararchivename<<endl; | |
534 | printf("*******************************\n"); | |
535 | ||
536 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
537 | Error("runProcess","Cannot Build the PAR Archive! - Abort!"); | |
538 | return -1; | |
539 | } | |
540 | } | |
541 | // check for SETUP.C and execute | |
542 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
543 | printf("*******************************\n"); | |
544 | printf("*** Setup PAR archive ***\n"); | |
545 | cout<<pararchivename<<endl; | |
546 | printf("*******************************\n"); | |
547 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
548 | } | |
549 | ||
550 | gSystem->ChangeDirectory(ocwd.Data()); | |
551 | printf("Current dir: %s\n", ocwd.Data()); | |
552 | } | |
553 | ||
554 | ||
555 | // Helper macros for creating chains | |
556 | // from: CreateESDChain.C,v 1.10 jgrosseo Exp | |
557 | ||
558 | TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset) | |
559 | { | |
560 | // creates chain of files in a given directory or file containing a list. | |
561 | // In case of directory the structure is expected as: | |
562 | // <aDataDir>/<dir0>/AliESDs.root | |
563 | // <aDataDir>/<dir1>/AliESDs.root | |
564 | // ... | |
565 | ||
566 | if (!aDataDir) | |
567 | return 0; | |
568 | ||
569 | Long_t id, size, flags, modtime; | |
570 | if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime)) | |
571 | { | |
572 | printf("%s not found.\n", aDataDir); | |
573 | return 0; | |
574 | } | |
575 | ||
576 | TChain* chain = new TChain("esdTree"); | |
577 | TChain* chaingAlice = 0; | |
578 | ||
579 | if (flags & 2) | |
580 | { | |
581 | TString execDir(gSystem->pwd()); | |
582 | TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir); | |
583 | TList* dirList = baseDir->GetListOfFiles(); | |
584 | Int_t nDirs = dirList->GetEntries(); | |
585 | gSystem->cd(execDir); | |
586 | ||
587 | Int_t count = 0; | |
588 | ||
589 | for (Int_t iDir=0; iDir<nDirs; ++iDir) | |
590 | { | |
591 | TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir); | |
592 | if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0) | |
593 | continue; | |
594 | ||
595 | if (offset > 0) | |
596 | { | |
597 | --offset; | |
598 | continue; | |
599 | } | |
600 | ||
601 | if (count++ == aRuns) | |
602 | break; | |
603 | ||
604 | TString presentDirName(aDataDir); | |
605 | presentDirName += "/"; | |
606 | presentDirName += presentDir->GetName(); | |
607 | chain->Add(presentDirName + "/AliESDs.root/esdTree"); | |
608 | // cerr<<presentDirName<<endl; | |
609 | } | |
610 | ||
611 | } | |
612 | else | |
613 | { | |
614 | // Open the input stream | |
615 | ifstream in; | |
616 | in.open(aDataDir); | |
617 | ||
618 | Int_t count = 0; | |
619 | ||
620 | // Read the input list of files and add them to the chain | |
621 | TString esdfile; | |
622 | while(in.good()) { | |
623 | in >> esdfile; | |
624 | if (!esdfile.Contains("root")) continue; // protection | |
625 | ||
626 | if (offset > 0) | |
627 | { | |
628 | --offset; | |
629 | continue; | |
630 | } | |
631 | ||
632 | if (count++ == aRuns) | |
633 | break; | |
634 | ||
635 | // add esd file | |
636 | chain->Add(esdfile); | |
637 | } | |
638 | ||
639 | in.close(); | |
640 | } | |
641 | ||
642 | return chain; | |
643 | } | |
644 | ||
645 | // Helper macros for creating chains | |
646 | // from: CreateESDChain.C,v 1.10 jgrosseo Exp | |
647 | ||
648 | TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset) | |
649 | { | |
650 | // creates chain of files in a given directory or file containing a list. | |
651 | // In case of directory the structure is expected as: | |
652 | // <aDataDir>/<dir0>/AliAOD.root | |
653 | // <aDataDir>/<dir1>/AliAOD.root | |
654 | // ... | |
655 | ||
656 | if (!aDataDir) | |
657 | return 0; | |
658 | ||
659 | Long_t id, size, flags, modtime; | |
660 | if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime)) | |
661 | { | |
662 | printf("%s not found.\n", aDataDir); | |
663 | return 0; | |
664 | } | |
665 | ||
666 | TChain* chain = new TChain("aodTree"); | |
667 | TChain* chaingAlice = 0; | |
668 | ||
669 | if (flags & 2) | |
670 | { | |
671 | TString execDir(gSystem->pwd()); | |
672 | TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir); | |
673 | TList* dirList = baseDir->GetListOfFiles(); | |
674 | Int_t nDirs = dirList->GetEntries(); | |
675 | gSystem->cd(execDir); | |
676 | ||
677 | Int_t count = 0; | |
678 | ||
679 | for (Int_t iDir=0; iDir<nDirs; ++iDir) | |
680 | { | |
681 | TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir); | |
682 | if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0) | |
683 | continue; | |
684 | ||
685 | if (offset > 0) | |
686 | { | |
687 | --offset; | |
688 | continue; | |
689 | } | |
690 | ||
691 | if (count++ == aRuns) | |
692 | break; | |
693 | ||
694 | TString presentDirName(aDataDir); | |
695 | presentDirName += "/"; | |
696 | presentDirName += presentDir->GetName(); | |
697 | chain->Add(presentDirName + "/AliAOD.root/aodTree"); | |
698 | // cerr<<presentDirName<<endl; | |
699 | } | |
700 | ||
701 | } | |
702 | else | |
703 | { | |
704 | // Open the input stream | |
705 | ifstream in; | |
706 | in.open(aDataDir); | |
707 | ||
708 | Int_t count = 0; | |
709 | ||
710 | // Read the input list of files and add them to the chain | |
711 | TString aodfile; | |
712 | while(in.good()) { | |
713 | in >> aodfile; | |
714 | if (!aodfile.Contains("root")) continue; // protection | |
715 | ||
716 | if (offset > 0) | |
717 | { | |
718 | --offset; | |
719 | continue; | |
720 | } | |
721 | ||
722 | if (count++ == aRuns) | |
723 | break; | |
724 | ||
725 | // add aod file | |
726 | chain->Add(aodfile); | |
727 | } | |
728 | ||
729 | in.close(); | |
730 | } | |
731 | ||
732 | return chain; | |
733 | } | |
734 | ||
735 |