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