1 /////////////////////////////////////////////////////////////////////////////////
3 // HOW TO USE THIS MACRO:
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)
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
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.
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.
30 // the macro can be used to run local in aliroot or root, on the grid and on caf
31 ///////////////////////////////////////////////////////////////////////////////////
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
40 // Flow analysis method can be:(set to kTRUE or kFALSE)
44 Bool_t LYZEP = kFALSE;
50 // Analysis type can be ESD, AOD, MC, ESDMC0, ESDMC1
51 const TString type = "ESD";
53 // Boolean to fill/not fill the QA histograms
57 //Use weights for Q vector
58 Bool_t usePhiWeights = kFALSE; //Phi
59 Bool_t usePtWeights = kFALSE; //v'(pt)
60 Bool_t useEtaWeights = kFALSE; //v'(eta)
61 Bool_t useWeights = usePhiWeights||usePtWeights||useEtaWeights;
66 // For integrated flow
67 const Double_t ptmin1 = 0.0;
68 const Double_t ptmax1 = 10.0;
69 const Double_t ymin1 = -1.;
70 const Double_t ymax1 = 1.;
71 const Int_t mintrackrefsTPC1 = 2;
72 const Int_t mintrackrefsITS1 = 3;
73 const Int_t charge1 = 1;
74 Bool_t UsePIDIntegratedFlow = kFALSE;
75 const Int_t PDG1 = 211;
76 const Int_t minclustersTPC1 = 50;
77 const Int_t maxnsigmatovertex1 = 3;
79 // For differential flow
80 const Double_t ptmin2 = 0.0;
81 const Double_t ptmax2 = 10.0;
82 const Double_t ymin2 = -1.;
83 const Double_t ymax2 = 1.;
84 const Int_t mintrackrefsTPC2 = 2;
85 const Int_t mintrackrefsITS2 = 3;
86 const Int_t charge2 = 1;
87 Bool_t UsePIDDifferentialFlow = kFALSE;
88 const Int_t PDG2 = 211;
89 const Int_t minclustersTPC2 = 50;
90 const Int_t maxnsigmatovertex2 = 3;
92 // ESD data on PROOF cluster
93 //void runAliAnalysisTaskFlow(Int_t mode=mPROOF, const Char_t* data="/PWG2/akisiel/Therminator_c2030", Int_t nRuns=-1, Int_t offset=0)
95 // AOD data on PROOF cluster
96 //void runAliAnalysisTaskFlow(Int_t mode=mPROOF, const Char_t* data="/PWG2/nkolk/myDataSet", Int_t nRuns=-1, Int_t offset=0)
97 //void runAliAnalysisTaskFlow(Int_t mode=mPROOF, const Char_t* data="/PWG2/akisiel/Therminator_midcentral_AOD", Int_t nRuns=44, Int_t offset=0)
100 //void runAliAnalysisTaskFlow(Int_t mode=mLocal, Int_t nRuns = 4, const Char_t* dataDir="/data/alice2/kolk/Therminator_midcentral", Int_t offset = 0)
101 //void runAliAnalysisTaskFlow(Int_t mode=mLocalPAR, Int_t nRuns = 55, const Char_t* dataDir="/data/alice2/kolk/Therminator_midcentral", Int_t offset = 0)
104 void runAliAnalysisTaskFlow(Int_t mode=mLocal, Int_t nRuns = -1, const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset = 0)
105 //void runAliAnalysisTaskFlow(Int_t mode=mLocalPAR, Int_t nRuns = 55, const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset = 0)
112 if (LYZ1 && LYZ2) {cout<<"WARNING: you cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1."<<endl; exit(); }
113 if (LYZ2 && LYZEP) {cout<<"WARNING: you cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl; exit(); }
114 if (LYZ1 && LYZEP) {cout<<"WARNING: you cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl; exit(); }
118 if (mode==mLocal || mode == mLocalPAR || mode == mGRID) {
119 if (type!="AOD") { TChain* chain = CreateESDChain(dataDir, nRuns, offset);}
120 else { TChain* chain = CreateAODChain(dataDir, nRuns, offset);}
123 //Create cuts using correction framework
125 //Set TList for the QA histograms
127 TList* qaIntFE = new TList(); TList* qaDiffFE = new TList();
130 //############# cuts on MC
131 AliCFTrackKineCuts* mcKineCuts1 = new AliCFTrackKineCuts("mcKineCuts1","MC-level kinematic cuts");
132 mcKineCuts1->SetPtRange(ptmin1,ptmax1);
133 mcKineCuts1->SetRapidityRange(ymin1,ymax1);
134 mcKineCuts1->SetChargeMC(charge1);
136 mcKineCuts1->SetQAOn(qaIntFE);
139 AliCFTrackKineCuts* mcKineCuts2 = new AliCFTrackKineCuts("mcKineCuts2","MC-level kinematic cuts");
140 mcKineCuts2->SetPtRange(ptmin2,ptmax2);
141 mcKineCuts2->SetRapidityRange(ymin2,ymax2);
142 mcKineCuts2->SetChargeMC(charge2);
144 mcKineCuts2->SetQAOn(qaDiffFE);
147 AliCFParticleGenCuts* mcGenCuts1 = new AliCFParticleGenCuts("mcGenCuts1","MC particle generation cuts for integrated flow");
148 mcGenCuts1->SetRequireIsPrimary();
149 if (UsePIDIntegratedFlow) {mcGenCuts1->SetRequirePdgCode(PDG1);}
151 mcGenCuts1->SetQAOn(qaIntFE);
154 AliCFParticleGenCuts* mcGenCuts2 = new AliCFParticleGenCuts("mcGenCuts2","MC particle generation cuts for differential flow");
155 mcGenCuts2->SetRequireIsPrimary();
156 if (UsePIDDifferentialFlow) {mcGenCuts2->SetRequirePdgCode(PDG2);}
158 mcGenCuts2->SetQAOn(qaDiffFE);
161 //############# Acceptance Cuts
162 AliCFAcceptanceCuts *mcAccCuts1 = new AliCFAcceptanceCuts("mcAccCuts1","MC acceptance cuts");
163 mcAccCuts1->SetMinNHitITS(mintrackrefsITS1);
164 mcAccCuts1->SetMinNHitTPC(mintrackrefsTPC1);
166 mcAccCuts1->SetQAOn(qaIntFE);
169 AliCFAcceptanceCuts *mcAccCuts2 = new AliCFAcceptanceCuts("mcAccCuts2","MC acceptance cuts");
170 mcAccCuts2->SetMinNHitITS(mintrackrefsITS2);
171 mcAccCuts2->SetMinNHitTPC(mintrackrefsTPC2);
173 mcAccCuts2->SetQAOn(qaDiffFE);
176 //############# Rec-Level kinematic cuts
177 AliCFTrackKineCuts *recKineCuts1 = new AliCFTrackKineCuts("recKineCuts1","rec-level kine cuts");
178 recKineCuts1->SetPtRange(ptmin1,ptmax1);
179 recKineCuts1->SetRapidityRange(ymin1,ymax1);
180 recKineCuts1->SetChargeRec(charge1);
182 recKineCuts1->SetQAOn(qaIntFE);
185 AliCFTrackKineCuts *recKineCuts2 = new AliCFTrackKineCuts("recKineCuts2","rec-level kine cuts");
186 recKineCuts2->SetPtRange(ptmin2,ptmax2);
187 recKineCuts2->SetRapidityRange(ymin2,ymax2);
188 recKineCuts2->SetChargeRec(charge2);
190 recKineCuts2->SetQAOn(qaDiffFE);
193 AliCFTrackQualityCuts *recQualityCuts1 = new AliCFTrackQualityCuts("recQualityCuts1","rec-level quality cuts");
194 recQualityCuts1->SetMinNClusterTPC(minclustersTPC1);
195 recQualityCuts1->SetStatus(AliESDtrack::kITSrefit);
197 recQualityCuts1->SetQAOn(qaIntFE);
200 AliCFTrackQualityCuts *recQualityCuts2 = new AliCFTrackQualityCuts("recQualityCuts2","rec-level quality cuts");
201 recQualityCuts2->SetMinNClusterTPC(minclustersTPC2);
202 recQualityCuts2->SetStatus(AliESDtrack::kITSrefit);
204 recQualityCuts2->SetQAOn(qaDiffFE);
207 AliCFTrackIsPrimaryCuts *recIsPrimaryCuts1 = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts1","rec-level isPrimary cuts");
208 recIsPrimaryCuts1->SetMaxNSigmaToVertex(maxnsigmatovertex1);
210 recIsPrimaryCuts1->SetQAOn(qaIntFE);
213 AliCFTrackIsPrimaryCuts *recIsPrimaryCuts2 = new AliCFTrackIsPrimaryCuts("recIsPrimaryCuts2","rec-level isPrimary cuts");
214 recIsPrimaryCuts2->SetMaxNSigmaToVertex(maxnsigmatovertex2);
216 recIsPrimaryCuts2->SetQAOn(qaDiffFE);
219 int n_species = AliPID::kSPECIES ;
220 Double_t* prior = new Double_t[n_species];
222 prior[0] = 0.0244519 ;
223 prior[1] = 0.0143988 ;
224 prior[2] = 0.805747 ;
225 prior[3] = 0.0928785 ;
226 prior[4] = 0.0625243 ;
228 AliCFTrackCutPid* cutPID1 = NULL;
229 if(UsePIDIntegratedFlow) {
230 AliCFTrackCutPid* cutPID1 = new AliCFTrackCutPid("cutPID1","ESD_PID for integrated flow") ;
231 cutPID1->SetPriors(prior);
232 cutPID1->SetProbabilityCut(0.0);
233 cutPID1->SetDetectors("TPC TOF");
234 switch(TMath::Abs(PDG1)) {
235 case 11 : cutPID1->SetParticleType(AliPID::kElectron, kTRUE); break;
236 case 13 : cutPID1->SetParticleType(AliPID::kMuon , kTRUE); break;
237 case 211 : cutPID1->SetParticleType(AliPID::kPion , kTRUE); break;
238 case 321 : cutPID1->SetParticleType(AliPID::kKaon , kTRUE); break;
239 case 2212 : cutPID1->SetParticleType(AliPID::kProton , kTRUE); break;
240 default : printf("UNDEFINED PID\n"); break;
243 cutPID1->SetQAOn(qaIntFE);
247 AliCFTrackCutPid* cutPID2 = NULL;
248 if (UsePIDDifferentialFlow) {
249 AliCFTrackCutPid* cutPID2 = new AliCFTrackCutPid("cutPID2","ESD_PID for differential flow") ;
250 cutPID2->SetPriors(prior);
251 cutPID2->SetProbabilityCut(0.0);
252 cutPID2->SetDetectors("TPC TOF");
253 switch(TMath::Abs(PDG2)) {
254 case 11 : cutPID2->SetParticleType(AliPID::kElectron, kTRUE); break;
255 case 13 : cutPID2->SetParticleType(AliPID::kMuon , kTRUE); break;
256 case 211 : cutPID2->SetParticleType(AliPID::kPion , kTRUE); break;
257 case 321 : cutPID2->SetParticleType(AliPID::kKaon , kTRUE); break;
258 case 2212 : cutPID2->SetParticleType(AliPID::kProton , kTRUE); break;
259 default : printf("UNDEFINED PID\n"); break;
262 cutPID2->SetQAOn(qaIntFE);
266 printf("CREATE MC KINE CUTS\n");
267 TObjArray* mcList1 = new TObjArray(0);
268 mcList1->AddLast(mcKineCuts1);
269 mcList1->AddLast(mcGenCuts1);
271 TObjArray* mcList2 = new TObjArray(0);
272 mcList2->AddLast(mcKineCuts2);
273 mcList2->AddLast(mcGenCuts2);
275 printf("CREATE ACCEPTANCE CUTS\n");
276 TObjArray* accList1 = new TObjArray(0) ;
277 accList1->AddLast(mcAccCuts1);
279 TObjArray* accList2 = new TObjArray(0) ;
280 accList2->AddLast(mcAccCuts2);
282 printf("CREATE RECONSTRUCTION CUTS\n");
283 TObjArray* recList1 = new TObjArray(0) ;
284 recList1->AddLast(recKineCuts1);
285 recList1->AddLast(recQualityCuts1);
286 recList1->AddLast(recIsPrimaryCuts1);
288 TObjArray* recList2 = new TObjArray(0) ;
289 recList2->AddLast(recKineCuts2);
290 recList2->AddLast(recQualityCuts2);
291 recList2->AddLast(recIsPrimaryCuts2);
293 printf("CREATE PID CUTS\n");
294 TObjArray* fPIDCutList1 = new TObjArray(0) ;
295 if(UsePIDIntegratedFlow) {fPIDCutList1->AddLast(cutPID1);}
297 TObjArray* fPIDCutList2 = new TObjArray(0) ;
298 if (UsePIDDifferentialFlow) {fPIDCutList2->AddLast(cutPID2);}
300 printf("CREATE INTERFACE AND CUTS\n");
301 AliCFManager* cfmgr1 = new AliCFManager();
302 cfmgr1->SetNStepParticle(4);
303 cfmgr1->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList1);
304 cfmgr1->SetParticleCutsList(AliCFManager::kPartAccCuts,accList1);
305 cfmgr1->SetParticleCutsList(AliCFManager::kPartRecCuts,recList1);
306 cfmgr1->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList1);
308 AliCFManager* cfmgr2 = new AliCFManager();
309 cfmgr2->SetNStepParticle(4);
310 cfmgr2->SetParticleCutsList(AliCFManager::kPartGenCuts,mcList2);
311 cfmgr2->SetParticleCutsList(AliCFManager::kPartAccCuts,accList2);
312 cfmgr2->SetParticleCutsList(AliCFManager::kPartRecCuts,recList2);
313 cfmgr2->SetParticleCutsList(AliCFManager::kPartSelCuts,fPIDCutList2);
316 TFile *weightsFile = NULL;
317 TList *weightsList = NULL;
320 //open the file with the weights:
321 weightsFile = TFile::Open("weights.root","READ");
323 //access the list which holds the histos with weigths:
324 weightsList = (TList*)weightsFile->Get("weights");
327 cout<<" WARNING: the file <weights.root> with weights from the previous run was not available."<<endl;
334 // read the input file from the first run
335 TString inputFileNameLYZ2 = "outputLYZ1analysis" ;
336 inputFileNameLYZ2 += type;
337 inputFileNameLYZ2 += ".root";
338 cout<<"The input file is "<<inputFileNameLYZ2.Data()<<endl;
339 TFile* fInputFileLYZ2 = new TFile(inputFileNameLYZ2.Data(),"READ");
340 if(!fInputFileLYZ2 || fInputFileLYZ2->IsZombie()) {
341 cerr << " ERROR: NO First Run file... " << endl ;
345 TList* fInputListLYZ2 = (TList*)fInputFileLYZ2->Get("cobjLYZ1");
346 if (!fInputListLYZ2) {cout<<"list is NULL pointer!"<<endl;}
348 cout<<"LYZ2 input file/list read..."<<endl;
352 // read the input file from the second LYZ run
353 TString inputFileNameLYZEP = "outputLYZ2analysis" ;
354 inputFileNameLYZEP += type;
355 inputFileNameLYZEP += ".root";
356 cout<<"The input file is "<<inputFileNameLYZEP.Data()<<endl;
357 TFile* fInputFileLYZEP = new TFile(inputFileNameLYZEP.Data(),"READ");
358 if(!fInputFileLYZEP || fInputFileLYZEP->IsZombie()) {
359 cerr << " ERROR: NO First Run file... " << endl ;
363 TList* fInputListLYZEP = (TList*)fInputFileLYZEP->Get("cobjLYZ2");
364 if (!fInputListLYZEP) {cout<<"list is NULL pointer!"<<endl;}
366 cout<<"LYZEP input file/list read..."<<endl;
369 //____________________________________________//
370 // Make the analysis manager
371 AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager");
374 AliVEventHandler* esdH = new AliESDInputHandler;
375 mgr->SetInputEventHandler(esdH);
377 AliMCEventHandler *mc = new AliMCEventHandler();
378 mgr->SetMCtruthEventHandler(mc);} }
381 AliVEventHandler* aodH = new AliAODInputHandler;
382 mgr->SetInputEventHandler(aodH);
384 AliMCEventHandler *mc = new AliMCEventHandler();
385 mgr->SetMCtruthEventHandler(mc);} }
387 if (type == "MC" || type == "ESDMC0" || type == "ESDMC1"){
388 AliVEventHandler* esdH = new AliESDInputHandler;
389 mgr->SetInputEventHandler(esdH);
391 AliMCEventHandler *mc = new AliMCEventHandler();
392 mgr->SetMCtruthEventHandler(mc); }
394 //____________________________________________//
396 AliAnalysisTaskFlowEvent *taskFE = NULL;
398 taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kTRUE);
399 taskFE->SetQAList1(qaIntFE);
400 taskFE->SetQAList2(qaDiffFE);
401 taskFE->SetAnalysisType(type);
402 taskFE->SetCFManager1(cfmgr1);
403 taskFE->SetCFManager2(cfmgr2);
404 mgr->AddTask(taskFE);
407 taskFE = new AliAnalysisTaskFlowEvent("TaskFlowEvent",kFALSE);
408 taskFE->SetAnalysisType(type);
409 taskFE->SetCFManager1(cfmgr1);
410 taskFE->SetCFManager2(cfmgr2);
411 mgr->AddTask(taskFE);
414 AliAnalysisTaskFittingQDistribution *taskFQD = new AliAnalysisTaskFittingQDistribution("TaskFittingQDistribution",useWeights);
415 taskFQD->SetUsePhiWeights(usePhiWeights);
416 mgr->AddTask(taskFQD);
419 AliAnalysisTaskScalarProduct *taskSP = new AliAnalysisTaskScalarProduct("TaskScalarProduct",kFALSE);
420 taskSP->SetAnalysisType(type);
421 taskSP->SetCFManager1(cfmgr1);
422 taskSP->SetCFManager2(cfmgr2);
423 mgr->AddTask(taskSP);
426 AliAnalysisTaskLeeYangZeros *taskLYZ1 = new AliAnalysisTaskLeeYangZeros("TaskLeeYangZeros",kTRUE,kFALSE);
427 taskLYZ1->SetAnalysisType(type);
428 taskLYZ1->SetFirstRunLYZ(kTRUE);
429 taskLYZ1->SetUseSumLYZ(kTRUE);
430 taskLYZ1->SetCFManager1(cfmgr1);
431 taskLYZ1->SetCFManager2(cfmgr2);
432 mgr->AddTask(taskLYZ1);
435 AliAnalysisTaskLeeYangZeros *taskLYZ2 = new AliAnalysisTaskLeeYangZeros("TaskLeeYangZeros",kFALSE,kFALSE);
436 taskLYZ2->SetAnalysisType(type);
437 taskLYZ2->SetFirstRunLYZ(kFALSE);
438 taskLYZ2->SetUseSumLYZ(kTRUE);
439 taskLYZ2->SetCFManager1(cfmgr1);
440 taskLYZ2->SetCFManager2(cfmgr2);
441 mgr->AddTask(taskLYZ2);
444 AliAnalysisTaskLYZEventPlane *taskLYZEP = new AliAnalysisTaskLYZEventPlane("TaskLYZEventPlane",kFALSE);
445 taskLYZEP->SetAnalysisType(type);
446 taskLYZEP->SetCFManager1(cfmgr1);
447 taskLYZEP->SetCFManager2(cfmgr2);
448 mgr->AddTask(taskLYZEP);
451 AliAnalysisTaskCumulants *taskGFC = new AliAnalysisTaskCumulants("TaskCumulants",kFALSE,useWeights);
452 taskGFC->SetAnalysisType(type);
453 taskGFC->SetUsePhiWeights(usePhiWeights);
454 taskGFC->SetUsePtWeights(usePtWeights);
455 taskGFC->SetUseEtaWeights(useEtaWeights);
456 taskGFC->SetCFManager1(cfmgr1);
457 taskGFC->SetCFManager2(cfmgr2);
458 mgr->AddTask(taskGFC);
461 AliAnalysisTaskQCumulants *taskQC = new AliAnalysisTaskQCumulants("TaskQCumulants",kFALSE,useWeights);
462 taskQC->SetAnalysisType(type);
463 taskQC->SetUsePhiWeights(usePhiWeights);
464 taskQC->SetUsePtWeights(usePtWeights);
465 taskQC->SetUseEtaWeights(useEtaWeights);
466 taskQC->SetCFManager1(cfmgr1);
467 taskQC->SetCFManager2(cfmgr2);
468 mgr->AddTask(taskQC);
471 AliAnalysisTaskMCEventPlane *taskMCEP = new AliAnalysisTaskMCEventPlane("TaskMCEventPlane",kFALSE);
472 taskMCEP->SetAnalysisType(type);
473 taskMCEP->SetCFManager1(cfmgr1);
474 taskMCEP->SetCFManager2(cfmgr2);
475 mgr->AddTask(taskMCEP);
479 // Create containers for input/output
480 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
481 // TString outputFE = "outputFlowEvent";
483 // outputFE+= ".root";
484 AliAnalysisDataContainer *coutputFE = mgr->CreateContainer("cobjFlowEventSimple", AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);
487 AliAnalysisDataContainer *cinputWeights = mgr->CreateContainer("cobjWeights",TList::Class(),AliAnalysisManager::kInputContainer);
491 AliAnalysisDataContainer *cinputLYZ2 = mgr->CreateContainer("cobjLYZ2in",TList::Class(),AliAnalysisManager::kInputContainer); }
493 AliAnalysisDataContainer *cinputLYZEP = mgr->CreateContainer("cobjLYZEPin",TList::Class(),AliAnalysisManager::kInputContainer); }
496 TString outputSP = "outputSPanalysis";
499 AliAnalysisDataContainer *coutputSP = mgr->CreateContainer("cobjSP", TList::Class(),AliAnalysisManager::kOutputContainer,outputSP);
503 TString outputLYZ1 = "outputLYZ1analysis";
505 outputLYZ1+= ".root";
506 AliAnalysisDataContainer *coutputLYZ1 = mgr->CreateContainer("cobjLYZ1", TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1);
510 TString outputLYZ2 = "outputLYZ2analysis";
512 outputLYZ2+= ".root";
513 AliAnalysisDataContainer *coutputLYZ2 = mgr->CreateContainer("cobjLYZ2", TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2);
517 TString outputLYZEP = "outputLYZEPanalysis";
519 outputLYZEP+= ".root";
520 AliAnalysisDataContainer *coutputLYZEP = mgr->CreateContainer("cobjLYZEP", TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZEP);
524 TString outputGFC = "outputGFCanalysis";
527 AliAnalysisDataContainer *coutputGFC = mgr->CreateContainer("cobjGFC", TList::Class(),AliAnalysisManager::kOutputContainer,outputGFC);
531 TString outputQC = "outputQCanalysis";
534 AliAnalysisDataContainer *coutputQC = mgr->CreateContainer("cobjQC", TList::Class(),AliAnalysisManager::kOutputContainer,outputQC);
538 TString outputFQD = "outputFQDanalysis";
541 AliAnalysisDataContainer *coutputFQD = mgr->CreateContainer("cobjFQD", TList::Class(),AliAnalysisManager::kOutputContainer,outputFQD);
545 TString outputMCEP = "outputMCEPanalysis";
547 outputMCEP+= ".root";
548 AliAnalysisDataContainer *coutputMCEP = mgr->CreateContainer("cobjMCEP", TList::Class(),AliAnalysisManager::kOutputContainer,outputMCEP);
553 TString qaNameIntFE = "QAforInt_FE_";
555 qaNameIntFE += ".root";
556 AliAnalysisDataContainer *coutputQA1FE =
557 mgr->CreateContainer("QAintFE", TList::Class(),AliAnalysisManager::kOutputContainer,qaNameIntFE);
559 TString qaNameDiffFE = "QAforDiff_FE_";
560 qaNameDiffFE += type;
561 qaNameDiffFE += ".root";
562 AliAnalysisDataContainer *coutputQA2FE =
563 mgr->CreateContainer("QAdiffFE", TList::Class(),AliAnalysisManager::kOutputContainer,qaNameDiffFE);
567 //____________________________________________//
570 // the flow event simple is produced here
571 mgr->ConnectInput(taskFE,0,cinput1);
572 mgr->ConnectOutput(taskFE,0,coutputFE);
574 mgr->ConnectOutput(taskFE,1,coutputQA1FE);
575 mgr->ConnectOutput(taskFE,2,coutputQA2FE);
579 mgr->ConnectInput(taskFQD,0,coutputFE);
580 mgr->ConnectOutput(taskFQD,0,coutputFQD);
582 mgr->ConnectInput(taskFQD,1,cinputWeights);
583 cinputWeights->SetData(weightsList);
587 mgr->ConnectInput(taskSP,0,cinput1);
588 mgr->ConnectOutput(taskSP,0,coutputSP);
591 mgr->ConnectInput(taskLYZ1,0,cinput1);
592 mgr->ConnectOutput(taskLYZ1,0,coutputLYZ1);
595 mgr->ConnectInput(taskLYZ2,0,cinput1);
596 mgr->ConnectInput(taskLYZ2,1,cinputLYZ2);
597 mgr->ConnectOutput(taskLYZ2,0,coutputLYZ2);
598 cinputLYZ2->SetData(fInputListLYZ2);
601 mgr->ConnectInput(taskLYZEP,0,cinput1);
602 mgr->ConnectInput(taskLYZEP,1,cinputLYZEP);
603 mgr->ConnectOutput(taskLYZEP,0,coutputLYZEP);
604 cinputLYZEP->SetData(fInputListLYZEP);
607 mgr->ConnectInput(taskGFC,0,cinput1);
608 mgr->ConnectOutput(taskGFC,0,coutputGFC);
610 mgr->ConnectInput(taskGFC,1,cinputWeights);
611 cinputWeights->SetData(weightsList);
615 mgr->ConnectInput(taskQC,0,cinput1);
616 mgr->ConnectOutput(taskQC,0,coutputQC);
618 mgr->ConnectInput(taskQC,1,cinputWeights);
619 cinputWeights->SetData(weightsList);
623 mgr->ConnectInput(taskMCEP,0,cinput1);
624 mgr->ConnectOutput(taskMCEP,0,coutputMCEP);
629 //----------------------------------------------------------
631 //----------------------------------------------------------
633 if (!mgr->InitAnalysis()) return;
636 if (mode==mLocal || mode == mLocalPAR) {
637 mgr->StartAnalysis("local",chain);
639 else if (mode==mPROOF) {
640 // mgr->StartAnalysis("proof",chain);
641 mgr->StartAnalysis("proof",data,nRuns,offset);
643 else if (mode==mGRID) {
644 mgr->StartAnalysis("local",chain);
652 void LoadLibraries(const anaModes mode) {
654 //--------------------------------------
655 // Load the needed libraries most of them already loaded by aliroot
656 //--------------------------------------
657 gSystem->Load("libTree.so");
658 gSystem->Load("libGeom.so");
659 gSystem->Load("libVMC.so");
660 gSystem->Load("libXMLIO.so");
661 gSystem->Load("libPhysics.so");
663 //----------------------------------------------------------
664 // >>>>>>>>>>> Local mode <<<<<<<<<<<<<<
665 //----------------------------------------------------------
667 //--------------------------------------------------------
668 // If you want to use already compiled libraries
669 // in the aliroot distribution
670 //--------------------------------------------------------
671 gSystem->Load("libSTEERBase");
672 gSystem->Load("libESD");
673 gSystem->Load("libAOD");
674 gSystem->Load("libANALYSIS");
675 gSystem->Load("libANALYSISalice");
676 gSystem->Load("libCORRFW.so");
677 cerr<<"libCORRFW.so loaded..."<<endl;
678 gSystem->Load("libPWG2flowCommon.so");
679 cerr<<"libPWG2flowCommon.so loaded..."<<endl;
680 gSystem->Load("libPWG2flowTasks.so");
681 cerr<<"libPWG2flowTasks.so loaded..."<<endl;
684 else if (mode == mLocalPAR || mode == mGRID) {
685 //--------------------------------------------------------
686 //If you want to use root and par files from aliroot
687 //--------------------------------------------------------
688 SetupPar("STEERBase");
691 SetupPar("ANALYSIS");
692 SetupPar("ANALYSISalice");
695 SetupPar("PWG2flowCommon");
696 cerr<<"PWG2flowCommon.par loaded..."<<endl;
697 SetupPar("PWG2flowTasks");
698 cerr<<"PWG2flowTasks.par loaded..."<<endl;
701 //---------------------------------------------------------
702 // <<<<<<<<<< PROOF mode >>>>>>>>>>>>
703 //---------------------------------------------------------
704 else if (mode==mPROOF) {
707 // set to debug root versus if needed
708 // TProof::Mgr("alicecaf")->SetROOTVersion("v5-21-01-alice_dbg");
709 // TProof::Mgr("alicecaf")->SetROOTVersion("v5-21-01-alice");
712 // Put appropriate username here
713 // TProof::Reset("proof://snelling@alicecaf.cern.ch");
714 printf("*** Connect to PROOF ***\n");
715 // TProof::Open("abilandz@alicecaf.cern.ch");
716 TProof::Open("snelling@localhost");
718 // Enable the STEERBase Package
719 gProof->ClearPackage("STEERBase.par");
720 gProof->UploadPackage("STEERBase.par");
721 gProof->EnablePackage("STEERBase");
722 // Enable the ESD Package
723 gProof->ClearPackage("ESD.par");
724 gProof->UploadPackage("ESD.par");
725 gProof->EnablePackage("ESD");
726 // Enable the AOD Package
727 gProof->ClearPackage("AOD.par");
728 gProof->UploadPackage("AOD.par");
729 gProof->EnablePackage("AOD");
730 // Enable the Analysis Package
731 gProof->ClearPackage("ANALYSIS.par");
732 gProof->UploadPackage("ANALYSIS.par");
733 gProof->EnablePackage("ANALYSIS");
734 // Enable the Analysis Package alice
735 gProof->ClearPackage("ANALYSISalice.par");
736 gProof->UploadPackage("ANALYSISalice.par");
737 gProof->EnablePackage("ANALYSISalice");
739 gProof->ClearPackage("PWG2AOD.par");
740 gProof->UploadPackage("PWG2AOD.par");
741 gProof->EnablePackage("PWG2AOD");
742 // Enable the Correction Framework
743 gProof->ClearPackage("CORRFW.par");
744 gProof->UploadPackage("CORRFW.par");
745 gProof->EnablePackage("CORRFW");
746 // Enable Flow Analysis
747 gProof->ClearPackage("PWG2flowCommon");
748 gProof->UploadPackage("PWG2flowCommon.par");
749 gProof->EnablePackage("PWG2flowCommon");
750 gProof->ClearPackage("PWG2flowTasks");
751 gProof->UploadPackage("PWG2flowTasks.par");
752 gProof->EnablePackage("PWG2flowTasks");
754 gProof->ShowEnabledPackages();
759 void SetupPar(char* pararchivename) {
760 //Load par files, create analysis libraries
761 //For testing, if par file already decompressed and modified
762 //classes then do not decompress.
764 TString cdir(Form("%s", gSystem->WorkingDirectory() )) ;
765 TString parpar(Form("%s.par", pararchivename)) ;
766 if ( gSystem->AccessPathName(parpar.Data()) ) {
767 gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ;
768 TString processline(Form(".! make %s", parpar.Data())) ;
769 gROOT->ProcessLine(processline.Data()) ;
770 gSystem->ChangeDirectory(cdir) ;
771 processline = Form(".! mv /tmp/%s .", parpar.Data()) ;
772 gROOT->ProcessLine(processline.Data()) ;
774 if ( gSystem->AccessPathName(pararchivename) ) {
775 TString processline = Form(".! tar xvzf %s",parpar.Data()) ;
776 gROOT->ProcessLine(processline.Data());
779 TString ocwd = gSystem->WorkingDirectory();
780 gSystem->ChangeDirectory(pararchivename);
782 // check for BUILD.sh and execute
783 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
784 printf("*******************************\n");
785 printf("*** Building PAR archive ***\n");
786 cout<<pararchivename<<endl;
787 printf("*******************************\n");
789 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
790 Error("runProcess","Cannot Build the PAR Archive! - Abort!");
794 // check for SETUP.C and execute
795 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
796 printf("*******************************\n");
797 printf("*** Setup PAR archive ***\n");
798 cout<<pararchivename<<endl;
799 printf("*******************************\n");
800 gROOT->Macro("PROOF-INF/SETUP.C");
803 gSystem->ChangeDirectory(ocwd.Data());
804 printf("Current dir: %s\n", ocwd.Data());
808 // Helper macros for creating chains
809 // from: CreateESDChain.C,v 1.10 jgrosseo Exp
811 TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
813 // creates chain of files in a given directory or file containing a list.
814 // In case of directory the structure is expected as:
815 // <aDataDir>/<dir0>/AliESDs.root
816 // <aDataDir>/<dir1>/AliESDs.root
822 Long_t id, size, flags, modtime;
823 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
825 printf("%s not found.\n", aDataDir);
829 TChain* chain = new TChain("esdTree");
830 TChain* chaingAlice = 0;
834 TString execDir(gSystem->pwd());
835 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
836 TList* dirList = baseDir->GetListOfFiles();
837 Int_t nDirs = dirList->GetEntries();
838 gSystem->cd(execDir);
842 for (Int_t iDir=0; iDir<nDirs; ++iDir)
844 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
845 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
854 if (count++ == aRuns)
857 TString presentDirName(aDataDir);
858 presentDirName += "/";
859 presentDirName += presentDir->GetName();
860 chain->Add(presentDirName + "/AliESDs.root/esdTree");
861 // cerr<<presentDirName<<endl;
867 // Open the input stream
873 // Read the input list of files and add them to the chain
877 if (!esdfile.Contains("root")) continue; // protection
885 if (count++ == aRuns)
898 // Helper macros for creating chains
899 // from: CreateESDChain.C,v 1.10 jgrosseo Exp
901 TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)
903 // creates chain of files in a given directory or file containing a list.
904 // In case of directory the structure is expected as:
905 // <aDataDir>/<dir0>/AliAOD.root
906 // <aDataDir>/<dir1>/AliAOD.root
912 Long_t id, size, flags, modtime;
913 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
915 printf("%s not found.\n", aDataDir);
919 TChain* chain = new TChain("aodTree");
920 TChain* chaingAlice = 0;
924 TString execDir(gSystem->pwd());
925 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
926 TList* dirList = baseDir->GetListOfFiles();
927 Int_t nDirs = dirList->GetEntries();
928 gSystem->cd(execDir);
932 for (Int_t iDir=0; iDir<nDirs; ++iDir)
934 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
935 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
944 if (count++ == aRuns)
947 TString presentDirName(aDataDir);
948 presentDirName += "/";
949 presentDirName += presentDir->GetName();
950 chain->Add(presentDirName + "/AliAOD.root/aodTree");
951 // cerr<<presentDirName<<endl;
957 // Open the input stream
963 // Read the input list of files and add them to the chain
967 if (!aodfile.Contains("root")) continue; // protection
975 if (count++ == aRuns)