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