Added option to set event selection
[u/mrichter/AliRoot.git] / PWGCF / FLOW / macros / AddTaskFlowCentralityPIDQC.C
CommitLineData
31e0a55e 1/////////////////////////////////////////////////////////////////////////////////////////////\r
2//\r
3// AddTask* macro for flow analysis\r
4// Creates a Flow Event task and adds it to the analysis manager.\r
5// Sets the cuts using the correction framework (CORRFW) classes.\r
6// Also creates Flow Analysis tasks and connects them to the output of the flow event task.\r
7//\r
8/////////////////////////////////////////////////////////////////////////////////////////////\r
9\r
6ea349ad 10void AddTaskFlowCentralityPIDQC(Int_t centralitysel,\r
11 Float_t centrMin=10.,\r
31e0a55e 12 Float_t centrMax=20.,\r
13 TString fileNameBase="output",\r
14 Bool_t isPID = kTRUE,\r
15 AliPID::EParticleType particleType=AliPID::kPion,\r
16 AliFlowTrackCuts::PIDsource sourcePID = AliFlowTrackCuts::kTOFbayesian,\r
17 Int_t charge=0,\r
18 Int_t harmonic=2,\r
19 Bool_t doQA=kFALSE,\r
a2a4ff0f 20 Float_t etamin=-0.8,\r
21 Float_t etamax=0.8, \r
31e0a55e 22 TString uniqueStr="" )\r
23{\r
24 // Define the range for eta subevents (for SP method)\r
25 Double_t minA = -5;\r
26 Double_t maxA = -1.5;\r
27 Double_t minB = 1.5;\r
28 Double_t maxB = 5;\r
29\r
30 // AFTERBURNER\r
31 Bool_t useAfterBurner=kFALSE;\r
32 Double_t v1=0.0;\r
33 Double_t v2=0.0;\r
34 Double_t v3=0.0;\r
35 Double_t v4=0.0;\r
36 Int_t numberOfTrackClones=0; //non-flow\r
37\r
38 // Define a range of the detector to exclude\r
39 Bool_t ExcludeRegion = kFALSE;\r
40 Double_t excludeEtaMin = -0.;\r
41 Double_t excludeEtaMax = 0.;\r
42 Double_t excludePhiMin = 0.;\r
43 Double_t excludePhiMax = 0.;\r
44\r
45 // use physics selection class\r
46 Bool_t UsePhysicsSelection = kTRUE;\r
47\r
48 // QA\r
49 Bool_t runQAtask=kFALSE;\r
50 Bool_t FillQAntuple=kFALSE;\r
51 Bool_t DoQAcorrelations=kFALSE;\r
52\r
53 // RUN SETTINGS\r
54 // Flow analysis method can be:(set to kTRUE or kFALSE)\r
55 Bool_t SP = kFALSE; // scalar product method (similar to eventplane method)\r
56 Bool_t QC = kTRUE; // cumulants using Q vectors\r
57 \r
58 //these are OBSOLETE, use at own peril\r
59 Bool_t GFC = kFALSE; // cumulants based on generating function\r
60 Bool_t MCEP = kFALSE; // correlation with Monte Carlo reaction plane\r
61 Bool_t FQD = kFALSE; // fit of the distribution of the Q vector (only integrated v)\r
62 Bool_t LYZ1SUM = kFALSE; // Lee Yang Zeroes using sum generating function (integrated v)\r
63 Bool_t LYZ1PROD = kFALSE; // Lee Yang Zeroes using product generating function (integrated v)\r
64 Bool_t LYZ2SUM = kFALSE; // Lee Yang Zeroes using sum generating function (second pass differential v)\r
65 Bool_t LYZ2PROD = kFALSE; // Lee Yang Zeroes using product generating function (second pass differential v)\r
66 Bool_t LYZEP = kFALSE; // Lee Yang Zeroes Event plane using sum generating function (gives eventplane + weight)\r
67 Bool_t MH = kFALSE; // azimuthal correlators in mixed harmonics \r
68 Bool_t NL = kFALSE; // nested loops (for instance distribution of phi1-phi2 for all distinct pairs)\r
69\r
70 Bool_t METHODS[] = {SP,LYZ1SUM,LYZ1PROD,LYZ2SUM,LYZ2PROD,LYZEP,GFC,QC,FQD,MCEP,MH,NL};\r
71\r
72 // Boolean to use/not use weights for the Q vector\r
73 Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta)\r
74\r
75 // SETTING THE CUTS\r
76\r
77 //---------Data selection----------\r
78 //kMC, kGlobal, kESD_TPConly, kESD_SPDtracklet\r
79 AliFlowTrackCuts::trackParameterType rptype = AliFlowTrackCuts::kTPCstandalone;\r
80 AliFlowTrackCuts::trackParameterType poitype = AliFlowTrackCuts::kTPCstandalone;\r
81\r
82 //---------Parameter mixing--------\r
83 //kPure - no mixing, kTrackWithMCkine, kTrackWithMCPID, kTrackWithMCpt\r
84 AliFlowTrackCuts::trackParameterMix rpmix = AliFlowTrackCuts::kPure;\r
85 AliFlowTrackCuts::trackParameterMix poimix = AliFlowTrackCuts::kPure;\r
86\r
87\r
88 const char* rptypestr = AliFlowTrackCuts::GetParamTypeName(rptype);\r
89 const char* poitypestr = AliFlowTrackCuts::GetParamTypeName(poitype);\r
90\r
91 //===========================================================================\r
92 // EVENTS CUTS:\r
93 AliFlowEventCuts* cutsEvent = new AliFlowEventCuts("event cuts");\r
94 cutsEvent->SetCentralityPercentileRange(centrMin,centrMax);\r
95 cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);\r
05b8872b 96// cutsEvent->SetRefMultMethod(AliFlowEventCuts::kV0);\r
31e0a55e 97 //cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kSPD1tracklets);\r
98// cutsEvent->SetNContributorsRange(2);\r
99 cutsEvent->SetPrimaryVertexZrange(-10.,10.);\r
100 cutsEvent->SetQA(doQA);\r
05b8872b 101 cutsEvent->SetCutTPCmultiplicityOutliers();\r
31e0a55e 102 \r
103 // RP TRACK CUTS:\r
104 AliFlowTrackCuts* cutsRP2 = AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts();\r
105 AliFlowTrackCuts* cutsRP = new AliFlowTrackCuts("TPConlyRP");\r
106 cutsRP->SetParamType(rptype);\r
107 cutsRP->SetParamMix(rpmix);\r
108 cutsRP->SetPtRange(0.2,5.);\r
a2a4ff0f 109 cutsRP->SetEtaRange(etamin,etamax);\r
31e0a55e 110 cutsRP->SetMinNClustersTPC(70);\r
111// cutsRP->SetMinChi2PerClusterTPC(0.1);\r
112// cutsRP->SetMaxChi2PerClusterTPC(4.0);\r
113 cutsRP->SetMaxDCAToVertexXY(3.0);\r
114 cutsRP->SetMaxDCAToVertexZ(3.0);\r
115 cutsRP->SetAcceptKinkDaughters(kFALSE);\r
116 cutsRP->SetMinimalTPCdedx(10.);\r
94f72045 117 cutsRP->SetAODfilterBit(1); \r
31e0a55e 118 cutsRP->SetQA(doQA);\r
119\r
120 // POI TRACK CUTS:\r
05b8872b 121 AliFlowTrackCuts* cutsPOI = new AliFlowTrackCuts("TPConlyPOI");\r
31e0a55e 122 cutsPOI->SetParamType(poitype);\r
123 cutsPOI->SetParamMix(poimix);\r
124 cutsPOI->SetPtRange(0.0,10.);\r
a2a4ff0f 125 cutsPOI->SetEtaRange(etamin,etamax);\r
31e0a55e 126 //cutsPOI->SetRequireCharge(kTRUE);\r
127 //cutsPOI->SetPID(PdgRP);\r
128 cutsPOI->SetMinNClustersTPC(70);\r
129// cutsPOI->SetMinChi2PerClusterTPC(0.1);\r
130// cutsPOI->SetMaxChi2PerClusterTPC(4.0);\r
131// cutsPOI->SetRequireITSRefit(kTRUE);\r
132// cutsPOI->SetRequireTPCRefit(kTRUE);\r
133// cutsPOI->SetMinNClustersITS(2);\r
134 //cutsPOI->SetMaxChi2PerClusterITS(1.e+09);\r
135 cutsPOI->SetMaxDCAToVertexXY(3.0);\r
136 cutsPOI->SetMaxDCAToVertexZ(3.0);\r
137 //cutsPOI->SetDCAToVertex2D(kTRUE);\r
138 //cutsPOI->SetMaxNsigmaToVertex(1.e+10);\r
139 //cutsPOI->SetRequireSigmaToVertex(kFALSE);\r
140 cutsPOI->SetAcceptKinkDaughters(kFALSE);\r
141 if(isPID) cutsPOI->SetPID(particleType, sourcePID);\r
142 if (charge!=0) cutsPOI->SetCharge(charge);\r
143 //cutsPOI->SetAllowTOFmismatch(kFALSE);\r
144 cutsPOI->SetRequireStrictTOFTPCagreement(kTRUE);\r
145 //iexample: francesco's tunig TPC Bethe Bloch for data:\r
146 //cutsPOI->GetESDpid().GetTPCResponse().SetBetheBlochParameters(4.36414e-02,1.75977e+01,1.14385e-08,2.27907e+00,3.36699e+00);\r
147 //cutsPOI->GetESDpid().GetTPCResponse().SetMip(49);\r
148 cutsPOI->SetMinimalTPCdedx(10.);\r
05b8872b 149 cutsPOI->SetAODfilterBit(1);\r
31e0a55e 150 cutsPOI->SetQA(doQA);\r
151 cutsPOI->SetPriors((centrMin+centrMax)*0.5); // set priors and PID as a function of the centrality\r
152\r
153 TString outputSlotName("");\r
154 outputSlotName+=uniqueStr;\r
155 outputSlotName+=Form("QC(%i) ",harmonic);\r
156 outputSlotName+=cutsRP->GetName();\r
157 outputSlotName+=" ";\r
158 outputSlotName+=cutsPOI->GetName();\r
159 outputSlotName+=Form(" %.0f-",centrMin);\r
160 outputSlotName+=Form("%.0f ",centrMax);\r
161 if(isPID){\r
162 outputSlotName+=AliFlowTrackCuts::PIDsourceName(sourcePID);\r
163 outputSlotName+=" ";\r
164 outputSlotName+=AliPID::ParticleName(particleType);\r
165 }\r
166 else{\r
167 outputSlotName+="AllCharged";\r
168 }\r
169 if (charge<0) outputSlotName+="-";\r
170 if (charge>0) outputSlotName+="+";\r
171\r
172 TString fileName(fileNameBase);\r
173 fileName.Append(".root");\r
174\r
175 Bool_t useWeights = WEIGHTS[0] || WEIGHTS[1] || WEIGHTS[2];\r
176 if (useWeights) cout<<"Weights are used"<<endl;\r
177 else cout<<"Weights are not used"<<endl;\r
178 \r
179 // Get the pointer to the existing analysis manager via the static access method.\r
180 //==============================================================================\r
181 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
182 if (!mgr) {\r
183 Error("AddTaskFlowEvent", "No analysis manager to connect to.");\r
184 return NULL;\r
185 }\r
186 \r
187 // Check the analysis type using the event handlers connected to the analysis\r
188 // manager. The availability of MC handler can also be checked here.\r
189 //==============================================================================\r
190 if (!mgr->GetInputEventHandler()) {\r
191 ::Error("AddTaskFlowEvent", "This task requires an input event handler");\r
192 return NULL;\r
193 } \r
194\r
195 // Open external input files\r
196 //===========================================================================\r
197 //weights: \r
198 TFile *weightsFile = NULL;\r
199 TList *weightsList = NULL;\r
200\r
201 if(useWeights) {\r
202 //open the file with the weights:\r
203 weightsFile = TFile::Open("weights.root","READ");\r
204 if(weightsFile) {\r
205 //access the list which holds the histos with weigths:\r
206 weightsList = (TList*)weightsFile->Get("weights");\r
207 }\r
208 else {\r
209 cout<<" WARNING: the file <weights.root> with weights from the previous run was not available."<<endl;\r
210 break;\r
211 } \r
212 }\r
213 \r
214 //LYZ2\r
215 if (LYZ2SUM || LYZ2PROD) {\r
216 //read the outputfile of the first run\r
217 TString outputFileName = "AnalysisResults1.root";\r
218 TString pwd(gSystem->pwd());\r
219 pwd+="/";\r
220 pwd+=outputFileName.Data();\r
221 TFile *outputFile = NULL;\r
222 if(gSystem->AccessPathName(pwd.Data(),kFileExists)) {\r
223 cout<<"WARNING: You do not have an output file:"<<endl;\r
224 cout<<" "<<pwd.Data()<<endl;\r
225 exit(0);\r
226 } else { outputFile = TFile::Open(pwd.Data(),"READ");}\r
227 \r
228 if (LYZ2SUM){ \r
229 // read the output directory from LYZ1SUM \r
230 TString inputFileNameLYZ2SUM = "outputLYZ1SUManalysis" ;\r
231 inputFileNameLYZ2SUM += rptypestr;\r
232 cout<<"The input directory is "<<inputFileNameLYZ2SUM.Data()<<endl;\r
233 TFile* fInputFileLYZ2SUM = (TFile*)outputFile->FindObjectAny(inputFileNameLYZ2SUM.Data());\r
234 if(!fInputFileLYZ2SUM || fInputFileLYZ2SUM->IsZombie()) { \r
235 cerr << " ERROR: To run LYZ2SUM you need the output file from LYZ1SUM. This file is not there! Please run LYZ1SUM first." << endl ; \r
236 break;\r
237 }\r
238 else {\r
239 TList* fInputListLYZ2SUM = (TList*)fInputFileLYZ2SUM->Get("LYZ1SUM");\r
240 if (!fInputListLYZ2SUM) {cout<<"list is NULL pointer!"<<endl;}\r
241 }\r
242 cout<<"LYZ2SUM input file/list read..."<<endl;\r
243 }\r
244\r
245 if (LYZ2PROD){ \r
246 // read the output directory from LYZ1PROD \r
247 TString inputFileNameLYZ2PROD = "outputLYZ1PRODanalysis" ;\r
248 inputFileNameLYZ2PROD += rptypestr;\r
249 cout<<"The input directory is "<<inputFileNameLYZ2PROD.Data()<<endl;\r
250 TFile* fInputFileLYZ2PROD = (TFile*)outputFile->FindObjectAny(inputFileNameLYZ2PROD.Data());\r
251 if(!fInputFileLYZ2PROD || fInputFileLYZ2PROD->IsZombie()) { \r
252 cerr << " ERROR: To run LYZ2PROD you need the output file from LYZ1PROD. This file is not there! Please run LYZ1PROD first." << endl ; \r
253 break;\r
254 }\r
255 else {\r
256 TList* fInputListLYZ2PROD = (TList*)fInputFileLYZ2PROD->Get("LYZ1PROD");\r
257 if (!fInputListLYZ2PROD) {cout<<"list is NULL pointer!"<<endl;}\r
258 }\r
259 cout<<"LYZ2PROD input file/list read..."<<endl;\r
260 }\r
261 }\r
262\r
263 if (LYZEP) {\r
264 //read the outputfile of the second run\r
265 TString outputFileName = "AnalysisResults2.root";\r
266 TString pwd(gSystem->pwd());\r
267 pwd+="/";\r
268 pwd+=outputFileName.Data();\r
269 TFile *outputFile = NULL;\r
270 if(gSystem->AccessPathName(pwd.Data(),kFileExists)) {\r
271 cout<<"WARNING: You do not have an output file:"<<endl;\r
272 cout<<" "<<pwd.Data()<<endl;\r
273 exit(0);\r
274 } else {\r
275 outputFile = TFile::Open(pwd.Data(),"READ");\r
276 }\r
277 \r
278 // read the output file from LYZ2SUM\r
279 TString inputFileNameLYZEP = "outputLYZ2SUManalysis" ;\r
280 inputFileNameLYZEP += rptypestr;\r
281 cout<<"The input file is "<<inputFileNameLYZEP.Data()<<endl;\r
282 TFile* fInputFileLYZEP = (TFile*)outputFile->FindObjectAny(inputFileNameLYZEP.Data());\r
283 if(!fInputFileLYZEP || fInputFileLYZEP->IsZombie()) { \r
284 cerr << " ERROR: To run LYZEP you need the output file from LYZ2SUM. This file is not there! Please run LYZ2SUM first." << endl ; \r
285 break;\r
286 }\r
287 else {\r
288 TList* fInputListLYZEP = (TList*)fInputFileLYZEP->Get("LYZ2SUM");\r
289 if (!fInputListLYZEP) {cout<<"list is NULL pointer!"<<endl;}\r
290 }\r
291 cout<<"LYZEP input file/list read..."<<endl;\r
292 }\r
293 \r
294 \r
295 // Create the FMD task and add it to the manager\r
296 //===========================================================================\r
297 if (rptypestr == "FMD") {\r
298 AliFMDAnalysisTaskSE *taskfmd = NULL;\r
299 if (rptypestr == "FMD") {\r
300 taskfmd = new AliFMDAnalysisTaskSE("TaskFMD");\r
6ea349ad 301 taskfmd->SelectCollisionCandidates(centralitysel);\r
31e0a55e 302 mgr->AddTask(taskfmd);\r
303 \r
304 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();\r
305 pars->Init();\r
306 pars->SetProcessPrimary(kTRUE); //for MC only\r
307 pars->SetProcessHits(kFALSE);\r
308 \r
309 //pars->SetRealData(kTRUE); //for real data\r
310 //pars->SetProcessPrimary(kFALSE); //for real data\r
311 }\r
312 }\r
313 \r
314 // Create the flow event task, add it to the manager.\r
315 //===========================================================================\r
316 AliAnalysisTaskFlowEvent *taskFE = NULL;\r
317\r
318 if(useAfterBurner)\r
319 { \r
320 taskFE = new AliAnalysisTaskFlowEvent(Form("TaskFlowEvent %s",outputSlotName.Data()),"",doQA,1);\r
321 taskFE->SetFlow(v1,v2,v3,v4); \r
322 taskFE->SetNonFlowNumberOfTrackClones(numberOfTrackClones);\r
323 taskFE->SetAfterburnerOn();\r
6ea349ad 324 taskFE->SelectCollisionCandidates(centralitysel);\r
31e0a55e 325 }\r
6ea349ad 326 else {taskFE = new AliAnalysisTaskFlowEvent(Form("TaskFlowEvent %s",outputSlotName.Data()),"",doQA); \r
327 taskFE->SelectCollisionCandidates(centralitysel);}\r
31e0a55e 328 if (ExcludeRegion) {\r
329 taskFE->DefineDeadZone(excludeEtaMin, excludeEtaMax, excludePhiMin, excludePhiMax); \r
330 }\r
331 taskFE->SetSubeventEtaRange(minA, maxA, minB, maxB);\r
332 if (UsePhysicsSelection) {\r
333 taskFE->SelectCollisionCandidates(AliVEvent::kMB);\r
334 cout<<"Using Physics Selection"<<endl;\r
335 }\r
336 mgr->AddTask(taskFE);\r
337 \r
338 // Pass cuts for RPs and POIs to the task:\r
339 taskFE->SetCutsEvent(cutsEvent);\r
340 taskFE->SetCutsRP(cutsRP);\r
341 taskFE->SetCutsPOI(cutsPOI);\r
342 if (cutsRP->GetParamType()==AliFlowTrackCuts::kV0)\r
343 { \r
344 //TODO: since this is set in a static object all analyses in an analysis train\r
345 //will be affected.\r
346 taskFE->SetHistWeightvsPhiMin(0.);\r
347 taskFE->SetHistWeightvsPhiMax(200.);\r
348 }\r
349\r
350 // Create the analysis tasks, add them to the manager.\r
351 //===========================================================================\r
352 if (SP){\r
353 AliAnalysisTaskScalarProduct *taskSP = new AliAnalysisTaskScalarProduct(Form("TaskScalarProduct %s",outputSlotName.Data()),WEIGHTS[0]);\r
6ea349ad 354 taskSP->SelectCollisionCandidates(centralitysel);\r
31e0a55e 355 taskSP->SetRelDiffMsub(1.0);\r
356 taskSP->SetApplyCorrectionForNUA(kTRUE);\r
357 mgr->AddTask(taskSP);\r
358 }\r
359 if (LYZ1SUM){\r
360 AliAnalysisTaskLeeYangZeros *taskLYZ1SUM = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosSUM %s",outputSlotName.Data()),kTRUE);\r
6ea349ad 361 taskLYZ1SUM->SelectCollisionCandidates(centralitysel);\r
31e0a55e 362 taskLYZ1SUM->SetFirstRunLYZ(kTRUE);\r
363 taskLYZ1SUM->SetUseSumLYZ(kTRUE);\r
364 mgr->AddTask(taskLYZ1SUM);\r
365 }\r
366 if (LYZ1PROD){\r
367 AliAnalysisTaskLeeYangZeros *taskLYZ1PROD = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosPROD %s",outputSlotName.Data()),kTRUE);\r
6ea349ad 368 taskLYZ1PROD->SelectCollisionCandidates(centralitysel);\r
31e0a55e 369 taskLYZ1PROD->SetFirstRunLYZ(kTRUE);\r
370 taskLYZ1PROD->SetUseSumLYZ(kFALSE);\r
371 mgr->AddTask(taskLYZ1PROD);\r
372 }\r
373 if (LYZ2SUM){\r
374 AliAnalysisTaskLeeYangZeros *taskLYZ2SUM = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosSUM %s",outputSlotName.Data()),kFALSE);\r
6ea349ad 375 taskLYZ2SUM->SelectCollisionCandidates(centralitysel);\r
31e0a55e 376 taskLYZ2SUM->SetFirstRunLYZ(kFALSE);\r
377 taskLYZ2SUM->SetUseSumLYZ(kTRUE);\r
378 mgr->AddTask(taskLYZ2SUM);\r
379 }\r
380 if (LYZ2PROD){\r
381 AliAnalysisTaskLeeYangZeros *taskLYZ2PROD = new AliAnalysisTaskLeeYangZeros(Form("TaskLeeYangZerosPROD %s",outputSlotName.Data()),kFALSE);\r
6ea349ad 382 taskLYZ2PROD->SelectCollisionCandidates(centralitysel);\r
31e0a55e 383 taskLYZ2PROD->SetFirstRunLYZ(kFALSE);\r
384 taskLYZ2PROD->SetUseSumLYZ(kFALSE);\r
385 mgr->AddTask(taskLYZ2PROD);\r
386 }\r
387 if (LYZEP){\r
388 AliAnalysisTaskLYZEventPlane *taskLYZEP = new AliAnalysisTaskLYZEventPlane(Form("TaskLYZEventPlane %s",outputSlotName.Data()));\r
6ea349ad 389 taskLYZEP->SelectCollisionCandidates(centralitysel);\r
31e0a55e 390 mgr->AddTask(taskLYZEP);\r
391 }\r
392 if (GFC){\r
393 AliAnalysisTaskCumulants *taskGFC = new AliAnalysisTaskCumulants(Form("TaskCumulants %s",outputSlotName.Data()),useWeights);\r
6ea349ad 394 taskGFC->SelectCollisionCandidates(centralitysel);\r
31e0a55e 395 taskGFC->SetUsePhiWeights(WEIGHTS[0]); \r
396 taskGFC->SetUsePtWeights(WEIGHTS[1]);\r
397 taskGFC->SetUseEtaWeights(WEIGHTS[2]); \r
398 mgr->AddTask(taskGFC);\r
399 }\r
400 if (QC){\r
401 AliAnalysisTaskQCumulants *taskQC = new AliAnalysisTaskQCumulants(Form("TaskQCumulants %s",outputSlotName.Data()),useWeights);\r
6ea349ad 402 taskQC->SelectCollisionCandidates(centralitysel);\r
31e0a55e 403 taskQC->SetUsePhiWeights(WEIGHTS[0]); \r
404 taskQC->SetUsePtWeights(WEIGHTS[1]);\r
405 taskQC->SetUseEtaWeights(WEIGHTS[2]); \r
406 taskQC->SetCalculateCumulantsVsM(kFALSE);\r
407 taskQC->SetnBinsMult(10000);\r
408 taskQC->SetMinMult(0.);\r
409 taskQC->SetMaxMult(10000.);\r
410 taskQC->SetHarmonic(harmonic);\r
411 taskQC->SetApplyCorrectionForNUA(kFALSE);\r
412 taskQC->SetFillMultipleControlHistograms(kFALSE); \r
413 mgr->AddTask(taskQC);\r
414 }\r
415 if (FQD){\r
416 AliAnalysisTaskFittingQDistribution *taskFQD = new AliAnalysisTaskFittingQDistribution(Form("TaskFittingQDistribution %s",outputSlotName.Data()),kFALSE);\r
6ea349ad 417 taskFQD->SelectCollisionCandidates(centralitysel);\r
31e0a55e 418 taskFQD->SetUsePhiWeights(WEIGHTS[0]); \r
419 taskFQD->SetqMin(0.);\r
420 taskFQD->SetqMax(1000.);\r
421 taskFQD->SetqNbins(10000);\r
422 mgr->AddTask(taskFQD);\r
423 }\r
424 if (MCEP){\r
425 AliAnalysisTaskMCEventPlane *taskMCEP = new AliAnalysisTaskMCEventPlane(Form("TaskMCEventPlane %s",outputSlotName.Data()));\r
6ea349ad 426 taskMCEP->SelectCollisionCandidates(centralitysel);\r
31e0a55e 427 mgr->AddTask(taskMCEP);\r
428 }\r
429 if (MH){\r
430 AliAnalysisTaskMixedHarmonics *taskMH = new AliAnalysisTaskMixedHarmonics(Form("TaskMixedHarmonics %s",outputSlotName.Data()),useWeights);\r
6ea349ad 431 taskMH->SelectCollisionCandidates(centralitysel);\r
31e0a55e 432 taskMH->SetHarmonic(1); // n in cos[n(phi1+phi2-2phi3)] and cos[n(psi1+psi2-2phi3)]\r
433 taskMH->SetNoOfMultipicityBins(10000);\r
434 taskMH->SetMultipicityBinWidth(1.);\r
435 taskMH->SetMinMultiplicity(1.);\r
436 taskMH->SetCorrectForDetectorEffects(kTRUE);\r
437 taskMH->SetEvaluateDifferential3pCorrelator(kFALSE); // evaluate <<cos[n(psi1+psi2-2phi3)]>> (Remark: two nested loops) \r
438 taskMH->SetOppositeChargesPOI(kFALSE); // POIs psi1 and psi2 in cos[n(psi1+psi2-2phi3)] will have opposite charges \r
439 mgr->AddTask(taskMH);\r
440 } \r
441 if (NL){\r
442 AliAnalysisTaskNestedLoops *taskNL = new AliAnalysisTaskNestedLoops(Form("TaskNestedLoops %s",outputSlotName.Data()),useWeights);\r
6ea349ad 443 taskNL->SelectCollisionCandidates(centralitysel);\r
31e0a55e 444 taskNL->SetHarmonic(1); // n in cos[n(phi1+phi2-2phi3)] and cos[n(psi1+psi2-2phi3)]\r
445 taskNL->SetEvaluateNestedLoopsForRAD(kTRUE); // RAD = Relative Angle Distribution\r
446 taskNL->SetEvaluateNestedLoopsForMH(kTRUE); // evalaute <<cos[n(phi1+phi2-2phi3)]>> (Remark: three nested loops) \r
447 taskNL->SetEvaluateDifferential3pCorrelator(kFALSE); // evaluate <<cos[n(psi1+psi2-2phi3)]>> (Remark: three nested loops) \r
448 taskNL->SetOppositeChargesPOI(kFALSE); // POIs psi1 and psi2 in cos[n(psi1+psi2-2phi3)] will have opposite charges \r
449 mgr->AddTask(taskNL);\r
450 }\r
451\r
452 // Create the output container for the data produced by the task\r
453 // Connect to the input and output containers\r
454 //===========================================================================\r
455 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();\r
456 \r
457 if (rptypestr == "FMD") {\r
458 AliAnalysisDataContainer *coutputFMD = \r
459 mgr->CreateContainer(Form("BackgroundCorrected %s",outputSlotName.Data()), TList::Class(), AliAnalysisManager::kExchangeContainer);\r
460 //input and output taskFMD \r
461 mgr->ConnectInput(taskfmd, 0, cinput1);\r
462 mgr->ConnectOutput(taskfmd, 1, coutputFMD);\r
463 //input into taskFE\r
464 mgr->ConnectInput(taskFE,1,coutputFMD);\r
465 }\r
466 \r
467 AliAnalysisDataContainer *coutputFE = \r
468 mgr->CreateContainer(Form("FlowEventSimple %s",outputSlotName.Data()),AliFlowEventSimple::Class(),AliAnalysisManager::kExchangeContainer);\r
469 mgr->ConnectInput(taskFE,0,cinput1); \r
470 mgr->ConnectOutput(taskFE,1,coutputFE);\r
471 \r
472 if (taskFE->GetQAOn())\r
473 {\r
474 TString outputQA = fileName;\r
475 outputQA += ":QA";\r
476 AliAnalysisDataContainer* coutputFEQA = \r
477 mgr->CreateContainer(Form("QA %s",outputSlotName.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,outputQA);\r
478 mgr->ConnectOutput(taskFE,2,coutputFEQA);\r
479 }\r
480\r
481 // Create the output containers for the data produced by the analysis tasks\r
482 // Connect to the input and output containers\r
483 //===========================================================================\r
484 if (useWeights) { \r
485 AliAnalysisDataContainer *cinputWeights = mgr->CreateContainer(Form("Weights %s",outputSlotName.Data()),\r
486 TList::Class(),AliAnalysisManager::kInputContainer); \r
487 }\r
488\r
489 if(SP) {\r
490 TString outputSP = fileName;\r
491 outputSP += ":outputSPanalysis";\r
492 outputSP+= rptypestr;\r
493 AliAnalysisDataContainer *coutputSP = mgr->CreateContainer(Form("SP %s",outputSlotName.Data()), \r
494 TList::Class(),AliAnalysisManager::kOutputContainer,outputSP); \r
495 mgr->ConnectInput(taskSP,0,coutputFE); \r
496 mgr->ConnectOutput(taskSP,1,coutputSP); \r
497 if (WEIGHTS[0]) {\r
498 mgr->ConnectInput(taskSP,1,cinputWeights);\r
499 cinputWeights->SetData(weightsList);\r
500 }\r
501 }\r
502 if(LYZ1SUM) {\r
503 TString outputLYZ1SUM = fileName;\r
504 outputLYZ1SUM += ":outputLYZ1SUManalysis";\r
505 outputLYZ1SUM+= rptypestr;\r
506 AliAnalysisDataContainer *coutputLYZ1SUM = mgr->CreateContainer(Form("LYZ1SUM %s",outputSlotName.Data()), \r
507 TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1SUM); \r
508 mgr->ConnectInput(taskLYZ1SUM,0,coutputFE);\r
509 mgr->ConnectOutput(taskLYZ1SUM,1,coutputLYZ1SUM);\r
510 }\r
511 if(LYZ1PROD) {\r
512 TString outputLYZ1PROD = fileName;\r
513 outputLYZ1PROD += ":outputLYZ1PRODanalysis";\r
514 outputLYZ1PROD+= rptypestr;\r
515 AliAnalysisDataContainer *coutputLYZ1PROD = mgr->CreateContainer(Form("LYZ1PROD %s",outputSlotName.Data()), \r
516 TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ1PROD); \r
517 mgr->ConnectInput(taskLYZ1PROD,0,coutputFE); \r
518 mgr->ConnectOutput(taskLYZ1PROD,1,coutputLYZ1PROD);\r
519 }\r
520 if(LYZ2SUM) {\r
521 AliAnalysisDataContainer *cinputLYZ2SUM = mgr->CreateContainer(Form("LYZ2SUMin %s",outputSlotName.Data()),\r
522 TList::Class(),AliAnalysisManager::kInputContainer);\r
523 TString outputLYZ2SUM = fileName;\r
524 outputLYZ2SUM += ":outputLYZ2SUManalysis";\r
525 outputLYZ2SUM+= rptypestr;\r
526 \r
527 AliAnalysisDataContainer *coutputLYZ2SUM = mgr->CreateContainer(Form("LYZ2SUM %s",outputSlotName.Data()), \r
528 TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2SUM); \r
529 mgr->ConnectInput(taskLYZ2SUM,0,coutputFE); \r
530 mgr->ConnectInput(taskLYZ2SUM,1,cinputLYZ2SUM);\r
531 mgr->ConnectOutput(taskLYZ2SUM,1,coutputLYZ2SUM); \r
532 cinputLYZ2SUM->SetData(fInputListLYZ2SUM);\r
533 }\r
534 if(LYZ2PROD) {\r
535 AliAnalysisDataContainer *cinputLYZ2PROD = mgr->CreateContainer(Form("LYZ2PRODin %s",outputSlotName.Data()),\r
536 TList::Class(),AliAnalysisManager::kInputContainer);\r
537 TString outputLYZ2PROD = fileName;\r
538 outputLYZ2PROD += ":outputLYZ2PRODanalysis";\r
539 outputLYZ2PROD+= rptypestr;\r
540 \r
541 AliAnalysisDataContainer *coutputLYZ2PROD = mgr->CreateContainer(Form("LYZ2PROD %s",outputSlotName.Data()), \r
542 TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZ2PROD); \r
543 mgr->ConnectInput(taskLYZ2PROD,0,coutputFE); \r
544 mgr->ConnectInput(taskLYZ2PROD,1,cinputLYZ2PROD);\r
545 mgr->ConnectOutput(taskLYZ2PROD,1,coutputLYZ2PROD); \r
546 cinputLYZ2PROD->SetData(fInputListLYZ2PROD);\r
547 }\r
548 if(LYZEP) {\r
549 AliAnalysisDataContainer *cinputLYZEP = mgr->CreateContainer(Form("LYZEPin %s",outputSlotName.Data()),\r
550 TList::Class(),AliAnalysisManager::kInputContainer);\r
551 TString outputLYZEP = fileName;\r
552 outputLYZEP += ":outputLYZEPanalysis";\r
553 outputLYZEP+= rptypestr;\r
554 \r
555 AliAnalysisDataContainer *coutputLYZEP = mgr->CreateContainer(Form("LYZEP %s",outputSlotName.Data()), \r
556 TList::Class(),AliAnalysisManager::kOutputContainer,outputLYZEP); \r
557 mgr->ConnectInput(taskLYZEP,0,coutputFE); \r
558 mgr->ConnectInput(taskLYZEP,1,cinputLYZEP);\r
559 mgr->ConnectOutput(taskLYZEP,1,coutputLYZEP); \r
560 cinputLYZEP->SetData(fInputListLYZEP);\r
561 }\r
562 if(GFC) {\r
563 TString outputGFC = fileName;\r
564 outputGFC += ":outputGFCanalysis";\r
565 outputGFC+= rptypestr;\r
566 \r
567 AliAnalysisDataContainer *coutputGFC = mgr->CreateContainer(Form("GFC %s",outputSlotName.Data()), \r
568 TList::Class(),AliAnalysisManager::kOutputContainer,outputGFC); \r
569 mgr->ConnectInput(taskGFC,0,coutputFE); \r
570 mgr->ConnectOutput(taskGFC,1,coutputGFC);\r
571 if (useWeights) {\r
572 mgr->ConnectInput(taskGFC,1,cinputWeights);\r
573 cinputWeights->SetData(weightsList);\r
574 } \r
575 }\r
576 if(QC) {\r
577 TString outputQC = fileName;\r
578 outputQC += ":outputQCanalysis";\r
579 outputQC+= rptypestr;\r
580\r
581 AliAnalysisDataContainer *coutputQC = mgr->CreateContainer(Form("QC %s",outputSlotName.Data()), \r
582 TList::Class(),AliAnalysisManager::kOutputContainer,outputQC); \r
583 mgr->ConnectInput(taskQC,0,coutputFE); \r
584 mgr->ConnectOutput(taskQC,1,coutputQC);\r
585 if (useWeights) {\r
586 mgr->ConnectInput(taskQC,1,cinputWeights);\r
587 cinputWeights->SetData(weightsList);\r
588 }\r
589 }\r
590 if(FQD) {\r
591 TString outputFQD = fileName;\r
592 outputFQD += ":outputFQDanalysis";\r
593 outputFQD+= rptypestr;\r
594 \r
595 AliAnalysisDataContainer *coutputFQD = mgr->CreateContainer(Form("FQD %s",outputSlotName.Data()), \r
596 TList::Class(),AliAnalysisManager::kOutputContainer,outputFQD); \r
597 mgr->ConnectInput(taskFQD,0,coutputFE); \r
598 mgr->ConnectOutput(taskFQD,1,coutputFQD);\r
599 if(useWeights) {\r
600 mgr->ConnectInput(taskFQD,1,cinputWeights);\r
601 cinputWeights->SetData(weightsList);\r
602 } \r
603 }\r
604 if(MCEP) {\r
605 TString outputMCEP = fileName;\r
606 outputMCEP += ":outputMCEPanalysis";\r
607 outputMCEP+= rptypestr;\r
608 \r
609 AliAnalysisDataContainer *coutputMCEP = mgr->CreateContainer(Form("MCEP %s",outputSlotName.Data()), \r
610 TList::Class(),AliAnalysisManager::kOutputContainer,outputMCEP); \r
611 mgr->ConnectInput(taskMCEP,0,coutputFE);\r
612 mgr->ConnectOutput(taskMCEP,1,coutputMCEP); \r
613 }\r
614 if(MH) {\r
615 TString outputMH = fileName;\r
616 outputMH += ":outputMHanalysis";\r
617 outputMH += rptypestr;\r
618 \r
619 AliAnalysisDataContainer *coutputMH = mgr->CreateContainer(Form("MH %s",outputSlotName.Data()), \r
620 TList::Class(),AliAnalysisManager::kOutputContainer,outputMH); \r
621 mgr->ConnectInput(taskMH,0,coutputFE); \r
622 mgr->ConnectOutput(taskMH,1,coutputMH); \r
623 //if (useWeights) {\r
624 // mgr->ConnectInput(taskMH,1,cinputWeights);\r
625 // cinputWeights->SetData(weightsList);\r
626 //} \r
627 }\r
628 if(NL) {\r
629 TString outputNL = fileName;\r
630 outputNL += ":outputNLanalysis";\r
631 outputNL += rptypestr;\r
632\r
633 AliAnalysisDataContainer *coutputNL = mgr->CreateContainer(Form("NL %s",outputSlotName.Data()), \r
634 TList::Class(),AliAnalysisManager::kOutputContainer,outputNL); \r
635 mgr->ConnectInput(taskNL,0,coutputFE);\r
636 mgr->ConnectOutput(taskNL,1,coutputNL);\r
637 //if (useWeights) {\r
638 // mgr->ConnectInput(taskNL,1,cinputWeights);\r
639 // cinputWeights->SetData(weightsList);\r
640 //} \r
641 }\r
642\r
643 ///////////////////////////////////////////////////////////////////////////////////////////\r
644 if (runQAtask)\r
645 {\r
646 AliAnalysisTaskQAflow* taskQAflow = new AliAnalysisTaskQAflow(Form("TaskQAflow %s",outputSlotName.Data()));\r
6ea349ad 647 taskQAflow->SelectCollisionCandidates(centralitysel);\r
31e0a55e 648 taskQAflow->SetEventCuts(cutsEvent);\r
649 taskQAflow->SetTrackCuts(cutsRP);\r
650 taskQAflow->SetFillNTuple(FillQAntuple);\r
651 taskQAflow->SetDoCorrelations(DoQAcorrelations);\r
652 mgr->AddTask(taskQAflow);\r
653 \r
654 Printf("outputSlotName %s",outputSlotName.Data());\r
655 TString taskQAoutputFileName(fileNameBase);\r
656 taskQAoutputFileName.Append("_QA.root");\r
657 AliAnalysisDataContainer* coutputQAtask = mgr->CreateContainer(Form("flowQA %s",outputSlotName.Data()),\r
658 TObjArray::Class(),\r
659 AliAnalysisManager::kOutputContainer,\r
660 taskQAoutputFileName);\r
661 AliAnalysisDataContainer* coutputQAtaskTree = mgr->CreateContainer(Form("flowQAntuple %s",outputSlotName.Data()),\r
662 TNtuple::Class(),\r
663 AliAnalysisManager::kOutputContainer,\r
664 taskQAoutputFileName);\r
665 mgr->ConnectInput(taskQAflow,0,mgr->GetCommonInputContainer());\r
666 mgr->ConnectInput(taskQAflow,1,coutputFE);\r
667 mgr->ConnectOutput(taskQAflow,1,coutputQAtask);\r
668 if (FillQAntuple) mgr->ConnectOutput(taskQAflow,2,coutputQAtaskTree);\r
669 }\r
670}\r
671\r
672\r
673\r
674\r
675\r