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