]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/EMCALTasks/AliAnalysisTaskPi0V2.cxx
change to function calls with enum data types
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliAnalysisTaskPi0V2.cxx
CommitLineData
04b116e8 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
3c40321c 16/* $Id: AliAnalysisTaskPi0V2.cxx 55404 2012-03-29 10:10:19Z fca $ */
17
04b116e8 18/* AliAnalysisTaskPi0V2.cxx
19 *
20 * Template task producing a P_t spectrum and pseudorapidity distribution.
21 * Includes explanations of physics and primary track selections
22 *
23 * Instructions for adding histograms can be found below, starting with NEW HISTO
24 *
25 * Based on tutorial example from offline pages
26 * Edited by Arvinder Palaha
27 */
3c40321c 28#include "AliAnalysisTaskPi0V2.h"
29
04b116e8 30#include "Riostream.h"
31#include "TChain.h"
32#include "TTree.h"
33#include "TH1F.h"
34#include "TH2F.h"
35#include "TH3F.h"
36#include "TCanvas.h"
37#include "TList.h"
3c40321c 38
70d53162 39#include "AliAnalysisTaskSE.h"
04b116e8 40#include "AliAnalysisManager.h"
41#include "AliStack.h"
42#include "AliESDtrackCuts.h"
3c40321c 43#include "AliESDEvent.h"
44#include "AliESDInputHandler.h"
04b116e8 45#include "AliAODEvent.h"
70d53162 46#include "AliMCEvent.h"
ceba2d0c 47#include "AliVCluster.h"
04b116e8 48
49#include "AliEventplane.h"
50#include "AliEMCALGeometry.h"
51#include "THnSparse.h"
e5ba16b4 52#include "TClonesArray.h"
53#include "TString.h"
3c40321c 54
9d6804f4 55using std::cout;
56using std::endl;
57
3c40321c 58ClassImp(AliAnalysisTaskPi0V2)
59
60//________________________________________________________________________
965c985f 61AliAnalysisTaskPi0V2::AliAnalysisTaskPi0V2(const char *name) // All data members should be initialised here
62 :AliAnalysisTaskSE(name),
04b116e8 63 fOutput(0),
04b116e8 64 fESD(0),
ceba2d0c 65 fTracksName("PicoTrack"), fV1ClusName("CaloCluster"), fV2ClusName("CaloCluster"),
7bb82cc2 66 fTrigClass("CVLN_|CSEMI_|CCENT|CVHN"),
ceba2d0c 67 fTracks(0), fV1Clus(0), fV2Clus(0),
7bb82cc2 68 fRunNumber(-999.),
8071d5b2 69 fEvtSelect(1),
e50db689 70 fVtxCut(15.),
8f4922cb 71 fNcellCut(2), fECut(1), fEtaCut(0.65), fM02Cut(0.5), fPi0AsyCut(0), isV1Clus(1),
04b116e8 72 fCentrality(99.),
73 fEPTPC(-999.),
74 fEPTPCreso(0.),
75 fEPV0(-999.), fEPV0A(-999.), fEPV0C(-999.), fEPV0Ar(-999.), fEPV0Cr(-999.), fEPV0r(-999.),
76 fEPV0AR4(-999.), fEPV0AR5(-999.), fEPV0AR6(-999.), fEPV0AR7(-999.), fEPV0CR0(-999.), fEPV0CR1(-999.), fEPV0CR2(-999.), fEPV0CR3(-999.),
ef7e23cf 77 hEvtCount(0), hAllcentV0(0), hAllcentV0r(0), hAllcentV0A(0), hAllcentV0C(0), hAllcentTPC(0),
7bb82cc2 78 h2DcosV0r(0), h2DsinV0r(0), h2DcosV0A(0), h2DsinV0A(0), h2DcosV0C(0), h2DsinV0C(0), h2DcosTPC(0), h2DsinTPC(0),
04b116e8 79 hEPTPC(0), hresoTPC(0),
80 hEPV0(0), hEPV0A(0), hEPV0C(0), hEPV0Ar(0), hEPV0Cr(0), hEPV0r(0), hEPV0AR4(0), hEPV0AR7(0), hEPV0CR0(0), hEPV0CR3(0),
e50db689 81 hdifV0Ar_V0Cr(0), hdifV0A_V0CR0(0), hdifV0A_V0CR3(0), hdifV0ACR0_V0CR3(0), hdifV0C_V0AR4(0), hdifV0C_V0AR7(0), hdifV0AR4_V0AR7(0),
04b116e8 82 hdifV0A_V0C(0), hdifV0A_TPC(0), hdifV0C_TPC(0), hdifV0C_V0A(0),
8f4922cb 83 hM02vsPtA(0), hM02vsPtB(0), hClusDxDZA(0), hClusDxDZB(0),
93df010a 84 hdifEMC_EPV0(0), hdifEMC_EPV0A(0), hdifEMC_EPV0C(0), hdifful_EPV0(0), hdifful_EPV0A(0), hdifful_EPV0C(0),
85 hdifout_EPV0(0), hdifout_EPV0A(0), hdifout_EPV0C(0), hdifEMC_EPTPC(0), hdifful_EPTPC(0), hdifout_EPTPC(0),
8e5ac2d1 86// hdifClus_EPV0(0), hdifClus_EPV0A(0), hdifClus_EPV0C(0), hdifClus_EPTPC(0),
87 fClusterPbV0(0), fClusterPbV0A(0), fClusterPbV0C(0), fClusterPbTPC(0),
04b116e8 88 fHEPV0r(0), fHEPV0A(0), fHEPV0C(0), fHEPTPC(0)
89
3c40321c 90{
04b116e8 91 // Dummy constructor ALWAYS needed for I/O.
92 DefineInput(0, TChain::Class());
93 DefineOutput(1, TList::Class()); // for output list
3c40321c 94}
95
96//________________________________________________________________________
965c985f 97AliAnalysisTaskPi0V2::AliAnalysisTaskPi0V2() // All data members should be initialised here
8f40bd27 98 :AliAnalysisTaskSE("default_name"),
04b116e8 99 fOutput(0),
04b116e8 100 fESD(0),
13e6ff28 101 fTracksName("PicoTrack"), fV1ClusName("CaloCluster"), fV2ClusName("CaloCluster"),
7bb82cc2 102 fTrigClass("CVLN_|CSEMI_|CCENT|CVHN"),
13e6ff28 103 fTracks(0), fV1Clus(0), fV2Clus(0),
7bb82cc2 104 fRunNumber(-999.),
8071d5b2 105 fEvtSelect(1),
e50db689 106 fVtxCut(15.),
8f4922cb 107 fNcellCut(2), fECut(1), fEtaCut(0.65), fM02Cut(0.5), fPi0AsyCut(0), isV1Clus(1),
04b116e8 108 fCentrality(99.),
109 fEPTPC(-999.),
110 fEPTPCreso(0.),
111 fEPV0(-999.), fEPV0A(-999.), fEPV0C(-999.), fEPV0Ar(-999.), fEPV0Cr(-999.), fEPV0r(-999.),
112 fEPV0AR4(-999.), fEPV0AR5(-999.), fEPV0AR6(-999.), fEPV0AR7(-999.), fEPV0CR0(-999.), fEPV0CR1(-999.), fEPV0CR2(-999.), fEPV0CR3(-999.),
ef7e23cf 113 hEvtCount(0), hAllcentV0(0), hAllcentV0r(0), hAllcentV0A(0), hAllcentV0C(0), hAllcentTPC(0),
13e6ff28 114 h2DcosV0r(0), h2DsinV0r(0), h2DcosV0A(0), h2DsinV0A(0), h2DcosV0C(0), h2DsinV0C(0), h2DcosTPC(0), h2DsinTPC(0),
04b116e8 115 hEPTPC(0), hresoTPC(0),
116 hEPV0(0), hEPV0A(0), hEPV0C(0), hEPV0Ar(0), hEPV0Cr(0), hEPV0r(0), hEPV0AR4(0), hEPV0AR7(0), hEPV0CR0(0), hEPV0CR3(0),
e50db689 117 hdifV0Ar_V0Cr(0), hdifV0A_V0CR0(0), hdifV0A_V0CR3(0), hdifV0ACR0_V0CR3(0), hdifV0C_V0AR4(0), hdifV0C_V0AR7(0), hdifV0AR4_V0AR7(0),
13e6ff28 118 hdifV0A_V0C(0), hdifV0A_TPC(0), hdifV0C_TPC(0), hdifV0C_V0A(0),
8f4922cb 119 hM02vsPtA(0), hM02vsPtB(0), hClusDxDZA(0), hClusDxDZB(0),
13e6ff28 120 hdifEMC_EPV0(0), hdifEMC_EPV0A(0), hdifEMC_EPV0C(0), hdifful_EPV0(0), hdifful_EPV0A(0), hdifful_EPV0C(0),
93df010a 121 hdifout_EPV0(0), hdifout_EPV0A(0), hdifout_EPV0C(0), hdifEMC_EPTPC(0), hdifful_EPTPC(0), hdifout_EPTPC(0),
8e5ac2d1 122// hdifClus_EPV0(0), hdifClus_EPV0A(0), hdifClus_EPV0C(0), hdifClus_EPTPC(0),
123 fClusterPbV0(0), fClusterPbV0A(0), fClusterPbV0C(0), fClusterPbTPC(0),
04b116e8 124 fHEPV0r(0), fHEPV0A(0), fHEPV0C(0), fHEPTPC(0)
3c40321c 125{
04b116e8 126 // Constructor
127 // Define input and output slots here (never in the dummy constructor)
128 // Input slot #0 works with a TChain - it is connected to the default input container
129 // Output slot #1 writes into a TH1 container
130 DefineInput(0, TChain::Class());
131 DefineOutput(1, TList::Class()); // for output list
3c40321c 132}
133
134//________________________________________________________________________
135AliAnalysisTaskPi0V2::~AliAnalysisTaskPi0V2()
136{
04b116e8 137 // Destructor. Clean-up the output list, but not the histograms that are put inside
138 // (the list is owner and will clean-up these histograms). Protect in PROOF case.
670ffa5c 139 delete fOutput;
3c40321c 140}
141//_____________________________________________________________________
142Double_t AliAnalysisTaskPi0V2::GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const
143{
144 // Get maximum energy of attached cell.
145
146 id = -1;
147
148 AliVCaloCells *cells = 0;
149 if (fESD)
150 cells = fESD->GetEMCALCells();
3c40321c 151 if (!cells)
152 return 0;
153
154 Double_t maxe = 0;
155 const Int_t ncells = cluster->GetNCells();
156 for (Int_t i=0; i<ncells; i++) {
157 Double_t e = cells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i)));
158 if (e>maxe) {
159 maxe = e;
160 id = cluster->GetCellAbsId(i);
161 }
162 }
163 return maxe;
164}
165//_____________________________________________________________________
166Double_t AliAnalysisTaskPi0V2::GetCrossEnergy(const AliVCluster *cluster, Short_t &idmax) const
167{
168 // Calculate the energy of cross cells around the leading cell.
169
170 AliVCaloCells *cells = 0;
171 if (fESD)
172 cells = fESD->GetEMCALCells();
3c40321c 173 if (!cells)
174 return 0;
175
176 AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
177 if (!geom)
178 return 0;
179
180 Int_t iSupMod = -1;
181 Int_t iTower = -1;
182 Int_t iIphi = -1;
183 Int_t iIeta = -1;
184 Int_t iphi = -1;
185 Int_t ieta = -1;
186 Int_t iphis = -1;
187 Int_t ietas = -1;
188
965c985f 189 Double_t crossEnergy = 0.;
3c40321c 190
191 geom->GetCellIndex(idmax,iSupMod,iTower,iIphi,iIeta);
192 geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphis,ietas);
193
194 Int_t ncells = cluster->GetNCells();
195 for (Int_t i=0; i<ncells; i++) {
196 Int_t cellAbsId = cluster->GetCellAbsId(i);
197 geom->GetCellIndex(cellAbsId,iSupMod,iTower,iIphi,iIeta);
198 geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta);
199 Int_t aphidiff = TMath::Abs(iphi-iphis);
200 if (aphidiff>1)
201 continue;
202 Int_t aetadiff = TMath::Abs(ieta-ietas);
203 if (aetadiff>1)
204 continue;
205 if ( (aphidiff==1 && aetadiff==0) ||
206 (aphidiff==0 && aetadiff==1) ) {
207 crossEnergy += cells->GetCellAmplitude(cellAbsId);
208 }
209 }
210
211 return crossEnergy;
212}
213//_____________________________________________________________________
214Bool_t AliAnalysisTaskPi0V2::IsWithinFiducialVolume(Short_t id) const
215{
216 // Check if cell is within given fiducial volume.
217
218 Double_t fNFiducial = 1;
219
220 Int_t iSupMod = -1;
221 Int_t iTower = -1;
222 Int_t iIphi = -1;
223 Int_t iIeta = -1;
224 Int_t iphi = -1;
225 Int_t ieta = -1;
226
227 Bool_t okrow = kFALSE;
228 Bool_t okcol = kFALSE;
229
04b116e8 230 AliEMCALGeometry *geom = AliEMCALGeometry::GetInstance();
3c40321c 231 if (!geom)
232 return kFALSE;
233
234 Int_t cellAbsId = id;
235 geom->GetCellIndex(cellAbsId,iSupMod,iTower,iIphi,iIeta);
236 geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta);
237
238 // Check rows/phi
239 if (iSupMod < 10) {
240 if (iphi >= fNFiducial && iphi < 24-fNFiducial)
241 okrow = kTRUE;
242 } else {
243 if (iphi >= fNFiducial && iphi < 12-fNFiducial)
244 okrow = kTRUE;
245 }
246 // Check columns/eta
247 Bool_t noEMCALBorderAtEta0 = kTRUE;
248 if (!noEMCALBorderAtEta0) {
249 if (ieta > fNFiducial && ieta < 48-fNFiducial)
250 okcol = kTRUE;
251 } else {
252 if (iSupMod%2==0) {
253 if (ieta >= fNFiducial)
254 okcol = kTRUE;
255 } else {
256 if (ieta < 48-fNFiducial)
257 okcol = kTRUE;
258 }
259 }
260 if (okrow && okcol)
261 return kTRUE;
262
263 return kFALSE;
264}
265//______________________________________________________________________
ceba2d0c 266Bool_t AliAnalysisTaskPi0V2::IsGoodCluster(const AliVCluster *c) const
3c40321c 267{
268
269 if(!c)
270 return kFALSE;
271
670ffa5c 272 if(c->GetNCells() < fNcellCut)
3c40321c 273 return kFALSE;
274
670ffa5c 275 if(c->E() < fECut)
3c40321c 276 return kFALSE;
277
278 Short_t id = -1;
279 Double_t maxE = GetMaxCellEnergy(c, id);
965c985f 280 if((1. - double(GetCrossEnergy(c,id))/maxE) > 0.97)
3c40321c 281 return kFALSE;
282
965c985f 283
3c40321c 284 Float_t pos1[3];
285 c->GetPosition(pos1);
286 TVector3 clsPos(pos1);
287 Double_t eta = clsPos.Eta();
288
670ffa5c 289 if(TMath::Abs(eta) > fEtaCut)
3c40321c 290 return kFALSE;
291
292 if (!IsWithinFiducialVolume(id))
293 return kFALSE;
294
670ffa5c 295 if(c->GetM02() >fM02Cut)
3c40321c 296 return kFALSE;
297
04b116e8 298
3c40321c 299 return kTRUE;
70d53162 300
cc57d293 301}
302//________________________________________________________________________________________________
ceba2d0c 303Bool_t AliAnalysisTaskPi0V2::IsGoodClusterV1(const AliVCluster *c) const
cc57d293 304{
305
306 if(!c)
307 return kFALSE;
308
309 if(c->GetNCells() < fNcellCut)
310 return kFALSE;
311
312 if(c->E() < fECut)
313 return kFALSE;
314
315 Short_t id = -1;
316 Double_t maxE = GetMaxCellEnergy(c, id);
317 if((1. - double(GetCrossEnergy(c,id))/maxE) > 0.97)
318 return kFALSE;
319
320
321 Float_t pos1[3];
322 c->GetPosition(pos1);
323 TVector3 clsPos(pos1);
324 Double_t eta = clsPos.Eta();
325
326 if(TMath::Abs(eta) > fEtaCut)
327 return kFALSE;
328
329 if (!IsWithinFiducialVolume(id))
330 return kFALSE;
331
332 if(c->GetM02() <0.5)
333 return kFALSE;
334
335 Double_t dr = TMath::Sqrt(c->GetTrackDx()*c->GetTrackDx() + c->GetTrackDz()*c->GetTrackDz());
336 if(dr>0.025)
337 return kFALSE;
338
339 return kTRUE;
340
04b116e8 341}
3c40321c 342//_____________________________________________________________________
343Bool_t AliAnalysisTaskPi0V2::IsGoodPion(const TLorentzVector &p1, const TLorentzVector &p2) const
344{
345 // Is good pion?
346
670ffa5c 347 if(fPi0AsyCut){
348 Double_t asym = TMath::Abs(p1.E()-p2.E())/(p1.E()+p2.E());
349 if (asym>0.7)
350 return kFALSE;
351 }
3c40321c 352 TLorentzVector pion;
353 pion = p1 + p2;
354 Double_t eta = pion.Eta();
670ffa5c 355 if(TMath::Abs(eta) > fEtaCut)
3c40321c 356 return kFALSE;
357
358 return kTRUE;
359}
360//_______________________________________________________________________
361void AliAnalysisTaskPi0V2::FillPion(const TLorentzVector& p1, const TLorentzVector& p2, Double_t EPV0r, Double_t EPV0A, Double_t EPV0C, Double_t EPTPC)
362{
363 // Fill histogram.
364
365 if (!IsGoodPion(p1,p2))
366 return;
367 TLorentzVector pion;
368 pion = p1 + p2;
369
370 Double_t mass = pion.M();
371 Double_t pt = pion.Pt();
372 Double_t phi = pion.Phi();
373
374 Double_t dphiV0 = phi-EPV0r;
375 Double_t dphiV0A = phi-EPV0A;
376 Double_t dphiV0C = phi-EPV0C;
377 Double_t dphiTPC = phi-EPTPC;
378
379 Double_t cos2phiV0 = TMath::Cos(2.*(dphiV0));
380 Double_t cos2phiV0A = TMath::Cos(2.*(dphiV0A));
381 Double_t cos2phiV0C = TMath::Cos(2.*(dphiV0C));
382 Double_t cos2phiTPC = TMath::Cos(2.*(dphiTPC));
383
c6ee6f73 384 dphiV0 = TVector2::Phi_0_2pi(dphiV0); if(dphiV0 >TMath::Pi()) dphiV0 -= TMath::Pi();
385 dphiV0A = TVector2::Phi_0_2pi(dphiV0A); if(dphiV0A >TMath::Pi()) dphiV0A -= TMath::Pi();
386 dphiV0C = TVector2::Phi_0_2pi(dphiV0C); if(dphiV0C >TMath::Pi()) dphiV0C -= TMath::Pi();
387 dphiTPC = TVector2::Phi_0_2pi(dphiTPC); if(dphiTPC >TMath::Pi()) dphiTPC -= TMath::Pi();
3c40321c 388
389 Double_t xV0[5]; // Match ndims in fH V0 EP
390 xV0[0] = mass;
391 xV0[1] = pt;
392 xV0[2] = fCentrality;
393 xV0[3] = dphiV0;
394 xV0[4] = cos2phiV0;
395 fHEPV0r->Fill(xV0);
396
397 Double_t xV0A[5]; // Match ndims in fH V0A EP
398 xV0A[0] = mass;
399 xV0A[1] = pt;
400 xV0A[2] = fCentrality;
401 xV0A[3] = dphiV0A;
402 xV0A[4] = cos2phiV0A;
403 fHEPV0A->Fill(xV0A);
404
405 Double_t xV0C[5]; // Match ndims in fH V0C EP
406 xV0C[0] = mass;
407 xV0C[1] = pt;
408 xV0C[2] = fCentrality;
409 xV0C[3] = dphiV0C;
410 xV0C[4] = cos2phiV0C;
411 fHEPV0C->Fill(xV0C);
412
413 Double_t xTPC[5]; // Match ndims in fH TPC EP
414 xTPC[0] = mass;
415 xTPC[1] = pt;
416 xTPC[2] = fCentrality;
417 xTPC[3] = dphiTPC;
418 xTPC[4] = cos2phiTPC;
419 fHEPTPC->Fill(xTPC);
70d53162 420
04b116e8 421
7bb82cc2 422}
e50db689 423//________________________________________________________________________________________________________________________________
8e5ac2d1 424void AliAnalysisTaskPi0V2::FillCluster(const TLorentzVector& p1, Double_t EPV0r, Double_t EPV0A, Double_t EPV0C, Double_t EPTPC, Double_t M02)
7bb82cc2 425{
426 //cluster(photon) v2 method
8e5ac2d1 427// Double_t Pt = p1.Pt();
428 Double_t Et = p1.Et();
7bb82cc2 429 Double_t Phi = p1.Phi();
430
431 Double_t difClusV0 = TVector2::Phi_0_2pi(Phi-EPV0r); if(difClusV0 >TMath::Pi()) difClusV0 -= TMath::Pi();
432 Double_t difClusV0A = TVector2::Phi_0_2pi(Phi-EPV0A); if(difClusV0A >TMath::Pi()) difClusV0A -= TMath::Pi();
433 Double_t difClusV0C = TVector2::Phi_0_2pi(Phi-EPV0C); if(difClusV0C >TMath::Pi()) difClusV0C -= TMath::Pi();
434 Double_t difClusTPC = TVector2::Phi_0_2pi(Phi-EPTPC); if(difClusTPC >TMath::Pi()) difClusTPC -= TMath::Pi();
435
8e5ac2d1 436 Double_t DataV0[5];
437 DataV0[0] = Et;
438 DataV0[1] = M02;
439 DataV0[2] = fCentrality;
440 DataV0[3] = difClusV0;
441 DataV0[4] = TMath::Cos(2.0*(difClusV0));
442 fClusterPbV0->Fill(DataV0);
443
444 Double_t DataV0A[5];
445 DataV0A[0] = Et;
446 DataV0A[1] = M02;
447 DataV0A[2] = fCentrality;
448 DataV0A[3] = difClusV0A;
449 DataV0A[4] = TMath::Cos(2.0*(difClusV0A));
450 fClusterPbV0A->Fill(DataV0A);
451
452 Double_t DataV0C[5];
453 DataV0C[0] = Et;
454 DataV0C[1] = M02;
455 DataV0C[2] = fCentrality;
456 DataV0C[3] = difClusV0C;
457 DataV0C[4] = TMath::Cos(2.0*(difClusV0C));
458 fClusterPbV0C->Fill(DataV0C);
459
460 Double_t DataTPC[5];
461 DataTPC[0] = Et;
462 DataTPC[1] = M02;
463 DataTPC[2] = fCentrality;
464 DataTPC[3] = difClusTPC;
465 DataTPC[4] = TMath::Cos(2.0*(difClusTPC));
466 fClusterPbTPC->Fill(DataTPC);
7bb82cc2 467
04b116e8 468}
3c40321c 469//_________________________________________________________________________________________________
ceba2d0c 470void AliAnalysisTaskPi0V2::GetMom(TLorentzVector& p, const AliVCluster *c, Double_t *vertex)
3c40321c 471{
472 // Calculate momentum.
473 Float_t posMom[3];
474 c->GetPosition(posMom);
475 TVector3 clsPos2(posMom);
476
477 Double_t e = c->E();
478 Double_t r = clsPos2.Perp();
479 Double_t eta = clsPos2.Eta();
480 Double_t phi = clsPos2.Phi();
481
482 TVector3 pos;
483 pos.SetPtEtaPhi(r,eta,phi);
484
485 if (vertex) { //calculate direction relative to vertex
486 pos -= vertex;
487 }
488
489 Double_t rad = pos.Mag();
490 p.SetPxPyPzE(e*pos.x()/rad, e*pos.y()/rad, e*pos.z()/rad, e);
70d53162 491
04b116e8 492}
3c40321c 493//________________________________________________________________________
494void AliAnalysisTaskPi0V2::UserCreateOutputObjects()
495{
04b116e8 496 // Create histograms
497 // Called once (on the worker node)
3c40321c 498
04b116e8 499 fOutput = new TList();
500 fOutput->SetOwner(); // IMPORTANT!
ef7e23cf 501
502 hEvtCount = new TH1F("hEvtCount", " Event Plane", 10, 0.5, 10.5);
4fbbf89d 503 hEvtCount->GetXaxis()->SetBinLabel(1,"All");
504 hEvtCount->GetXaxis()->SetBinLabel(2,"Evt Cut");
505 hEvtCount->GetXaxis()->SetBinLabel(3,"Trg Class");
506 hEvtCount->GetXaxis()->SetBinLabel(4,"Vtx");
507 hEvtCount->GetXaxis()->SetBinLabel(5,"Cent");
508 hEvtCount->GetXaxis()->SetBinLabel(5,"EPtask");
509 hEvtCount->GetXaxis()->SetBinLabel(7,"EPvalue");
510 hEvtCount->GetXaxis()->SetBinLabel(8,"Pass");
ef7e23cf 511 fOutput->Add(hEvtCount);
04b116e8 512
ebaf288d 513 hEPTPC = new TH2F("hEPTPC", "EPTPC vs cent", 100, 0., 100., 100, 0., TMath::Pi());
514 hresoTPC = new TH2F("hresoTPC", "TPc reso vs cent", 100, 0., 100., 100, 0., 1.);
515 hEPV0 = new TH2F("hEPV0", "EPV0 vs cent", 100, 0., 100., 100, 0., TMath::Pi());
516 hEPV0A = new TH2F("hEPV0A", "EPV0A vs cent", 100, 0., 100., 100, 0., TMath::Pi());
517 hEPV0C = new TH2F("hEPV0C", "EPV0C vs cent", 100, 0., 100., 100, 0., TMath::Pi());
518 hEPV0Ar = new TH2F("hEPV0Ar", "EPV0Ar vs cent", 100, 0., 100., 100, 0., TMath::Pi());
519 hEPV0Cr = new TH2F("hEPV0Cr", "EPV0Cr vs cent", 100, 0., 100., 100, 0., TMath::Pi());
520 hEPV0r = new TH2F("hEPV0r", "EPV0r vs cent", 100, 0., 100., 100, 0., TMath::Pi());
521 hEPV0AR4 = new TH2F("hEPV0AR4", "EPV0AR4 vs cent", 100, 0., 100., 100, 0., TMath::Pi());
522 hEPV0AR7 = new TH2F("hEPV0AR7", "EPV0AR7 vs cent", 100, 0., 100., 100, 0., TMath::Pi());
523 hEPV0CR0 = new TH2F("hEPV0CR0", "EPV0CR0 vs cent", 100, 0., 100., 100, 0., TMath::Pi());
524 hEPV0CR3 = new TH2F("hEPV0CR3", "EPV0CR3 vs cent", 100, 0., 100., 100, 0., TMath::Pi());
04b116e8 525 fOutput->Add(hEPTPC);
526 fOutput->Add(hresoTPC);
527 fOutput->Add(hEPV0);
528 fOutput->Add(hEPV0A);
529 fOutput->Add(hEPV0C);
530 fOutput->Add(hEPV0Ar);
531 fOutput->Add(hEPV0Cr);
532 fOutput->Add(hEPV0r);
533 fOutput->Add(hEPV0AR4);
534 fOutput->Add(hEPV0AR7);
535 fOutput->Add(hEPV0CR0);
536 fOutput->Add(hEPV0CR3);
537
e50db689 538 hdifV0Ar_V0Cr = new TH2F("hdifV0Ar_V0Cr", "EP Ar-Cr ", 100, 0., 100., 100, -1., 1.);
ebaf288d 539 hdifV0A_V0CR0 = new TH2F("hdifV0A_V0CR0", "EP A-R0 ", 100, 0., 100., 100, -1., 1.);
540 hdifV0A_V0CR3 = new TH2F("hdifV0A_V0CR3", "EP A-R3 ", 100, 0., 100., 100, -1., 1.);
541 hdifV0ACR0_V0CR3 = new TH2F("hdifV0ACR0_V0CR3", "EP R0-R3 ", 100, 0., 100., 100, -1., 1.);
542 hdifV0C_V0AR4 = new TH2F("hdifV0C_V0AR4", "EP C-R4 ", 100, 0., 100., 100, -1., 1.);
543 hdifV0C_V0AR7 = new TH2F("hdifV0C_V0AR7", "EP C-R7 ", 100, 0., 100., 100, -1., 1.);
544 hdifV0AR4_V0AR7 = new TH2F("hdifV0AR4_V0AR7", "EP R4-R7 ", 100, 0., 100., 100, -1., 1.);
e50db689 545 fOutput->Add(hdifV0Ar_V0Cr);
04b116e8 546 fOutput->Add(hdifV0A_V0CR0);
547 fOutput->Add(hdifV0A_V0CR3);
548 fOutput->Add(hdifV0ACR0_V0CR3);
549 fOutput->Add(hdifV0C_V0AR4);
550 fOutput->Add(hdifV0C_V0AR7);
551 fOutput->Add(hdifV0AR4_V0AR7);
552
ebaf288d 553 hdifV0A_V0C = new TH2F("hdifV0A_V0C", "EP A-C ", 100, 0., 100., 100, -1., 1.);
554 hdifV0A_TPC = new TH2F("hdifV0A_TPC", "EP A-TPC", 100, 0., 100., 100, -1., 1.);
555 hdifV0C_TPC = new TH2F("hdifV0C_TPC", "EP C-TPC", 100, 0., 100., 100, -1., 1.);
556 hdifV0C_V0A = new TH2F("hdifV0C_V0A", "EP C-A ", 100, 0., 100., 100, -1., 1.);
04b116e8 557 fOutput->Add(hdifV0A_V0C);
558 fOutput->Add(hdifV0A_TPC);
559 fOutput->Add(hdifV0C_TPC);
560 fOutput->Add(hdifV0C_V0A);
561
562
563
93df010a 564 hdifEMC_EPV0 = new TH3F("hdifEMC_EPV0", "dif phi in EMC with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
565 hdifEMC_EPV0A = new TH3F("hdifEMC_EPV0A", "dif phi in EMC with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
566 hdifEMC_EPV0C = new TH3F("hdifEMC_EPV0C", "dif phi in EMC with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
567 fOutput->Add(hdifEMC_EPV0);
568 fOutput->Add(hdifEMC_EPV0A);
569 fOutput->Add(hdifEMC_EPV0C);
570
571 hdifful_EPV0 = new TH3F("hdifful_EPV0", "dif phi in full with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
572 hdifful_EPV0A = new TH3F("hdifful_EPV0A", "dif phi in full with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
573 hdifful_EPV0C = new TH3F("hdifful_EPV0C", "dif phi in full with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
574 fOutput->Add(hdifful_EPV0);
575 fOutput->Add(hdifful_EPV0A);
576 fOutput->Add(hdifful_EPV0C);
577
578 hdifout_EPV0 = new TH3F("hdifout_EPV0", "dif phi NOT in EMC with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
579 hdifout_EPV0A = new TH3F("hdifout_EPV0A", "dif phi NOT in EMC with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
580 hdifout_EPV0C = new TH3F("hdifout_EPV0C", "dif phi NOT in EMC with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
581 fOutput->Add(hdifout_EPV0);
582 fOutput->Add(hdifout_EPV0A);
583 fOutput->Add(hdifout_EPV0C);
584
585 hdifEMC_EPTPC = new TH3F("hdifEMC_EPTPC", "dif phi in EMC with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
586 hdifful_EPTPC = new TH3F("hdifful_EPTPC", "dif phi in full with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
587 hdifout_EPTPC = new TH3F("hdifout_EPTPC", "dif phi NOT in EMC with EP", 100, 0., 100., 100, 0., TMath::Pi(), 15, 0., 15.);
588 fOutput->Add(hdifEMC_EPTPC);
589 fOutput->Add(hdifful_EPTPC);
590 fOutput->Add(hdifout_EPTPC);
04b116e8 591
8e5ac2d1 592/* hdifClus_EPV0 = new TH3F("hdifClus_EPV0", "dif phi in EMC Clus with EP", 100, 0., 100., 100, 0., TMath::Pi(), 90, 5., 50.);
13e6ff28 593 hdifClus_EPV0A = new TH3F("hdifClus_EPV0A", "dif phi in EMC Clus with EP", 100, 0., 100., 100, 0., TMath::Pi(), 90, 5., 50.);
594 hdifClus_EPV0C = new TH3F("hdifClus_EPV0C", "dif phi in EMC Clus with EP", 100, 0., 100., 100, 0., TMath::Pi(), 90, 5., 50.);
595 hdifClus_EPTPC = new TH3F("hdifClus_EPTPC", "dif phi in EMC Clus with EP", 100, 0., 100., 100, 0., TMath::Pi(), 90, 5., 50.);
7bb82cc2 596 fOutput->Add(hdifClus_EPV0);
597 fOutput->Add(hdifClus_EPV0A);
598 fOutput->Add(hdifClus_EPV0C);
599 fOutput->Add(hdifClus_EPTPC);
8e5ac2d1 600*/
601
602 // Et M02 V0Mcent DeltaPhi Cos[2*DeltaPhi]
603 Int_t bins[5] = { 500, 350, 100, 100, 100 }; // binning
604 Double_t min[5] = { 0.0, 0.0, 0, 0.0, -1.0}; // min x
605 Double_t max[5] = { 50.0, 3.5, 100, TMath::Pi(), 1.0}; // max x
606
607 fClusterPbV0 = new THnSparseF("fClusterPbV0","",5,bins,min,max);
608 fClusterPbV0->GetAxis(0)->SetTitle("Transverse Energy [GeV]"); fClusterPbV0->GetAxis(1)->SetTitle("M02"); fClusterPbV0->GetAxis(2)->SetTitle("V0M Centrality");
609 fClusterPbV0->GetAxis(3)->SetTitle("Delta(#phi) [rad]"); fClusterPbV0->GetAxis(4)->SetTitle("Cos[2*Delta(#phi)]");
610 fOutput->Add(fClusterPbV0);
611
612 fClusterPbV0A = new THnSparseF("fClusterPbV0A","",5,bins,min,max);
613 fClusterPbV0A->GetAxis(0)->SetTitle("Transverse Energy [GeV]"); fClusterPbV0A->GetAxis(1)->SetTitle("M02"); fClusterPbV0A->GetAxis(2)->SetTitle("V0M Centrality");
614 fClusterPbV0A->GetAxis(3)->SetTitle("Delta(#phi) [rad]"); fClusterPbV0A->GetAxis(4)->SetTitle("Cos[2*Delta(#phi)]");
615 fOutput->Add(fClusterPbV0A);
616
617 fClusterPbV0C = new THnSparseF("fClusterPbV0C","",5,bins,min,max);
618 fClusterPbV0C->GetAxis(0)->SetTitle("Transverse Energy [GeV]"); fClusterPbV0C->GetAxis(1)->SetTitle("M02"); fClusterPbV0C->GetAxis(2)->SetTitle("V0M Centrality");
619 fClusterPbV0C->GetAxis(3)->SetTitle("Delta(#phi) [rad]"); fClusterPbV0C->GetAxis(4)->SetTitle("Cos[2*Delta(#phi)]");
620 fOutput->Add(fClusterPbV0C);
621
622 fClusterPbTPC = new THnSparseF("fClusterPbTPC","",5,bins,min,max);
623 fClusterPbTPC->GetAxis(0)->SetTitle("Transverse Energy [GeV]"); fClusterPbTPC->GetAxis(1)->SetTitle("M02"); fClusterPbTPC->GetAxis(2)->SetTitle("V0M Centrality");
624 fClusterPbTPC->GetAxis(3)->SetTitle("Delta(#phi) [rad]"); fClusterPbTPC->GetAxis(4)->SetTitle("Cos[2*Delta(#phi)]");
625 fOutput->Add(fClusterPbTPC);
626
7bb82cc2 627
ebaf288d 628 hAllcentV0 = new TH1F("hAllcentV0", "All cent EP V0", 100, 0., TMath::Pi());
629 hAllcentV0r = new TH1F("hAllcentV0r", "All cent EP V0r", 100, 0., TMath::Pi());
630 hAllcentV0A = new TH1F("hAllcentV0A", "All cent EP V0A", 100, 0., TMath::Pi());
631 hAllcentV0C = new TH1F("hAllcentV0C", "All cent EP V0C", 100, 0., TMath::Pi());
632 hAllcentTPC = new TH1F("hAllcentTPC", "All cent EP TPC", 100, 0., TMath::Pi());
633 fOutput->Add(hAllcentV0);
634 fOutput->Add(hAllcentV0r);
635 fOutput->Add(hAllcentV0A);
636 fOutput->Add(hAllcentV0C);
637 fOutput->Add(hAllcentTPC);
638
7bb82cc2 639 h2DcosV0r = new TH2F("h2DcosV0r", "cos(Phi) V0r vs Run NUmber", 200, 0, 200, 100, -1, 1);
640 h2DsinV0r = new TH2F("h2DsinV0r", "sin(Phi) V0r vs Run NUmber", 200, 0, 200, 100, -1, 1);
641 h2DcosV0A = new TH2F("h2DcosV0A", "cos(Phi) V0r vs Run NUmber", 200, 0, 200, 100, -1, 1);
642 h2DsinV0A = new TH2F("h2DsinV0A", "sin(Phi) V0r vs Run NUmber", 200, 0, 200, 100, -1, 1);
643 h2DcosV0C = new TH2F("h2DcosV0C", "cos(Phi) V0r vs Run NUmber", 200, 0, 200, 100, -1, 1);
644 h2DsinV0C = new TH2F("h2DsinV0C", "sin(Phi) V0r vs Run NUmber", 200, 0, 200, 100, -1, 1);
645 h2DcosTPC = new TH2F("h2DcosTPC", "cos(Phi) V0r vs Run NUmber", 200, 0, 200, 100, -1, 1);
646 h2DsinTPC = new TH2F("h2DsinTPC", "sin(Phi) V0r vs Run NUmber", 200, 0, 200, 100, -1, 1);
647 fOutput->Add(h2DcosV0r);
648 fOutput->Add(h2DsinV0r);
649 fOutput->Add(h2DcosV0A);
650 fOutput->Add(h2DsinV0A);
651 fOutput->Add(h2DcosV0C);
652 fOutput->Add(h2DsinV0C);
653 fOutput->Add(h2DcosTPC);
654 fOutput->Add(h2DsinTPC);
655
8f4922cb 656 hM02vsPtA = new TH2F("hM02vsPtA", "M02 vs Et before cut", 5000, 0, 50, 400, 0, 4.);
657 hM02vsPtB = new TH2F("hM02vsPtB", "M02 vs Et before cut", 5000, 0, 50, 400, 0, 4.);
cc57d293 658 fOutput->Add(hM02vsPtA);
659 fOutput->Add(hM02vsPtB);
660
13e6ff28 661 hClusDxDZA = new TH2F("hClusDxDZA", "clus Dx vs Dz", 1000, -1., 1., 1000, -1., 1);
8f4922cb 662 hClusDxDZB = new TH2F("hClusDxDZB", "clus Dx vs Dz", 1000, -1., 1., 1000, -1., 1);
663 fOutput->Add(hClusDxDZA);
664 fOutput->Add(hClusDxDZB);
cc57d293 665
04b116e8 666 const Int_t ndims = 5;
667 Int_t nMgg=500, nPt=40, nCent=20, nDeltaPhi=315, ncos2phi=500;
8e5ac2d1 668 Int_t binsv1[ndims] = {nMgg, nPt, nCent, nDeltaPhi, ncos2phi};
04b116e8 669 Double_t xmin[ndims] = { 0, 0., 0, 0., -1.};
670 Double_t xmax[ndims] = { 0.5, 20., 100, 3.15, 1.};
8e5ac2d1 671 fHEPV0r = new THnSparseF("fHEPV0r", "Flow histogram EPV0", ndims, binsv1, xmin, xmax);
672 fHEPV0A = new THnSparseF("fHEPV0A", "Flow histogram EPV0A", ndims, binsv1, xmin, xmax);
673 fHEPV0C = new THnSparseF("fHEPV0C", "Flow histogram EPV0C", ndims, binsv1, xmin, xmax);
674 fHEPTPC = new THnSparseF("fHEPTPC", "Flow histogram EPTPC", ndims, binsv1, xmin, xmax);
04b116e8 675 fOutput->Add(fHEPV0r);
676 fOutput->Add(fHEPV0A);
677 fOutput->Add(fHEPV0C);
678 fOutput->Add(fHEPTPC);
679
3c40321c 680
04b116e8 681
682 PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
3c40321c 683}
684
685//________________________________________________________________________
686void AliAnalysisTaskPi0V2::UserExec(Option_t *)
687{
04b116e8 688 // Main loop
689 // Called for each event
690
04b116e8 691 // Create pointer to reconstructed event
692 AliVEvent *event = InputEvent();
693 if (!event) { Printf("ERROR: Could not retrieve event"); return; }
7bb82cc2 694 // create pointer to event
695 fESD = dynamic_cast<AliESDEvent*>(event);
696 if (!fESD) {
697 AliError("Cannot get the ESD event");
698 return;
699 }
4fbbf89d 700 hEvtCount->Fill(1);
7bb82cc2 701
702 Int_t AbsRunNumber = fESD->GetRunNumber();
703 fRunNumber = ConvertToInternalRunNumber(AbsRunNumber);
04b116e8 704
0c842c93 705 Bool_t isSelected =0;
670ffa5c 706 if(fEvtSelect == 1){ //MB+SemiCentral
ea7921ea 707 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kAnyINT | AliVEvent::kSemiCentral));
670ffa5c 708 } else if (fEvtSelect == 2){ //MB+Central+SemiCentral
ea7921ea 709 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kAnyINT | AliVEvent::kSemiCentral | AliVEvent::kCentral));
670ffa5c 710 } else if(fEvtSelect == 3){ //MB
ea7921ea 711 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kAnyINT ));
8071d5b2 712 }
ea7921ea 713
8071d5b2 714 if(!isSelected )
0c842c93 715 return;
716
4fbbf89d 717 hEvtCount->Fill(2);
7bb82cc2 718 if(!fTrigClass.IsNull()){
719 TString fired;
720 fired = fESD->GetFiredTriggerClasses();
721 if (!fired.Contains("-B-"))
722 return;
723 TObjArray *arr = fTrigClass.Tokenize("|");
724 if (!arr)
725 return;
726 Bool_t match = 0;
727 for (Int_t i=0;i<arr->GetEntriesFast();++i) {
728 TObject *obj = arr->At(i);
729 if (!obj)
730 continue;
731 if (fired.Contains(obj->GetName())) {
732 match = 1;
733 break;
734 }
735 }
736 delete arr;
737 if (
ea7921ea 738 !match && //select by Trigger classes in KCentral and KSemiCentral
739 !(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kAnyINT )) // always accept MB
7bb82cc2 740 )
741 return; //Not match skip this event
742 }
04b116e8 743
4fbbf89d 744 hEvtCount->Fill(3);
ef7e23cf 745 const AliESDVertex* fvertex = fESD->GetPrimaryVertex();
670ffa5c 746 if(TMath::Abs(fvertex->GetZ())>fVtxCut)
c6ee6f73 747 return;
04b116e8 748 Double_t vertex[3] = {fvertex->GetX(), fvertex->GetY(), fvertex->GetZ()};
70d53162 749
4fbbf89d 750 hEvtCount->Fill(4);
ef7e23cf 751
04b116e8 752 if(fESD->GetCentrality()) {
753 fCentrality =
670ffa5c 754 fESD->GetCentrality()->GetCentralityPercentile("CL1"); //spd vertex
ef7e23cf 755 } else{
756 return;
04b116e8 757 }
3c40321c 758
4fbbf89d 759 hEvtCount->Fill(5);
04b116e8 760 AliEventplane *ep = fESD->GetEventplane();
7bb82cc2 761 if (ep) {
04b116e8 762 if (ep->GetQVector())
7bb82cc2 763 fEPTPC = ep->GetQVector()->Phi()/2. ;
04b116e8 764 else
7bb82cc2 765 fEPTPC = -999.;
04b116e8 766 if (ep->GetQsub1()&&ep->GetQsub2())
7bb82cc2 767 fEPTPCreso = TMath::Cos(2.*(ep->GetQsub1()->Phi()/2.-ep->GetQsub2()->Phi()/2.));
04b116e8 768 else
7bb82cc2 769 fEPTPCreso = -1;
04b116e8 770
771 fEPV0 = ep->GetEventplane("V0", fESD);
772 fEPV0A = ep->GetEventplane("V0A", fESD);
773 fEPV0C = ep->GetEventplane("V0C", fESD);
774 Double_t qx=0, qy=0;
775 Double_t qxr=0, qyr=0;
776 fEPV0Ar = ep->CalculateVZEROEventPlane(fESD, 4, 5, 2, qxr, qyr);
777 fEPV0Cr = ep->CalculateVZEROEventPlane(fESD, 2, 3, 2, qx, qy);
778 qxr += qx;
779 qyr += qy;
780 fEPV0r = TMath::ATan2(qyr,qxr)/2.;
781 fEPV0AR4 = ep->CalculateVZEROEventPlane(fESD, 4, 2, qx, qy);
782 fEPV0AR5 = ep->CalculateVZEROEventPlane(fESD, 5, 2, qx, qy);
783 fEPV0AR6 = ep->CalculateVZEROEventPlane(fESD, 6, 2, qx, qy);
784 fEPV0AR7 = ep->CalculateVZEROEventPlane(fESD, 7, 2, qx, qy);
785 fEPV0CR0 = ep->CalculateVZEROEventPlane(fESD, 0, 2, qx, qy);
786 fEPV0CR1 = ep->CalculateVZEROEventPlane(fESD, 1, 2, qx, qy);
787 fEPV0CR2 = ep->CalculateVZEROEventPlane(fESD, 2, 2, qx, qy);
788 fEPV0CR3 = ep->CalculateVZEROEventPlane(fESD, 3, 2, qx, qy);
04b116e8 789 }
7bb82cc2 790 FillEPQA(); //Fill the EP QA
965c985f 791
4fbbf89d 792 hEvtCount->Fill(6);
ef7e23cf 793
7bb82cc2 794 if( fEPV0A<-2. || fEPV0C<-2. || fEPTPC<-2. || fEPV0r<-2.)
795 return;
ef7e23cf 796
4fbbf89d 797 hEvtCount->Fill(7);
ef7e23cf 798
ebaf288d 799 fEPV0 = TVector2::Phi_0_2pi(fEPV0); if(fEPV0>TMath::Pi()) fEPV0 = fEPV0 - TMath::Pi();
800 fEPV0r = TVector2::Phi_0_2pi(fEPV0r); if(fEPV0r>TMath::Pi()) fEPV0r = fEPV0r - TMath::Pi();
801 fEPV0A = TVector2::Phi_0_2pi(fEPV0A); if(fEPV0A>TMath::Pi()) fEPV0A = fEPV0A - TMath::Pi();
802 fEPV0C = TVector2::Phi_0_2pi(fEPV0C); if(fEPV0C>TMath::Pi()) fEPV0C = fEPV0C - TMath::Pi();
803 fEPV0Ar = TVector2::Phi_0_2pi(fEPV0Ar); if(fEPV0Ar>TMath::Pi()) fEPV0Ar = fEPV0Ar - TMath::Pi();
804 fEPV0Cr = TVector2::Phi_0_2pi(fEPV0Cr); if(fEPV0Cr>TMath::Pi()) fEPV0Cr = fEPV0Cr - TMath::Pi();
805 fEPV0AR4 = TVector2::Phi_0_2pi(fEPV0AR4); if(fEPV0AR4>TMath::Pi()) fEPV0AR4 = fEPV0AR4 - TMath::Pi();
806 fEPV0AR7 = TVector2::Phi_0_2pi(fEPV0AR7); if(fEPV0AR7>TMath::Pi()) fEPV0AR7 = fEPV0AR7 - TMath::Pi();
807 fEPV0CR0 = TVector2::Phi_0_2pi(fEPV0CR0); if(fEPV0CR0>TMath::Pi()) fEPV0CR0 = fEPV0CR0 - TMath::Pi();
808 fEPV0CR3 = TVector2::Phi_0_2pi(fEPV0CR3); if(fEPV0CR3>TMath::Pi()) fEPV0CR3 = fEPV0CR3 - TMath::Pi();
809
8071d5b2 810 if(fEPTPC != -999.)
04b116e8 811 hEPTPC->Fill(fCentrality, fEPTPC);
812 if(fEPTPCreso!=-1) hresoTPC->Fill(fCentrality, fEPTPCreso);
813 hEPV0->Fill(fCentrality, fEPV0);
814 hEPV0A->Fill(fCentrality, fEPV0A);
815 hEPV0C->Fill(fCentrality, fEPV0C);
816 hEPV0Ar->Fill(fCentrality, fEPV0Ar);
817 hEPV0Cr->Fill(fCentrality, fEPV0Cr);
818 hEPV0r->Fill(fCentrality, fEPV0r);
ebaf288d 819 hEPV0AR4->Fill(fCentrality, fEPV0AR4);
820 hEPV0AR7->Fill(fCentrality, fEPV0AR7);
821 hEPV0CR0->Fill(fCentrality, fEPV0CR0);
822 hEPV0CR3->Fill(fCentrality, fEPV0CR3);
823
824 hAllcentV0->Fill(fEPV0);
825 hAllcentV0r->Fill(fEPV0r);
826 hAllcentV0A->Fill(fEPV0A);
827 hAllcentV0C->Fill(fEPV0C);
828 hAllcentTPC->Fill(fEPTPC);
04b116e8 829
e50db689 830 hdifV0Ar_V0Cr->Fill(fCentrality, TMath::Cos(2.*(fEPV0Ar - fEPV0Cr)));
04b116e8 831 hdifV0A_V0CR0->Fill(fCentrality, TMath::Cos(2.*(fEPV0A - fEPV0CR0)));
832 hdifV0A_V0CR3->Fill(fCentrality, TMath::Cos(2.*(fEPV0A - fEPV0CR3)));
833 hdifV0ACR0_V0CR3->Fill(fCentrality, TMath::Cos(2*(fEPV0CR0 - fEPV0CR3)));
834 hdifV0C_V0AR4->Fill(fCentrality, TMath::Cos(2*(fEPV0C - fEPV0AR4)));
835 hdifV0C_V0AR7->Fill(fCentrality, TMath::Cos(2*(fEPV0C - fEPV0AR7)));
836 hdifV0AR4_V0AR7->Fill(fCentrality, TMath::Cos(2*(fEPV0AR4 - fEPV0AR7)));
3c40321c 837
04b116e8 838 hdifV0A_V0C->Fill(fCentrality, TMath::Cos(2*(fEPV0A - fEPV0C)));
839 hdifV0A_TPC->Fill(fCentrality, TMath::Cos(2*(fEPV0A - fEPTPC)));
840 hdifV0C_TPC->Fill(fCentrality, TMath::Cos(2*(fEPV0C - fEPTPC)));
841 hdifV0C_V0A->Fill(fCentrality, TMath::Cos(2*(fEPV0C - fEPV0A)));
842 // Cluster loop for reconstructed event
04b116e8 843
13e6ff28 844//================ for v2 clusterize analysis==============================================
845 if(!isV1Clus){
846 if (!fV2ClusName.IsNull() && !fV2Clus) {
847 fV2Clus = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fV2ClusName));
848 if (!fV2Clus) {
849 AliError(Form("%s: Could not retrieve tracks %s!", GetName(), fV2ClusName.Data()));
850 return;
851 }
852 }
853 Int_t nCluster = fV2Clus->GetEntries();
854 for(Int_t i=0; i<nCluster; ++i){
855 AliVCluster *c1 = static_cast<AliVCluster*>(fV2Clus->At(i));
856 hClusDxDZA->Fill(c1->GetTrackDz(), c1->GetTrackDx());
857 if(!c1->IsEMCAL()) continue;
858 if(!IsGoodCluster(c1)) continue;
859 hClusDxDZB->Fill(c1->GetTrackDz(), c1->GetTrackDx());
860 TLorentzVector p1;
861 GetMom(p1, c1, vertex);
862 for(Int_t j=i+1; j<nCluster; ++j){
863 AliVCluster *c2 = static_cast<AliVCluster*>(fV2Clus->At(i));
864 if(!c2->IsEMCAL()) continue;
865 if(!IsGoodCluster(c2)) continue;
866 TLorentzVector p2;
867 GetMom(p2, c2, vertex);
868 FillPion(p1, p2, fEPV0r, fEPV0A, fEPV0C, fEPTPC);
869 }
870 }
ceba2d0c 871 }
13e6ff28 872 //================ for v1 clusterize analysis==============================================
8f4922cb 873 if(isV1Clus){
ceba2d0c 874 if (!fV2ClusName.IsNull() && !fV1Clus) {
875 fV1Clus = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fV1ClusName));
876 if (!fV1Clus) {
877 AliError(Form("%s: Could not retrieve tracks %s!", GetName(), fV1ClusName.Data()));
878 return;
879 }
880 }
881 Int_t nClusterV1 = fV1Clus->GetEntries();
882 for(Int_t i=0; i<nClusterV1; ++i){
ceba2d0c 883 AliVCluster *c3 = static_cast<AliVCluster*>(fV1Clus->At(i));
13e6ff28 884 hClusDxDZA->Fill(c3->GetTrackDz(), c3->GetTrackDx());
885 Float_t clsPosEt[3] = {0,0,0};
886 c3->GetPosition(clsPosEt);
887 TVector3 clsVec(clsPosEt);
888 Double_t Et = c3->E()*TMath::Sin(clsVec.Theta());
889 hM02vsPtA->Fill(Et, c3->GetM02());
8f4922cb 890 if(!c3->IsEMCAL()) continue;
891 if(!IsGoodClusterV1(c3)) continue;
13e6ff28 892 hM02vsPtB->Fill(Et, c3->GetM02());
893 hClusDxDZB->Fill(c3->GetTrackDz(), c3->GetTrackDx());
8f4922cb 894 TLorentzVector p3;
895 GetMom(p3, c3, vertex);
8e5ac2d1 896 FillCluster(p3, fEPV0r, fEPV0A, fEPV0C, fEPTPC, c3->GetM02());
8f4922cb 897 }
898 }
899
900
e5ba16b4 901 if (!fTracksName.IsNull() && !fTracks) {
902 fTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fTracksName));
903 if (!fTracks) {
904 AliError(Form("%s: Could not retrieve tracks %s!", GetName(), fTracksName.Data()));
905 return;
e5ba16b4 906 }
50ebbe79 907 }
e5ba16b4 908
909 Int_t ntracks = fTracks->GetEntries();
910 for(Int_t i=0; i<ntracks; ++i){
911 AliVTrack *track = static_cast<AliVTrack*>(fTracks->At(i));
912 Double_t tPhi = track->Phi();
913 Double_t tPt = track->Pt();
914
915 Double_t difTrackV0 = TVector2::Phi_0_2pi(tPhi-fEPV0); if(difTrackV0 >TMath::Pi()) difTrackV0 -= TMath::Pi();
916 Double_t difTrackV0A = TVector2::Phi_0_2pi(tPhi-fEPV0A); if(difTrackV0A >TMath::Pi()) difTrackV0A -= TMath::Pi();
917 Double_t difTrackV0C = TVector2::Phi_0_2pi(tPhi-fEPV0C); if(difTrackV0C >TMath::Pi()) difTrackV0C -= TMath::Pi();
918 Double_t difTrackTPC = TVector2::Phi_0_2pi(tPhi-fEPTPC); if(difTrackTPC >TMath::Pi()) difTrackTPC -= TMath::Pi();
919 if(track->IsEMCAL()){
920 hdifEMC_EPV0->Fill(fCentrality, difTrackV0, tPt);
921 hdifEMC_EPV0A->Fill(fCentrality, difTrackV0A, tPt);
922 hdifEMC_EPV0C->Fill(fCentrality, difTrackV0C, tPt);
923 hdifEMC_EPTPC->Fill(fCentrality, difTrackTPC, tPt);
924 }else{
925 hdifout_EPV0->Fill(fCentrality, difTrackV0, tPt);
926 hdifout_EPV0A->Fill(fCentrality, difTrackV0A, tPt);
927 hdifout_EPV0C->Fill(fCentrality, difTrackV0C, tPt);
928 hdifout_EPTPC->Fill(fCentrality, difTrackTPC, tPt);
929 }
930 hdifful_EPV0->Fill(fCentrality, difTrackV0, tPt);
931 hdifful_EPV0A->Fill(fCentrality, difTrackV0A, tPt);
932 hdifful_EPV0C->Fill(fCentrality, difTrackV0C, tPt);
933 hdifful_EPTPC->Fill(fCentrality, difTrackTPC, tPt);
04b116e8 934 }
4fbbf89d 935 hEvtCount->Fill(8);
04b116e8 936
937 // NEW HISTO should be filled before this point, as PostData puts the
938 // information for this iteration of the UserExec in the container
939 PostData(1, fOutput);
3c40321c 940}
7bb82cc2 941//____________________________________________________________________
942Int_t AliAnalysisTaskPi0V2::ConvertToInternalRunNumber(Int_t n)
943{
944 switch(n){
945 case 170593 : return 179 ;
946 case 170572 : return 178 ;
947 case 170556 : return 177 ;
948 case 170552 : return 176 ;
949 case 170546 : return 175 ;
950 case 170390 : return 174 ;
951 case 170389 : return 173 ;
952 case 170388 : return 172 ;
953 case 170387 : return 171 ;
954 case 170315 : return 170 ;
955 case 170313 : return 169 ;
956 case 170312 : return 168 ;
957 case 170311 : return 167 ;
958 case 170309 : return 166 ;
959 case 170308 : return 165 ;
960 case 170306 : return 164 ;
961 case 170270 : return 163 ;
962 case 170269 : return 162 ;
963 case 170268 : return 161 ;
964 case 170267 : return 160 ;
965 case 170264 : return 159 ;
966 case 170230 : return 158 ;
967 case 170228 : return 157 ;
968 case 170208 : return 156 ;
969 case 170207 : return 155 ;
970 case 170205 : return 154 ;
971 case 170204 : return 153 ;
972 case 170203 : return 152 ;
973 case 170195 : return 151 ;
974 case 170193 : return 150 ;
975 case 170163 : return 149 ;
976 case 170162 : return 148 ;
977 case 170159 : return 147 ;
978 case 170155 : return 146 ;
979 case 170152 : return 145 ;
980 case 170091 : return 144 ;
981 case 170089 : return 143 ;
982 case 170088 : return 142 ;
983 case 170085 : return 141 ;
984 case 170084 : return 140 ;
985 case 170083 : return 139 ;
986 case 170081 : return 138 ;
987 case 170040 : return 137 ;
988 case 170038 : return 136 ;
989 case 170036 : return 135 ;
990 case 170027 : return 134 ;
991 case 169981 : return 133 ;
992 case 169975 : return 132 ;
993 case 169969 : return 131 ;
994 case 169965 : return 130 ;
995 case 169961 : return 129 ;
996 case 169956 : return 128 ;
997 case 169926 : return 127 ;
998 case 169924 : return 126 ;
999 case 169923 : return 125 ;
1000 case 169922 : return 124 ;
1001 case 169919 : return 123 ;
1002 case 169918 : return 122 ;
1003 case 169914 : return 121 ;
1004 case 169859 : return 120 ;
1005 case 169858 : return 119 ;
1006 case 169855 : return 118 ;
1007 case 169846 : return 117 ;
1008 case 169838 : return 116 ;
1009 case 169837 : return 115 ;
1010 case 169835 : return 114 ;
1011 case 169683 : return 113 ;
1012 case 169628 : return 112 ;
1013 case 169591 : return 111 ;
1014 case 169590 : return 110 ;
1015 case 169588 : return 109 ;
1016 case 169587 : return 108 ;
1017 case 169586 : return 107 ;
1018 case 169584 : return 106 ;
1019 case 169557 : return 105 ;
1020 case 169555 : return 104 ;
1021 case 169554 : return 103 ;
1022 case 169553 : return 102 ;
1023 case 169550 : return 101 ;
1024 case 169515 : return 100 ;
1025 case 169512 : return 99 ;
1026 case 169506 : return 98 ;
1027 case 169504 : return 97 ;
1028 case 169498 : return 96 ;
1029 case 169475 : return 95 ;
1030 case 169420 : return 94 ;
1031 case 169419 : return 93 ;
1032 case 169418 : return 92 ;
1033 case 169417 : return 91 ;
1034 case 169415 : return 90 ;
1035 case 169411 : return 89 ;
1036 case 169238 : return 88 ;
1037 case 169236 : return 87 ;
1038 case 169167 : return 86 ;
1039 case 169160 : return 85 ;
1040 case 169156 : return 84 ;
1041 case 169148 : return 83 ;
1042 case 169145 : return 82 ;
1043 case 169144 : return 81 ;
1044 case 169143 : return 80 ;
1045 case 169138 : return 79 ;
1046 case 169099 : return 78 ;
1047 case 169094 : return 77 ;
1048 case 169091 : return 76 ;
1049 case 169045 : return 75 ;
1050 case 169044 : return 74 ;
1051 case 169040 : return 73 ;
1052 case 169035 : return 72 ;
1053 case 168992 : return 71 ;
1054 case 168988 : return 70 ;
1055 case 168984 : return 69 ;
1056 case 168826 : return 68 ;
1057 case 168777 : return 67 ;
1058 case 168514 : return 66 ;
1059 case 168512 : return 65 ;
1060 case 168511 : return 64 ;
1061 case 168467 : return 63 ;
1062 case 168464 : return 62 ;
1063 case 168461 : return 61 ;
1064 case 168460 : return 60 ;
1065 case 168458 : return 59 ;
1066 case 168362 : return 58 ;
1067 case 168361 : return 57 ;
1068 case 168356 : return 56 ;
1069 case 168342 : return 55 ;
1070 case 168341 : return 54 ;
1071 case 168325 : return 53 ;
1072 case 168322 : return 52 ;
1073 case 168318 : return 51 ;
1074 case 168311 : return 50 ;
1075 case 168310 : return 49 ;
1076 case 168213 : return 48 ;
1077 case 168212 : return 47 ;
1078 case 168208 : return 46 ;
1079 case 168207 : return 45 ;
1080 case 168206 : return 44 ;
1081 case 168205 : return 43 ;
1082 case 168204 : return 42 ;
1083 case 168203 : return 41 ;
1084 case 168181 : return 40 ;
1085 case 168177 : return 39 ;
1086 case 168175 : return 38 ;
1087 case 168173 : return 37 ;
1088 case 168172 : return 36 ;
1089 case 168171 : return 35 ;
1090 case 168115 : return 34 ;
1091 case 168108 : return 33 ;
1092 case 168107 : return 32 ;
1093 case 168105 : return 31 ;
1094 case 168104 : return 30 ;
1095 case 168103 : return 29 ;
1096 case 168076 : return 28 ;
1097 case 168069 : return 27 ;
1098 case 168068 : return 26 ;
1099 case 168066 : return 25 ;
1100 case 167988 : return 24 ;
1101 case 167987 : return 23 ;
1102 case 167986 : return 22 ;
1103 case 167985 : return 21 ;
1104 case 167921 : return 20 ;
1105 case 167920 : return 19 ;
1106 case 167915 : return 18 ;
1107 case 167909 : return 17 ;
1108 case 167903 : return 16 ;
1109 case 167902 : return 15 ;
1110 case 167818 : return 14 ;
1111 case 167814 : return 13 ;
1112 case 167813 : return 12 ;
1113 case 167808 : return 11 ;
1114 case 167807 : return 10 ;
1115 case 167806 : return 9 ;
1116 case 167713 : return 8 ;
1117 case 167712 : return 7 ;
1118 case 167711 : return 6 ;
1119 case 167706 : return 5 ;
1120 case 167693 : return 4 ;
1121 case 166532 : return 3 ;
1122 case 166530 : return 2 ;
1123 case 166529 : return 1 ;
1124
1125 default : return 199;
1126 }
1127}
1128//_______________________________________________________________________
1129void AliAnalysisTaskPi0V2::FillEPQA()
1130{
1131
1132 h2DcosV0r->Fill(fRunNumber, TMath::Cos(fEPV0r));
1133 h2DsinV0r->Fill(fRunNumber, TMath::Sin(fEPV0r));
1134 h2DcosV0A->Fill(fRunNumber, TMath::Cos(fEPV0A));
1135 h2DsinV0A->Fill(fRunNumber, TMath::Sin(fEPV0A));
1136 h2DcosV0C->Fill(fRunNumber, TMath::Cos(fEPV0C));
1137 h2DsinV0C->Fill(fRunNumber, TMath::Sin(fEPV0C));
1138 h2DcosTPC->Fill(fRunNumber, TMath::Cos(fEPTPC));
1139 h2DsinTPC->Fill(fRunNumber, TMath::Sin(fEPTPC));
3c40321c 1140
04b116e8 1141
7bb82cc2 1142}
3c40321c 1143//________________________________________________________________________
1144void AliAnalysisTaskPi0V2::Terminate(Option_t *)
1145{
04b116e8 1146 // Draw result to screen, or perform fitting, normalizations
1147 // Called once at the end of the query
1148// fOutput = dynamic_cast<TList*> (GetOutputData(1));
1149 // if(!fOutput) { Printf("ERROR: could not retrieve TList fOutput"); return; }
1150
1151 // Get the physics selection histograms with the selection statistics
1152 //AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1153 //AliESDInputHandler *inputH = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
1154 //TH2F *histStat = (TH2F*)inputH->GetStatistics();
1155
1156
1157 // NEW HISTO should be retrieved from the TList container in the above way,
1158 // so it is available to draw on a canvas such as below
1159
3c40321c 1160}