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