]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskV2AllChAOD.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TestAOD / AliAnalysisTaskV2AllChAOD.cxx
CommitLineData
10a99a07 1/**************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16//-----------------------------------------------------------------
17// AliAnalysisTaskV2AllChAOD class
18//-----------------------------------------------------------------
19
20#include "TChain.h"
21#include "TTree.h"
22#include "TLegend.h"
23#include "TH1F.h"
24#include "TH2F.h"
25#include "THnSparse.h"
26#include "TProfile.h"
27#include "TCanvas.h"
28#include "AliAnalysisTask.h"
29#include "AliAODTrack.h"
30#include "AliAODMCParticle.h"
31#include "AliVParticle.h"
32#include "AliAODEvent.h"
33#include "AliAODInputHandler.h"
34#include "AliAnalysisTaskV2AllChAOD.h"
35#include "AliAnalysisTaskESDfilter.h"
36#include "AliAnalysisDataContainer.h"
37#include "AliSpectraAODTrackCuts.h"
38#include "AliSpectraAODEventCuts.h"
39#include "AliPIDCombined.h"
40#include "AliCentrality.h"
41#include "TProof.h"
42#include "AliVEvent.h"
43#include "AliStack.h"
44#include <TMCProcess.h>
45
46#include <iostream>
47
48using namespace std;
49
50ClassImp(AliAnalysisTaskV2AllChAOD)
51
52//________________________________________________________________________
53AliAnalysisTaskV2AllChAOD::AliAnalysisTaskV2AllChAOD(const char *name) : AliAnalysisTaskSE(name),
54 fAOD(0x0),
55 fTrackCuts(0x0),
56 fEventCuts(0x0),
57 fIsMC(0),
58 fCharge(0),
59 fVZEROside(0),
60 fOutput(0x0),
61 fOutput_lq(0x0),
62 fOutput_sq(0x0),
63 fnCentBins(20),
64 fnQvecBins(100),
65 fIsQvecCalibMode(0),
66 fQvecUpperLim(100),
67 fCutLargeQperc(90.),
68 fCutSmallQperc(10.),
69 fEtaGapMin(-0.5),
70 fEtaGapMax(0.5),
d64e71aa 71 fTrkBit(272),
72 fEtaCut(0.8),
73 fMinPt(0),
74 fMaxPt(20.0),
75 fMinTPCNcls(70),
962f3d11 76 fFillTHn(kTRUE),
10a99a07 77 fResSP(0),
bc76879c 78 fEta_vs_Phi_bef(0),
2ba0e068 79 fEta_vs_PhiA(0),
80 fEta_vs_PhiB(0),
10a99a07 81 fResSP_lq(0),
bc76879c 82 fResSP_sq(0)
10a99a07 83{
84
85 for (Int_t i = 0; i< 9; i++){
86 fv2SPGap1A[i] = 0;
10a99a07 87 fv2SPGap1B[i] = 0;
bc76879c 88
89 fSinGap1Aq[i] = 0;
90 fCosGap1Aq[i] = 0;
91 fSinGap1Bq[i] = 0;
92 fCosGap1Bq[i] = 0;
10a99a07 93
94 fSinGap1A[i] = 0;
95 fCosGap1A[i] = 0;
96 fSinGap1B[i] = 0;
97 fCosGap1B[i] = 0;
98
99 //large q
100 fv2SPGap1A_lq[i] = 0;
101 fv2SPGap1B_lq[i] = 0;
bc76879c 102
103 fSinGap1Aq_lq[i] = 0;
104 fCosGap1Aq_lq[i] = 0;
105 fSinGap1Bq_lq[i] = 0;
106 fCosGap1Bq_lq[i] = 0;
107
10a99a07 108 fSinGap1A_lq[i] = 0;
109 fCosGap1A_lq[i] = 0;
110 fSinGap1B_lq[i] = 0;
111 fCosGap1B_lq[i] = 0;
112
113 //small q
114 fv2SPGap1A_sq[i] = 0;
115 fv2SPGap1B_sq[i] = 0;
bc76879c 116
117 fSinGap1Aq_sq[i] = 0;
118 fCosGap1Aq_sq[i] = 0;
119 fSinGap1Bq_sq[i] = 0;
120 fCosGap1Bq_sq[i] = 0;
121
10a99a07 122 fSinGap1A_sq[i] = 0;
123 fCosGap1A_sq[i] = 0;
124 fSinGap1B_sq[i] = 0;
125 fCosGap1B_sq[i] = 0;
126
127 }
128
129 // Default constructor
130 DefineInput(0, TChain::Class());
131 DefineOutput(1, TList::Class());
132 DefineOutput(2, AliSpectraAODEventCuts::Class());
133 DefineOutput(3, AliSpectraAODTrackCuts::Class());
134 DefineOutput(4, TList::Class());
135 DefineOutput(5, TList::Class());
136}
137
138//________________________________________________________________________
139void AliAnalysisTaskV2AllChAOD::UserCreateOutputObjects()
140{
141 // create output objects
142 fOutput=new TList();
143 fOutput->SetOwner();
144 fOutput->SetName("fOutput");
145
146 fOutput_lq=new TList();
147 fOutput_lq->SetOwner();
148 fOutput_lq->SetName("fOutput_lq");
149
150 fOutput_sq=new TList();
151 fOutput_sq->SetOwner();
152 fOutput_sq->SetName("fOutput_sq");
153
154 if (!fTrackCuts) AliFatal("Track Cuts should be set in the steering macro");
155 if (!fEventCuts) AliFatal("Event Cuts should be set in the steering macro");
156
962f3d11 157 if( fFillTHn ){
158 //dimensions of THnSparse for Q vector checks
159 const Int_t nvarev=4;
160 // cent Q vec Qa Qb
161 Int_t binsHistRealEv[nvarev] = { 10, fnQvecBins, 100, 100};
162 Double_t xminHistRealEv[nvarev] = { 0., 0., 0., 0.};
163 Double_t xmaxHistRealEv[nvarev] = { 10., fQvecUpperLim, 10., 10.};
164 THnSparseF* NSparseHistEv = new THnSparseF("NSparseHistEv","NSparseHistEv",nvarev,binsHistRealEv,xminHistRealEv,xmaxHistRealEv);
165 NSparseHistEv->GetAxis(0)->SetTitle(Form("%s cent",fEventCuts->GetCentralityMethod().Data()));
166 NSparseHistEv->GetAxis(0)->SetName(Form("%s_cent",fEventCuts->GetCentralityMethod().Data()));
167 NSparseHistEv->GetAxis(1)->SetTitle("Q vec");
168 NSparseHistEv->GetAxis(1)->SetName("Q_vec");
169 NSparseHistEv->GetAxis(2)->SetTitle("Q_vec (A)");
170 NSparseHistEv->GetAxis(2)->SetName("Qvec_A");
171 NSparseHistEv->GetAxis(3)->SetTitle("Q_vec (B)");
172 NSparseHistEv->GetAxis(3)->SetName("Qvec_B");
173 fOutput->Add(NSparseHistEv);
174 }
175
10a99a07 176 // binning common to all the THn
177 //change it according to your needs + move it to global variables -> setter/getter
178// Double_t ptBins[] = {0., 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.4, 2.8, 3.2, 3.6, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 20.0};
179// const Int_t nptBins = 31;
180 Double_t ptBins[] = {0., 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 3.0, 3.4, 3.8, 4.2, 4.6, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0, 12.0, 14.0, 16.0, 20.0};
181 const Int_t nptBins = 33;
182
10a99a07 183 fResSP = new TProfile("fResSP", "Resolution; centrality; Resolution", 9, -0.5, 8.5);
184 fOutput->Add(fResSP);
185
2ba0e068 186 fEta_vs_Phi_bef = new TH2D("fEta_vs_Phi_bef","eta vs phi distribution before eta gap;#eta;#phi",200.,-1.,1.,350.,0.,7.);
bc76879c 187 fOutput->Add(fEta_vs_Phi_bef);
d64e71aa 188
2ba0e068 189 fEta_vs_PhiA = new TH2D("fEta_vs_PhiA","eta vs phi distribution;#eta;#phi",200.,-1.,1.,350.,0.,7.);
190 fOutput->Add(fEta_vs_PhiA);
191
192 fEta_vs_PhiB = new TH2D("fEta_vs_PhiB","eta vs phi distribution;#eta;#phi",200.,-1.,1.,350.,0.,7.);
193 fOutput->Add(fEta_vs_PhiB);
d64e71aa 194
10a99a07 195 //large q resolution
196 fResSP_lq = new TProfile("fResSP_lq", "Resolution; centrality; Resolution", 9, -0.5, 8.5);
197 fOutput_lq->Add(fResSP_lq);
198
199 //small q resolution
200 fResSP_sq = new TProfile("fResSP_sq", "Resolution; centrality; Resolution", 9, -0.5, 8.5);
201 fOutput_sq->Add(fResSP_sq);
d64e71aa 202
10a99a07 203 for (Int_t iC = 0; iC < 9; iC++){
204
205 fv2SPGap1A[iC] = new TProfile(Form("fv2SPGap1A_%d", iC), "v_{2}{2} vs p_{T}; p_{T} (GeV/c); v_{2}{2}", nptBins, ptBins);
206 fOutput->Add(fv2SPGap1A[iC]);
207
10a99a07 208 fv2SPGap1B[iC] = new TProfile(Form("fv2SPGap1B_%d", iC), "v_{2}{2} vs p_{T}; p_{T} (GeV/c); v_{2}{2}", nptBins, ptBins);
209 fOutput->Add(fv2SPGap1B[iC]);
210
bc76879c 211 fSinGap1Aq[iC] = new TProfile(Form("fSinGap1Aq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
212 fOutput->Add(fSinGap1Aq[iC]);
10a99a07 213
bc76879c 214 fCosGap1Aq[iC] = new TProfile(Form("fCosGap1Aq_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
215 fOutput->Add(fCosGap1Aq[iC]);
216
217 fSinGap1Bq[iC] = new TProfile(Form("fSinGap1Bq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
218 fOutput->Add(fSinGap1Bq[iC]);
219
220 fCosGap1Bq[iC] = new TProfile(Form("fCosGap1Bq_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
221 fOutput->Add(fCosGap1Bq[iC]);
222
10a99a07 223 fSinGap1A[iC] = new TProfile(Form("fSinGap1A_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
224 fOutput->Add(fSinGap1A[iC]);
225
226 fCosGap1A[iC] = new TProfile(Form("fCosGap1A_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
227 fOutput->Add(fCosGap1A[iC]);
228
229 fSinGap1B[iC] = new TProfile(Form("fSinGap1B_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
230 fOutput->Add(fSinGap1B[iC]);
231
232 fCosGap1B[iC] = new TProfile(Form("fCosGap1B_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
233 fOutput->Add(fCosGap1B[iC]);
234
235 //large q
236 fv2SPGap1A_lq[iC] = new TProfile(Form("fv2SPGap1A_lq_%d", iC), "v_{2}{2} vs p_{T}; p_{T} (GeV/c); v_{2}{2}", nptBins, ptBins);
237 fOutput_lq->Add(fv2SPGap1A_lq[iC]);
238
239 fv2SPGap1B_lq[iC] = new TProfile(Form("fv2SPGap1B_lq_%d", iC), "v_{2}{2} vs p_{T}; p_{T} (GeV/c); v_{2}{2}", nptBins, ptBins);
240 fOutput_lq->Add(fv2SPGap1B_lq[iC]);
241
bc76879c 242 fSinGap1Aq_lq[iC] = new TProfile(Form("fSinGap1Aq_lq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
243 fOutput_lq->Add(fSinGap1Aq_lq[iC]);
244
245 fCosGap1Aq_lq[iC] = new TProfile(Form("fCosGap1Aq_lq_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
246 fOutput_lq->Add(fCosGap1Aq_lq[iC]);
247
248 fSinGap1Bq_lq[iC] = new TProfile(Form("fSinGap1Bq_lq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
249 fOutput_lq->Add(fSinGap1Bq_lq[iC]);
250
251 fCosGap1Bq_lq[iC] = new TProfile(Form("fCosGap1Bq_lq_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
252 fOutput_lq->Add(fCosGap1Bq_lq[iC]);
253
10a99a07 254 fSinGap1A_lq[iC] = new TProfile(Form("fSinGap1A_lq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
255 fOutput_lq->Add(fSinGap1A_lq[iC]);
256
257 fCosGap1A_lq[iC] = new TProfile(Form("fCosGap1A_lq_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
258 fOutput_lq->Add(fCosGap1A_lq[iC]);
259
260 fSinGap1B_lq[iC] = new TProfile(Form("fSinGap1B_lq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
261 fOutput_lq->Add(fSinGap1B_lq[iC]);
262
263 fCosGap1B_lq[iC] = new TProfile(Form("fCosGap1B_lq_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
264 fOutput_lq->Add(fCosGap1B_lq[iC]);
265
266 //small q
267 fv2SPGap1A_sq[iC] = new TProfile(Form("fv2SPGap1A_sq_%d", iC), "v_{2}{2} vs p_{T}; p_{T} (GeV/c); v_{2}{2}", nptBins, ptBins);
268 fOutput_sq->Add(fv2SPGap1A_sq[iC]);
269
270 fv2SPGap1B_sq[iC] = new TProfile(Form("fv2SPGap1B_sq_%d", iC), "v_{2}{2} vs p_{T}; p_{T} (GeV/c); v_{2}{2}", nptBins, ptBins);
271 fOutput_sq->Add(fv2SPGap1B_sq[iC]);
272
bc76879c 273 fSinGap1Aq_sq[iC] = new TProfile(Form("fSinGap1Aq_sq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
274 fOutput_sq->Add(fSinGap1Aq_sq[iC]);
275
276 fCosGap1Aq_sq[iC] = new TProfile(Form("fCosGap1Aq_sq_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
277 fOutput_sq->Add(fCosGap1Aq_sq[iC]);
278
279 fSinGap1Bq_sq[iC] = new TProfile(Form("fSinGap1Bq_sq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
280 fOutput_sq->Add(fSinGap1Bq_sq[iC]);
281
282 fCosGap1Bq_sq[iC] = new TProfile(Form("fCosGap1Bq_sq_%d", iC), "p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
283 fOutput_sq->Add(fCosGap1Bq_sq[iC]);
284
10a99a07 285 fSinGap1A_sq[iC] = new TProfile(Form("fSinGap1A_sq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
286 fOutput_sq->Add(fSinGap1A_sq[iC]);
287
288 fCosGap1A_sq[iC] = new TProfile(Form("fCosGap1A_sq_%d", iC), ";p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
289 fOutput_sq->Add(fCosGap1A_sq[iC]);
290
291 fSinGap1B_sq[iC] = new TProfile(Form("fSinGap1B_sq_%d", iC), ";p_{T} (GeV/c);#LT sin(2*#phi) #GT", nptBins, ptBins);
292 fOutput_sq->Add(fSinGap1B_sq[iC]);
293
294 fCosGap1B_sq[iC] = new TProfile(Form("fCosGap1B_sq_%d", iC), "p_{T} (GeV/c);#LT cos(2*#phi) #GT", nptBins, ptBins);
295 fOutput_sq->Add(fCosGap1B_sq[iC]);
296 };
297
298 PostData(1, fOutput );
299 PostData(2, fEventCuts);
300 PostData(3, fTrackCuts);
301 PostData(4, fOutput_lq );
302 PostData(5, fOutput_sq );
303}
304
305//________________________________________________________________________
306
307void AliAnalysisTaskV2AllChAOD::UserExec(Option_t *)
308{
309 //Printf("An event");
310 // main event loop
311 fAOD = dynamic_cast<AliAODEvent*>(fInputEvent);
312 if (!fAOD) {
313 AliWarning("ERROR: AliAODEvent not available \n");
314 return;
315 }
316
317 if (strcmp(fAOD->ClassName(), "AliAODEvent"))
318 {
319 AliFatal("Not processing AODs");
320 }
321
322 if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection
323
324 Double_t Qvec=0.;//in case of MC we save space in the memory
325 if(!fIsMC){
326 if(fIsQvecCalibMode){
327 if(fVZEROside==0)Qvec=fEventCuts->GetqV0A();
328 else if (fVZEROside==1)Qvec=fEventCuts->GetqV0C();
329 }
330 else Qvec=fEventCuts->GetQvecPercentile(fVZEROside);
331 }
332
333 Double_t Cent=fEventCuts->GetCent();
334
335 Short_t centV0 = -1;
336 if ((Cent > 0) && (Cent <= 5.0))
337 centV0 = 0;
338 else if ((Cent > 5.0) && (Cent <= 10.0))
339 centV0 = 1;
340 else if ((Cent > 10.0) && (Cent <= 20.0))
341 centV0 = 2;
342 else if ((Cent > 20.0) && (Cent <= 30.0))
343 centV0 = 3;
344 else if ((Cent > 30.0) && (Cent <= 40.0))
345 centV0 = 4;
346 else if ((Cent > 40.0) && (Cent <= 50.0))
347 centV0 = 5;
348 else if ((Cent > 50.0) && (Cent <= 60.0))
349 centV0 = 6;
350 else if ((Cent > 60.0) && (Cent <= 70.0))
351 centV0 = 7;
352 else if ((Cent > 70.0) && (Cent <= 80.0))
353 centV0 = 8;
354
355
356 Double_t QxGap1A = 0., QyGap1A = 0.;
357 Double_t QxGap1B = 0., QyGap1B = 0.;
358 Int_t multGap1A = 0, multGap1B = 0;
d57dd83f 359
360 for (Int_t loop = 0; loop < 2; loop++){
10a99a07 361
d57dd83f 362 //main loop on tracks
363 for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
364 AliAODTrack* track = fAOD->GetTrack(iTracks);
365 if(fCharge != 0 && track->Charge() != fCharge) continue;//if fCharge != 0 only select fCharge
366 if (!fTrackCuts->IsSelected(track,kTRUE)) continue; //track selection (rapidity selection NOT in the standard cuts)
10a99a07 367
bc76879c 368 fEta_vs_Phi_bef->Fill( track->Eta(), track->Phi() );
d57dd83f 369
370 if (loop == 0) {
371
372 if (track->Eta() > fEtaGapMax){
373 QxGap1A += TMath::Cos(2.*track->Phi());
374 QyGap1A += TMath::Sin(2.*track->Phi());
375 multGap1A++;
10a99a07 376
bc76879c 377 fSinGap1Aq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
378 fCosGap1Aq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
379
2ba0e068 380 fEta_vs_PhiA->Fill( track->Eta(), track->Phi() );
10a99a07 381
962f3d11 382 if (Qvec > fCutLargeQperc && Qvec < 100.){
bc76879c 383 fSinGap1Aq_lq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
384 fCosGap1Aq_lq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
d57dd83f 385 }
10a99a07 386
962f3d11 387 if (Qvec > 0. && Qvec < fCutSmallQperc){
bc76879c 388 fSinGap1Aq_sq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
389 fCosGap1Aq_sq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
d57dd83f 390 }
391 }
392
393 if (track->Eta() < fEtaGapMin){
394 QxGap1B += TMath::Cos(2.*track->Phi());
395 QyGap1B += TMath::Sin(2.*track->Phi());
396 multGap1B++;
10a99a07 397
bc76879c 398 fCosGap1Bq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
399 fSinGap1Bq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
400
2ba0e068 401 fEta_vs_PhiB->Fill( track->Eta(), track->Phi() );
10a99a07 402
962f3d11 403 if (Qvec > fCutLargeQperc && Qvec < 100.){
bc76879c 404 fSinGap1Bq_lq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
405 fCosGap1Bq_lq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
d57dd83f 406 }
10a99a07 407
962f3d11 408 if (Qvec > 0. && Qvec < fCutSmallQperc){
bc76879c 409 fSinGap1Bq_sq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
410 fCosGap1Bq_sq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
d57dd83f 411 }
10a99a07 412 }
10a99a07 413
d57dd83f 414 } else {
10a99a07 415
d57dd83f 416 //eval v2 scalar product
417 if (track->Eta() < fEtaGapMin && multGap1A > 0){
418 Double_t v2SPGap1A = (TMath::Cos(2.*track->Phi())*QxGap1A + TMath::Sin(2.*track->Phi())*QyGap1A)/(Double_t)multGap1A;
419 fv2SPGap1A[centV0]->Fill(track->Pt(), v2SPGap1A);
bc76879c 420
421 fSinGap1A[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
422 fCosGap1A[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
10a99a07 423
962f3d11 424 if (Qvec > fCutLargeQperc && Qvec < 100.){
d57dd83f 425 fv2SPGap1A_lq[centV0]->Fill(track->Pt(), v2SPGap1A);
bc76879c 426 fSinGap1A_lq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
427 fCosGap1A_lq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
428 }
10a99a07 429
962f3d11 430 if (Qvec > 0. && Qvec < fCutSmallQperc){
d57dd83f 431 fv2SPGap1A_sq[centV0]->Fill(track->Pt(), v2SPGap1A);
bc76879c 432 fSinGap1A_sq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
433 fCosGap1A_sq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
434 }
d57dd83f 435 }
10a99a07 436
d57dd83f 437 if (track->Eta() > fEtaGapMax && multGap1B > 0){
438 Double_t v2SPGap1B = (TMath::Cos(2.*track->Phi())*QxGap1B + TMath::Sin(2.*track->Phi())*QyGap1B)/(Double_t)multGap1B;
439 fv2SPGap1B[centV0]->Fill(track->Pt(), v2SPGap1B);
bc76879c 440
441 fCosGap1B[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
442 fSinGap1B[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
10a99a07 443
962f3d11 444 if (Qvec > fCutLargeQperc && Qvec < 100.){
d57dd83f 445 fv2SPGap1B_lq[centV0]->Fill(track->Pt(), v2SPGap1B);
bc76879c 446 fSinGap1B_lq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
447 fCosGap1B_lq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
448 }
d57dd83f 449
962f3d11 450 if (Qvec > 0. && Qvec < fCutSmallQperc){
d57dd83f 451 fv2SPGap1B_sq[centV0]->Fill(track->Pt(), v2SPGap1B);
bc76879c 452 fSinGap1B_sq[centV0]->Fill(track->Pt(), TMath::Sin(2.*track->Phi()));
453 fCosGap1B_sq[centV0]->Fill(track->Pt(), TMath::Cos(2.*track->Phi()));
454 }
d57dd83f 455 }
456 }// end else
457 } // end loop on tracks
458 } // end loop
459
10a99a07 460
461 if (multGap1A > 0 && multGap1B > 0){
462 Double_t res = (QxGap1A*QxGap1B + QyGap1A*QyGap1B)/(Double_t)multGap1A/(Double_t)multGap1B;
463 fResSP->Fill((Double_t)centV0, res);
464
962f3d11 465 if (Qvec > fCutLargeQperc && Qvec < 100.){
10a99a07 466 fResSP_lq->Fill((Double_t)centV0, res);
962f3d11 467 }
468
469 if (Qvec > 0. && Qvec < fCutSmallQperc){
10a99a07 470 fResSP_sq->Fill((Double_t)centV0, res);
962f3d11 471 }
472
473 if( fFillTHn ){
474 Double_t QA = TMath::Sqrt( (QxGap1A*QxGap1A + QyGap1A*QyGap1A)/multGap1A );
475 Double_t QB = TMath::Sqrt( (QxGap1B*QxGap1B + QyGap1B*QyGap1B)/multGap1B );
476
477 Double_t varEv[4];
478 varEv[0]=centV0;
479 varEv[1]=Qvec;
480 varEv[2]=(Double_t)QA;
481 varEv[3]=(Double_t)QB;
482 ((THnSparseF*)fOutput->FindObject("NSparseHistEv"))->Fill(varEv);//event loop
483 }
10a99a07 484 }
485
10a99a07 486 PostData(1, fOutput );
487 PostData(2, fEventCuts);
488 PostData(3, fTrackCuts);
489 PostData(4, fOutput_lq );
490 PostData(5, fOutput_sq );
491}
492
493//_________________________________________________________________
494Bool_t AliAnalysisTaskV2AllChAOD::GetDCA(const AliAODTrack* trk, Double_t * p){
495
496 //AliAODTrack::DCA(): for newest AOD fTrack->DCA() always gives -999. This should fix.
497 //FIXME should update EventCuts?
498 //FIXME add track->GetXYZ(p) method
499
500 double xyz[3],cov[3];
501
502 if (!trk->GetXYZ(xyz)) { // dca is not stored
503 AliExternalTrackParam etp;
504 etp.CopyFromVTrack(trk);
505 AliVEvent* ev = (AliVEvent*)trk->GetEvent();
506 if (!ev) {/*printf("Event is not connected to the track\n");*/ return kFALSE;}
507 if (!etp.PropagateToDCA(ev->GetPrimaryVertex(), ev->GetMagneticField(),999,xyz,cov)) return kFALSE; // failed, track is too far from vertex
508 }
509 p[0] = xyz[0];
510 p[1] = xyz[1];
511 return kTRUE;
512
513}
514
515//_________________________________________________________________
516void AliAnalysisTaskV2AllChAOD::Terminate(Option_t *)
517{
518 // Terminate
519}