]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/PHOSTasks/PHOS_PbPb/AliAnalysisTaskPi0FlowMC.cxx
Reverted to Tag v5-05-64-AN.
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPb / AliAnalysisTaskPi0FlowMC.cxx
CommitLineData
444647ad 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
16// Extension to Pi0FLOw, mimicing AliPHOSHijingEfficiency
17// by Dmitri Peressounko, 05.02.2013
18// Authors: Henrik Qvigstad, Dmitri Peressounko
19// Date : 05.04.2013
20/* $Id$ */
21
22#include "TChain.h"
23#include "TTree.h"
24#include "TObjArray.h"
25#include "TF1.h"
26#include "TFile.h"
27#include "TH1F.h"
28#include "TH2F.h"
29#include "TH2I.h"
30#include "TH3F.h"
31#include "TParticle.h"
32#include "TCanvas.h"
33#include "TStyle.h"
34#include "TRandom.h"
35#include "TROOT.h"
36#include "THashList.h"
abbd081b 37#include "TArray.h"
38#include "TArrayD.h"
444647ad 39
40
41#include "AliAnalysisManager.h"
42#include "AliMCEventHandler.h"
43#include "AliMCEvent.h"
44#include "AliStack.h"
45#include "AliAnalysisTaskSE.h"
46#include "AliPHOSHijingEfficiency.h"
47#include "AliCaloPhoton.h"
48#include "AliPHOSGeometry.h"
49#include "AliPHOSEsdCluster.h"
50#include "AliPHOSCalibData.h"
51#include "AliESDEvent.h"
52#include "AliESDCaloCells.h"
53#include "AliESDVertex.h"
54#include "AliESDtrackCuts.h"
55#include "AliLog.h"
56#include "AliPID.h"
57#include "AliCDBManager.h"
58#include "AliCentrality.h"
59#include "AliESDtrackCuts.h"
60#include "AliEventplane.h"
61#include "TProfile.h"
62#include <TPDGCode.h>
63#include "AliOADBContainer.h"
00c8d7ab 64
444647ad 65
4c316866 66#include "AliAnalysisTaskPi0Flow.h"
444647ad 67#include "AliAnalysisTaskPi0FlowMC.h"
68
69ClassImp(AliAnalysisTaskPi0FlowMC);
70
71//TODO: rnlin?
72
abbd081b 73//TODO: Geometry IHEP?
74//TODO: PHOS matrix?
75//TODO: Centrality.?
76
a91370e6 77const Double_t AliAnalysisTaskPi0FlowMC::kRCut = 1.;
78
444647ad 79AliAnalysisTaskPi0FlowMC::AliAnalysisTaskPi0FlowMC(const char* name, AliAnalysisTaskPi0Flow::Period period)
80: AliAnalysisTaskPi0Flow(name, period),
00c8d7ab 81 fStack(0x0)
444647ad 82{
83}
84
85AliAnalysisTaskPi0FlowMC::~AliAnalysisTaskPi0FlowMC()
86{
87}
88
abbd081b 89void AliAnalysisTaskPi0FlowMC::UserCreateOutputObjects()
444647ad 90{
abbd081b 91 // Do standard Pi0Flow CreateOuputObjects
92 AliAnalysisTaskPi0Flow::UserCreateOutputObjects();
444647ad 93
94 // MC Generated histograms
95 char key[55];
96 for(Int_t cent=0; cent < fCentEdges.GetSize()-1; cent++){
97 snprintf(key,55,"hMC_rap_gamma_cen%d",cent) ;
98 fOutputContainer->Add(new TH1F(key,"Rapidity pi0",200,-1.,1.)) ;
99 snprintf(key,55,"hMC_rap_pi0_cen%d",cent) ;
100 fOutputContainer->Add(new TH1F(key,"Rapidity pi0",200,-1.,1.)) ;
101 snprintf(key,55,"hMC_rap_eta_cen%d",cent) ;
102 fOutputContainer->Add(new TH1F(key,"Rapidity eta",200,-1.,1.)) ;
103 snprintf(key,55,"hMC_phi_gamma_cen%d",cent) ;
104 fOutputContainer->Add(new TH1F(key,"Phi pi0",200,0.,TMath::TwoPi())) ;
105 snprintf(key,55,"hMC_phi_pi0_cen%d",cent) ;
106 fOutputContainer->Add(new TH1F(key,"Phi pi0",200,0.,TMath::TwoPi())) ;
107 snprintf(key,55,"hMC_phi_eta_cen%d",cent) ;
108 fOutputContainer->Add(new TH1F(key,"Phi eta",200,0.,TMath::TwoPi())) ;
109 snprintf(key,55,"hMC_all_gamma_cen%d",cent) ;
110 fOutputContainer->Add(new TH1F(key,"Rapidity photon",250,0.,25.)) ;
111 snprintf(key,55,"hMC_all_pi0_cen%d",cent) ;
112 fOutputContainer->Add(new TH1F(key,"Rapidity pi0",250,0.,25.)) ;
113 snprintf(key,55,"hMC_all_eta_cen%d",cent) ;
114 fOutputContainer->Add(new TH1F(key,"Rapidity eta",250,0.,25.)) ;
115 snprintf(key,55,"hMC_unitEta_gamma_cen%d",cent) ;
116 fOutputContainer->Add(new TH1F(key,"Pt photon",250,0.,25.)) ;
117 snprintf(key,55,"hMC_unitEta_pi0_cen%d",cent) ;
118 fOutputContainer->Add(new TH1F(key,"Rapidity eta",250,0.,25.)) ;
119 snprintf(key,55,"hMC_unitEta_eta_cen%d",cent) ;
120 fOutputContainer->Add(new TH1F(key,"Rapidity eta",250,0.,25.)) ;
4c316866 121
122 snprintf(key,55,"hMC_all_K0S_cen%d",cent) ;
123 fOutputContainer->Add(new TH1F(key,"Rapidity photon",250,0.,25.)) ;
124
125 snprintf(key,55,"hMC_unitEta_K0S_cen%d",cent) ;
126 fOutputContainer->Add(new TH1F(key,"Rapidity eta",250,0.,25.)) ;
127
444647ad 128 }
129 fOutputContainer->Add(new TH2F("hMC_gamma_vertex","Creation vertex",25,0.,25.,1000,0.,500.)) ;
130 fOutputContainer->Add(new TH2F("hMC_pi0_vertex","Creation vertex",25,0.,25.,1000,0.,500.)) ;
131 fOutputContainer->Add(new TH2F("hMC_eta_vertex","Creation vertex",25,0.,25.,1000,0.,500.)) ;
132
133
134 Int_t nPt = 200;
135 Double_t ptMin = 0;
136 Double_t ptMax = 20;
137 fOutputContainer->Add(new TH2F("Vertex","Pi0 creation vertex",nPt,ptMin,ptMax,5000,0.,500.));
138 fOutputContainer->Add(new TH3F("hSecondPi0RphiZ","Secondary pi0 vertex",450,0.,450.,100,0.,TMath::TwoPi(),200,-100.,100.));
139 fOutputContainer->Add(new TH2F("hSecondPi0RE","Secondary pi0 vertex",450,0.,450.,200,0.,20.));
140 fOutputContainer->Add(new TH3F("hMass_R","Mass vs radius any parent",50,0.,0.25,100,0.,10.,300,0.,600.));
141 fOutputContainer->Add(new TH3F("Real_pi_R","All clusters",50,0.,0.25,100,0.,10.,250,0.,500.));
142 fOutputContainer->Add(new TH3F("Real_pi_Z","All clusters",50,0.,0.25,100,0.,10.,100,-100.,100.));
143// fOutputContainer->Add(new TH2F(Form("Real_npnp_RZ"),"All clusters",250,0.,500.,100,-100.,100.));
144// fOutputContainer->Add(new TH3F(Form("Real_mass_R"),"All clusters",50,0.,0.25,100,0.,10.,300,0.,600.));
145
146 const Int_t nM = 500;
147 const Double_t mMin = 0.0;
148 const Double_t mMax = 1.0;
149
150 for(Int_t cen=0; cen < fCentEdges.GetSize()-1; cen++){
151 fOutputContainer->Add(new TH1F(Form("hPrimPhot_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
152 fOutputContainer->Add(new TH1F(Form("hPrimEl_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
153 fOutputContainer->Add(new TH1F(Form("hPrimPi0_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
154 fOutputContainer->Add(new TH1F(Form("hPrimEta_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
155 fOutputContainer->Add(new TH1F(Form("hPrimPipm_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
156 fOutputContainer->Add(new TH1F(Form("hPrimP_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
157 fOutputContainer->Add(new TH1F(Form("hPrimPbar_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
158 fOutputContainer->Add(new TH1F(Form("hPrimN_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
159 fOutputContainer->Add(new TH1F(Form("hPrimNbar_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
160 fOutputContainer->Add(new TH1F(Form("hPrimK0S_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
161 fOutputContainer->Add(new TH1F(Form("hPrimK0L_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
162 fOutputContainer->Add(new TH1F(Form("hPrimKpm_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
163 fOutputContainer->Add(new TH1F(Form("hPrimOther_cen%d",cen),"Primary spetrum",nPt,ptMin,ptMax));
164
165 //pairs from common parents
166 fOutputContainer->Add(new TH2F(Form("hParentAll_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
167 fOutputContainer->Add(new TH2F(Form("hParentK0s_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
168 fOutputContainer->Add(new TH2F(Form("hParentGamma_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
169 fOutputContainer->Add(new TH2F(Form("hParentEl_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
170 fOutputContainer->Add(new TH2F(Form("hParentOther_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
171 fOutputContainer->Add(new TH2F(Form("hParentPi0_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
172 fOutputContainer->Add(new TH2F(Form("hParentDirPi0_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
173
174 //common parent - pi0
175 fOutputContainer->Add(new TH2F(Form("hParentPi0NoPrim_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
176 fOutputContainer->Add(new TH2F(Form("hParentPi0Eta_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
177 fOutputContainer->Add(new TH2F(Form("hParentPi0Omega_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
178 fOutputContainer->Add(new TH2F(Form("hParentPi0Pipm_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
179 fOutputContainer->Add(new TH2F(Form("hParentPi0Kpm_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
180 fOutputContainer->Add(new TH2F(Form("hParentPi0Ks_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
181 fOutputContainer->Add(new TH2F(Form("hParentPi0Kl_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
182 fOutputContainer->Add(new TH2F(Form("hParentPi0pn_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
183 fOutputContainer->Add(new TH2F(Form("hParentPi0antipn_cen%d",cen),"All clusters",nM,mMin,mMax,nPt,ptMin,ptMax));
184
185 }
186
187
188 //Photon contaminations
189 fOutputContainer->Add(new TH2F("hPipmGammaConvR","Conversion radius" ,200,0.,20.,1000,0.,500.));
190 fOutputContainer->Add(new TH2F("hPipmElConvR","Conversion radius" ,200,0.,20.,1000,0.,500.));
191 fOutputContainer->Add(new TH2F("hPipmNConvR","Conversion radius" ,200,0.,20.,1000,0.,500.));
192 fOutputContainer->Add(new TH2F("hPipmOtherConvR","Conversion radius" ,200,0.,20.,1000,0.,500.));
193 fOutputContainer->Add(new TH2F("hPipmGammaConvRZ","Conversion radius" ,400,-200.,200.,1000,0.,500.));
194
195 const Int_t nTypes=24 ;
196 char partTypes[nTypes][55] ;
197 snprintf(partTypes[0],55,"hGammaNoPrim") ; //
198 snprintf(partTypes[1],55,"hGammaPhot") ; //
199 snprintf(partTypes[2],55,"hGammaEl") ; //
200 snprintf(partTypes[3],55,"hGammaPi0") ; //
201 snprintf(partTypes[4],55,"hGammaEta") ; //
202 snprintf(partTypes[5],55,"hhGammaOmega") ; //
203 snprintf(partTypes[6],55,"hGammaPipm") ; //
204 snprintf(partTypes[7],55,"hGammaP") ; //
205 snprintf(partTypes[8],55,"hGammaPbar") ; //
206 snprintf(partTypes[9],55,"hGammaN") ; //
207 snprintf(partTypes[10],55,"hGammaNbar") ; //
208 snprintf(partTypes[11],55,"hGammaK0S") ; //
209 snprintf(partTypes[12],55,"hGammaK0L") ; //
210 snprintf(partTypes[13],55,"hGammaKpm") ; //
211 snprintf(partTypes[14],55,"hGammaKstar") ; //
212 snprintf(partTypes[15],55,"hGammaDelta") ; //
213 snprintf(partTypes[16],55,"hGammaOtherCharged") ; //
214 snprintf(partTypes[17],55,"hGammaOtherNeutral") ; //
215 snprintf(partTypes[18],55,"hGammaPipmGamma") ; //
216 snprintf(partTypes[19],55,"hGammaPipmEl") ; //
217 snprintf(partTypes[20],55,"hGammaPipmOther") ; //
218 snprintf(partTypes[21],55,"hGammaPipmDirect") ; //
219 snprintf(partTypes[22],55,"hGammaPipmp") ; //
220 snprintf(partTypes[23],55,"hGammaPipmn") ; //
221
222 const Int_t nPID=12 ;
545b989c 223 char cPID[12][25] ;
444647ad 224 snprintf(cPID[0],25,"All") ;
225 snprintf(cPID[1],25,"Allcore") ;
226 snprintf(cPID[2],25,"CPV") ;
227 snprintf(cPID[3],25,"CPVcore") ;
228 snprintf(cPID[4],25,"CPV2") ;
229 snprintf(cPID[5],25,"CPV2core") ;
230 snprintf(cPID[6],25,"Disp") ;
231 snprintf(cPID[7],25,"Dispcore") ;
232 snprintf(cPID[8],25,"Disp2") ;
233 snprintf(cPID[9],25,"Disp2core") ;
234 snprintf(cPID[10],25,"Both") ;
235 snprintf(cPID[11],25,"Bothcore") ;
236
237 for(Int_t itype=0; itype<nTypes; itype++){
238 for(Int_t iPID=0; iPID<nPID; iPID++){
00c8d7ab 239 for(Int_t cen=0; cen<5; cen++){
444647ad 240 fOutputContainer->Add(new TH1F(Form("%s_%s_cen%d",partTypes[itype],cPID[iPID],cen),"Cluster parents",nPt,ptMin,ptMax));
241 }
242 }
abbd081b 243 }
244
245 PostData(1, fOutputContainer);
444647ad 246}
247
abbd081b 248void AliAnalysisTaskPi0FlowMC::UserExec(Option_t* option)
444647ad 249{
444647ad 250 fStack = GetMCStack();
251
abbd081b 252 AliAnalysisTaskPi0Flow::UserExec(option);
253}
254
255
256void AliAnalysisTaskPi0FlowMC::SelectPhotonClusters()
257{
258 AliAnalysisTaskPi0Flow::SelectPhotonClusters();
444647ad 259
abbd081b 260 for (Int_t i1=0; i1<fCaloPhotonsPHOS->GetEntriesFast(); i1++) {
261 AliCaloPhoton * photon = (AliCaloPhoton*)fCaloPhotonsPHOS->At(i1);
262 AliVCluster* cluster = photon->GetCluster();
263 Bool_t sure= kTRUE;
264 Int_t primary=FindPrimary(cluster,sure) ;
265 photon->SetPrimary(primary);
266 photon->SetWeight(PrimaryWeight(primary)) ;
f2471c72 267 }
4c316866 268
f2471c72
YK
269 for (Int_t i1=0; i1<fCaloPhotonsPHOS->GetEntriesFast(); i1++) {
270 AliCaloPhoton * photon = (AliCaloPhoton*)fCaloPhotonsPHOS->At(i1);
271 Int_t primary = photon->GetPrimary();
00c8d7ab 272 TParticle* p = fStack->Particle(primary);
4c316866 273 if(p->R() >kRCut) {
274 if(p->GetPdgCode()==11 || p->GetPdgCode()==-11) continue;
f2471c72
YK
275 else { fCaloPhotonsPHOS->Remove(photon); fCaloPhotonsPHOS->Compress(); }
276 }
277 }
278
abbd081b 279}
444647ad 280
abbd081b 281void AliAnalysisTaskPi0FlowMC::FillSelectedClusterHistograms()
282{
444647ad 283 for (Int_t i1=0; i1<fCaloPhotonsPHOS->GetEntriesFast(); i1++) {
abbd081b 284 AliCaloPhoton * ph1=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
285
286 Double_t dphiA=ph1->Phi()-fRPV0A ;
287 while(dphiA<0)dphiA+=TMath::Pi() ;
288 while(dphiA>TMath::Pi())dphiA-=TMath::Pi() ;
289
290 Double_t dphiC=ph1->Phi()-fRPV0C ;
291 while(dphiC<0)dphiC+=TMath::Pi() ;
292 while(dphiC>TMath::Pi())dphiC-=TMath::Pi() ;
293
294 Double_t dphiT=ph1->Phi()-fRP ;
295 while(dphiT<0)dphiT+=TMath::Pi() ;
296 while(dphiT>TMath::Pi())dphiT-=TMath::Pi() ;
297
298 Double_t pt = ph1->Pt() ;
299 Double_t ptcore = ph1->GetMomV2()->Pt() ;
300 Double_t w = ph1->GetWeight();
301
302 FillHistogram(Form("hPhotPhiV0AAll_cen%d",fCentBin),pt,dphiA, w) ;
303 FillHistogram(Form("hPhotPhiV0CAll_cen%d",fCentBin),pt,dphiC, w) ;
304 if(fHaveTPCRP)
305 FillHistogram(Form("hPhotPhiTPCAll_cen%d",fCentBin),pt,dphiT, w) ;
306 FillHistogram(Form("hPhotPhiV0AAllcore_cen%d",fCentBin),ptcore,dphiA, w) ;
307 FillHistogram(Form("hPhotPhiV0CAllcore_cen%d",fCentBin),ptcore,dphiC, w) ;
308 if(fHaveTPCRP)
309 FillHistogram(Form("hPhotPhiTPCAllcore_cen%d",fCentBin),ptcore,dphiT, w) ;
310
311 FillHistogram(Form("hPhotAll_cen%d",fCentBin),pt, w) ;
312 FillHistogram(Form("hPhotAllcore_cen%d",fCentBin),ptcore, w) ;
313 if(ph1->IsntUnfolded()){
314 FillHistogram(Form("hPhotAllwou_cen%d",fCentBin),pt, w) ;
315 FillHistogram(Form("hPhotPhiV0AAllwou_cen%d",fCentBin),pt,dphiA, w) ;
316 FillHistogram(Form("hPhotPhiV0CAllwou_cen%d",fCentBin),pt,dphiC, w) ;
317 if(fHaveTPCRP)
318 FillHistogram(Form("hPhotPhiTPCAllwou_cen%d",fCentBin),pt,dphiT, w) ;
319 }
320 if(ph1->IsCPVOK()){
321 FillHistogram(Form("hPhotPhiV0ACPV_cen%d",fCentBin),pt,dphiA, w) ;
322 FillHistogram(Form("hPhotPhiV0CCPV_cen%d",fCentBin),pt,dphiC, w) ;
323 if(fHaveTPCRP)
324 FillHistogram(Form("hPhotPhiTPCCPV_cen%d",fCentBin),pt,dphiT, w) ;
325
326 FillHistogram(Form("hPhotPhiV0ACPVcore_cen%d",fCentBin),ptcore,dphiA, w) ;
327 FillHistogram(Form("hPhotPhiV0CCPVcore_cen%d",fCentBin),ptcore,dphiC, w) ;
328 if(fHaveTPCRP)
329 FillHistogram(Form("hPhotPhiTPCCPVcore_cen%d",fCentBin),ptcore,dphiT, w) ;
330
331 FillHistogram(Form("hPhotCPV_cen%d",fCentBin),pt, w) ;
332 FillHistogram(Form("hPhotCPVcore_cen%d",fCentBin),ptcore, w) ;
333 }
334 if(ph1->IsCPV2OK()){
335 FillHistogram(Form("hPhotPhiV0ACPV2_cen%d",fCentBin),pt,dphiA, w) ;
336 FillHistogram(Form("hPhotPhiV0CCPV2_cen%d",fCentBin),pt,dphiC, w) ;
337 if(fHaveTPCRP)
338 FillHistogram(Form("hPhotPhiTPCCPV2_cen%d",fCentBin),pt,dphiT, w) ;
339
340 FillHistogram(Form("hPhotPhiV0ACPV2core_cen%d",fCentBin),ptcore,dphiA, w) ;
341 FillHistogram(Form("hPhotPhiV0CCPV2core_cen%d",fCentBin),ptcore,dphiC, w) ;
342 if(fHaveTPCRP)
343 FillHistogram(Form("hPhotPhiTPCCPV2core_cen%d",fCentBin),ptcore,dphiT, w) ;
344 FillHistogram(Form("hPhotCPV2_cen%d",fCentBin),pt, w) ;
345 FillHistogram(Form("hPhotCPV2core_cen%d",fCentBin),ptcore, w) ;
346 }
347 if(ph1->IsDispOK()){
348 FillHistogram(Form("hPhotPhiV0ADisp_cen%d",fCentBin),pt,dphiA, w) ;
349 FillHistogram(Form("hPhotPhiV0CDisp_cen%d",fCentBin),pt,dphiC, w) ;
350 if(fHaveTPCRP)
351 FillHistogram(Form("hPhotPhiTPCDisp_cen%d",fCentBin),pt,dphiT, w) ;
352
353 FillHistogram(Form("hPhotPhiV0ADispcore_cen%d",fCentBin),ptcore,dphiA, w) ;
354 FillHistogram(Form("hPhotPhiV0CDispcore_cen%d",fCentBin),ptcore,dphiC, w) ;
355 if(fHaveTPCRP)
356 FillHistogram(Form("hPhotPhiTPCDispcore_cen%d",fCentBin),ptcore,dphiT, w) ;
357
358 if(ph1->IsntUnfolded()){
359 FillHistogram(Form("hPhotPhiV0ADispwou_cen%d",fCentBin),pt,dphiA, w) ;
360 FillHistogram(Form("hPhotPhiV0CDispwou_cen%d",fCentBin),pt,dphiC, w) ;
361 if(fHaveTPCRP)
362 FillHistogram(Form("hPhotPhiTPCDispwou_cen%d",fCentBin),pt,dphiT, w) ;
363
364 }
365 FillHistogram(Form("hPhotDisp_cen%d",fCentBin),pt, w) ;
366 FillHistogram(Form("hPhotDispcore_cen%d",fCentBin),ptcore, w) ;
367 if(ph1->IsntUnfolded()){
368 FillHistogram(Form("hPhotDispwou_cen%d",fCentBin),pt, w) ;
369 }
370 if(ph1->IsCPVOK()){
371 FillHistogram(Form("hPhotPhiV0ABoth_cen%d",fCentBin),pt,dphiA, w) ;
372 FillHistogram(Form("hPhotPhiV0CBoth_cen%d",fCentBin),pt,dphiC, w) ;
373 if(fHaveTPCRP)
374 FillHistogram(Form("hPhotPhiTPCBoth_cen%d",fCentBin),pt,dphiT, w) ;
375
376 FillHistogram(Form("hPhotPhiV0ABothcore_cen%d",fCentBin),ptcore,dphiA, w) ;
377 FillHistogram(Form("hPhotPhiV0CBothcore_cen%d",fCentBin),ptcore,dphiC, w) ;
378 if(fHaveTPCRP)
379 FillHistogram(Form("hPhotPhiTPCBothcore_cen%d",fCentBin),ptcore,dphiT, w) ;
380
381 FillHistogram(Form("hPhotBoth_cen%d",fCentBin),pt, w) ;
382 FillHistogram(Form("hPhotBothcore_cen%d",fCentBin),ptcore, w) ;
383 }
384 }
385 if(ph1->IsDisp2OK()){
386 FillHistogram(Form("hPhotPhiV0ADisp2_cen%d",fCentBin),pt,dphiA, w) ;
387 FillHistogram(Form("hPhotPhiV0CDisp2_cen%d",fCentBin),pt,dphiC, w) ;
388 if(fHaveTPCRP)
389 FillHistogram(Form("hPhotPhiTPCDisp2_cen%d",fCentBin),pt,dphiT, w) ;
390 FillHistogram(Form("hPhotPhiV0ADisp2core_cen%d",fCentBin),ptcore,dphiA, w) ;
391 FillHistogram(Form("hPhotPhiV0CDisp2core_cen%d",fCentBin),ptcore,dphiC, w) ;
392 if(fHaveTPCRP)
393 FillHistogram(Form("hPhotPhiTPCDisp2core_cen%d",fCentBin),ptcore,dphiT, w) ;
394
395 FillHistogram(Form("hPhotDisp2_cen%d",fCentBin),pt, w) ;
396 FillHistogram(Form("hPhotDisp2core_cen%d",fCentBin),ptcore, w) ;
397 if(ph1->IsCPVOK()){
398 FillHistogram(Form("hPhotPhiV0ABoth2_cen%d",fCentBin),pt,dphiA, w) ;
399 FillHistogram(Form("hPhotPhiV0CBoth2_cen%d",fCentBin),pt,dphiC, w) ;
400 if(fHaveTPCRP)
401 FillHistogram(Form("hPhotPhiTPCBoth2_cen%d",fCentBin),pt,dphiT, w) ;
402
403 FillHistogram(Form("hPhotPhiV0ABoth2core_cen%d",fCentBin),ptcore,dphiA, w) ;
404 FillHistogram(Form("hPhotPhiV0CBoth2core_cen%d",fCentBin),ptcore,dphiC, w) ;
405 if(fHaveTPCRP)
406 FillHistogram(Form("hPhotPhiTPCBoth2core_cen%d",fCentBin),ptcore,dphiT, w) ;
407
408 FillHistogram(Form("hPhotBoth2_cen%d",fCentBin),pt, w) ;
409 FillHistogram(Form("hPhotBoth2core_cen%d",fCentBin),ptcore, w) ;
410 }
411 }
444647ad 412 }
abbd081b 413}
414
415void AliAnalysisTaskPi0FlowMC::ConsiderPi0s()
416{
417 char key[55];
418 for (Int_t i1=0; i1 < fCaloPhotonsPHOS->GetEntriesFast()-1; i1++) {
419 AliCaloPhoton * ph1=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
420 const Double_t w1 = ph1->GetWeight();
421 for (Int_t i2=i1+1; i2<fCaloPhotonsPHOS->GetEntriesFast(); i2++) {
422 AliCaloPhoton * ph2=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i2) ;
423 TLorentzVector p12 = *ph1 + *ph2;
424 TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());
425
426 const Double_t w2 = ph2->GetWeight();
027589f5 427 Double_t w = TMath::Sqrt(w1*w2);
abbd081b 428
e9c54af2 429 FillHistogram("hPHOSphi",fCentrality,p12.Pt(),p12.Phi(), w) ;
abbd081b 430 Double_t dphiA=p12.Phi()-fRPV0A ;
431 while(dphiA<0)dphiA+=TMath::Pi() ;
432 while(dphiA>TMath::Pi())dphiA-=TMath::Pi() ;
433
434 Double_t dphiC=p12.Phi()-fRPV0C ;
435 while(dphiC<0)dphiC+=TMath::Pi() ;
436 while(dphiC>TMath::Pi())dphiC-=TMath::Pi() ;
437
438 Double_t dphiT=p12.Phi()-fRP ;
439 while(dphiT<0)dphiT+=TMath::Pi() ;
440 while(dphiT>TMath::Pi())dphiT-=TMath::Pi() ;
441
442 Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
443 Double_t m=p12.M() ;
444 Double_t mcore=pv12.M() ;
445 Double_t pt=p12.Pt() ;
446 Double_t ptcore=pv12.Pt() ;
447 Double_t pt1=ph1->Pt() ;
448 Double_t pt2=ph2->Pt() ;
449 Double_t ptcore1=ph1->GetMomV2()->Pt() ;
450 Double_t ptcore2=ph2->GetMomV2()->Pt() ;
451
452 FillHistogram(Form("hMassPtV0AAll_cen%d",fCentBin),m,pt,dphiA, w) ;
453 FillHistogram(Form("hMassPtV0CAll_cen%d",fCentBin),m,pt,dphiC, w) ;
454 if(fHaveTPCRP)
455 FillHistogram(Form("hMassPtTPCAll_cen%d",fCentBin),m,pt,dphiT, w) ;
456
457 FillHistogram(Form("hMassPtV0AAllcore_cen%d",fCentBin),mcore,ptcore,dphiA, w) ;
458 FillHistogram(Form("hMassPtV0CAllcore_cen%d",fCentBin),mcore,ptcore,dphiC, w) ;
459 if(fHaveTPCRP)
460 FillHistogram(Form("hMassPtTPCAllcore_cen%d",fCentBin),mcore,ptcore,dphiT, w) ;
461
462
463 FillHistogram(Form("hPi0All_cen%d",fCentBin),m,pt, w) ;
464 FillHistogram(Form("hPi0Allcore_cen%d",fCentBin),mcore,ptcore, w) ;
465 if(ph1->IsntUnfolded() && ph2->IsntUnfolded()){
466 FillHistogram(Form("hPi0Allwou_cen%d",fCentBin),m,pt, w) ;
467 FillHistogram(Form("hMassPtV0AAllwou_cen%d",fCentBin),m,pt,dphiA, w) ;
468 FillHistogram(Form("hMassPtV0CAllwou_cen%d",fCentBin),m,pt,dphiC, w) ;
469 if(fHaveTPCRP)
470 FillHistogram(Form("hMassPtTPCAllwou_cen%d",fCentBin),m,pt,dphiT, w) ;
471 }
472
473 FillHistogram(Form("hSingleAll_cen%d",fCentBin),m,pt1, w) ;
474 FillHistogram(Form("hSingleAll_cen%d",fCentBin),m,pt2, w) ;
475 FillHistogram(Form("hSingleAllcore_cen%d",fCentBin),mcore,ptcore1, w) ;
476 FillHistogram(Form("hSingleAllcore_cen%d",fCentBin),mcore,ptcore2, w) ;
477 if(ph1->IsntUnfolded())
478 FillHistogram(Form("hSingleAllwou_cen%d",fCentBin),m,pt1, w) ;
479 if(ph2->IsntUnfolded())
480 FillHistogram(Form("hSingleAllwou_cen%d",fCentBin),m,pt2, w) ;
481 if(ph1->IsCPVOK()){
482 FillHistogram(Form("hSingleCPV_cen%d",fCentBin),m,pt1, w) ;
483 FillHistogram(Form("hSingleCPVcore_cen%d",fCentBin),mcore,ptcore1, w) ;
484 }
485 if(ph2->IsCPVOK()){
486 FillHistogram(Form("hSingleCPV_cen%d",fCentBin),m,pt2, w) ;
487 FillHistogram(Form("hSingleCPVcore_cen%d",fCentBin),mcore,ptcore2, w) ;
488 }
489 if(ph1->IsCPV2OK()){
490 FillHistogram(Form("hSingleCPV2_cen%d",fCentBin),m,pt1, w) ;
491 FillHistogram(Form("hSingleCPV2core_cen%d",fCentBin),mcore,ptcore2, w) ;
492 }
493 if(ph2->IsCPV2OK()){
494 FillHistogram(Form("hSingleCPV2_cen%d",fCentBin),m,pt2, w) ;
495 FillHistogram(Form("hSingleCPV2core_cen%d",fCentBin),mcore,ptcore2, w) ;
496 }
497 if(ph1->IsDispOK()){
498 FillHistogram(Form("hSingleDisp_cen%d",fCentBin),m,pt1, w) ;
499 if(ph1->IsntUnfolded()){
500 FillHistogram(Form("hSingleDispwou_cen%d",fCentBin),m,pt1, w) ;
501 }
502 FillHistogram(Form("hSingleDispcore_cen%d",fCentBin),mcore,ptcore1, w) ;
503 }
504 if(ph2->IsDispOK()){
505 FillHistogram(Form("hSingleDisp_cen%d",fCentBin),m,pt2, w) ;
506 if(ph1->IsntUnfolded()){
507 FillHistogram(Form("hSingleDispwou_cen%d",fCentBin),m,pt2, w) ;
508 }
509 FillHistogram(Form("hSingleDispcore_cen%d",fCentBin),mcore,ptcore2, w) ;
510 }
511 if(ph1->IsDisp2OK()){
512 FillHistogram(Form("hSingleDisp2_cen%d",fCentBin),m,pt1, w) ;
513 FillHistogram(Form("hSingleDisp2core_cen%d",fCentBin),mcore,ptcore1, w) ;
514 }
515 if(ph2->IsDisp2OK()){
516 FillHistogram(Form("hSingleDisp2_cen%d",fCentBin),m,pt2, w) ;
517 FillHistogram(Form("hSingleDisp2core_cen%d",fCentBin),mcore,ptcore1, w) ;
518 }
519 if(ph1->IsDispOK() && ph1->IsCPVOK()){
520 FillHistogram(Form("hSingleBoth_cen%d",fCentBin),m,pt1, w) ;
521 FillHistogram(Form("hSingleBothcore_cen%d",fCentBin),mcore,ptcore1, w) ;
522 }
523 if(ph2->IsDispOK() && ph2->IsCPVOK()){
524 FillHistogram(Form("hSingleBoth_cen%d",fCentBin),m,pt2, w) ;
525 FillHistogram(Form("hSingleBothcore_cen%d",fCentBin),mcore,ptcore2, w) ;
526 }
527 if(ph1->IsDisp2OK() && ph1->IsCPVOK()){
528 FillHistogram(Form("hSingleBoth2_cen%d",fCentBin),m,pt1, w) ;
529 FillHistogram(Form("hSingleBoth2core_cen%d",fCentBin),mcore,ptcore1, w) ;
530 }
531 if(ph2->IsDisp2OK() && ph2->IsCPVOK()){
532 FillHistogram(Form("hSingleBoth2_cen%d",fCentBin),m,pt2, w) ;
533 FillHistogram(Form("hSingleBoth2core_cen%d",fCentBin),mcore,ptcore2, w) ;
534 }
535
536
537 if(a<kAlphaCut){
538 FillHistogram(Form("hPi0All_a07_cen%d",fCentBin),m,pt, w) ;
539 }
540
541 if(ph1->IsCPVOK() && ph2->IsCPVOK()){
542 snprintf(key,55,"hMassPtCPV_cen%d",fCentBin) ;
543 FillHistogram(Form("hMassPtV0ACPV_cen%d",fCentBin),m,pt,dphiA, w) ;
544 FillHistogram(Form("hMassPtV0CCPV_cen%d",fCentBin),m,pt,dphiC, w) ;
545 if(fHaveTPCRP)
546 FillHistogram(Form("hMassPtTPCCPV_cen%d",fCentBin),m,pt,dphiT, w) ;
547
548 FillHistogram(Form("hMassPtV0ACPVcore_cen%d",fCentBin),mcore,ptcore,dphiA, w) ;
549 FillHistogram(Form("hMassPtV0CCPVcore_cen%d",fCentBin),mcore,ptcore,dphiC, w) ;
550 if(fHaveTPCRP)
551 FillHistogram(Form("hMassPtTPCCPVcore_cen%d",fCentBin),mcore,ptcore,dphiT, w) ;
552
553 FillHistogram(Form("hPi0CPV_cen%d",fCentBin),m,pt, w) ;
554 FillHistogram(Form("hPi0CPVcore_cen%d",fCentBin),mcore, ptcore, w) ;
555
556 if(a<kAlphaCut){
557 FillHistogram(Form("hPi0CPV_a07_cen%d",fCentBin),m,pt, w) ;
558 }
559 }
560 if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
561 FillHistogram(Form("hMassPtV0ACPV2_cen%d",fCentBin),m,pt,dphiA, w) ;
562 FillHistogram(Form("hMassPtV0CCPV2_cen%d",fCentBin),m,pt,dphiC, w) ;
563 if(fHaveTPCRP)
564 FillHistogram(Form("hMassPtTPCCPV2_cen%d",fCentBin),m,pt,dphiT, w) ;
565 FillHistogram(Form("hMassPtV0ACPV2core_cen%d",fCentBin),mcore,ptcore,dphiA, w) ;
566 FillHistogram(Form("hMassPtV0CCPV2core_cen%d",fCentBin),mcore,ptcore,dphiC, w) ;
567 if(fHaveTPCRP)
568 FillHistogram(Form("hMassPtTPCCPV2core_cen%d",fCentBin),mcore,ptcore,dphiT, w) ;
569
570 FillHistogram(Form("hPi0CPV2_cen%d",fCentBin),m,pt, w) ;
571 FillHistogram(Form("hPi0CPV2core_cen%d",fCentBin),mcore, ptcore, w) ;
572 if(a<kAlphaCut){
573 FillHistogram(Form("hPi0CPV2_a07_cen%d",fCentBin),m,pt, w) ;
574 }
575 }
576 if(ph1->IsDispOK() && ph2->IsDispOK()){
577 snprintf(key,55,"hMassPtDisp_cen%d",fCentBin) ;
578 FillHistogram(Form("hMassPtV0ADisp_cen%d",fCentBin),m,pt,dphiA, w) ;
579 FillHistogram(Form("hMassPtV0CDisp_cen%d",fCentBin),m,pt,dphiC, w) ;
580 if(fHaveTPCRP)
581 FillHistogram(Form("hMassPtTPCDisp_cen%d",fCentBin),m,pt,dphiT, w) ;
582
583 FillHistogram(Form("hMassPtV0ADispcore_cen%d",fCentBin),mcore, ptcore,dphiA, w) ;
584 FillHistogram(Form("hMassPtV0CDispcore_cen%d",fCentBin),mcore, ptcore,dphiC, w) ;
585 if(fHaveTPCRP)
586 FillHistogram(Form("hMassPtTPCDispcore_cen%d",fCentBin),mcore, ptcore,dphiT, w) ;
587
588 FillHistogram(Form("hPi0Disp_cen%d",fCentBin),m,pt, w) ;
589 FillHistogram(Form("hPi0Dispcore_cen%d",fCentBin),mcore, ptcore, w) ;
590
591 if(ph1->IsntUnfolded() && ph2->IsntUnfolded()){
592 FillHistogram(Form("hPi0Dispwou_cen%d",fCentBin),m,pt, w) ;
593
594 FillHistogram(Form("hMassPtV0ADispwou_cen%d",fCentBin),m,pt,dphiA, w) ;
595 FillHistogram(Form("hMassPtV0CDispwou_cen%d",fCentBin),m,pt,dphiC, w) ;
596 if(fHaveTPCRP)
597 FillHistogram(Form("hMassPtTPCDispwou_cen%d",fCentBin),m,pt,dphiT, w) ;
598 }
599
600 if(a<kAlphaCut){
601 FillHistogram(Form("hPi0Disp_a07_cen%d",fCentBin),m,pt, w) ;
602 }
603 if(ph1->IsCPVOK() && ph2->IsCPVOK()){
604 FillHistogram(Form("hMassPtV0ABoth_cen%d",fCentBin),m,pt,dphiA, w) ;
605 FillHistogram(Form("hMassPtV0CBoth_cen%d",fCentBin),m,pt,dphiC, w) ;
606 if(fHaveTPCRP)
607 FillHistogram(Form("hMassPtTPCBoth_cen%d",fCentBin),m,pt,dphiT, w) ;
608
609 FillHistogram(Form("hMassPtV0ABothcore_cen%d",fCentBin),mcore,ptcore,dphiA, w) ;
610 FillHistogram(Form("hMassPtV0CBothcore_cen%d",fCentBin),mcore,ptcore,dphiC, w) ;
611 if(fHaveTPCRP)
612 FillHistogram(Form("hMassPtTPCBothcore_cen%d",fCentBin),mcore,ptcore,dphiT, w) ;
613
614 FillHistogram(Form("hPi0Both_cen%d",fCentBin),m,pt, w) ;
615 FillHistogram(Form("hPi0Bothcore_cen%d",fCentBin),mcore,ptcore, w) ;
616
617 if(a<kAlphaCut){
618 snprintf(key,55,"hPi0Both_a07_cen%d",fCentBin) ;
619 FillHistogram(Form("hPi0Both_a07_cen%d",fCentBin),m,pt, w) ;
620 }
621 if(ph1->Module()==1 && ph2->Module()==1)
622 FillHistogram("hPi0M11", m, pt, w) ;
623 else if(ph1->Module()==2 && ph2->Module()==2)
624 FillHistogram("hPi0M22", m, pt, w) ;
625 else if(ph1->Module()==3 && ph2->Module()==3)
626 FillHistogram("hPi0M33", m, pt, w) ;
627 else if(ph1->Module()==1 && ph2->Module()==2)
628 FillHistogram("hPi0M12", m, pt, w) ;
629 else if(ph1->Module()==1 && ph2->Module()==3)
630 FillHistogram("hPi0M13", m, pt, w) ;
631 else if(ph1->Module()==2 && ph2->Module()==3)
632 FillHistogram("hPi0M23", m, pt, w) ;
633
634 }
635
636 }
637
638
639 if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
2f335b16 640 FillHistogram(Form("hPi0Disp2_cen%d",fCentBin),m,pt,w) ;
abbd081b 641 FillHistogram(Form("hPi0Disp2core_cen%d",fCentBin),mcore, ptcore, w) ;
642
643 FillHistogram(Form("hMassPtV0ADisp2_cen%d",fCentBin),m,pt,dphiA, w) ;
644 FillHistogram(Form("hMassPtV0CDisp2_cen%d",fCentBin),m,pt,dphiC, w) ;
645 if(fHaveTPCRP)
646 FillHistogram(Form("hMassPtTPCDisp2_cen%d",fCentBin),m,pt,dphiT, w) ;
647
648 FillHistogram(Form("hMassPtV0ADisp2core_cen%d",fCentBin),mcore, ptcore,dphiA, w) ;
649 FillHistogram(Form("hMassPtV0CDisp2core_cen%d",fCentBin),mcore, ptcore,dphiC, w) ;
650 if(fHaveTPCRP)
651 FillHistogram(Form("hMassPtTPCDisp2core_cen%d",fCentBin),mcore, ptcore,dphiT, w) ;
652
653 if(ph1->IsCPVOK() && ph2->IsCPVOK()){
654 FillHistogram(Form("hMassPtV0ABoth2_cen%d",fCentBin),m,pt,dphiA, w) ;
655 FillHistogram(Form("hMassPtV0CBoth2_cen%d",fCentBin),m,pt,dphiC, w) ;
656 if(fHaveTPCRP)
657 FillHistogram(Form("hMassPtTPCBoth2_cen%d",fCentBin),m,pt,dphiT, w) ;
658
659 FillHistogram(Form("hMassPtV0ABoth2core_cen%d",fCentBin),mcore,ptcore,dphiA, w) ;
660 FillHistogram(Form("hMassPtV0CBoth2core_cen%d",fCentBin),mcore,ptcore,dphiC, w) ;
661 if(fHaveTPCRP)
662 FillHistogram(Form("hMassPtTPCBoth2core_cen%d",fCentBin),mcore,ptcore,dphiT, w) ;
663
664 FillHistogram(Form("hPi0Both2_cen%d",fCentBin),m,pt, w) ;
665 FillHistogram(Form("hPi0Both2core_cen%d",fCentBin),mcore,ptcore, w) ;
666 }
667
668 }
669 } // end of loop i2
670 } // end of loop i1
671}
672
673//________________________________________________________________________
674void AliAnalysisTaskPi0FlowMC::ConsiderPi0sMix()
675{
676 char key[55];
677
678 TList * arrayList = GetCaloPhotonsPHOSList(fVtxBin, fCentBin, fEMRPBin);
679
680 for (Int_t i1=0; i1<fCaloPhotonsPHOS->GetEntriesFast(); i1++) {
681 AliCaloPhoton * ph1=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
682 const Double_t w1 = ph1->GetWeight();
683 for(Int_t evi=0; evi<arrayList->GetEntries();evi++){
684 TObjArray * mixPHOS = static_cast<TObjArray*>(arrayList->At(evi));
685 for(Int_t i2=0; i2<mixPHOS->GetEntriesFast();i2++){
686 AliCaloPhoton * ph2=(AliCaloPhoton*)mixPHOS->At(i2) ;
687 TLorentzVector p12 = *ph1 + *ph2;
688 TLorentzVector pv12 = *(ph1->GetMomV2()) + *(ph2->GetMomV2());
689
690 const Double_t w2 = ph2->GetWeight();
027589f5 691 Double_t w = TMath::Sqrt(w1*w2);
abbd081b 692
693 Double_t dphiA=p12.Phi()-fRPV0A ;
694 while(dphiA<0)dphiA+=TMath::Pi() ;
695 while(dphiA>TMath::Pi())dphiA-=TMath::Pi() ;
696
697 Double_t dphiC=p12.Phi()-fRPV0C ;
698 while(dphiC<0)dphiC+=TMath::Pi() ;
699 while(dphiC>TMath::Pi())dphiC-=TMath::Pi() ;
700
701 Double_t dphiT=p12.Phi()-fRP ;
702 while(dphiT<0)dphiT+=TMath::Pi() ;
703 while(dphiT>TMath::Pi())dphiT-=TMath::Pi() ;
704
705
706 Double_t a=TMath::Abs((ph1->E()-ph2->E())/(ph1->E()+ph2->E())) ;
707 Double_t m=p12.M() ;
708 Double_t mcore=pv12.M() ;
709 Double_t pt=p12.Pt() ;
710 Double_t ptcore=pv12.Pt() ;
711 Double_t pt1=ph1->Pt() ;
712 Double_t pt2=ph2->Pt() ;
713 Double_t ptcore1=ph1->GetMomV2()->Pt() ;
714 Double_t ptcore2=ph2->GetMomV2()->Pt() ;
715
716
717 snprintf(key,55,"hMiMassPtAll_cen%d",fCentBin) ;
718 FillHistogram(Form("hMiMassPtV0AAll_cen%d",fCentBin),m,pt,dphiA, w) ;
719 FillHistogram(Form("hMiMassPtV0CAll_cen%d",fCentBin),m,pt,dphiC, w) ;
720 if(fHaveTPCRP)
721 FillHistogram(Form("hMiMassPtTPCAll_cen%d",fCentBin),m,pt,dphiT, w) ;
722
723 FillHistogram(Form("hMiMassPtV0AAllcore_cen%d",fCentBin),mcore, ptcore, dphiA, w) ;
724 FillHistogram(Form("hMiMassPtV0CAllcore_cen%d",fCentBin),mcore, ptcore, dphiC, w) ;
725 if(fHaveTPCRP)
726 FillHistogram(Form("hMiMassPtTPCAllcore_cen%d",fCentBin),mcore, ptcore, dphiT, w) ;
727
728 FillHistogram(Form("hMiPi0All_cen%d",fCentBin),m,pt, w) ;
729 FillHistogram(Form("hMiPi0Allcore_cen%d",fCentBin),mcore,ptcore, w) ;
730 if(ph1->IsntUnfolded() && ph2->IsntUnfolded()){
731 FillHistogram(Form("hMiPi0Allwou_cen%d",fCentBin),m,pt, w) ;
732 FillHistogram(Form("hMiMassPtV0AAllwou_cen%d",fCentBin),m,pt,dphiA, w) ;
733 FillHistogram(Form("hMiMassPtV0CAllwou_cen%d",fCentBin),m,pt,dphiC, w) ;
734 if(fHaveTPCRP)
735 FillHistogram(Form("hMiMassPtTPCAllwou_cen%d",fCentBin),m,pt,dphiT, w) ;
736 }
737
738 FillHistogram(Form("hMiSingleAll_cen%d",fCentBin),m,pt1, w) ;
739 FillHistogram(Form("hMiSingleAll_cen%d",fCentBin),m,pt2, w) ;
740 FillHistogram(Form("hMiSingleAllcore_cen%d",fCentBin),mcore,ptcore1, w) ;
741 FillHistogram(Form("hMiSingleAllcore_cen%d",fCentBin),mcore,ptcore2, w) ;
742 if(ph1->IsntUnfolded())
743 FillHistogram(Form("hMiSingleAllwou_cen%d",fCentBin),m,pt1, w) ;
744 if(ph2->IsntUnfolded())
745 FillHistogram(Form("hMiSingleAllwou_cen%d",fCentBin),m,pt2, w) ;
746 if(ph1->IsCPVOK()){
747 FillHistogram(Form("hMiSingleCPV_cen%d",fCentBin),m,pt1, w) ;
748 FillHistogram(Form("hMiSingleCPVcore_cen%d",fCentBin),mcore,ptcore1, w) ;
749 }
750 if(ph2->IsCPVOK()){
751 FillHistogram(Form("hMiSingleCPV_cen%d",fCentBin),m,pt2, w) ;
752 FillHistogram(Form("hMiSingleCPVcore_cen%d",fCentBin),mcore,ptcore2, w) ;
753 }
754 if(ph1->IsCPV2OK()){
755 FillHistogram(Form("hMiSingleCPV2_cen%d",fCentBin),m,pt1, w) ;
756 FillHistogram(Form("hMiSingleCPV2core_cen%d",fCentBin),mcore,ptcore1, w) ;
757 }
758 if(ph2->IsCPV2OK()){
759 FillHistogram(Form("hMiSingleCPV2_cen%d",fCentBin),m,pt2, w) ;
760 FillHistogram(Form("hMiSingleCPV2core_cen%d",fCentBin),mcore,ptcore2, w) ;
761 }
762 if(ph1->IsDispOK()){
763 FillHistogram(Form("hMiSingleDisp_cen%d",fCentBin),m,pt1, w) ;
764 if(ph1->IsntUnfolded()){
765 FillHistogram(Form("hMiSingleDispwou_cen%d",fCentBin),m,pt1, w) ;
766 }
767 FillHistogram(Form("hMiSingleDispcore_cen%d",fCentBin),mcore,ptcore1, w) ;
768 }
769 if(ph2->IsDispOK()){
770 FillHistogram(Form("hMiSingleDisp_cen%d",fCentBin),m,pt2, w) ;
771 if(ph1->IsntUnfolded()){
772 FillHistogram(Form("hMiSingleDispwou_cen%d",fCentBin),m,pt2, w) ;
773 }
774 FillHistogram(Form("hMiSingleDispcore_cen%d",fCentBin),mcore,ptcore2, w) ;
775 }
776 if(ph1->IsDisp2OK()){
777 FillHistogram(Form("hMiSingleDisp2_cen%d",fCentBin),m,pt1, w) ;
778 FillHistogram(Form("hMiSingleDisp2core_cen%d",fCentBin),mcore,ptcore1, w) ;
779 }
780 if(ph2->IsDisp2OK()){
781 FillHistogram(Form("hMiSingleDisp2_cen%d",fCentBin),m,pt2, w) ;
782 FillHistogram(Form("hMiSingleDisp2core_cen%d",fCentBin),mcore,ptcore2, w) ;
783 }
784 if(ph1->IsDispOK() && ph1->IsCPVOK()){
785 snprintf(key,55,"hMiSingleBoth_cen%d",fCentBin) ;
786 FillHistogram(key,m,pt1, w) ;
787 snprintf(key,55,"hMiSingleBothcore_cen%d",fCentBin);
788 FillHistogram(key,mcore,ptcore1, w) ;
789 }
790 if(ph2->IsDispOK() && ph2->IsCPVOK()){
791 snprintf(key,55,"hMiSingleBoth_cen%d",fCentBin);
792 FillHistogram(key,m,pt2, w) ;
793 snprintf(key,55,"hMiSingleBothcore_cen%d",fCentBin);
794 FillHistogram(key,mcore,ptcore2, w) ;
795 }
796 if(ph1->IsDisp2OK() && ph1->IsCPVOK()){
797 FillHistogram(Form("hMiSingleBoth2_cen%d",fCentBin),m,pt1, w) ;
798 FillHistogram(Form("hMiSingleBoth2core_cen%d",fCentBin),mcore,ptcore1, w) ;
799 }
800 if(ph2->IsDisp2OK() && ph2->IsCPVOK()){
801 FillHistogram(Form("hMiSingleBoth2_cen%d",fCentBin),m,pt2, w) ;
802 FillHistogram(Form("hMiSingleBoth2core_cen%d",fCentBin),mcore,ptcore2, w) ;
803 }
804
805
806
807 if(a<kAlphaCut){
808 FillHistogram(Form("hMiPi0All_a07_cen%d",fCentBin),m,pt, w) ;
809 }
810 if(ph1->IsCPVOK() && ph2->IsCPVOK()){
811 FillHistogram(Form("hMiMassPtV0ACPV_cen%d",fCentBin),m,pt,dphiA, w) ;
812 FillHistogram(Form("hMiMassPtV0CCPV_cen%d",fCentBin),m,pt,dphiC, w) ;
813 if(fHaveTPCRP)
814 FillHistogram(Form("hMiMassPtTPCCPV_cen%d",fCentBin),m,pt,dphiT, w) ;
815
816 FillHistogram(Form("hMiMassPtV0ACPVcore_cen%d",fCentBin),mcore, ptcore,dphiA, w) ;
817 FillHistogram(Form("hMiMassPtV0CCPVcore_cen%d",fCentBin),mcore, ptcore,dphiC, w) ;
818 if(fHaveTPCRP)
819 FillHistogram(Form("hMiMassPtTPCCPVcore_cen%d",fCentBin),mcore, ptcore,dphiT, w) ;
820
821 FillHistogram(Form("hMiPi0CPV_cen%d",fCentBin),m,pt, w) ;
822 FillHistogram(Form("hMiPi0CPVcore_cen%d",fCentBin),mcore, ptcore, w) ;
823
824 if(a<kAlphaCut){
825 FillHistogram(Form("hMiPi0CPV_a07_cen%d",fCentBin),m,pt, w) ;
826 }
827 }
828 if(ph1->IsCPV2OK() && ph2->IsCPV2OK()){
829 FillHistogram(Form("hMiPi0CPV2_cen%d",fCentBin),m,pt, w) ;
830 FillHistogram(Form("hMiPi0CPV2core_cen%d",fCentBin),mcore, ptcore, w) ;
831
832 FillHistogram(Form("hMiMassPtV0ACPV2_cen%d",fCentBin),m,pt,dphiA, w) ;
833 FillHistogram(Form("hMiMassPtV0CCPV2_cen%d",fCentBin),m,pt,dphiC, w) ;
834 if(fHaveTPCRP)
835 FillHistogram(Form("hMiMassPtTPCCPV2_cen%d",fCentBin),m,pt,dphiT, w) ;
836 FillHistogram(Form("hMiMassPtV0ACPV2core_cen%d",fCentBin),mcore,ptcore,dphiA, w) ;
837 FillHistogram(Form("hMiMassPtV0CCPV2core_cen%d",fCentBin),mcore,ptcore,dphiC, w) ;
838 if(fHaveTPCRP)
839 FillHistogram(Form("hMiMassPtTPCCPV2core_cen%d",fCentBin),mcore,ptcore,dphiT, w) ;
840
841 if(a<kAlphaCut){
842 FillHistogram(Form("hMiPi0CPV2_a07_cen%d",fCentBin),m,pt, w) ;
843 }
844 }
845 if(ph1->IsDispOK() && ph2->IsDispOK()){
846 FillHistogram(Form("hMiMassPtV0ADisp_cen%d",fCentBin),m,pt,dphiA, w) ;
847 FillHistogram(Form("hMiMassPtV0CDisp_cen%d",fCentBin),m,pt,dphiC, w) ;
848 if(fHaveTPCRP)
849 FillHistogram(Form("hMiMassPtTPCDisp_cen%d",fCentBin),m,pt,dphiT, w) ;
850
851 FillHistogram(Form("hMiMassPtV0ADispcore_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiA, w) ;
852 FillHistogram(Form("hMiMassPtV0CDispcore_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiC, w) ;
853 if(fHaveTPCRP)
854 FillHistogram(Form("hMiMassPtTPCDispcore_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiT, w) ;
855
856
857 FillHistogram(Form("hMiPi0Disp_cen%d",fCentBin),m,pt, w) ;
858 FillHistogram(Form("hMiPi0Dispcore_cen%d",fCentBin),pv12.M(),pv12.Pt(), w) ;
859 if(ph1->IsntUnfolded() && ph2->IsntUnfolded()){
860 FillHistogram(Form("hMiPi0Dispwou_cen%d",fCentBin),m,pt, w) ;
861 FillHistogram(Form("hMiMassPtV0ADispwou_cen%d",fCentBin),m,pt,dphiA, w) ;
862 FillHistogram(Form("hMiMassPtV0CDispwou_cen%d",fCentBin),m,pt,dphiC, w) ;
863 if(fHaveTPCRP)
864 FillHistogram(Form("hMiMassPtTPCDispwou_cen%d",fCentBin),m,pt,dphiT, w) ;
865 }
866
867 if(a<kAlphaCut){
868 FillHistogram(Form("hMiPi0Disp_a07_cen%d",fCentBin),m,pt, w) ;
869 }
870 if(ph1->IsCPVOK() && ph2->IsCPVOK()){
871 FillHistogram(Form("hMiMassPtV0ABoth_cen%d",fCentBin),m,pt,dphiA, w) ;
872 FillHistogram(Form("hMiMassPtV0CBoth_cen%d",fCentBin),m,pt,dphiC, w) ;
873 if(fHaveTPCRP)
874 FillHistogram(Form("hMiMassPtTPCBoth_cen%d",fCentBin),m,pt,dphiT, w) ;
875
876 FillHistogram(Form("hMiMassPtV0ABothcore_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiA, w) ;
877 FillHistogram(Form("hMiMassPtV0CBothcore_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiC, w) ;
878 if(fHaveTPCRP)
879 FillHistogram(Form("hMiMassPtTPCBothcore_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiT, w) ;
880
881 FillHistogram(Form("hMiPi0Both_cen%d",fCentBin),m,pt, w) ;
882 FillHistogram(Form("hMiPi0Bothcore_cen%d",fCentBin),pv12.M(),pv12.Pt(), w) ;
883
884 if(a<kAlphaCut){
885 FillHistogram(Form("hMiPi0Both_a07_cen%d",fCentBin),m,pt, w) ;
886 }
887 }
888 }
889
890 if(ph1->IsDisp2OK() && ph2->IsDisp2OK()){
891 FillHistogram(Form("hMiMassPtV0ADisp2_cen%d",fCentBin),m,pt,dphiA, w) ;
892 FillHistogram(Form("hMiMassPtV0CDisp2_cen%d",fCentBin),m,pt,dphiC, w) ;
893 if(fHaveTPCRP)
894 FillHistogram(Form("hMiMassPtTPCDisp2_cen%d",fCentBin),m,pt,dphiT, w) ;
895
896 FillHistogram(Form("hMiMassPtV0ADisp2core_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiA, w) ;
897 FillHistogram(Form("hMiMassPtV0CDisp2core_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiC, w) ;
898 if(fHaveTPCRP)
899 FillHistogram(Form("hMiMassPtTPCDisp2core_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiT, w) ;
900
901
902 FillHistogram(Form("hMiPi0Disp2_cen%d",fCentBin),m,pt, w) ;
903 FillHistogram(Form("hMiPi0Disp2core_cen%d",fCentBin),pv12.M(),pv12.Pt(), w) ;
904
905 if(ph1->IsCPVOK() && ph2->IsCPVOK()){
906 FillHistogram(Form("hMiMassPtV0ABoth2_cen%d",fCentBin),m,pt,dphiA, w) ;
907 FillHistogram(Form("hMiMassPtV0CBoth2_cen%d",fCentBin),m,pt,dphiC, w) ;
908 if(fHaveTPCRP)
909 FillHistogram(Form("hMiMassPtTPCBoth2_cen%d",fCentBin),m,pt,dphiT, w) ;
910
911 FillHistogram(Form("hMiMassPtV0ABoth2core_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiA, w) ;
912 FillHistogram(Form("hMiMassPtV0CBoth2core_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiC, w) ;
913 if(fHaveTPCRP)
914 FillHistogram(Form("hMiMassPtTPCBoth2core_cen%d",fCentBin),pv12.M(),pv12.Pt(),dphiT, w) ;
915
916 FillHistogram(Form("hMiPi0Both2_cen%d",fCentBin),m,pt, w) ;
917 FillHistogram(Form("hMiPi0Both2core_cen%d",fCentBin),pv12.M(),pv12.Pt(), w) ;
918
919 }
920 }
921 } // end of loop i2
922 }
923 } // end of loop i1
924}
925
926
927void AliAnalysisTaskPi0FlowMC::ProcessMC()
928{
929 FillMCHist();
e3f56a86 930 FillSecondaries() ;
444647ad 931}
932
933
934
935//___________________________________________________________________________
936void AliAnalysisTaskPi0FlowMC::FillMCHist(){
937 //fill histograms for efficiensy etc. calculation
938
939 //---------First pi0/eta-----------------------------
940 char partName[10] ;
941 char hkey[55] ;
00c8d7ab 942
943 if(!fStack) return ;
944 for(Int_t i=0;i<fStack->GetNtrack();i++){
945 TParticle* particle = fStack->Particle(i);
444647ad 946 if(particle->GetPdgCode() == kPi0)
947 snprintf(partName,10,"pi0") ;
948 else
949 if(particle->GetPdgCode() == kEta)
00c8d7ab 950 snprintf(partName,10,"eta") ;
444647ad 951 else
00c8d7ab 952 if(particle->GetPdgCode() == kGamma)
953 snprintf(partName,10,"gamma") ;
444647ad 954 else
4c316866 955 if(particle->GetPdgCode() == 310)
956 snprintf(partName,10,"K0S") ;
957 else
958 continue ;
00c8d7ab 959
444647ad 960 //Primary particle
961 Double_t r=particle->R() ;
962 Double_t pt = particle->Pt() ;
963 //Distribution over vertex
964 FillHistogram(Form("hMC_%s_vertex",partName),pt,r) ;
965
966 if(r >kRCut)
967 continue ;
968
4c316866 969 Double_t phi=particle->Phi() ;
970 while(phi<0.)phi+=TMath::TwoPi() ;
971 while(phi>TMath::TwoPi())phi-=TMath::TwoPi() ;
00c8d7ab 972
4c316866 973 Double_t phig = 180./TMath::Pi()*phi; // phi in deg
974
444647ad 975 //Total number of pi0 with creation radius <1 cm
976 Double_t weight = PrimaryParticleWeight(particle) ;
977 snprintf(hkey,55,"hMC_all_%s_cen%d",partName,fCentBin) ;
00c8d7ab 978
444647ad 979 FillHistogram(hkey,pt,weight) ;
4c316866 980
981 if(TMath::Abs(particle->Y())<0.135 && phig>260. && phig<320.){
444647ad 982 snprintf(hkey,55,"hMC_unitEta_%s_cen%d",partName,fCentBin) ;
983 FillHistogram(hkey,pt,weight) ;
4c316866 984
985 snprintf(hkey,55,"hMC_rap_%s_cen%d",partName,fCentBin) ;
986 FillHistogram(hkey,particle->Y(),weight) ;
00c8d7ab 987
4c316866 988 snprintf(hkey,55,"hMC_phi_%s_cen%d",partName,fCentBin) ;
989 FillHistogram(hkey,phi,weight) ;
00c8d7ab 990 }
3e9154bb 991
00c8d7ab 992 }
993}
444647ad 994
995//________________________________________________________________________
00c8d7ab 996void AliAnalysisTaskPi0FlowMC::FillSecondaries(){
444647ad 997 //Sort secondaires
998
999 //Fill spectra of primary particles
1000 //with proper weight
abbd081b 1001 if( fDebug )
1002 AliInfo("start");
00c8d7ab 1003 for(Int_t i=0; i<fStack->GetNtrack(); i++){
1004 TParticle * p = fStack->Particle(i) ;
444647ad 1005 if(p->R()>kRCut)
1006 continue ;
c2975169 1007 if( TMath::Abs(p->Pt())<1.e-6 )
1008 continue;
444647ad 1009 if(TMath::Abs(p->Y())>0.5)
1010 continue ;
1011 Double_t w = PrimaryParticleWeight(p) ;
1012 Int_t primPdgCode=p->GetPdgCode() ;
00c8d7ab 1013 switch(primPdgCode){
1014 case kGamma: FillHistogram(Form("hPrimPhot_cen%d",fCentBin),p->Pt(),w);
1015 break ;
1016 case kElectron:
1017 case -kElectron:
1018 FillHistogram(Form("hPrimEl_cen%d",fCentBin),p->Pt(),w);
1019 break ;
1020 case kPi0:
1021 FillHistogram(Form("hPrimPi0_cen%d",fCentBin),p->Pt(),w);
1022 break ;
1023 case kEta:
1024 FillHistogram(Form("hPrimEta_cen%d",fCentBin),p->Pt(),w);
1025 break ;
1026 case kPiPlus:
1027 case kPiMinus:
1028 FillHistogram(Form("hPrimPipm_cen%d",fCentBin),p->Pt(),w);
1029 break ;
1030 case kProton: //p
1031 FillHistogram(Form("hPrimP_cen%d",fCentBin),p->Pt(),w);
1032 break ;
1033 case kProtonBar: //pbar
1034 FillHistogram(Form("hPrimPbar_cen%d",fCentBin),p->Pt(),w);
1035 break ;
1036 case kNeutron: //n
1037 FillHistogram(Form("hPrimN_cen%d",fCentBin),p->Pt(),w);
1038 break ;
1039 case kNeutronBar: //nbar
1040 FillHistogram(Form("hPrimNbar_cen%d",fCentBin),p->Pt(),w);
1041 break ;
1042 case 310: //nbar
1043 FillHistogram(Form("hPrimK0S_cen%d",fCentBin),p->Pt(),w);
1044 break ;
1045 case 130: //nbar
1046 FillHistogram(Form("hPrimK0L_cen%d",fCentBin),p->Pt(),w);
1047 break ;
1048 case 321: //K+
1049 case -321: //K-
1050 FillHistogram(Form("hPrimKpm_cen%d",fCentBin),p->Pt(),w);
1051 break ;
1052 default: //other
1053 FillHistogram(Form("hPrimOther_cen%d",fCentBin),p->Pt(),w);
1054 }
444647ad 1055 }
abbd081b 1056 if(fDebug)
1057 AliInfo("Origins of secondary pi0s");
444647ad 1058 //Origins of secondary pi0s
00c8d7ab 1059 for(Int_t i=0; i<fStack->GetNtrack(); i++){
1060 TParticle * p = fStack->Particle(i) ;
444647ad 1061 if(p->GetPdgCode()!=111)
1062 continue ;
1063 FillHistogram("Vertex",p->Pt(),p->R());
1064 if(p->R()<kRCut)
1065 continue ;
1066 Double_t phi=p->Phi() ;
1067 while(phi<0.)phi+=TMath::TwoPi() ;
1068 while(phi>TMath::TwoPi())phi-=TMath::TwoPi() ;
1069 FillHistogram("hSecondPi0RphiZ",p->R(),phi,p->Vz()) ;
1070 Double_t w = PrimaryParticleWeight(p) ;
1071 FillHistogram("hSecondPi0RE",p->R(),p->Pt(),w) ;
1072 }
1073
1074 TLorentzVector p1;
1075
1076 Int_t inPHOS=fCaloPhotonsPHOS->GetEntries() ;
1077 for (Int_t i1=0; i1<inPHOS-1; i1++) {
1078 AliCaloPhoton * ph1=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
1079 Double_t w1=ph1->GetWeight() ;
1080 for (Int_t i2=i1+1; i2<inPHOS; i2++) {
1081 AliCaloPhoton * ph2=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i2) ;
1082 TLorentzVector p12 = *ph1 + *ph2;
1083 Double_t w2=ph2->GetWeight() ;
1084 Double_t w = TMath::Sqrt(w1*w2) ;
1085 FillHistogram(Form("hParentAll_cen%d",fCentBin),p12.M(),p12.Pt(),w) ;
1086 Int_t prim=FindCommonParent(ph1->GetPrimary(),ph2->GetPrimary()) ;
1087 if(prim>-1){
00c8d7ab 1088 TParticle * particle = (TParticle *)fStack->Particle(prim);
444647ad 1089 FillHistogram("hMass_R",p12.M(),p12.Pt(),TMath::Sqrt(particle->R()*particle->R()+particle->Vz()*particle->Vz())) ;
1090
1091
1092 Int_t pdgCode=particle->GetPdgCode() ;
1093 if(pdgCode!=111){ //common parent - not pi0
1094 if(pdgCode==22)
1095 FillHistogram(Form("hParentGamma_cen%d",fCentBin),p12.M(),p12.Pt(),w) ;
1096 else{
1097 if(pdgCode==11 || pdgCode==-11){
1098 FillHistogram(Form("hParentEl_cen%d",fCentBin),p12.M(),p12.Pt(),w) ;
1099 }
1100 else{
1101 if(InPi0mass(p12.M() ,p12.Pt())){
abbd081b 1102 if(fDebug >1) AliInfo(Form("Common parent: %d",pdgCode));
444647ad 1103 }
1104 FillHistogram(Form("hParentOther_cen%d",fCentBin),p12.M(),p12.Pt(),w) ;
1105 }
1106 }//Not photons
1107 }//Common parent not pi0
1108 else{ //common parent - pi0
1109 FillHistogram(Form("hParentPi0_cen%d",fCentBin),p12.M(),p12.Pt(),w) ;
1110 FillHistogram(Form("Real_pi_R"),p12.M(),p12.Pt(),particle->R(),w) ;
1111 FillHistogram(Form("Real_pi_Z"),p12.M(),p12.Pt(),particle->Vz(),w) ;
1112 if(particle->R()<kRCut && TMath::Abs(particle->Vz())<fMaxAbsVertexZ){
1113 FillHistogram(Form("hParentDirPi0_cen%d",fCentBin),p12.M(),p12.Pt(),w) ;
1114 continue ;
1115 }
1116 //Common particle pi0, created off-vertex
00c8d7ab 1117 Int_t primPi0=particle->GetFirstMother();
444647ad 1118 if(primPi0==-1){
1119 FillHistogram(Form("hParentPi0NoPrim_cen%d",fCentBin),p12.M(),p12.Pt(),w) ;
1120 }
1121 else{
00c8d7ab 1122 Int_t primPdgCode=fStack->Particle(primPi0)->GetPdgCode() ;
444647ad 1123 switch(primPdgCode){
1124 case 221: FillHistogram(Form("hParentPi0Eta_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; //eta
00c8d7ab 1125 break ;
444647ad 1126 case 223: FillHistogram(Form("hParentPi0Omega_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; //omega
00c8d7ab 1127 break ;
444647ad 1128 case 211: //pi+-
1129 case -211: FillHistogram(Form("hParentPi0Pipm_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; //
00c8d7ab 1130 break ;
444647ad 1131 case 321: //K+-
1132 case -321: FillHistogram(Form("hParentPi0Kpm_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; //
00c8d7ab 1133 break ;
444647ad 1134 case 310: FillHistogram(Form("hParentPi0Ks_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; // K0S
00c8d7ab 1135 break ;
444647ad 1136 case 130: FillHistogram(Form("hParentPi0Kl_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; // K0L
00c8d7ab 1137 break ;
444647ad 1138 case 2212: //p
1139 case 2112: //n
00c8d7ab 1140 FillHistogram(Form("hParentPi0pn_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; // pn
1141 break ;
444647ad 1142 case -2212: //pbar
1143 case -2112: //nbar
00c8d7ab 1144 FillHistogram(Form("hParentPi0antipn_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; // pn
1145 break ;
444647ad 1146 default: //other
00c8d7ab 1147 FillHistogram(Form("hParentPi0Other_cen%d",fCentBin),p12.M(),p12.Pt(),w) ; //
444647ad 1148 }//switch
1149 }//pi0 with primary
1150 }//common parent - pi0
1151 }//there is common primary
1152 }//seond photon loop
1153 }//first photon loop
1154
1155
1156 //Now look at photon contaiminations
1157 for (Int_t i1=0; i1<inPHOS-1; i1++) {
1158 AliCaloPhoton * ph1=(AliCaloPhoton*)fCaloPhotonsPHOS->At(i1) ;
1159 Int_t iprim = ph1->GetPrimary() ;
1160 if(iprim<0)
1161 FillAllHistograms(Form("hGammaNoPrim_cen%d",fCentBin),ph1) ; //
1162 else{
1163 //Find primary at vertex
00c8d7ab 1164 TParticle * primPHOS = fStack->Particle(iprim) ;
1165 Int_t iprimV=primPHOS->GetFirstMother();
444647ad 1166 TParticle * primVtx = primPHOS ;
1167 while((iprimV>-1) && primVtx->R()>kRCut){
00c8d7ab 1168 primVtx = fStack->Particle(iprimV) ;
1169 iprimV=primVtx->GetFirstMother();
444647ad 1170 }
1171
1172 //photon
1173 Int_t primPdgCode=primVtx->GetPdgCode() ;
1174 switch(primPdgCode){
00c8d7ab 1175 case 22: FillAllHistograms("hGammaPhot",ph1);
1176 break ;
1177 case 11:
1178 case -11:
1179 FillAllHistograms("hGammaEl",ph1);
1180 break ;
1181 case 111:
1182 FillAllHistograms("hGammaPi0",ph1);
1183 break ;
1184 case 221:
1185 FillAllHistograms("hGammaEta",ph1);
1186 break ;
1187 case 223: FillAllHistograms("hGammaOmega",ph1) ; //omega
1188 break ;
1189 case 211:
1190 case -211:
1191 FillAllHistograms("hGammaPipm",ph1);
1192 //Find particle entered PHOS
1193 if(primVtx == primPHOS)
1194 FillAllHistograms("hGammaPipmDirect",ph1);
1195 else{
1196 Int_t primPdgPHOS=primPHOS->GetPdgCode() ;
1197 if(primPdgPHOS==22){
1198 FillAllHistograms("hGammaPipmGamma",ph1);
1199 FillHistogram("hPipmGammaConvR",ph1->Pt(),primPHOS->R());
1200 FillHistogram("hPipmGammaConvRZ",primPHOS->Vz(),primPHOS->R());
1201 break ;
1202 }
1203 if(TMath::Abs(primPdgPHOS)==11){
1204 FillAllHistograms("hGammaPipmEl",ph1);
1205 FillHistogram("hPipmElConvR",ph1->Pt(),primPHOS->R());
1206 break ;
1207 }
1208 if(TMath::Abs(primPdgPHOS)==2212){
1209 FillAllHistograms("hGammaPipmp",ph1);
1210 FillHistogram("hPipmNConvR",ph1->Pt(),primPHOS->R());
1211 break ;
1212 }
1213 if(TMath::Abs(primPdgPHOS)==2112){
1214 FillAllHistograms("hGammaPipmn",ph1);
1215 FillHistogram("hPipmNConvR",ph1->Pt(),primPHOS->R());
1216 break ;
1217 }
1218 FillAllHistograms("hGammaPipmOther",ph1);
1219 FillHistogram("hPipmOtherConvR",ph1->Pt(),primPHOS->R());
1220 }
1221 break ;
1222 case 2212: //p
1223 FillAllHistograms("hGammaP",ph1);
1224 break ;
1225 case -2212: //pbar
1226 FillAllHistograms("hGammaPbar",ph1);
1227 break ;
1228 case 2112: //n
1229 FillAllHistograms("hGammaN",ph1);
1230 break ;
1231 case -2112: //nbar
1232 FillAllHistograms("hGammaNbar",ph1) ; // pn
1233 break ;
1234 case 310: //nbar
1235 FillAllHistograms("hGammaK0S",ph1) ; // pn
1236 break ;
1237 case 130: //nbar
1238 FillAllHistograms("hGammaK0L",ph1) ; // pn
1239 break ;
1240 case 321: //K+
1241 case -321: //K-
1242 FillAllHistograms("hGammaKpm",ph1) ; // pn
1243 break ;
1244 case -323:
1245 case 323:
1246 case -313:
1247 case 313: FillAllHistograms("hGammaKstar",ph1) ; // K*(892)
1248 break ;
444647ad 1249
00c8d7ab 1250 case -2224 : //Deltas
1251 case 2224 : //Deltas
1252 case -2214 : //Deltas
1253 case 2214 : //Deltas
1254 case -2114 : //Deltas
1255 case 2114 : //Deltas
1256 case -1114 : //Deltas
1257 case 1114 : //Deltas
1258 FillAllHistograms("hGammaDelta",ph1) ; // pn
1259 break ;
1260 default: //other
1261 if(primVtx->GetPDG()->Charge())
1262 FillAllHistograms("hGammaOtherCharged",ph1) ; //
1263 else
1264 FillAllHistograms("hGammaOtherNeutral",ph1) ; //
444647ad 1265 }
1266 }
1267
1268 }//single photons
1269}
1270
1271//_____________________________________________________________________________
1272void AliAnalysisTaskPi0FlowMC::FillAllHistograms(const char * particleName,AliCaloPhoton * ph)
1273{
1274 //Fill All PID histograms
1275
1276 Double_t w=ph->GetWeight() ;
1277 Double_t pt = ph->Pt() ;
1278 Double_t ptC=ph->GetMomV2()->Pt() ;
1279 FillHistogram(Form("%s_All_cen%d",particleName,fCentBin),pt,w) ;
1280 FillHistogram(Form("%s_Allcore_cen%d",particleName,fCentBin),ptC,w) ;
1281 if(ph->IsCPVOK()){
1282 FillHistogram(Form("%s_CPV_cen%d",particleName,fCentBin),pt,w) ;
1283 FillHistogram(Form("%s_CPVcore_cen%d",particleName,fCentBin),ptC,w) ;
1284 }
1285 if(ph->IsCPV2OK()){
1286 FillHistogram(Form("%s_CPV2_cen%d",particleName,fCentBin),pt,w) ;
1287 FillHistogram(Form("%s_CPV2core_cen%d",particleName,fCentBin),ptC,w) ;
1288 }
1289 if(ph->IsDispOK()){
1290 FillHistogram(Form("%s_Disp_cen%d",particleName,fCentBin),pt,w) ;
1291 FillHistogram(Form("%s_Dispcore_cen%d",particleName,fCentBin),ptC,w) ;
1292 if(ph->IsDisp2OK()){
1293 FillHistogram(Form("%s_Disp2_cen%d",particleName,fCentBin),pt,w) ;
1294 FillHistogram(Form("%s_Disp2core_cen%d",particleName,fCentBin),ptC,w) ;
1295 }
1296 if(ph->IsCPVOK()){
1297 FillHistogram(Form("%s_Both_cen%d",particleName,fCentBin),pt,w) ;
1298 FillHistogram(Form("%s_Bothcore_cen%d",particleName,fCentBin),ptC,w) ;
1299 }
1300 }
1301}
1302
1303
1304//___________________________________________________________________________
597c9948 1305Double_t AliAnalysisTaskPi0FlowMC::PrimaryWeight(Int_t /* primary */){
7ea85581 1306 return 1.;
444647ad 1307}
1308//________________________________________________________________________
597c9948 1309Double_t AliAnalysisTaskPi0FlowMC::PrimaryParticleWeight(TParticle * /* particle */){
7ea85581 1310 return 1.;
444647ad 1311}
1312
1313//___________________________________________________________________________
1314AliStack* AliAnalysisTaskPi0FlowMC::GetMCStack()
1315{
1316 fStack = 0;
1317 AliVEventHandler* eventHandler = AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler();
1318 if(eventHandler){
1319 AliMCEventHandler* mcEventHandler = dynamic_cast<AliMCEventHandler*> (eventHandler);
00c8d7ab 1320 if( mcEventHandler)
444647ad 1321 fStack = static_cast<AliMCEventHandler*>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler())->MCEvent()->Stack();
1322 }
abbd081b 1323
00c8d7ab 1324 if( ! fStack )
1325 AliError("Could not get MC Stack!");
444647ad 1326 return fStack;
1327}
abbd081b 1328
1329Int_t AliAnalysisTaskPi0FlowMC::FindPrimary(AliVCluster*clu, Bool_t&sure){
1330 //Finds primary and estimates if it unique one?
1331 //First check can it be photon/electron
1332 const Double_t emFraction=0.9; //part of energy of cluster to be assigned to EM particle
00c8d7ab 1333 Int_t n=clu->GetNLabels() ;
abbd081b 1334 for(Int_t i=0; i<n; i++){
00c8d7ab 1335 TParticle* p= fStack->Particle(clu->GetLabelAt(i)) ;
abbd081b 1336 Int_t pdg = p->GetPdgCode() ;
1337 if(pdg==22 || pdg==11 || pdg == -11){
1338 if(p->Energy()>emFraction*clu->E()){
1339 sure=kTRUE ;
00c8d7ab 1340 return clu->GetLabelAt(i);
abbd081b 1341 }
1342 }
1343 }
1344
1345 Double_t* Ekin= new Double_t[n] ;
1346 for(Int_t i=0; i<n; i++){
00c8d7ab 1347 TParticle* p= fStack->Particle(clu->GetLabelAt(i)) ;
abbd081b 1348 Ekin[i]=p->P() ; // estimate of kinetic energy
1349 if(p->GetPdgCode()==-2212 || p->GetPdgCode()==-2112){
1350 Ekin[i]+=1.8 ; //due to annihilation
1351 }
1352 }
1353 Int_t iMax=0;
1354 Double_t eMax=0.,eSubMax=0. ;
1355 for(Int_t i=0; i<n; i++){
1356 if(Ekin[i]>eMax){
1357 eSubMax=eMax;
1358 eMax=Ekin[i];
1359 iMax=i;
1360 }
1361 }
1362 if(eSubMax>0.8*eMax)//not obvious primary
1363 sure=kFALSE;
1364 else
1365 sure=kTRUE;
1366 delete[] Ekin;
00c8d7ab 1367 return clu->GetLabelAt(iMax) ;
abbd081b 1368}
1369
1370//________________________________________________________________________
1371Int_t AliAnalysisTaskPi0FlowMC::FindCommonParent(Int_t iPart, Int_t jPart){
1372 //check if there is a common parent for particles i and j
1373 // -1: no common parent or wrong iPart/jPart
1374
00c8d7ab 1375 if(iPart==-1 || iPart>=fStack->GetNtrack() ||
1376 jPart==-1 || jPart>=fStack->GetNtrack()) return -1;
abbd081b 1377
1378 Int_t iprim1=iPart;
1379 while(iprim1>-1){
1380 Int_t iprim2=jPart;
1381 while(iprim2>-1){
1382 if(iprim1==iprim2)
1383 return iprim1 ;
00c8d7ab 1384 iprim2=((TParticle *)fStack->Particle(iprim2))->GetFirstMother();
abbd081b 1385 }
00c8d7ab 1386 iprim1=((TParticle *)fStack->Particle(iprim1))->GetFirstMother();
abbd081b 1387 }
1388 return -1;
1389}
1390//________________________________________________________________________
1391Bool_t AliAnalysisTaskPi0FlowMC::HaveParent(Int_t iPart, Int_t pdgParent){
1392 //check if there is a common parent for particles i and j
1393 // -1: no common parent or wrong iPart/jPart
00c8d7ab 1394
1395 if(iPart==-1 || iPart>=fStack->GetNtrack()) return -1;
abbd081b 1396
1397 Int_t iprim1=iPart;
1398 while(iprim1>-1){
00c8d7ab 1399 TParticle * tmp = fStack->Particle(iprim1) ;
abbd081b 1400 if(tmp->GetPdgCode()==pdgParent)
1401 return kTRUE ;
00c8d7ab 1402 iprim1=tmp->GetFirstMother();
abbd081b 1403 }
1404 return kFALSE;
1405}
1406//________________________________________________________________________
1407Bool_t AliAnalysisTaskPi0FlowMC::InPi0mass(Double_t m, Double_t /*pt*/){
1408
1409 return TMath::Abs(m-0.135)<0.007*2.5 ;
1410}
e3f56a86 1411