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