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