]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Tasks/AliAnalysisTaskVnV0.cxx
fixes warnings
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskVnV0.cxx
CommitLineData
afa8df58 1#include "AliAnalysisTaskVnV0.h"
2
3// ROOT includes
4#include <TMath.h>
5
6// AliRoot includes
7#include "AliInputEventHandler.h"
8#include "AliAODEvent.h"
9#include "AliAODVertex.h"
10#include "AliAODTrack.h"
11#include "AliCentrality.h"
12#include "AliVHeader.h"
13#include "AliAODVZERO.h"
14#include "TFile.h"
15#include "AliOADBContainer.h"
16#include "TH2F.h"
17#include "TF1.h"
587d006a 18#include "AliGenHijingEventHeader.h"
19#include "AliMCEvent.h"
20#include "AliAODMCHeader.h"
21#include "AliAODMCParticle.h"
afa8df58 22
23// STL includes
24//#include <iostream>
25//using namespace std;
26
27ClassImp(AliAnalysisTaskVnV0)
28
afa8df58 29//_____________________________________________________________________________
30AliAnalysisTaskVnV0::AliAnalysisTaskVnV0():
31 AliAnalysisTaskSE(),
32 fAOD(0),
587d006a 33 fVtxCut(10.0), // cut on |vertex| < fVtxCut
afa8df58 34 fEtaCut(0.8), // cut on |eta| < fEtaCut
35 fMinPt(0.15), // cut on pt > fMinPt
36 fRun(-1),
37 fList(new TList()),
38 fList2(new TList()),
587d006a 39 fList3(new TList()),
40 fList4(new TList()),
41 fMultV0(NULL),
afa8df58 42 fV0Cpol(100),
43 fV0Apol(100),
587d006a 44 fHResTPCv0A2(NULL),
45 fHResTPCv0C2(NULL),
46 fHResv0Cv0A2(NULL),
47 fHResTPCv0A3(NULL),
48 fHResTPCv0C3(NULL),
49 fHResv0Cv0A3(NULL),
50 fPhiRPv0A(NULL),
51 fPhiRPv0C(NULL),
52 fPhiRPv0Av3(NULL),
53 fPhiRPv0Cv3(NULL),
54 fPhiTracks(NULL),
55 fQA(NULL),
56 fQA2(NULL),
57 fQAv3(NULL),
58 fQA2v3(NULL),
afa8df58 59 fPID(new AliFlowBayesianPID()),
587d006a 60 fTree(NULL),
61 fCentrality(-1),
afa8df58 62 evPlAngV0ACor2(0),
63 evPlAngV0CCor2(0),
64 evPlAng2(0),
65 evPlAngV0ACor3(0),
66 evPlAngV0CCor3(0),
67 evPlAng3(0),
68 fV2(kTRUE),
587d006a 69 fV3(kTRUE),
70 fContAllChargesV0A(NULL),
71 fContAllChargesV0C(NULL),
72 fContAllChargesV0Av3(NULL),
73 fContAllChargesV0Cv3(NULL),
74 fContAllChargesMC(NULL),
75 fContAllChargesMCv3(NULL),
76 fIsMC(kFALSE),
77 fQAsw(kFALSE)
afa8df58 78{
79 DefineOutput(1, TList::Class());
80 DefineOutput(2, TList::Class());
587d006a 81 DefineOutput(3, TList::Class());
82 DefineOutput(4, TList::Class());
afa8df58 83
84 // Default constructor (should not be used)
85 fList->SetName("resultsV2");
86 fList2->SetName("resultsV3");
587d006a 87 fList3->SetName("resultsMC");
88 fList4->SetName("QA");
afa8df58 89
90 fPID->SetNewTrackParam(); // Better tuning for TOF PID tracking effect in LHC10h
afa8df58 91}
92
93//______________________________________________________________________________
94AliAnalysisTaskVnV0::AliAnalysisTaskVnV0(const char *name):
95 AliAnalysisTaskSE(name),
96 fAOD(0),
587d006a 97 fVtxCut(10.0), // cut on |vertex| < fVtxCut
afa8df58 98 fEtaCut(0.8), // cut on |eta| < fEtaCut
99 fMinPt(0.15), // cut on pt > fMinPt
100 fRun(-1),
101 fList(new TList()),
102 fList2(new TList()),
587d006a 103 fList3(new TList()),
104 fList4(new TList()),
105 fMultV0(NULL),
afa8df58 106 fV0Cpol(100),
107 fV0Apol(100),
587d006a 108 fHResTPCv0A2(NULL),
109 fHResTPCv0C2(NULL),
110 fHResv0Cv0A2(NULL),
111 fHResTPCv0A3(NULL),
112 fHResTPCv0C3(NULL),
113 fHResv0Cv0A3(NULL),
114 fPhiRPv0A(NULL),
115 fPhiRPv0C(NULL),
116 fPhiRPv0Av3(NULL),
117 fPhiRPv0Cv3(NULL),
118 fPhiTracks(NULL),
119 fQA(NULL),
120 fQA2(NULL),
121 fQAv3(NULL),
122 fQA2v3(NULL),
afa8df58 123 fPID(new AliFlowBayesianPID()),
587d006a 124 fTree(NULL),
125 fCentrality(-1),
afa8df58 126 evPlAngV0ACor2(0),
127 evPlAngV0CCor2(0),
128 evPlAng2(0),
129 evPlAngV0ACor3(0),
130 evPlAngV0CCor3(0),
131 evPlAng3(0),
132 fV2(kTRUE),
587d006a 133 fV3(kTRUE),
134 fContAllChargesV0A(NULL),
135 fContAllChargesV0C(NULL),
136 fContAllChargesV0Av3(NULL),
137 fContAllChargesV0Cv3(NULL),
138 fContAllChargesMC(NULL),
139 fContAllChargesMCv3(NULL),
140 fIsMC(kFALSE),
141 fQAsw(kFALSE)
afa8df58 142{
143
144 DefineOutput(1, TList::Class());
145 DefineOutput(2, TList::Class());
587d006a 146 DefineOutput(3, TList::Class());
147 DefineOutput(4, TList::Class());
afa8df58 148
149 // Output slot #1 writes into a TTree
150 fList->SetName("resultsV2");
151 fList2->SetName("resultsV3");
587d006a 152 fList3->SetName("resultsMC");
153 fList4->SetName("QA");
afa8df58 154
155 fPID->SetNewTrackParam(); // Better tuning for TOF PID tracking effect in LHC10h
156}
157
158//_____________________________________________________________________________
159AliAnalysisTaskVnV0::~AliAnalysisTaskVnV0()
160{
161
162}
163
164//______________________________________________________________________________
165void AliAnalysisTaskVnV0::UserCreateOutputObjects()
166{
167
587d006a 168 if(fIsMC) fPID->SetMC(kTRUE);
169
170
afa8df58 171 // Tree for EP debug (comment the adding to v2 list id not needed)
172 fTree = new TTree("tree","tree");
173 fTree->Branch("evPlAngV0ACor2",&evPlAngV0ACor2,"evPlAngV0ACor2/F");
174 fTree->Branch("evPlAngV0CCor2",&evPlAngV0CCor2,"evPlAngV0CCor2/F");
175 fTree->Branch("evPlAng2",&evPlAng2,"evPlAng2/F");
176 fTree->Branch("fCentrality",&fCentrality,"fCentrality/F");
177 fTree->Branch("evPlAngV0ACor3",&evPlAngV0ACor3,"evPlAngV0ACor3/F");
178 fTree->Branch("evPlAngV0CCor3",&evPlAngV0CCor3,"evPlAngV0CCor3/F");
179 fTree->Branch("evPlAng3",&evPlAng3,"evPlAng3/F");
180
181
182 // Container analyses (different steps mean different species)
183 const Int_t nPtBinsTOF = 45;
184 Double_t binsPtTOF[nPtBinsTOF+1] = {0., 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.25, 2.5, 2.75,3.0,3.25,3.5,3.75,4.0,4.5,5,5.5,6,6.5,7,8,9,10,12,15,20};
185 const Int_t nChargeBinsTOF = 3;
186 Double_t binChargeTOF[nChargeBinsTOF+1] = {-1.5,-0.5,0.5,1.5};
587d006a 187// const Int_t nv_2BinsTOF = 50;
188// Double_t binV_2TOF[nv_2BinsTOF+1];
189// for(Int_t i=0;i<nv_2BinsTOF+1;i++){
190// binV_2TOF[i] = -1 + i*2./nv_2BinsTOF;
191// }
afa8df58 192 const Int_t nCentrTOF = 9;
193 Double_t binCentrTOF[nCentrTOF+1] = {-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5};
194 const Int_t nProbTOF = 4;
587d006a 195 Double_t binProbTOF[nProbTOF+1] = {0.0,0.6,0.8,0.9,1.00001};
196
197 const Int_t nPsiTOF = 10;
198// Double_t binPsiTOF[nPsiTOF+1];
199// for(Int_t i=0;i<nPsiTOF+1;i++){
200// binPsiTOF[i] = -TMath::Pi()/2 + i*TMath::Pi()/nPsiTOF;
201// }
202// Double_t binPsiTOFv3[nPsiTOF+1];
203// for(Int_t i=0;i<nPsiTOF+1;i++){
204// binPsiTOFv3[i] = -TMath::Pi()/3 + i*TMath::Pi()/nPsiTOF*2/3;
205// }
afa8df58 206
207 const Int_t nMaskPID = 3;
208 Double_t binMaskPID[nMaskPID+1] = {-0.5,0.5,1.5,2.5};
209
587d006a 210 const Int_t nChargeBinsTOFres = 2;
211 const Int_t nCentrTOFres = 9;
212 const Int_t nProbTOFres = 4;
213 const Int_t nPsiTOFres = 10;
214 const Int_t nMaskPIDres = 3;
215
216 Int_t binsTOF[5] = {nCentrTOFres,nChargeBinsTOFres,nProbTOFres,nPsiTOFres,nMaskPIDres};
217 Int_t binsTOFmc[5] = {nCentrTOFres,nChargeBinsTOFres,1,nPsiTOFres,2};
afa8df58 218
219 // v2 container
587d006a 220 fContAllChargesV0A = new AliFlowVZEROResults("v2A",5,binsTOF);
221 fContAllChargesV0A->SetVarRange(0,-0.5,8.5); // centrality
222 fContAllChargesV0A->SetVarRange(1,-1.5,1.5); // charge
223 fContAllChargesV0A->SetVarRange(2,0.6,1.0001);// prob
224 fContAllChargesV0A->SetVarRange(3,-TMath::Pi()/2,TMath::Pi()/2); // Psi
225 fContAllChargesV0A->SetVarRange(4,-0.5,2.5); // pid mask
226 fContAllChargesV0A->SetVarName(0,"centrality");
227 fContAllChargesV0A->SetVarName(1,"charge");
228 fContAllChargesV0A->SetVarName(2,"prob");
229 fContAllChargesV0A->SetVarName(3,"#Psi");
230 fContAllChargesV0A->SetVarName(4,"PIDmask");
231 fContAllChargesV0A->AddSpecies("all",nPtBinsTOF,binsPtTOF);
232 fContAllChargesV0A->AddSpecies("pi",nPtBinsTOF,binsPtTOF);
233 fContAllChargesV0A->AddSpecies("k",nPtBinsTOF,binsPtTOF);
234 fContAllChargesV0A->AddSpecies("pr",nPtBinsTOF,binsPtTOF);
235 fContAllChargesV0A->AddSpecies("e",nPtBinsTOF,binsPtTOF);
236 fContAllChargesV0A->AddSpecies("d",nPtBinsTOF,binsPtTOF);
237 fContAllChargesV0A->AddSpecies("t",nPtBinsTOF,binsPtTOF);
238 fContAllChargesV0A->AddSpecies("he3",nPtBinsTOF,binsPtTOF);
239 fContAllChargesV0A->AddSpecies("mu",nPtBinsTOF,binsPtTOF);
240
241 fContAllChargesV0C = new AliFlowVZEROResults("v2C",5,binsTOF);
242 fContAllChargesV0C->SetVarRange(0,-0.5,8.5); // centrality
243 fContAllChargesV0C->SetVarRange(1,-1.5,1.5); // charge
244 fContAllChargesV0C->SetVarRange(2,0.6,1.0001);// prob
245 fContAllChargesV0C->SetVarRange(3,-TMath::Pi()/2,TMath::Pi()/2); // Psi
246 fContAllChargesV0C->SetVarRange(4,-0.5,2.5); // pid mask
247 fContAllChargesV0C->SetVarName(0,"centrality");
248 fContAllChargesV0C->SetVarName(1,"charge");
249 fContAllChargesV0C->SetVarName(2,"prob");
250 fContAllChargesV0C->SetVarName(3,"#Psi");
251 fContAllChargesV0C->SetVarName(4,"PIDmask");
252 fContAllChargesV0C->AddSpecies("all",nPtBinsTOF,binsPtTOF);
253 fContAllChargesV0C->AddSpecies("pi",nPtBinsTOF,binsPtTOF);
254 fContAllChargesV0C->AddSpecies("k",nPtBinsTOF,binsPtTOF);
255 fContAllChargesV0C->AddSpecies("pr",nPtBinsTOF,binsPtTOF);
256 fContAllChargesV0C->AddSpecies("e",nPtBinsTOF,binsPtTOF);
257 fContAllChargesV0C->AddSpecies("d",nPtBinsTOF,binsPtTOF);
258 fContAllChargesV0C->AddSpecies("t",nPtBinsTOF,binsPtTOF);
259 fContAllChargesV0C->AddSpecies("he3",nPtBinsTOF,binsPtTOF);
260 fContAllChargesV0C->AddSpecies("mu",nPtBinsTOF,binsPtTOF);
afa8df58 261
262 fList->Add(fContAllChargesV0A);
263 fList->Add(fContAllChargesV0C);
264
587d006a 265 if(fIsMC){
266 fContAllChargesMC = new AliFlowVZEROResults("v2mc",5,binsTOFmc);
267 fContAllChargesMC->SetVarRange(0,-0.5,8.5); // centrality
268 fContAllChargesMC->SetVarRange(1,-1.5,1.5); // charge
269 fContAllChargesMC->SetVarRange(2,0.6,1.0001);// prob
270 fContAllChargesMC->SetVarRange(3,-TMath::Pi()/2,TMath::Pi()/2); // Psi
271 fContAllChargesMC->SetVarRange(4,-0.5,1.5); // pid mask
272 fContAllChargesMC->SetVarName(0,"centrality");
273 fContAllChargesMC->SetVarName(1,"charge");
274 fContAllChargesMC->SetVarName(2,"prob");
275 fContAllChargesMC->SetVarName(3,"#Psi");
276 fContAllChargesMC->SetVarName(4,"PIDmask");
277 fContAllChargesMC->AddSpecies("all",nPtBinsTOF,binsPtTOF);
278 fContAllChargesMC->AddSpecies("pi",nPtBinsTOF,binsPtTOF);
279 fContAllChargesMC->AddSpecies("k",nPtBinsTOF,binsPtTOF);
280 fContAllChargesMC->AddSpecies("pr",nPtBinsTOF,binsPtTOF);
281 fContAllChargesMC->AddSpecies("e",nPtBinsTOF,binsPtTOF);
282 fContAllChargesMC->AddSpecies("mu",nPtBinsTOF,binsPtTOF);
283 fList3->Add(fContAllChargesMC);
284 }
285
afa8df58 286 // v3 container
587d006a 287 fContAllChargesV0Av3 = new AliFlowVZEROResults("v3A",5,binsTOF);
288 fContAllChargesV0Av3->SetVarRange(0,-0.5,8.5); // centrality
289 fContAllChargesV0Av3->SetVarRange(1,-1.5,1.5); // charge
290 fContAllChargesV0Av3->SetVarRange(2,0.6,1.0001);// prob
291 fContAllChargesV0Av3->SetVarRange(3,-TMath::Pi()/3,TMath::Pi()/3); // Psi
292 fContAllChargesV0Av3->SetVarRange(4,-0.5,2.5); // pid mask
293 fContAllChargesV0Av3->SetVarName(0,"centrality");
294 fContAllChargesV0Av3->SetVarName(1,"charge");
295 fContAllChargesV0Av3->SetVarName(2,"prob");
296 fContAllChargesV0Av3->SetVarName(3,"#Psi");
297 fContAllChargesV0Av3->SetVarName(4,"PIDmask");
298 fContAllChargesV0Av3->AddSpecies("all",nPtBinsTOF,binsPtTOF);
299 fContAllChargesV0Av3->AddSpecies("pi",nPtBinsTOF,binsPtTOF);
300 fContAllChargesV0Av3->AddSpecies("k",nPtBinsTOF,binsPtTOF);
301 fContAllChargesV0Av3->AddSpecies("pr",nPtBinsTOF,binsPtTOF);
302 fContAllChargesV0Av3->AddSpecies("e",nPtBinsTOF,binsPtTOF);
303 fContAllChargesV0Av3->AddSpecies("d",nPtBinsTOF,binsPtTOF);
304 fContAllChargesV0Av3->AddSpecies("t",nPtBinsTOF,binsPtTOF);
305 fContAllChargesV0Av3->AddSpecies("he3",nPtBinsTOF,binsPtTOF);
306 fContAllChargesV0Av3->AddSpecies("mu",nPtBinsTOF,binsPtTOF);
307
308 fContAllChargesV0Cv3 = new AliFlowVZEROResults("v3C",5,binsTOF);
309 fContAllChargesV0Cv3->SetVarRange(0,-0.5,8.5); // centrality
310 fContAllChargesV0Cv3->SetVarRange(1,-1.5,1.5); // charge
311 fContAllChargesV0Cv3->SetVarRange(2,0.6,1.0001);// prob
312 fContAllChargesV0Cv3->SetVarRange(3,-TMath::Pi()/3,TMath::Pi()/3); // Psi
313 fContAllChargesV0Cv3->SetVarRange(4,-0.5,2.5); // pid mask
314 fContAllChargesV0Cv3->SetVarName(0,"centrality");
315 fContAllChargesV0Cv3->SetVarName(1,"charge");
316 fContAllChargesV0Cv3->SetVarName(2,"prob");
317 fContAllChargesV0Cv3->SetVarName(3,"#Psi");
318 fContAllChargesV0Cv3->SetVarName(4,"PIDmask");
319 fContAllChargesV0Cv3->AddSpecies("all",nPtBinsTOF,binsPtTOF);
320 fContAllChargesV0Cv3->AddSpecies("pi",nPtBinsTOF,binsPtTOF);
321 fContAllChargesV0Cv3->AddSpecies("k",nPtBinsTOF,binsPtTOF);
322 fContAllChargesV0Cv3->AddSpecies("pr",nPtBinsTOF,binsPtTOF);
323 fContAllChargesV0Cv3->AddSpecies("e",nPtBinsTOF,binsPtTOF);
324 fContAllChargesV0Cv3->AddSpecies("d",nPtBinsTOF,binsPtTOF);
325 fContAllChargesV0Cv3->AddSpecies("t",nPtBinsTOF,binsPtTOF);
326 fContAllChargesV0Cv3->AddSpecies("he3",nPtBinsTOF,binsPtTOF);
327 fContAllChargesV0Cv3->AddSpecies("mu",nPtBinsTOF,binsPtTOF);
afa8df58 328
329 fList2->Add(fContAllChargesV0Av3);
330 fList2->Add(fContAllChargesV0Cv3);
331
332 // TProfile for resolutions 3 subevents (V0A, V0C, TPC)
333 // v2
334 fHResTPCv0A2 = new TProfile("hResTPCv0A2","",9,0,9);
335 fHResTPCv0C2 = new TProfile("hResTPCv0C2","",9,0,9);
336 fHResv0Cv0A2 = new TProfile("hResv0Cv0A2","",9,0,9);
337
338 fList->Add(fHResTPCv0A2);
339 fList->Add(fHResTPCv0C2);
340 fList->Add(fHResv0Cv0A2);
341
342 // v3
343 fHResTPCv0A3 = new TProfile("hResTPCv0A3","",9,0,9);
344 fHResTPCv0C3 = new TProfile("hResTPCv0C3","",9,0,9);
345 fHResv0Cv0A3 = new TProfile("hResv0Cv0A3","",9,0,9);
346
347 fList2->Add(fHResTPCv0A3);
348 fList2->Add(fHResTPCv0C3);
349 fList2->Add(fHResv0Cv0A3);
350
351 // V0A and V0C event plane distributions
352 //v2
353 fPhiRPv0A = new TH2F("fPhiRPv0Av2","#phi distribution of EP VZERO-A;centrality;#phi (rad)",9,0,9,nPsiTOF,-TMath::Pi(),TMath::Pi());
354 fPhiRPv0C = new TH2F("fPhiRPv0Cv2","#phi distribution of EP VZERO-C;centrality;#phi (rad)",9,0,9,nPsiTOF,-TMath::Pi(),TMath::Pi());
355
356 //v3
357 fPhiRPv0Av3 = new TH2F("fPhiRPv0Av3","#phi distribution of EP VZERO-A;centrality;#phi (rad)",9,0,9,nPsiTOF,-TMath::Pi()/3*2,TMath::Pi()/3*2);
358 fPhiRPv0Cv3 = new TH2F("fPhiRPv0Cv3","#phi distribution of EP VZERO-C;centrality;#phi (rad)",9,0,9,nPsiTOF,-TMath::Pi()/3*2,TMath::Pi()/3*2);
359
360 // Track phi distribution container (only once) put in v2 output (only if needed)
361 const Int_t nPhiBin = 20;
362 Double_t binPhi[nPhiBin+1];
363 for(Int_t i=0;i<nPhiBin+1;i++){
364 binPhi[i] = i*TMath::Pi()*0.1;
365 }
366 Int_t binsPhi[5] = {nCentrTOF,nChargeBinsTOF,nPtBinsTOF,nProbTOF,nPhiBin};
367 fPhiTracks = new AliCFContainer("fPhiTracks","centr:charge:pt:prob:phi",1+7,5,binsPhi);
368 fPhiTracks->SetBinLimits(0,binCentrTOF);
369 fPhiTracks->SetBinLimits(1,binChargeTOF);
370 fPhiTracks->SetBinLimits(2,binsPtTOF);
371 fPhiTracks->SetBinLimits(3,binProbTOF);
372 fPhiTracks->SetBinLimits(4,binPhi);
373 fPhiTracks->SetVarTitle(0,"centrality");
374 fPhiTracks->SetVarTitle(1,"charge");
375 fPhiTracks->SetVarTitle(2,"p_{t} (GeV/c)");
376 fPhiTracks->SetVarTitle(3,"Bayesian Probability");
377 fPhiTracks->SetVarTitle(4,"#phi");
378
379 // QA container
380 // v2
381 const Int_t nDETsignal = 50;
382 Double_t binDETsignal[nDETsignal+1];
383 for(Int_t i=0;i<nDETsignal+1;i++){
384 binDETsignal[i] = -5 + i*10. / nDETsignal;
385 }
587d006a 386// const Int_t nEta = 5;
387// Double_t binEta[nEta+1];
388// for(Int_t i=0;i<nEta+1;i++){
389// binEta[i] = -1 + i*2. / nEta;
390// }
afa8df58 391
392 const Int_t nDeltaPhi = 5;
393 Double_t binDeltaPhi[nDeltaPhi+1];
394 for(Int_t i=0;i<nDeltaPhi+1;i++){
395 binDeltaPhi[i] = -TMath::Pi() + i*2*TMath::Pi() / nDeltaPhi;
396 }
397
398 Int_t binsQA[7] = {nCentrTOF,nPtBinsTOF,nProbTOF,nDETsignal,nDETsignal,nDeltaPhi,nMaskPID};
399
400 fQA = new AliCFContainer("fQAv2","centr:pt:prob:TPCsig:TOFsig:DeltaPhi:maskPID",7,7,binsQA);
401 fQA->SetBinLimits(0,binCentrTOF);
402 fQA->SetBinLimits(1,binsPtTOF);
403 fQA->SetBinLimits(2,binProbTOF);
404 fQA->SetBinLimits(3,binDETsignal);
405 fQA->SetBinLimits(4,binDETsignal);
406 fQA->SetBinLimits(5,binDeltaPhi);
407 fQA->SetBinLimits(6,binMaskPID);
408 fQA->SetVarTitle(0,"centrality");
409 fQA->SetVarTitle(1,"p_{t} (GeV/c)");
410 fQA->SetVarTitle(2,"Bayesian Probability");
411 fQA->SetVarTitle(3,"N_{#sigma}^{TPC}");
412 fQA->SetVarTitle(4,"N_{#sigma}^{TOF}");
413 fQA->SetVarTitle(5,"#Delta#phi (V0A)");
414 fQA->SetVarTitle(6,"TOF PID");
415
416 fQA2 = new AliCFContainer("fQA2v2","centr:pt:prob:TPCsig:TOFsig:DeltaPhi:maskPID",7,8,binsQA);
417 fQA2->SetBinLimits(0,binCentrTOF);
418 fQA2->SetBinLimits(1,binsPtTOF);
419 fQA2->SetBinLimits(2,binProbTOF);
420 fQA2->SetBinLimits(3,binDETsignal);
421 fQA2->SetBinLimits(4,binDETsignal);
422 fQA2->SetBinLimits(5,binDeltaPhi);
423 fQA2->SetBinLimits(6,binMaskPID);
424 fQA2->SetVarTitle(0,"centrality");
425 fQA2->SetVarTitle(1,"p_{t} (GeV/c)");
426 fQA2->SetVarTitle(2,"Bayesian Probability");
427 fQA2->SetVarTitle(3,"N_{#sigma}^{TPC}");
428 fQA2->SetVarTitle(4,"N_{#sigma}^{TOF}");
429 fQA2->SetVarTitle(5,"#Delta#phi (V0C)");
430 fQA2->SetVarTitle(6,"TOF PID");
431
432 // v3
433 const Int_t nDeltaPhiV3 = 7;
434 Double_t binDeltaPhiV3[nDeltaPhiV3+1];
435 for(Int_t i=0;i<nDeltaPhiV3+1;i++){
436 binDeltaPhiV3[i] = -TMath::Pi() + i*2*TMath::Pi() / nDeltaPhiV3;
437 }
438
439 Int_t binsQAv3[7] = {nCentrTOF,nPtBinsTOF,nProbTOF,nDETsignal,nDETsignal,nDeltaPhiV3,nMaskPID};
440
441 fQAv3 = new AliCFContainer("fQAv3","centr:pt:prob:TPCsig:TOFsig:DeltaPhi:maskPID",7,7,binsQAv3);
442 fQAv3->SetBinLimits(0,binCentrTOF);
443 fQAv3->SetBinLimits(1,binsPtTOF);
444 fQAv3->SetBinLimits(2,binProbTOF);
445 fQAv3->SetBinLimits(3,binDETsignal);
446 fQAv3->SetBinLimits(4,binDETsignal);
447 fQAv3->SetBinLimits(5,binDeltaPhiV3);
448 fQAv3->SetBinLimits(6,binMaskPID);
449 fQAv3->SetVarTitle(0,"centrality");
450 fQAv3->SetVarTitle(1,"p_{t} (GeV/c)");
451 fQAv3->SetVarTitle(2,"Bayesian Probability");
452 fQAv3->SetVarTitle(3,"N_{#sigma}^{TPC}");
453 fQAv3->SetVarTitle(4,"N_{#sigma}^{TOF}");
454 fQAv3->SetVarTitle(5,"#Delta#phi (V0A)");
455 fQAv3->SetVarTitle(6,"TOF PID");
456
457 fQA2v3 = new AliCFContainer("fQA2v3","centr:pt:prob:TPCsig:TOFsig:DeltaPhi:maskPID",7,8,binsQA);
458 fQA2v3->SetBinLimits(0,binCentrTOF);
459 fQA2v3->SetBinLimits(1,binsPtTOF);
460 fQA2v3->SetBinLimits(2,binProbTOF);
461 fQA2v3->SetBinLimits(3,binDETsignal);
462 fQA2v3->SetBinLimits(4,binDETsignal);
463 fQA2v3->SetBinLimits(5,binDeltaPhiV3);
464 fQA2v3->SetBinLimits(6,binMaskPID);
465 fQA2v3->SetVarTitle(0,"centrality");
466 fQA2v3->SetVarTitle(1,"p_{t} (GeV/c)");
467 fQA2v3->SetVarTitle(2,"Bayesian Probability");
468 fQA2v3->SetVarTitle(3,"N_{#sigma}^{TPC}");
469 fQA2v3->SetVarTitle(4,"N_{#sigma}^{TOF}");
470 fQA2v3->SetVarTitle(5,"#Delta#phi (V0C)");
471 fQA2v3->SetVarTitle(6,"TOF PID");
472
473
474 fList->Add(fPhiRPv0A);
475 fList->Add(fPhiRPv0C);
587d006a 476 if(fQAsw)
477 fList4->Add(fPhiTracks); // comment if not needed
478
479 if(fQAsw && fV2){
480 fList4->Add(fQA);
481 fList4->Add(fQA2);
482 }
afa8df58 483
484 fList2->Add(fPhiRPv0Av3);
485 fList2->Add(fPhiRPv0Cv3);
afa8df58 486
587d006a 487 if(fQAsw && fV3){
488 fList4->Add(fQAv3);
489 fList4->Add(fQA2v3);
490 }
491
492 fList->Add(fTree); // comment if not needed
afa8df58 493
494 printf("Output creation ok!!\n\n\n\n");
495
496 // Post output data.
497 if(fV2) PostData(1, fList);
498 if(fV3) PostData(2, fList2);
587d006a 499 if(fIsMC) PostData(3, fList3);
500 if(fQAsw) PostData(4, fList4);
afa8df58 501}
502
503//______________________________________________________________________________
504void AliAnalysisTaskVnV0::UserExec(Option_t *)
505{
506 // Main loop
507 // Called for each event
508
509 fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
510 if(!fAOD){
511 Printf("%s:%d AODEvent not found in Input Manager",(char*)__FILE__,__LINE__);
512 this->Dump();
513 return;
514 }
515
516 Int_t run = fAOD->GetRunNumber();
517
518 if(run != fRun){
519 // Load the calibrations run dependent
520 OpenInfoCalbration(run);
521 fRun=run;
522 }
523
524 Float_t zvtx = GetVertex(fAOD);
525
587d006a 526
527
528 //Get the MC object
d6a1c304 529 if(fIsMC){
530 AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(fAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
531 if (!mcHeader) {
532 AliError("Could not find MC Header in AOD");
533 return;
534 }
587d006a 535 }
536
537 /*
538 AliMCEvent* mcEvent = MCEvent();
539 if (!mcEvent) {
540 Printf("ERROR: Could not retrieve MC event");
541 return;
542 }
543
544 Double_t gReactionPlane = -999., gImpactParameter = -999.;
545 //Get the MC header
546 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
547 if (headerH) {
548 //Printf("=====================================================");
549 //Printf("Reaction plane angle: %lf",headerH->ReactionPlaneAngle());
550 //Printf("=====================================================");
551 gReactionPlane = headerH->ReactionPlaneAngle();
552 gImpactParameter = headerH->ImpactParameter();
553 }
554
555*/
556
afa8df58 557 if (TMath::Abs(zvtx) < fVtxCut) {
558 //Centrality
559 Float_t v0Centr = -10.;
560 Float_t trkCentr = -10.;
561 AliCentrality *centrality = fAOD->GetCentrality();
562 if (centrality){
563 v0Centr = centrality->GetCentralityPercentile("V0M");
564 trkCentr = centrality->GetCentralityPercentile("TRK");
565 }
566
567 if(TMath::Abs(v0Centr - trkCentr) < 5.0){ // consistency cut on centrality selection
568 fPID->SetDetResponse(fAOD, v0Centr); // Set the PID object for each event!!!!
569 Analyze(fAOD,v0Centr); // Do analysis!!!!
570
571 fCentrality = v0Centr;
572 if(fV2) fTree->Fill();
573 }
574 }
575
576}
577
578//________________________________________________________________________
579void AliAnalysisTaskVnV0::Analyze(AliAODEvent* aodEvent, Float_t v0Centr)
580{
581 Float_t mass[8] = {5.10998909999999971e-04, 1.05658000000000002e-01, 1.39570000000000000e-01, 4.93676999999999977e-01, 9.38271999999999995e-01,1.87783699999999998,2.81740199999999996,1.40805449999999999};
582
583 // Event plane resolution for v2
584 Float_t evPlRes[18] = {0.350582,0.505393,0.607845,0.632913,0.592230,0.502489,0.381717,0.249539,0.133180, // V0A vs. centrality
585 0.446480,0.612705,0.712222,0.736200,0.697907,0.610114,0.481009,0.327402,0.182277};// V0C vs. centrality
586
587 Int_t iC = -1;
588 if (v0Centr >0 && v0Centr < 80){ // analysis only for 0-80% centrality classes
589 // centrality bins
590 if(v0Centr < 5) iC = 0;
591 else if(v0Centr < 10) iC = 1;
592 else if(v0Centr < 20) iC = 2;
593 else if(v0Centr < 30) iC = 3;
594 else if(v0Centr < 40) iC = 4;
595 else if(v0Centr < 50) iC = 5;
596 else if(v0Centr < 60) iC = 6;
597 else if(v0Centr < 70) iC = 7;
598 else iC = 8;
599
600 //reset Q vector info
601 Double_t Qxa2 = 0, Qya2 = 0;
602 Double_t Qxc2 = 0, Qyc2 = 0;
603 Double_t Qxa3 = 0, Qya3 = 0;
604 Double_t Qxc3 = 0, Qyc3 = 0;
587d006a 605
606 Int_t nAODTracks = aodEvent->GetNumberOfTracks();
607
608 AliAODMCHeader *mcHeader = NULL;
609 TClonesArray *mcArray = NULL;
610 Float_t evplaneMC = 0;
611 if(fIsMC){
612 mcHeader = dynamic_cast<AliAODMCHeader*>(fAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
613 evplaneMC = mcHeader->GetReactionPlaneAngle();
614 if(evplaneMC > TMath::Pi()/2 && evplaneMC <= TMath::Pi()*3/2) evplaneMC-=TMath::Pi();
615 else if(evplaneMC > TMath::Pi()*3/2) evplaneMC-=2*TMath::Pi();
616
617 if (mcHeader) {
618 mcArray = (TClonesArray*)fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());
619 }
620 }
621
afa8df58 622 //V0 info
623 AliAODVZERO* aodV0 = aodEvent->GetVZEROData();
624
625 for (Int_t iv0 = 0; iv0 < 64; iv0++) {
626 Double_t phiV0 = TMath::PiOver4()*(0.5 + iv0 % 8);
627 Float_t multv0 = aodV0->GetMultiplicity(iv0);
628 if (iv0 < 32){ // V0C
629 Qxc2 += TMath::Cos(2*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
630 Qyc2 += TMath::Sin(2*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
631 Qxc3 += TMath::Cos(3*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
632 Qyc3 += TMath::Sin(3*phiV0) * multv0*fV0Cpol/fMultV0->GetBinContent(iv0+1);
633 } else { // V0A
634 Qxa2 += TMath::Cos(2*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
635 Qya2 += TMath::Sin(2*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
636 Qxa3 += TMath::Cos(3*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
637 Qya3 += TMath::Sin(3*phiV0) * multv0*fV0Apol/fMultV0->GetBinContent(iv0+1);
638 }
639 }
640
641 //grab for each centrality the proper histo with the Qx and Qy to do the recentering
642 Double_t Qxamean2 = fMeanQ[iC][1][0];
643 Double_t Qxarms2 = fWidthQ[iC][1][0];
644 Double_t Qyamean2 = fMeanQ[iC][1][1];
645 Double_t Qyarms2 = fWidthQ[iC][1][1];
646 Double_t Qxamean3 = fMeanQv3[iC][1][0];
647 Double_t Qxarms3 = fWidthQv3[iC][1][0];
648 Double_t Qyamean3 = fMeanQv3[iC][1][1];
649 Double_t Qyarms3 = fWidthQv3[iC][1][1];
650
651 Double_t Qxcmean2 = fMeanQ[iC][0][0];
652 Double_t Qxcrms2 = fWidthQ[iC][0][0];
653 Double_t Qycmean2 = fMeanQ[iC][0][1];
654 Double_t Qycrms2 = fWidthQ[iC][0][1];
655 Double_t Qxcmean3 = fMeanQv3[iC][0][0];
656 Double_t Qxcrms3 = fWidthQv3[iC][0][0];
657 Double_t Qycmean3 = fMeanQv3[iC][0][1];
658 Double_t Qycrms3 = fWidthQv3[iC][0][1];
659
660 Double_t QxaCor2 = (Qxa2 - Qxamean2)/Qxarms2;
661 Double_t QyaCor2 = (Qya2 - Qyamean2)/Qyarms2;
662 Double_t QxcCor2 = (Qxc2 - Qxcmean2)/Qxcrms2;
663 Double_t QycCor2 = (Qyc2 - Qycmean2)/Qycrms2;
664 Double_t QxaCor3 = (Qxa3 - Qxamean3)/Qxarms3;
665 Double_t QyaCor3 = (Qya3 - Qyamean3)/Qyarms3;
666 Double_t QxcCor3 = (Qxc3 - Qxcmean3)/Qxcrms3;
667 Double_t QycCor3 = (Qyc3 - Qycmean3)/Qycrms3;
668
669 evPlAngV0ACor2 = TMath::ATan2(QyaCor2, QxaCor2)/2.;
670 evPlAngV0CCor2 = TMath::ATan2(QycCor2, QxcCor2)/2.;
671 evPlAngV0ACor3 = TMath::ATan2(QyaCor3, QxaCor3)/3.;
672 evPlAngV0CCor3 = TMath::ATan2(QycCor3, QxcCor3)/3.;
673
afa8df58 674 //loop track and get pid
675 for(Int_t iT = 0; iT < nAODTracks; iT++) { // loop on the tracks
676 AliAODTrack* aodTrack = aodEvent->GetTrack(iT);
677
678 if (!aodTrack){
679 aodTrack->Delete();
680 continue;
681 }
682
683 Bool_t trkFlag = aodTrack->TestFilterBit(1); // TPC only tracks
684
685 if ((TMath::Abs(aodTrack->Eta()) > fEtaCut) || (aodTrack->Pt() < fMinPt) || (aodTrack->GetTPCNcls() < 70) || !trkFlag){
686 continue;
687 }
688
689 Double_t b[2] = {-99., -99.};
690 Double_t bCov[3] = {-99., -99., -99.};
691 if (!aodTrack->PropagateToDCA(fAOD->GetPrimaryVertex(), fAOD->GetMagneticField(), 100., b, bCov))
692 continue;
693
694 if ((TMath::Abs(b[0]) > 3.0) || (TMath::Abs(b[1]) > 2.4))
695 continue;
696
697 // re-map the container in an array to do the analysis for V0A and V0C within a loop
698 Float_t evPlAngV0[2] = {evPlAngV0ACor2,evPlAngV0CCor2};
587d006a 699 AliFlowVZEROResults *contV0[2] = {fContAllChargesV0A,fContAllChargesV0C};
afa8df58 700 AliCFContainer *QA[2] = {fQA,fQA2};
701
702 Float_t evPlAngV0v3[2] = {evPlAngV0ACor3,evPlAngV0CCor3};
587d006a 703 AliFlowVZEROResults *contV0v3[2] = {fContAllChargesV0Av3,fContAllChargesV0Cv3};
afa8df58 704 AliCFContainer *QAv3[2] = {fQAv3,fQA2v3};
705
587d006a 706 // Fill MC results
707 if(fIsMC && mcArray){
708 fPID->ComputeProb(aodTrack,fAOD); // compute Bayesian probabilities
709 Float_t tofMismProbMC = fPID->GetTOFMismProb(); // TOF mismatch probability requested to be lower than 50% for TOF analysis
710
711 Float_t xMC[5] = {iC,aodTrack->Charge(),1,evplaneMC,fPID->GetCurrentMask(1)&&tofMismProbMC < 0.5}; // to fill analysis v2 container
712
713
714 Float_t v2mc = TMath::Cos(2*(aodTrack->Phi() - evplaneMC));
715
716 fContAllChargesMC->Fill(0,aodTrack->Pt(),v2mc,xMC);
717
718 Int_t iS = TMath::Abs(((AliAODMCParticle*)mcArray->At(TMath::Abs(aodTrack->GetLabel())))->GetPdgCode());
719 if(iS==11){
720 fContAllChargesMC->Fill(4,aodTrack->Pt(),v2mc,xMC);
721 }
722 else if(iS==13){
723 fContAllChargesMC->Fill(5,aodTrack->Pt(),v2mc,xMC);
724 }
725 else if(iS==211){
726 fContAllChargesMC->Fill(1,aodTrack->Pt(),v2mc,xMC);
727 }
728 else if(iS==321){
729 fContAllChargesMC->Fill(2,aodTrack->Pt(),v2mc,xMC);
730 }
731 else if(iS==2212){
732 fContAllChargesMC->Fill(3,aodTrack->Pt(),v2mc,xMC);
733 }
734 }
735
afa8df58 736 for(Int_t iV0=0;iV0<2;iV0++){ // loop on A and C side
737
738 fPID->SetPsiCorrectionDeDx(evPlAngV0[iV0],evPlRes[iV0*8+iC]); // set the PID dE/dx correction as a function of the v2-EP (resolution is needed)
739
587d006a 740 Float_t v2V0 = TMath::Cos(2*(aodTrack->Phi() - evPlAngV0[iV0]));
741 Float_t v3V0 = TMath::Cos(3*(aodTrack->Phi() - evPlAngV0v3[iV0]));
afa8df58 742
587d006a 743 fPID->ComputeProb(aodTrack,fAOD); // compute Bayesian probabilities
744 Float_t dedx = fPID->GetDeDx();//aodTrack->GetTPCsignal();
afa8df58 745 Float_t *probRead = fPID->GetProb();
746 Float_t prob[8] = {probRead[0],probRead[1],probRead[2],probRead[3],probRead[4],probRead[5],probRead[6],probRead[7]};
747 Float_t tofMismProb = fPID->GetTOFMismProb(); // TOF mismatch probability requested to be lower than 50% for TOF analysis
587d006a 748 Float_t x[5] = {iC,aodTrack->Charge(),1,evPlAngV0[iV0],fPID->GetCurrentMask(1)&&tofMismProb < 0.5}; // to fill analysis v2 container
749 Float_t x3[5] = {iC,aodTrack->Charge(),1,evPlAngV0v3[iV0],fPID->GetCurrentMask(1)&&tofMismProb < 0.5}; // to fill analysis v3 container
afa8df58 750
751 Double_t phi[5] = {iC,aodTrack->Charge(),aodTrack->Pt(),1,aodTrack->Phi()}; // to fill track container
752
753 // Fill no PID
587d006a 754 if(iV0 && fQAsw) fPhiTracks->Fill(phi,0);
755 if(fV2) contV0[iV0]->Fill(0,aodTrack->Pt(),v2V0,x);
756 if(fV3) contV0v3[iV0]->Fill(0,aodTrack->Pt(),v3V0,x3);
757
afa8df58 758
afa8df58 759 Double_t dedxExp[8];
760 Float_t tof = -1;
761 Double_t inttimes[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
762 Double_t expTOFsigma[8] = {0.,0.,0.,0.,0.,0.,0.,0.};
763 if(aodTrack->GetDetPid()){ // check the PID object is available
764 for(Int_t iS=0;iS < 8;iS++)
765 dedxExp[iS] = fPID->GetExpDeDx(aodTrack,iS);
587d006a 766
afa8df58 767 if(fPID->GetCurrentMask(1)){ // if TOF is present
768 Float_t ptrack = aodTrack->P();
769 tof = aodTrack->GetTOFsignal() - fPID->GetESDpid()->GetTOFResponse().GetStartTime(ptrack);
770 aodTrack->GetIntegratedTimes(inttimes);
771
772 for(Int_t iS=5;iS < 8;iS++) // extra info for light nuclei
773 inttimes[iS] = inttimes[0] / ptrack * mass[iS] * TMath::Sqrt(1+ptrack*ptrack/mass[iS]/mass[iS]);
774
775 for(Int_t iS=0;iS<8;iS++) expTOFsigma[iS] = fPID->GetESDpid()->GetTOFResponse().GetExpectedSigma(ptrack, inttimes[iS], mass[iS]);
776 }
777 }
778
779 Float_t deltaPhiV0 = aodTrack->Phi() - evPlAngV0[iV0];
780 if(deltaPhiV0 > TMath::Pi()) deltaPhiV0 -= 2*TMath::Pi();
781 else if(deltaPhiV0 < -TMath::Pi()) deltaPhiV0 += 2*TMath::Pi();
782 if(deltaPhiV0 > TMath::Pi()) deltaPhiV0 -= 2*TMath::Pi();
783 else if(deltaPhiV0 < -TMath::Pi()) deltaPhiV0 += 2*TMath::Pi();
784
785 Float_t deltaPhiV0v3 = aodTrack->Phi() - evPlAngV0v3[iV0];
786 if(deltaPhiV0v3 > TMath::Pi()) deltaPhiV0v3 -= 2*TMath::Pi();
787 else if(deltaPhiV0v3 < -TMath::Pi()) deltaPhiV0v3 += 2*TMath::Pi();
788 if(deltaPhiV0v3 > TMath::Pi()) deltaPhiV0v3 -= 2*TMath::Pi();
789 else if(deltaPhiV0v3 < -TMath::Pi()) deltaPhiV0v3 += 2*TMath::Pi();
790
791 // variable to fill QA container
1b25920f 792 Double_t xQA[7] = {iC,aodTrack->Pt(), 0.0, 4.99, 4.99,deltaPhiV0,x[4]}; // v2
793 Double_t xQA3[7] = {iC,aodTrack->Pt(), 0.0, 4.99, 4.99,deltaPhiV0v3,x[4]}; // v3
afa8df58 794
795 //pid selection
796 if(!(fPID->GetCurrentMask(0)) || !aodTrack->GetDetPid()){} // TPC PID and PID object strictly required (very important!!!!)
797 else if(prob[2] > 0.6){ // pi
798 phi[3] = prob[2]; // set probability in the container variables
587d006a 799 x[2] = prob[2];
afa8df58 800 xQA[2] = prob[2];
587d006a 801 x3[2] = x[2];
afa8df58 802 xQA3[2] = xQA[2];
803 if(dedx > 10.){ // set TPC signal in the QA container variables
804 xQA[3] = (dedx - dedxExp[2])/(dedxExp[2]*0.07); // TPC
805 xQA3[3] = xQA[3]; // TPC
806 }
587d006a 807 if(x[4] > 0.5){ // set TOF signal in the QA container variables if present
afa8df58 808 xQA[4] = (tof - inttimes[2])/expTOFsigma[2]; // TOF
809 xQA3[4] = xQA[4]; // TOF
810 }
811 if(TMath::Abs(xQA[3]) < 5){ // TPC 5 sigma extra cut to accept the track
587d006a 812 if(iV0 && fQAsw) fPhiTracks->Fill(phi,1);
813 if(fV2) contV0[iV0]->Fill(1,aodTrack->Pt(),v2V0,x);
814 if(fV3) contV0[iV0]->Fill(1,aodTrack->Pt(),v3V0,x3);
afa8df58 815 if(fV2) QA[iV0]->Fill(xQA,0);
afa8df58 816 if(fV3) QAv3[iV0]->Fill(xQA3,0);
817 }
818 }
819 else if(prob[3] > 0.6){ // K
820 phi[3] = prob[3];
587d006a 821 x[2] = prob[3];
afa8df58 822 xQA[2] = prob[3];
587d006a 823 x3[2] = x[2];
afa8df58 824 xQA3[2] = xQA[2];
825 if(dedx > 10.){
826 xQA[3] = (dedx - dedxExp[3])/(dedxExp[3]*0.07); // TPC
827 xQA3[3] = xQA[3]; // TPC
828 }
587d006a 829 if(x[4] > 0.5){
afa8df58 830 xQA[4] = (tof - inttimes[3])/expTOFsigma[3]; // TOF
831 xQA3[4] = xQA[4]; // TOF
832 }
833 if(TMath::Abs(xQA[3]) < 5){
587d006a 834 if(iV0 && fQAsw) fPhiTracks->Fill(phi,2);
835 if(fV2) contV0[iV0]->Fill(2,aodTrack->Pt(),v2V0,x);
836 if(fV3) contV0[iV0]->Fill(2,aodTrack->Pt(),v3V0,x3);
afa8df58 837 if(fV2) QA[iV0]->Fill(xQA,1);
afa8df58 838 if(fV3) QAv3[iV0]->Fill(xQA3,1);
839 }
840 }
841 else if(prob[4] > 0.6){ // p
842 phi[3] = prob[4];
587d006a 843 x[2] = prob[4];
afa8df58 844 xQA[2] = prob[4];
587d006a 845 x3[2] = x[2];
afa8df58 846 xQA3[2] = xQA[2];
847 if(dedx > 10.){
848 xQA[3] = (dedx - dedxExp[4])/(dedxExp[4]*0.07); // TPC
849 xQA3[3] = xQA[3]; // TPC
850 }
587d006a 851 if(x[4] > 0.5){
afa8df58 852 xQA[4] = (tof - inttimes[4])/expTOFsigma[4]; // TOF
853 xQA3[4] = xQA[4]; // TOF
854 }
855 if(TMath::Abs(xQA[3]) < 5){
587d006a 856 if(iV0 && fQAsw) fPhiTracks->Fill(phi,3);
857 if(fV2) contV0[iV0]->Fill(3,aodTrack->Pt(),v2V0,x);
858 if(fV3) contV0[iV0]->Fill(3,aodTrack->Pt(),v3V0,x3);
afa8df58 859 if(fV2) QA[iV0]->Fill(xQA,2);
afa8df58 860 if(fV3) QAv3[iV0]->Fill(xQA3,2);
861 }
862 }
863 else if(prob[0] > 0.6){ // e
864 phi[3] = prob[0];
587d006a 865 x[2] = prob[0];
afa8df58 866 xQA[2] = prob[0];
587d006a 867 x3[2] = x[2];
afa8df58 868 xQA3[2] = xQA[2];
869 if(dedx > 10.){
870 xQA[3] = (dedx - dedxExp[0])/(dedxExp[0]*0.07); // TPC
871 xQA3[3] = xQA[3]; // TPC
872 }
587d006a 873 if(x[4] > 0.5){
afa8df58 874 xQA[4] = (tof - inttimes[0])/expTOFsigma[0]; // TOF
875 xQA3[4] = xQA[4]; // TOF
876 }
877 if(TMath::Abs(xQA[3]) < 5){
587d006a 878 if(iV0 && fQAsw) fPhiTracks->Fill(phi,4);
879 if(fV2) contV0[iV0]->Fill(4,aodTrack->Pt(),v2V0,x);
880 if(fV3) contV0[iV0]->Fill(4,aodTrack->Pt(),v3V0,x3);
afa8df58 881 if(fV2) QA[iV0]->Fill(xQA,3);
afa8df58 882 if(fV3) QAv3[iV0]->Fill(xQA3,3);
883 }
884 }
587d006a 885 else if(prob[1] > 0.6){ // mu
886 phi[3] = prob[1];
887 x[2] = prob[1];
888 xQA[2] = prob[1];
889 x3[2] = x[2];
890 xQA3[2] = xQA[2];
891 if(dedx > 10.){
892 xQA[3] = (dedx - dedxExp[1])/(dedxExp[1]*0.07); // TPC
893 xQA3[3] = xQA[3]; // TPC
894 }
895 if(x[4] > 0.5){
896 xQA[4] = (tof - inttimes[1])/expTOFsigma[1]; // TOF
897 xQA3[4] = xQA[4]; // TOF
898 }
899 if(TMath::Abs(xQA[3]) < 5){
900 if(fV2) contV0[iV0]->Fill(8,aodTrack->Pt(),v2V0,x);
901 if(fV3) contV0[iV0]->Fill(8,aodTrack->Pt(),v3V0,x3);
902 }
903 }
afa8df58 904 else if(prob[5] > 0.6){ // d
905 phi[3] = prob[5];
587d006a 906 x[2] = prob[5];
afa8df58 907 xQA[2] = prob[5];
587d006a 908 x3[2] = x[2];
afa8df58 909 xQA3[2] = xQA[2];
910 if(dedx > 10.){
911 xQA[3] = (dedx - dedxExp[5])/(dedxExp[5]*0.07); // TPC
912 xQA3[3] = xQA[3]; // TPC
913 }
587d006a 914 if(x[4] > 0.5){
afa8df58 915 xQA[4] = (tof - inttimes[5])/expTOFsigma[5]; // TOF
916 xQA3[4] = xQA[4]; // TOF
917 }
918 if(TMath::Abs(xQA[3]) < 5){
587d006a 919 if(iV0 && fQAsw) fPhiTracks->Fill(phi,5);
920 if(fV2) contV0[iV0]->Fill(5,aodTrack->Pt(),v2V0,x);
921 if(fV3) contV0[iV0]->Fill(5,aodTrack->Pt(),v3V0,x3);
afa8df58 922 if(fV2) QA[iV0]->Fill(xQA,4);
afa8df58 923 if(fV3) QAv3[iV0]->Fill(xQA3,4);
924 }
925 }
926 else if(prob[6] > 0.6){ // t
927 phi[3] = prob[6];
587d006a 928 x[2] = prob[6];
afa8df58 929 xQA[2] = prob[6];
587d006a 930 x3[2] = x[2];
afa8df58 931 xQA3[2] = xQA[2];
932 if(dedx > 10.){
933 xQA[3] = (dedx - dedxExp[6])/(dedxExp[6]*0.07); // TPC
934 xQA3[3] = xQA[3]; // TPC
935 }
587d006a 936 if(x[4] > 0.5){
afa8df58 937 xQA[4] = (tof - inttimes[6])/expTOFsigma[6]; // TOF
938 xQA3[4] = xQA[4]; // TOF
939 }
940 if(TMath::Abs(xQA[3]) < 5){
587d006a 941 if(iV0 && fQAsw) fPhiTracks->Fill(phi,6);
942 if(fV2) contV0[iV0]->Fill(6,aodTrack->Pt(),v2V0,x);
943 if(fV3) contV0[iV0]->Fill(6,aodTrack->Pt(),v3V0,x3);
afa8df58 944 if(fV2) QA[iV0]->Fill(xQA,5);
afa8df58 945 if(fV3) QAv3[iV0]->Fill(xQA3,5);
946 }
947 }
948 else if(prob[7] > 0.6){ // He3
949 phi[3] = prob[7];
950 phi[1] *= 2;
587d006a 951 x[2] = prob[7];
afa8df58 952 xQA[2] = prob[7];
587d006a 953 x3[2] = x[2];
afa8df58 954 xQA3[2] = xQA[2];
955 if(dedx > 10.){
956 xQA[3] = (dedx - dedxExp[7])/(dedxExp[7]*0.07); // TPC
957 xQA3[3] = xQA[3]; // TPC
958 }
587d006a 959 if(x[4] > 0.5){
afa8df58 960 xQA[4] = (tof - inttimes[7])/expTOFsigma[7]; // TOF
961 xQA3[4] = xQA[4]; // TOF
962 }
963 if(TMath::Abs(xQA[3]) < 5){
587d006a 964 if(iV0 && fQAsw) fPhiTracks->Fill(phi,7);
965 if(fV2) contV0[iV0]->Fill(7,aodTrack->Pt()*2,v2V0,x);
966 if(fV3) contV0[iV0]->Fill(7,aodTrack->Pt()*2,v3V0,x3);
afa8df58 967 if(fV2) QA[iV0]->Fill(xQA,6);
afa8df58 968 if(fV3) QAv3[iV0]->Fill(xQA3,6);
969 }
587d006a 970 phi[1] *= 0.5;
afa8df58 971 }
972
587d006a 973 if(x[4] > 0.5){ // if TOF was present redo TPC stand alone PID to check the PID in the same acceptance (PID mask = 2)
afa8df58 974 fPID->ResetDetOR(1); // exclude TOF from PID
975 tofMismProb = 0;
976
587d006a 977 fPID->ComputeProb(aodTrack,fAOD);
978 dedx = fPID->GetDeDx();//aodTrack->GetTPCsignal();
afa8df58 979 probRead = fPID->GetProb();
980
981 fPID->SetDetOR(1); // include TOF for PID
982 }
983 Float_t probTPC[8] = {probRead[0],probRead[1],probRead[2],probRead[3],probRead[4],probRead[5],probRead[6],probRead[7]}; // TPC stand alone prbabilities
984
985 //pid selection TPC S.A. with TOF matching
587d006a 986 x[4]*=2; // set the mask to 2 id TOF is present
987 if(x[4]<1 || !(fPID->GetCurrentMask(0)) || !aodTrack->GetDetPid()){} // TPC PID S.A. PID in TOF acceptance
afa8df58 988 else if(probTPC[2] > 0.6){ // pi
587d006a 989 x[2] = probTPC[2];
990 x3[2] = x[2];
afa8df58 991 if(dedx > 10.){
992 xQA[3] = (dedx - dedxExp[2])/(dedxExp[2]*0.07); // TPC
993 xQA3[3] = xQA[3]; // TPC
994 }
995 if(TMath::Abs(xQA[3]) < 5){
587d006a 996 if(fV2) contV0[iV0]->Fill(1,aodTrack->Pt(),v2V0,x);
997 if(fV3) contV0[iV0]->Fill(1,aodTrack->Pt(),v3V0,x3);
afa8df58 998 }
999 }
1000 else if(probTPC[3] > 0.6){ // K
587d006a 1001 x[2] = probTPC[3];
1002 x3[2] = x[2];
afa8df58 1003 if(dedx > 10.){
1004 xQA[3] = (dedx - dedxExp[3])/(dedxExp[3]*0.07); // TPC
1005 xQA3[3] = xQA[3]; // TPC
1006 }
1007 if(TMath::Abs(xQA[3]) < 5){
587d006a 1008 if(fV2) contV0[iV0]->Fill(2,aodTrack->Pt(),v2V0,x);
1009 if(fV3) contV0[iV0]->Fill(2,aodTrack->Pt(),v3V0,x3);
afa8df58 1010 }
1011 }
1012 else if(probTPC[4] > 0.6){ // p
587d006a 1013 x[2] = probTPC[4];
1014 x3[2] = x[2];
afa8df58 1015 if(dedx > 10.){
1016 xQA[3] = (dedx - dedxExp[4])/(dedxExp[4]*0.07); // TPC
1017 xQA3[3] = xQA[3]; // TPC
1018 }
1019 if(TMath::Abs(xQA[3]) < 5){
587d006a 1020 if(fV2) contV0[iV0]->Fill(3,aodTrack->Pt(),v2V0,x);
1021 if(fV3) contV0[iV0]->Fill(3,aodTrack->Pt(),v3V0,x3);
afa8df58 1022 }
1023 }
1024 else if(probTPC[0] > 0.6){ // e
587d006a 1025 x[2] = probTPC[0];
1026 x3[2] = x[2];
afa8df58 1027 if(dedx > 10.){
1028 xQA[3] = (dedx - dedxExp[0])/(dedxExp[0]*0.07); // TPC
1029 xQA3[3] = xQA[3]; // TPC
1030 }
1031 if(TMath::Abs(xQA[3]) < 5){
587d006a 1032 if(fV2) contV0[iV0]->Fill(4,aodTrack->Pt(),v2V0,x);
1033 if(fV3) contV0[iV0]->Fill(4,aodTrack->Pt(),v3V0,x3);
1034 }
1035 }
1036 else if(probTPC[1] > 0.6){ // mu
1037 x[2] = probTPC[1];
1038 x3[2] = x[2];
1039 if(dedx > 10.){
1040 xQA[3] = (dedx - dedxExp[1])/(dedxExp[1]*0.07); // TPC
1041 xQA3[3] = xQA[3]; // TPC
1042 }
1043 if(TMath::Abs(xQA[3]) < 5){
1044 if(fV2) contV0[iV0]->Fill(8,aodTrack->Pt(),v2V0,x);
1045 if(fV3) contV0[iV0]->Fill(8,aodTrack->Pt(),v3V0,x3);
afa8df58 1046 }
1047 }
1048 else if(probTPC[5] > 0.6){ // d
587d006a 1049 x[2] = probTPC[5];
1050 x3[2] = x[2];
afa8df58 1051 if(dedx > 10.){
1052 xQA[3] = (dedx - dedxExp[5])/(dedxExp[5]*0.07); // TPC
1053 xQA3[3] = xQA[3]; // TPC
1054 }
1055 if(TMath::Abs(xQA[3]) < 5){
587d006a 1056 if(fV2) contV0[iV0]->Fill(5,aodTrack->Pt(),v2V0,x);
1057 if(fV3) contV0[iV0]->Fill(5,aodTrack->Pt(),v3V0,x3);
afa8df58 1058 }
1059 }
1060 else if(probTPC[6] > 0.6){ // t
587d006a 1061 x[2] = probTPC[6];
1062 x3[2] = x[2];
afa8df58 1063 if(dedx > 10.){
1064 xQA[3] = (dedx - dedxExp[6])/(dedxExp[6]*0.07); // TPC
1065 xQA3[3] = xQA[3]; // TPC
1066 }
1067 if(TMath::Abs(xQA[3]) < 5){
587d006a 1068 if(fV2) contV0[iV0]->Fill(6,aodTrack->Pt(),v2V0,x);
1069 if(fV3) contV0[iV0]->Fill(6,aodTrack->Pt(),v3V0,x3);
afa8df58 1070 }
1071 }
1072 else if(probTPC[7] > 0.6){ // He3
587d006a 1073 x[2] = probTPC[7];
1074 x3[2] = x[2];
afa8df58 1075 if(dedx > 10.){
1076 xQA[3] = (dedx - dedxExp[7])/(dedxExp[7]*0.07); // TPC
1077 xQA3[3] = xQA[3]; // TPC
1078 }
1079 if(TMath::Abs(xQA[3]) < 5){
587d006a 1080 if(fV2) contV0[iV0]->Fill(7,aodTrack->Pt()*2,v2V0,x);
1081 if(fV3) contV0[iV0]->Fill(7,aodTrack->Pt()*2,v3V0,x3);
afa8df58 1082 }
afa8df58 1083 }
1084 } // end side loop
1085 } // end track loop
1086
1087 // Fill EP distribution histograms
1088 if(fV2) fPhiRPv0A->Fill(iC,evPlAngV0ACor2);
1089 if(fV2) fPhiRPv0C->Fill(iC,evPlAngV0CCor2);
1090
1091 if(fV3) fPhiRPv0Av3->Fill(iC,evPlAngV0ACor3);
1092 if(fV3) fPhiRPv0Cv3->Fill(iC,evPlAngV0CCor3);
1093
1094 // TPC EP needed for resolution studies (TPC subevent)
1095 Double_t Qx2 = 0, Qy2 = 0;
1096 Double_t Qx3 = 0, Qy3 = 0;
1097
1098 for(Int_t iT = 0; iT < nAODTracks; iT++) {
1099
1100 AliAODTrack* aodTrack = aodEvent->GetTrack(iT);
1101
1102 if (!aodTrack){
1103 aodTrack->Delete();
1104 continue;
1105 }
1106
1107 Bool_t trkFlag = aodTrack->TestFilterBit(1);
1108
1109 if ((TMath::Abs(aodTrack->Eta()) > 0.8) || (aodTrack->Pt() < 0.2) || (aodTrack->GetTPCNcls() < 70) || !trkFlag)
1110 continue;
1111
1112 Double_t b[2] = {-99., -99.};
1113 Double_t bCov[3] = {-99., -99., -99.};
1114 if (!aodTrack->PropagateToDCA(fAOD->GetPrimaryVertex(), fAOD->GetMagneticField(), 100., b, bCov))
1115 continue;
1116
1117 if ((TMath::Abs(b[0]) > 3.0) || (TMath::Abs(b[1]) > 2.4))
1118 continue;
1119
1120 Qx2 += TMath::Cos(2*aodTrack->Phi());
1121 Qy2 += TMath::Sin(2*aodTrack->Phi());
1122 Qx3 += TMath::Cos(3*aodTrack->Phi());
1123 Qy3 += TMath::Sin(3*aodTrack->Phi());
1124
1125 }
1126
1127 evPlAng2 = TMath::ATan2(Qy2, Qx2)/2.;
1128 evPlAng3 = TMath::ATan2(Qy3, Qx3)/3.;
1129
1130 // Fill histograms needed for resolution evaluation
1131 if(fV2) fHResTPCv0A2->Fill(Double_t(iC), TMath::Cos(2*(evPlAng2 - evPlAngV0ACor2)));
1132 if(fV2) fHResTPCv0C2->Fill(Double_t(iC), TMath::Cos(2*(evPlAng2 - evPlAngV0CCor2)));
1133 if(fV2) fHResv0Cv0A2->Fill(Double_t(iC), TMath::Cos(2*(evPlAngV0ACor2 - evPlAngV0CCor2)));
1134
1135 if(fV3) fHResTPCv0A3->Fill(Double_t(iC), TMath::Cos(3*(evPlAng3 - evPlAngV0ACor3)));
1136 if(fV3) fHResTPCv0C3->Fill(Double_t(iC), TMath::Cos(3*(evPlAng3 - evPlAngV0CCor3)));
1137 if(fV3) fHResv0Cv0A3->Fill(Double_t(iC), TMath::Cos(3*(evPlAngV0ACor3 - evPlAngV0CCor3)));
1138 }
1139
1140}
1141
1142//_____________________________________________________________________________
1143Float_t AliAnalysisTaskVnV0::GetVertex(AliAODEvent* aod) const
1144{
1145
1146 Float_t zvtx = -999;
1147
1148 const AliAODVertex* vtxAOD = aod->GetPrimaryVertex();
1149 if (!vtxAOD)
1150 return zvtx;
1151 if(vtxAOD->GetNContributors()>0)
1152 zvtx = vtxAOD->GetZ();
1153
1154 return zvtx;
1155}
1156//_____________________________________________________________________________
1157void AliAnalysisTaskVnV0::Terminate(Option_t *)
1158{
1159 // Terminate loop
1160 Printf("Terminate()");
1161}
1162//_____________________________________________________________________________
1163void AliAnalysisTaskVnV0::OpenInfoCalbration(Int_t run){
1164 TString oadbfilename = "$ALICE_ROOT/OADB/PWGCF/VZERO/VZEROcalibEP.root";
1165 TFile *foadb = TFile::Open(oadbfilename.Data());
1166
1167 if(!foadb){
1168 printf("OADB file %s cannot be opened\n",oadbfilename.Data());
1169 return;
1170 }
1171
1172 AliOADBContainer *cont = (AliOADBContainer*) foadb->Get("hMultV0BefCorr");
1173 if(!cont){
1174 printf("OADB object hMultV0BefCorr is not available in the file\n");
1175 return;
1176 }
1177
1178 if(!(cont->GetObject(run))){
1179 printf("OADB object hMultV0BefCorr is not available for run %i (used run 137366)\n",run);
1180 run = 137366;
1181 }
1182 fMultV0 = ((TH2F *) cont->GetObject(run))->ProfileX();
1183
1184 TF1 *fpol0 = new TF1("fpol0","pol0");
1185 fMultV0->Fit(fpol0,"","",0,31);
1186 fV0Cpol = fpol0->GetParameter(0);
1187 fMultV0->Fit(fpol0,"","",32,64);
1188 fV0Apol = fpol0->GetParameter(0);
1189
1190 for(Int_t iside=0;iside<2;iside++){
1191 for(Int_t icoord=0;icoord<2;icoord++){
1192 for(Int_t i=0;i < nCentrBin;i++){
1193 char namecont[100];
1194 if(iside==0 && icoord==0)
d6a1c304 1195 snprintf(namecont,100,"hQxc2_%i",i);
afa8df58 1196 else if(iside==1 && icoord==0)
d6a1c304 1197 snprintf(namecont,100,"hQxa2_%i",i);
afa8df58 1198 else if(iside==0 && icoord==1)
d6a1c304 1199 snprintf(namecont,100,"hQyc2_%i",i);
afa8df58 1200 else if(iside==1 && icoord==1)
d6a1c304 1201 snprintf(namecont,100,"hQya2_%i",i);
afa8df58 1202
1203 cont = (AliOADBContainer*) foadb->Get(namecont);
1204 if(!cont){
1205 printf("OADB object %s is not available in the file\n",namecont);
1206 return;
1207 }
1208
1209 if(!(cont->GetObject(run))){
1210 printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
1211 run = 137366;
1212 }
1213 fMeanQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
1214 fWidthQ[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
1215
1216 //for v3
1217 if(iside==0 && icoord==0)
d6a1c304 1218 snprintf(namecont,100,"hQxc3_%i",i);
afa8df58 1219 else if(iside==1 && icoord==0)
d6a1c304 1220 snprintf(namecont,100,"hQxa3_%i",i);
afa8df58 1221 else if(iside==0 && icoord==1)
d6a1c304 1222 snprintf(namecont,100,"hQyc3_%i",i);
afa8df58 1223 else if(iside==1 && icoord==1)
d6a1c304 1224 snprintf(namecont,100,"hQya3_%i",i);
afa8df58 1225
1226 cont = (AliOADBContainer*) foadb->Get(namecont);
1227 if(!cont){
1228 printf("OADB object %s is not available in the file\n",namecont);
1229 return;
1230 }
1231
1232 if(!(cont->GetObject(run))){
1233 printf("OADB object %s is not available for run %i (used run 137366)\n",namecont,run);
1234 run = 137366;
1235 }
1236 fMeanQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetMean();
1237 fWidthQv3[i][iside][icoord] = ((TH1F *) cont->GetObject(run))->GetRMS();
1238
1239 }
1240 }
1241 }
1242}