]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx
move from AliAODTrack to AliVTrack
[u/mrichter/AliRoot.git] / PWG4 / PartCorrDep / AliAnaParticleHadronCorrelation.cxx
CommitLineData
1c5acb87 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/* $Id: $ */
16
17//_________________________________________________________________________
18// Class for the analysis of particle - hadron correlations
19// Particle (for example direct gamma) must be found in a previous analysis
20//-- Author: Gustavo Conesa (LNF-INFN)
dd4871cd 21
22// Modified by Yaxian Mao:
23// 1. add the UE subtraction for corrlation study
24// 2. change the correlation variable
e6b5d324 25// 3. Only use leading particle(cluster/track) as trigger for correlation (2010/07/02)
f8006433 26// 4. Make decay photon-hadron correlations where decay contribute pi0 mass (2010/09/09)
5025c139 27// 5. fill the pout to extract kt at the end, also to study charge asymmetry(2010/10/06)
1c5acb87 28//////////////////////////////////////////////////////////////////////////////
29
30
31// --- ROOT system ---
f8006433 32//#include "TClonesArray.h"
9415d854 33#include "TClass.h"
dd4871cd 34#include "TMath.h"
f8006433 35#include "TH3D.h"
1c5acb87 36
37//---- ANALYSIS system ----
1c5acb87 38#include "AliNeutralMesonSelection.h"
39#include "AliAnaParticleHadronCorrelation.h"
40#include "AliCaloTrackReader.h"
41#include "AliCaloPID.h"
42#include "AliAODPWG4ParticleCorrelation.h"
ff45398a 43#include "AliFiducialCut.h"
88f9563f 44#include "AliVTrack.h"
0ae57829 45#include "AliVCluster.h"
9415d854 46#include "AliMCAnalysisUtils.h"
47#include "TParticle.h"
48#include "AliStack.h"
591cc579 49#include "AliAODMCParticle.h"
c8fe2783 50#include "AliMixedEvent.h"
1c5acb87 51
52ClassImp(AliAnaParticleHadronCorrelation)
53
54
55//____________________________________________________________________________
dde5a268 56 AliAnaParticleHadronCorrelation::AliAnaParticleHadronCorrelation():
1c5acb87 57 AliAnaPartCorrBaseClass(),
dde5a268 58 fDeltaPhiMaxCut(0.), fDeltaPhiMinCut(0.), fSelectIsolated(0),
59 fMakeSeveralUE(0), fUeDeltaPhiMaxCut(0.), fUeDeltaPhiMinCut(0.),
5025c139 60 fPi0AODBranchName(""),fNeutralCorr(0), fPi0Trigger(0),
61 // fMultiBin(0),fNZvertBin(0),fNrpBin(0),fZvtxCut(0.),
62 // fUseSelectEvent(kFALSE),
2244659d 63 // fhNclustersNtracks(0), //fhVertex(0),
e6b5d324 64 fhPtLeading(0),fhPhiLeading(0),fhEtaLeading(0),
5025c139 65 fhDeltaPhiDeltaEtaCharged(0),
66 fhPhiCharged(0), fhEtaCharged(0),
67 fhDeltaPhiCharged(0),
68 fhDeltaEtaCharged(0),
69 fhDeltaPhiChargedPt(0),
70 fhDeltaPhiUeChargedPt(0),
71 fhPtImbalanceCharged(0),
72 fhPtImbalanceUeCharged(0),
73 fhPtImbalancePosCharged(0),fhPtImbalanceNegCharged(0),
dd4871cd 74 fhPtHbpCharged(0), fhPtHbpUeCharged(0),
123fc3bd 75 fhDeltaPhiUeLeftCharged(0),fhDeltaPhiUeRightCharged(0),
123fc3bd 76 fhPtImbalanceUeLeftCharged(0),fhPtImbalanceUeRightCharged(0),
5025c139 77 fhPtHbpUeLeftCharged(0),fhPtHbpUeRightCharged(0),
2244659d 78 fhPoutPtTrigPtAssoc(0), fhUePoutPtTrigPtAssoc(0),
79 fhPtTrigCharged(0),
5025c139 80 fhTrigDeltaPhiDeltaEtaCharged(0x0), fhTrigCorr(0x0),fhTrigUeCorr(0x0),
81 fhDeltaPhiDeltaEtaNeutral(0),
82 fhPhiNeutral(0), fhEtaNeutral(0),
83 fhDeltaPhiNeutral(0), fhDeltaEtaNeutral(0),
84 fhDeltaPhiNeutralPt(0),fhDeltaPhiUeNeutralPt(0),
85 fhPtImbalanceNeutral(0),fhPtImbalanceUeNeutral(0),
86 fhPtHbpNeutral(0), fhPtHbpUeNeutral(0),
87 fhDeltaPhiUeLeftNeutral(0),fhDeltaPhiUeRightNeutral(0),
dd4871cd 88 fhPtImbalanceUeLeftNeutral(0),fhPtImbalanceUeRightNeutral(0),
f8006433 89 fhPtHbpUeLeftNeutral(0),fhPtHbpUeRightNeutral(0),
90 fhPtPi0DecayRatio(0),
5025c139 91 fhDeltaPhiDecayCharged(0),
92 fhPtImbalanceDecayCharged(0),
93 fhDeltaPhiDecayNeutral(0),
94 fhPtImbalanceDecayNeutral(0)
1c5acb87 95{
96 //Default Ctor
477d6cee 97
1c5acb87 98 //Initialize parameters
99 InitParameters();
100}
1c5acb87 101
1c5acb87 102//________________________________________________________________________
103TList * AliAnaParticleHadronCorrelation::GetCreateOutputObjects()
104{
477d6cee 105
106 // Create histograms to be saved in output file and
107 // store them in fOutputContainer
108 TList * outputContainer = new TList() ;
109 outputContainer->SetName("CorrelationHistos") ;
110
5a2dbc3c 111 Int_t nptbins = GetHistoPtBins();
112 Int_t nphibins = GetHistoPhiBins();
113 Int_t netabins = GetHistoEtaBins();
477d6cee 114 Float_t ptmax = GetHistoPtMax();
115 Float_t phimax = GetHistoPhiMax();
116 Float_t etamax = GetHistoEtaMax();
117 Float_t ptmin = GetHistoPtMin();
118 Float_t phimin = GetHistoPhiMin();
119 Float_t etamin = GetHistoEtaMin();
5025c139 120
121
2244659d 122// fhNclustersNtracks = new TH2F ("Multiplicity","Neutral cluster and charged track multiplicity",1000, 0., 1000.,1000, 0., 1000.);
123// fhNclustersNtracks->SetYTitle("# of tracks");
124// fhNclustersNtracks->SetXTitle("# of clusters");
125
e6b5d324 126 fhPtLeading = new TH1F ("hPtLeading","p_T distribution of leading particles", nptbins,ptmin,ptmax);
127 fhPtLeading->SetXTitle("p_{T}^{trig} (GeV/c)");
128
129 fhPhiLeading = new TH2F ("hPhiLeading","#phi distribution of leading Particles",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
130 fhPhiLeading->SetYTitle("#phi (rad)");
131
132 fhEtaLeading = new TH2F ("hEtaLeading","#eta distribution of leading",nptbins,ptmin,ptmax, netabins,etamin,etamax);
133 fhEtaLeading->SetYTitle("#eta ");
2244659d 134 // outputContainer->Add(fhNclustersNtracks);
e6b5d324 135 outputContainer->Add(fhPtLeading);
136 outputContainer->Add(fhPhiLeading);
137 outputContainer->Add(fhEtaLeading);
477d6cee 138
139 //Correlation with charged hadrons
140 if(GetReader()->IsCTSSwitchedOn()) {
c8fe2783 141 fhDeltaPhiDeltaEtaCharged = new TH2F
f8006433 142 ("DeltaPhiDeltaEtaCharged","#phi_{trigger} - #phi_{h^{#pm}} vs #eta_{trigger} - #eta_{h^{#pm}}",
143 140,-2.,5.,200,-2,2);
c8fe2783 144 fhDeltaPhiDeltaEtaCharged->SetXTitle("#Delta #phi");
145 fhDeltaPhiDeltaEtaCharged->SetYTitle("#Delta #eta");
146
477d6cee 147 fhPhiCharged = new TH2F
f8006433 148 ("PhiCharged","#phi_{h^{#pm}} vs p_{T #pm}",
149 nptbins,ptmin,ptmax,nphibins,phimin,phimax);
477d6cee 150 fhPhiCharged->SetYTitle("#phi_{h^{#pm}} (rad)");
dd4871cd 151 fhPhiCharged->SetXTitle("p_{T #pm} (GeV/c)");
477d6cee 152
153 fhEtaCharged = new TH2F
f8006433 154 ("EtaCharged","#eta_{h^{#pm}} vs p_{T #pm}",
155 nptbins,ptmin,ptmax,netabins,etamin,etamax);
477d6cee 156 fhEtaCharged->SetYTitle("#eta_{h^{#pm}} (rad)");
dd4871cd 157 fhEtaCharged->SetXTitle("p_{T #pm} (GeV/c)");
477d6cee 158
159 fhDeltaPhiCharged = new TH2F
f8006433 160 ("DeltaPhiCharged","#phi_{trigger} - #phi_{h^{#pm}} vs p_{T trigger}",
161 nptbins,ptmin,ptmax,140,-2.,5.);
477d6cee 162 fhDeltaPhiCharged->SetYTitle("#Delta #phi");
163 fhDeltaPhiCharged->SetXTitle("p_{T trigger} (GeV/c)");
164
165 fhDeltaPhiChargedPt = new TH2F
f8006433 166 ("DeltaPhiChargedPt","#phi_{trigger} - #phi_{#h^{#pm}} vs p_{T h^{#pm}}",
167 nptbins,ptmin,ptmax,140,-2.,5.);
477d6cee 168 fhDeltaPhiChargedPt->SetYTitle("#Delta #phi");
169 fhDeltaPhiChargedPt->SetXTitle("p_{T h^{#pm}} (GeV/c)");
f8006433 170
dde5a268 171 fhDeltaPhiUeChargedPt = new TH2F
f8006433 172 ("DeltaPhiUeChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}}",
173 nptbins,ptmin,ptmax,140,-2.,5.);
dde5a268 174 fhDeltaPhiUeChargedPt->SetYTitle("#Delta #phi");
175 fhDeltaPhiUeChargedPt->SetXTitle("p_{T h^{#pm}} (GeV/c)");
477d6cee 176
177 fhDeltaEtaCharged = new TH2F
f8006433 178 ("DeltaEtaCharged","#eta_{trigger} - #eta_{h^{#pm}} vs p_{T trigger}",
179 nptbins,ptmin,ptmax,200,-2,2);
477d6cee 180 fhDeltaEtaCharged->SetYTitle("#Delta #eta");
181 fhDeltaEtaCharged->SetXTitle("p_{T trigger} (GeV/c)");
182
183 fhPtImbalanceCharged =
f8006433 184 new TH2F("CorrelationCharged","z_{trigger h^{#pm}} = p_{T h^{#pm}} / p_{T trigger}",
185 nptbins,ptmin,ptmax,200,0.,2.);
477d6cee 186 fhPtImbalanceCharged->SetYTitle("z_{trigger h^{#pm}}");
187 fhPtImbalanceCharged->SetXTitle("p_{T trigger}");
188
dde5a268 189 fhPtImbalanceUeCharged =
f8006433 190 new TH2F("CorrelationUeCharged","z_{trigger h^{#pm}} = p_{T Ueh^{#pm}} / p_{T trigger}",
191 nptbins,ptmin,ptmax,200,0.,2.);
dde5a268 192 fhPtImbalanceUeCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
193 fhPtImbalanceUeCharged->SetXTitle("p_{T trigger}");
f8006433 194
5025c139 195 fhPtImbalancePosCharged =
196 new TH2F("CorrelationPositiveCharged","z_{trigger h^{+}} = p_{T h^{+}} / p_{T trigger}",
197 nptbins,ptmin,ptmax,200,0.,2.);
198 fhPtImbalancePosCharged->SetYTitle("z_{trigger h^{+}}");
199 fhPtImbalancePosCharged->SetXTitle("p_{T trigger}");
200
201 fhPtImbalanceNegCharged =
202 new TH2F("CorrelationNegativeCharged","z_{trigger h^{-}} = p_{T h^{-}} / p_{T trigger}",
203 nptbins,ptmin,ptmax,200,0.,2.);
204 fhPtImbalanceNegCharged->SetYTitle("z_{trigger h^{-}}");
205 fhPtImbalanceNegCharged->SetXTitle("p_{T trigger}");
206
f8006433 207 fhPtHbpCharged =
208 new TH2F("HbpCharged","#xi = ln(1/x_{E}) with charged hadrons",
209 nptbins,ptmin,ptmax,200,0.,10.);
dd4871cd 210 fhPtHbpCharged->SetYTitle("ln(1/x_{E})");
211 fhPtHbpCharged->SetXTitle("p_{T trigger}");
212
213 fhPtHbpUeCharged =
f8006433 214 new TH2F("HbpUeCharged","#xi = ln(1/x_{E}) with charged hadrons",
215 nptbins,ptmin,ptmax,200,0.,10.);
dd4871cd 216 fhPtHbpUeCharged->SetYTitle("ln(1/x_{E})");
217 fhPtHbpUeCharged->SetXTitle("p_{T trigger}");
5025c139 218
2244659d 219 fhPoutPtTrigPtAssoc =
220 new TH3D("PoutPtTrigPtAssoc","Pout with charged hadrons",
221 nptbins,ptmin,ptmax,nptbins,ptmin,ptmax,2*nptbins,-ptmax,ptmax);
222 fhPoutPtTrigPtAssoc->SetZTitle("p_{out} (GeV/c)");
223 fhPoutPtTrigPtAssoc->SetYTitle("p_{T associated} (GeV/c)");
224 fhPoutPtTrigPtAssoc->SetXTitle("p_{T trigger} (GeV/c)");
225
226 fhUePoutPtTrigPtAssoc =
227 new TH3D("UePoutPtTrigPtAssoc"," UE Pout with charged hadrons",
228 nptbins,ptmin,ptmax,nptbins,ptmin,ptmax,2*nptbins,-ptmax,ptmax);
229 fhUePoutPtTrigPtAssoc->SetZTitle("p_{out} (GeV/c)");
230 fhUePoutPtTrigPtAssoc->SetYTitle("p_{T associated} (GeV/c)");
231 fhUePoutPtTrigPtAssoc->SetXTitle("p_{T trigger} (GeV/c)");
5025c139 232
233 fhPtTrigCharged =
234 new TH2F("PtTrigCharged","trgger and charged tracks pt distribution",
235 nptbins,ptmin,ptmax,nptbins,ptmin,ptmax);
236 fhPtTrigCharged->SetYTitle("p_{T asso} (GeV/c)");
237 fhPtTrigCharged->SetXTitle("p_{T trigger} (GeV/c)");
b6991fc4 238
c8fe2783 239 outputContainer->Add(fhDeltaPhiDeltaEtaCharged);
477d6cee 240 outputContainer->Add(fhPhiCharged) ;
241 outputContainer->Add(fhEtaCharged) ;
242 outputContainer->Add(fhDeltaPhiCharged) ;
243 outputContainer->Add(fhDeltaEtaCharged) ;
477d6cee 244 outputContainer->Add(fhDeltaPhiChargedPt) ;
dde5a268 245 outputContainer->Add(fhDeltaPhiUeChargedPt) ;
246 outputContainer->Add(fhPtImbalanceCharged) ;
5025c139 247 outputContainer->Add(fhPtImbalancePosCharged) ;
248 outputContainer->Add(fhPtImbalanceNegCharged) ;
dde5a268 249 outputContainer->Add(fhPtImbalanceUeCharged) ;
dd4871cd 250 outputContainer->Add(fhPtHbpCharged) ;
251 outputContainer->Add(fhPtHbpUeCharged) ;
2244659d 252 outputContainer->Add(fhPoutPtTrigPtAssoc) ;
253 outputContainer->Add(fhUePoutPtTrigPtAssoc) ;
5025c139 254 outputContainer->Add(fhPtTrigCharged) ;
f8006433 255
5025c139 256 if(DoEventSelect()){
257 Int_t nMultiBins = GetMultiBin();
258 fhTrigDeltaPhiDeltaEtaCharged = new TH3D*[nMultiBins] ;
259 fhTrigCorr = new TH2F*[nMultiBins];
260 fhTrigUeCorr = new TH2F*[nMultiBins];
261 for(Int_t im=0; im<nMultiBins; im++){
262 fhTrigDeltaPhiDeltaEtaCharged[im] = new TH3D
263 (Form("fhTrigDeltaPhiDeltaEtaCharged_%d",im),Form("fhTrigDeltaPhiDeltaEtaCharged_%d",im), nptbins,ptmin,ptmax, 140,-2.,5., 200,-2,2);
264 fhTrigDeltaPhiDeltaEtaCharged[im]->SetXTitle("p_{T trigger} (GeV/c)");
265 fhTrigDeltaPhiDeltaEtaCharged[im]->SetYTitle("#Delta #phi");
266 fhTrigDeltaPhiDeltaEtaCharged[im]->SetZTitle("#Delta #eta");
267 fhTrigCorr[im] = new TH2F
268 (Form("fhTrigPtCorr_%d",im),Form("fhTrigPtCorr_%d",im), nptbins,ptmin,ptmax,200,0.,2.);
269 fhTrigCorr[im]->SetYTitle("z_{trigger h^{#pm}}");
270 fhTrigCorr[im]->SetXTitle("p_{T trigger}");
271 fhTrigUeCorr[im] = new TH2F
272 (Form("fhTrigPtUeCorr_%d",im),Form("fhTrigPtUeCorr_%d",im), nptbins,ptmin,ptmax,200,0.,2.);
273 fhTrigUeCorr[im]->SetYTitle("z_{trigger h^{#pm}}");
274 fhTrigUeCorr[im]->SetXTitle("p_{T trigger}");
275
276 outputContainer->Add(fhTrigDeltaPhiDeltaEtaCharged[im]) ;
277 outputContainer->Add(fhTrigCorr[im]);
278 outputContainer->Add(fhTrigUeCorr[im]);
279
280 }
281 }
282
f8006433 283 if(fPi0Trigger){
2244659d 284 fhPtPi0DecayRatio = new TH2F
f8006433 285 ("hPtPi0DecayRatio","p_T of #pi^{0} and the ratio of pt for two decay",
2244659d 286 nptbins,ptmin,ptmax, 100,0.,2.);
f8006433 287 fhPtPi0DecayRatio->SetXTitle("p_{T}^{#pi^{0}} (GeV/c)");
2244659d 288 fhPtPi0DecayRatio->SetYTitle("p_{T}^{Decay}/p_{T}^{#pi^{0}}");
f8006433 289
5025c139 290 fhDeltaPhiDecayCharged = new TH2F
291 ("DeltaPhiDecayCharged","#phi_{Decay} - #phi_{h^{#pm}} vs p_{T Decay}",
f8006433 292 nptbins,ptmin,ptmax,140,-2.,5.);
5025c139 293 fhDeltaPhiDecayCharged->SetYTitle("#Delta #phi");
294 fhDeltaPhiDecayCharged->SetXTitle("p_{T Decay} (GeV/c)");
f8006433 295
5025c139 296 fhPtImbalanceDecayCharged =
297 new TH2F("CorrelationDecayCharged","z_{trigger h^{#pm}} = p_{T h^{#pm}} / p_{T Decay}",
f8006433 298 nptbins,ptmin,ptmax,200,0.,2.);
5025c139 299 fhPtImbalanceDecayCharged->SetYTitle("z_{decay h^{#pm}}");
300 fhPtImbalanceDecayCharged->SetXTitle("p_{T decay}");
f8006433 301
f8006433 302 outputContainer->Add(fhPtPi0DecayRatio) ;
5025c139 303 outputContainer->Add(fhDeltaPhiDecayCharged) ;
304 outputContainer->Add(fhPtImbalanceDecayCharged) ;
f8006433 305 }
306
307
dde5a268 308 if(fMakeSeveralUE){
123fc3bd 309 fhDeltaPhiUeLeftCharged = new TH2F
f8006433 310 ("DeltaPhiUeLeftChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE left side range of trigger particles",
311 nptbins,ptmin,ptmax,140,-2.,5.);
123fc3bd 312 fhDeltaPhiUeLeftCharged->SetYTitle("#Delta #phi");
313 fhDeltaPhiUeLeftCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
314 outputContainer->Add(fhDeltaPhiUeLeftCharged) ;
f8006433 315
123fc3bd 316 fhDeltaPhiUeRightCharged = new TH2F
f8006433 317 ("DeltaPhiUeRightChargedPt","#phi_{trigger} - #phi_{#Ueh^{#pm}} vs p_{T Ueh^{#pm}} with UE right side range of trigger particles",
318 nptbins,ptmin,ptmax,140,-2.,5.);
123fc3bd 319 fhDeltaPhiUeRightCharged->SetYTitle("#Delta #phi");
320 fhDeltaPhiUeRightCharged->SetXTitle("p_{T h^{#pm}} (GeV/c)");
321 outputContainer->Add(fhDeltaPhiUeRightCharged) ;
dde5a268 322
323 fhPtImbalanceUeLeftCharged =
f8006433 324 new TH2F("CorrelationUeChargedLeft","z_{trigger h^{#pm}} = p_{T Ueh^{#pm}} / p_{T trigger} with UE left side of trigger",
325 nptbins,ptmin,ptmax,200,0.,2.);
dde5a268 326 fhPtImbalanceUeLeftCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
327 fhPtImbalanceUeLeftCharged->SetXTitle("p_{T trigger}");
328 outputContainer->Add(fhPtImbalanceUeLeftCharged) ;
329
330 fhPtImbalanceUeRightCharged =
f8006433 331 new TH2F("CorrelationUeChargedRight","z_{trigger h^{#pm}} = p_{T Ueh^{#pm}} / p_{T trigger} with UE right side of trigger",
332 nptbins,ptmin,ptmax,200,0.,2.);
dde5a268 333 fhPtImbalanceUeRightCharged->SetYTitle("z_{trigger Ueh^{#pm}}");
334 fhPtImbalanceUeRightCharged->SetXTitle("p_{T trigger}");
335 outputContainer->Add(fhPtImbalanceUeRightCharged) ;
f8006433 336
337 fhPtHbpUeLeftCharged =
338 new TH2F("HbpUeChargedLeft","#xi = ln(1/x_{E}) with charged UE left side of trigger",
339 nptbins,ptmin,ptmax,200,0.,10.);
340 fhPtHbpUeLeftCharged->SetYTitle("ln(1/x_{E})");
341 fhPtHbpUeLeftCharged->SetXTitle("p_{T trigger}");
342 outputContainer->Add(fhPtHbpUeLeftCharged) ;
343
344 fhPtHbpUeRightCharged =
345 new TH2F("HbpUeChargedRight","#xi = ln(1/x_{E}) with charged UE right side of trigger",
346 nptbins,ptmin,ptmax,200,0.,10.);
347 fhPtHbpUeRightCharged->SetYTitle("ln(1/x_{E})");
348 fhPtHbpUeRightCharged->SetXTitle("p_{T trigger}");
349 outputContainer->Add(fhPtHbpUeRightCharged) ;
350
dde5a268 351 }
477d6cee 352 } //Correlation with charged hadrons
353
354 //Correlation with neutral hadrons
5025c139 355 if(fNeutralCorr){
477d6cee 356
c8fe2783 357 fhDeltaPhiDeltaEtaNeutral = new TH2F
f8006433 358 ("DeltaPhiDeltaEtaNeutral","#phi_{trigger} - #phi_{h^{0}} vs #eta_{trigger} - #eta_{h^{0}}",
359 140,-2.,5.,200,-2,2);
c8fe2783 360 fhDeltaPhiDeltaEtaNeutral->SetXTitle("#Delta #phi");
361 fhDeltaPhiDeltaEtaNeutral->SetYTitle("#Delta #eta");
b6991fc4 362
477d6cee 363 fhPhiNeutral = new TH2F
f8006433 364 ("PhiNeutral","#phi_{#pi^{0}} vs p_{T #pi^{0}}",
365 nptbins,ptmin,ptmax,nphibins,phimin,phimax);
477d6cee 366 fhPhiNeutral->SetYTitle("#phi_{#pi^{0}} (rad)");
dd4871cd 367 fhPhiNeutral->SetXTitle("p_{T #pi^{0}} (GeV/c)");
477d6cee 368
369 fhEtaNeutral = new TH2F
f8006433 370 ("EtaNeutral","#eta_{#pi^{0}} vs p_{T #pi^{0}}",
371 nptbins,ptmin,ptmax,netabins,etamin,etamax);
477d6cee 372 fhEtaNeutral->SetYTitle("#eta_{#pi^{0}} (rad)");
dd4871cd 373 fhEtaNeutral->SetXTitle("p_{T #pi^{0}} (GeV/c)");
477d6cee 374
375 fhDeltaPhiNeutral = new TH2F
f8006433 376 ("DeltaPhiNeutral","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T trigger}",
377 nptbins,ptmin,ptmax,nphibins,phimin,phimax);
477d6cee 378 fhDeltaPhiNeutral->SetYTitle("#Delta #phi");
379 fhDeltaPhiNeutral->SetXTitle("p_{T trigger} (GeV/c)");
380
381 fhDeltaPhiNeutralPt = new TH2F
f8006433 382 ("DeltaPhiNeutralPt","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T #pi^{0}}}",
383 nptbins,ptmin,ptmax,140,-2.,5.);
477d6cee 384 fhDeltaPhiNeutralPt->SetYTitle("#Delta #phi");
de8a210f 385 fhDeltaPhiNeutralPt->SetXTitle("p_{T h^{0}} (GeV/c)");
f8006433 386
123fc3bd 387 fhDeltaPhiUeNeutralPt = new TH2F
f8006433 388 ("DeltaPhiUeNeutralPt","#phi_{trigger} - #phi_{#pi^{0}} vs p_{T #pi^{0}}}",
389 nptbins,ptmin,ptmax,140,-2.,5.);
123fc3bd 390 fhDeltaPhiUeNeutralPt->SetYTitle("#Delta #phi");
de8a210f 391 fhDeltaPhiUeNeutralPt->SetXTitle("p_{T h^{0}} (GeV/c)");
477d6cee 392
393 fhDeltaEtaNeutral = new TH2F
f8006433 394 ("DeltaEtaNeutral","#eta_{trigger} - #eta_{#pi^{0}} vs p_{T trigger}",
395 nptbins,ptmin,ptmax,200,-2,2);
477d6cee 396 fhDeltaEtaNeutral->SetYTitle("#Delta #eta");
397 fhDeltaEtaNeutral->SetXTitle("p_{T trigger} (GeV/c)");
398
399 fhPtImbalanceNeutral =
f8006433 400 new TH2F("CorrelationNeutral","z_{trigger #pi} = p_{T #pi^{0}} / p_{T trigger}",
401 nptbins,ptmin,ptmax,200,0.,2.);
477d6cee 402 fhPtImbalanceNeutral->SetYTitle("z_{trigger #pi^{0}}");
403 fhPtImbalanceNeutral->SetXTitle("p_{T trigger}");
f8006433 404
123fc3bd 405 fhPtImbalanceUeNeutral =
f8006433 406 new TH2F("CorrelationUeNeutral","z_{trigger #pi} = p_{T #pi^{0}} / p_{T trigger}",
407 nptbins,ptmin,ptmax,200,0.,2.);
123fc3bd 408 fhPtImbalanceUeNeutral->SetYTitle("z_{trigger #pi^{0}}");
409 fhPtImbalanceUeNeutral->SetXTitle("p_{T trigger}");
c8fe2783 410
411 fhPtHbpNeutral =
f8006433 412 new TH2F("HbpNeutral","#xi = ln(1/x_{E}) with neutral particles",
413 nptbins,ptmin,ptmax,200,0.,10.);
c8fe2783 414 fhPtHbpNeutral->SetYTitle("ln(1/x_{E})");
415 fhPtHbpNeutral->SetXTitle("p_{T trigger}");
416
417 fhPtHbpUeNeutral =
f8006433 418 new TH2F("HbpUeNeutral","#xi = ln(1/x_{E}) with neutral particles",
419 nptbins,ptmin,ptmax,200,0.,10.);
c8fe2783 420 fhPtHbpUeNeutral->SetYTitle("ln(1/x_{E})");
421 fhPtHbpUeNeutral->SetXTitle("p_{T trigger}");
422
423
424 outputContainer->Add(fhDeltaPhiDeltaEtaNeutral);
477d6cee 425 outputContainer->Add(fhPhiNeutral) ;
426 outputContainer->Add(fhEtaNeutral) ;
427 outputContainer->Add(fhDeltaPhiNeutral) ;
123fc3bd 428 outputContainer->Add(fhDeltaPhiNeutralPt) ;
429 outputContainer->Add(fhDeltaPhiUeNeutralPt) ;
477d6cee 430 outputContainer->Add(fhDeltaEtaNeutral) ;
431 outputContainer->Add(fhPtImbalanceNeutral) ;
dd4871cd 432 outputContainer->Add(fhPtImbalanceUeNeutral) ;
c8fe2783 433 outputContainer->Add(fhPtHbpNeutral) ;
434 outputContainer->Add(fhPtHbpUeNeutral) ;
f8006433 435
436 if(fPi0Trigger){
5025c139 437 fhDeltaPhiDecayNeutral = new TH2F
438 ("DeltaPhiDecayNeutral","#phi_{Decay} - #phi_{h^{0}} vs p_{T Decay}",
f8006433 439 nptbins,ptmin,ptmax,140,-2.,5.);
5025c139 440 fhDeltaPhiDecayNeutral->SetYTitle("#Delta #phi");
441 fhDeltaPhiDecayNeutral->SetXTitle("p_{T Decay} (GeV/c)");
f8006433 442
5025c139 443 fhPtImbalanceDecayNeutral =
444 new TH2F("CorrelationDecayNeutral","z_{trigger h^{0}} = p_{T h^{0}} / p_{T Decay}",
f8006433 445 nptbins,ptmin,ptmax,200,0.,2.);
5025c139 446 fhPtImbalanceDecayNeutral->SetYTitle("z_{decay h^{0}}");
447 fhPtImbalanceDecayNeutral->SetXTitle("p_{T decay}");
f8006433 448
5025c139 449 outputContainer->Add(fhDeltaPhiDecayNeutral) ;
450 outputContainer->Add(fhPtImbalanceDecayNeutral) ;
f8006433 451 }
452
453
123fc3bd 454 if(fMakeSeveralUE){
455 fhDeltaPhiUeLeftNeutral = new TH2F
f8006433 456 ("DeltaPhiUeLeftNeutralPt","#phi_{trigger} - #phi_{#Ueh^{0}} vs p_{T h^{0}} with neutral UE left side range of trigger particles",
457 nptbins,ptmin,ptmax,140,-2.,5.);
123fc3bd 458 fhDeltaPhiUeLeftNeutral->SetYTitle("#Delta #phi");
459 fhDeltaPhiUeLeftNeutral->SetXTitle("p_{T h^{0}} (GeV/c)");
460 outputContainer->Add(fhDeltaPhiUeLeftNeutral) ;
f8006433 461
123fc3bd 462 fhDeltaPhiUeRightNeutral = new TH2F
f8006433 463 ("DeltaPhiUeRightNeutralPt","#phi_{trigger} - #phi_{#Ueh^{0}} vs p_{T Ueh^{0}} with neutral UE right side range of trigger particles",
464 nptbins,ptmin,ptmax,140,-2.,5.);
123fc3bd 465 fhDeltaPhiUeRightNeutral->SetYTitle("#Delta #phi");
466 fhDeltaPhiUeRightNeutral->SetXTitle("p_{T h^{0}} (GeV/c)");
467 outputContainer->Add(fhDeltaPhiUeRightNeutral) ;
468
469 fhPtImbalanceUeLeftNeutral =
f8006433 470 new TH2F("CorrelationUeNeutralLeft","z_{trigger h^{0}} = p_{T Ueh^{0}} / p_{T trigger} with neutral UE left side of trigger",
471 nptbins,ptmin,ptmax,140,0.,2.);
123fc3bd 472 fhPtImbalanceUeLeftNeutral->SetYTitle("z_{trigger Ueh^{0}}");
473 fhPtImbalanceUeLeftNeutral->SetXTitle("p_{T trigger}");
474 outputContainer->Add(fhPtImbalanceUeLeftNeutral) ;
475
476 fhPtImbalanceUeRightNeutral =
f8006433 477 new TH2F("CorrelationUeNeutralRight","z_{trigger h^{0}} = p_{T Ueh^{0}} / p_{T trigger} with neutral UE right side of trigger",
478 nptbins,ptmin,ptmax,200,0.,2.);
123fc3bd 479 fhPtImbalanceUeRightNeutral->SetYTitle("z_{trigger Ueh^{0}}");
480 fhPtImbalanceUeRightNeutral->SetXTitle("p_{T trigger}");
481 outputContainer->Add(fhPtImbalanceUeRightNeutral) ;
f8006433 482
c8fe2783 483 fhPtHbpUeLeftNeutral =
f8006433 484 new TH2F("HbpUeNeutralLeft","#xi = ln(1/x_{E}) with neutral UE left side of trigger",
485 nptbins,ptmin,ptmax,200,0.,10.);
c8fe2783 486 fhPtHbpUeLeftNeutral->SetYTitle("ln(1/x_{E})");
487 fhPtHbpUeLeftNeutral->SetXTitle("p_{T trigger}");
488 outputContainer->Add(fhPtHbpUeLeftNeutral) ;
489
490 fhPtHbpUeRightNeutral =
f8006433 491 new TH2F("HbpUeNeutralRight","#xi = ln(1/x_{E}) with neutral UE right side of trigger",
492 nptbins,ptmin,ptmax,200,0.,10.);
c8fe2783 493 fhPtHbpUeRightNeutral->SetYTitle("ln(1/x_{E})");
494 fhPtHbpUeRightNeutral->SetXTitle("p_{T trigger}");
495 outputContainer->Add(fhPtHbpUeRightNeutral) ;
496
123fc3bd 497 }
f8006433 498
477d6cee 499 //Keep neutral meson selection histograms if requiered
500 //Setting done in AliNeutralMesonSelection
501 if(GetNeutralMesonSelection()){
502 TList * nmsHistos = GetNeutralMesonSelection()->GetCreateOutputObjects() ;
503 if(GetNeutralMesonSelection()->AreNeutralMesonSelectionHistosKept())
f8006433 504 for(Int_t i = 0; i < nmsHistos->GetEntries(); i++) outputContainer->Add(nmsHistos->At(i)) ;
505 delete nmsHistos;
477d6cee 506 }
f8006433 507
477d6cee 508 }//Correlation with neutral hadrons
509
510 return outputContainer;
f8006433 511
1c5acb87 512}
513
477d6cee 514//____________________________________________________________________________
1c5acb87 515void AliAnaParticleHadronCorrelation::InitParameters()
516{
477d6cee 517
1c5acb87 518 //Initialize the parameters of the analysis.
a3aebfff 519 SetInputAODName("PWG4Particle");
591cc579 520 SetAODObjArrayName("Hadrons");
a3aebfff 521 AddToHistogramsName("AnaHadronCorr_");
522
dde5a268 523 SetPtCutRange(0.,300);
1c5acb87 524 fDeltaPhiMinCut = 1.5 ;
525 fDeltaPhiMaxCut = 4.5 ;
6639984f 526 fSelectIsolated = kFALSE;
dde5a268 527 fMakeSeveralUE = kFALSE;
528 fUeDeltaPhiMinCut = 1. ;
529 fUeDeltaPhiMaxCut = 1.5 ;
5025c139 530 fNeutralCorr = kFALSE ;
f8006433 531 fPi0Trigger = kFALSE ;
532
1c5acb87 533}
534
535//__________________________________________________________________
536void AliAnaParticleHadronCorrelation::Print(const Option_t * opt) const
537{
538
539 //Print some relevant parameters set for the analysis
540 if(! opt)
541 return;
542
a3aebfff 543 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
544 AliAnaPartCorrBaseClass::Print(" ");
545
1c5acb87 546 printf("Phi trigger particle-Hadron < %3.2f\n", fDeltaPhiMaxCut) ;
547 printf("Phi trigger particle-Hadron > %3.2f\n", fDeltaPhiMinCut) ;
6639984f 548 printf("Isolated Trigger? %d\n", fSelectIsolated) ;
dde5a268 549 printf("Phi trigger particle-UeHadron < %3.2f\n", fUeDeltaPhiMaxCut) ;
550 printf("Phi trigger particle-UeHadron > %3.2f\n", fUeDeltaPhiMinCut) ;
551 printf("Several UE? %d\n", fMakeSeveralUE) ;
f8006433 552 printf("Name of AOD Pi0 Branch %s \n",fPi0AODBranchName.Data());
553 printf("Do Decay-hadron correlation ? %d\n", fPi0Trigger) ;
554
555
556}
557
558//__________________________________________________________________
559TObjString* AliAnaParticleHadronCorrelation::GetAnalysisCuts()
560{
561 //Save parameters used for analysis
562 TString parList ; //this will be list of parameters used for this analysis.
563 const Int_t buffersize = 255;
564 char onePar[buffersize] ;
565
566 snprintf(onePar,buffersize,"--- AliAnaPaticleHadronCorrelation ---\n") ;
567 parList+=onePar ;
568 snprintf(onePar,buffersize,"Phi trigger particle-Hadron < %3.2f ", fDeltaPhiMaxCut) ;
569 parList+=onePar ;
570 snprintf(onePar,buffersize,"Phi trigger particle-Hadron > %3.2f ", fDeltaPhiMinCut) ;
571 parList+=onePar ;
572 snprintf(onePar,buffersize,"Isolated Trigger? %d\n", fSelectIsolated) ;
573 parList+=onePar ;
574 snprintf(onePar,buffersize,"Phi trigger particle-UeHadron < %3.2f ", fUeDeltaPhiMaxCut) ;
575 parList+=onePar ;
576 snprintf(onePar,buffersize,"Phi trigger particle-UeHadron > %3.2f ", fUeDeltaPhiMinCut) ;
577 parList+=onePar ;
578 snprintf(onePar,buffersize,"Several UE? %d\n", fMakeSeveralUE) ;
579 parList+=onePar ;
580 snprintf(onePar,buffersize,"Name of AOD Pi0 Branch %s ",fPi0AODBranchName.Data());
581 parList+=onePar ;
582 snprintf(onePar,buffersize,"Do Decay-hadron correlation ? %d", fPi0Trigger) ;
583 parList+=onePar ;
584
585 //Get parameters set in base class.
586 parList += GetBaseParametersList() ;
587
588 //Get parameters set in PID class.
589 //parList += GetCaloPID()->GetPIDParametersList() ;
590
591 //Get parameters set in FiducialCut class (not available yet)
592 //parlist += GetFidCut()->GetFidCutParametersList()
593
594 return new TObjString(parList) ;
595
1c5acb87 596}
597
f8006433 598
1c5acb87 599//____________________________________________________________________________
600void AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD()
601{
f8006433 602 //Particle-Hadron Correlation Analysis, fill AODs
477d6cee 603
604 if(!GetInputAODBranch()){
591cc579 605 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - No input particles in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
477d6cee 606 abort();
607 }
9415d854 608
609 if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation")){
c8fe2783 610 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s> \n",GetInputAODBranch()->GetClass()->GetName());
611 abort();
9415d854 612 }
613
477d6cee 614 if(GetDebug() > 1){
a3aebfff 615 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - Begin hadron correlation analysis, fill AODs \n");
616 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
be518ab0 617 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In CTS aod entries %d\n", GetCTSTracks()->GetEntriesFast());
618 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In EMCAL aod entries %d\n", GetEMCALClusters()->GetEntriesFast());
619 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - In PHOS aod entries %d\n", GetPHOSClusters()->GetEntriesFast());
477d6cee 620 }
621
f8006433 622 //Loop on stored AOD particles, trigger
b6991fc4 623 Double_t ptTrig = 0.;
624 Int_t trigIndex = -1;
477d6cee 625 Int_t naod = GetInputAODBranch()->GetEntriesFast();
be518ab0 626 //fhNclustersNtracks->Fill(naod, GetCTSTracks()->GetEntriesFast());
477d6cee 627 for(Int_t iaod = 0; iaod < naod ; iaod++){
628 AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
f8006433 629 //find the leading particles with highest momentum
c8fe2783 630 if (particle->Pt()>ptTrig) {
631 ptTrig = particle->Pt() ;
632 trigIndex = iaod ;
633 }
b6991fc4 634 }//Aod branch loop
635
f8006433 636 //Do correlation with leading particle
b6991fc4 637 if(trigIndex!=-1){
638
c8fe2783 639 AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(trigIndex));
f8006433 640 //Make correlation with charged hadrons
c8fe2783 641 if(GetReader()->IsCTSSwitchedOn() )
be518ab0 642 MakeChargedCorrelation(particle, GetCTSTracks(),kFALSE);
477d6cee 643
f8006433 644 TObjArray * pi0list = (TObjArray*) GetAODBranch(fPi0AODBranchName); //For the future, foresee more possible pi0 lists
5025c139 645 if(fNeutralCorr && pi0list && pi0list->GetEntriesFast() > 0)
f8006433 646 MakeNeutralCorrelation(particle, pi0list,kFALSE);
c8fe2783 647
b6991fc4 648 }//Correlate leading
c8fe2783 649
a3aebfff 650 if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillAOD() - End fill AODs \n");
477d6cee 651
1c5acb87 652}
653
654//____________________________________________________________________________
655void AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms()
656{
477d6cee 657 //Particle-Hadron Correlation Analysis, fill histograms
658
659 if(!GetInputAODBranch()){
591cc579 660 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - No input particles in AOD with name branch < %s >, STOP \n",GetInputAODName().Data());
477d6cee 661 abort();
662 }
9415d854 663
477d6cee 664 if(GetDebug() > 1){
a3aebfff 665 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - Begin hadron correlation analysis, fill histograms \n");
666 printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
477d6cee 667 }
9415d854 668
5025c139 669 //Get the vertex and check it is not too large in z
670 Double_t v[3] = {0,0,0}; //vertex ;
671 GetReader()->GetVertex(v);
672 if(!GetMixedEvent() && TMath::Abs(v[2]) > GetZvertexCut()) return ;
673
b6991fc4 674 //Loop on stored AOD particles, find leading
477d6cee 675 Int_t naod = GetInputAODBranch()->GetEntriesFast();
2244659d 676 // if(naod!=0)fhVertex->Fill(v[0],v[1],v[2]);
b6991fc4 677 Double_t ptTrig = 0.;
678 Int_t trigIndex = -1 ;
e6b5d324 679 for(Int_t iaod = 0; iaod < naod ; iaod++){ //loop on input trigger AOD file
9415d854 680 AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
5025c139 681 //vertex cut in case of mixing
682 if (GetMixedEvent()) {
683 Int_t evt=-1;
684 Int_t id =-1;
685 if (particle->GetCaloLabel(0) >= 0 ){
686 id=particle->GetCaloLabel(0);
687 if(id >= 0 )evt= GetMixedEvent()-> EventIndexForCaloCluster(id) ;
688 }
689 else if(particle->GetTrackLabel(0) >= 0 ){
690 id=particle->GetTrackLabel(0);
691 if(id >= 0 )evt= GetMixedEvent()->EventIndex(id) ;
692 }
693 else continue;
694
695 if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut())
2244659d 696 return ;
5025c139 697 }
698
9415d854 699 //check if the particle is isolated or if we want to take the isolation into account
700 if(OnlyIsolated() && !particle->IsIsolated()) continue;
5025c139 701 //check if inside the vertex cut
702 //find the leading particles with highest momentum
e6b5d324 703 if (particle->Pt()>ptTrig) {
704 ptTrig = particle->Pt() ;
705 trigIndex = iaod ;
706 }
707 }//finish searching for leading trigger particle
b6991fc4 708 if(trigIndex!=-1){ //using trigger partilce to do correlations
e6b5d324 709 AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(trigIndex));
b6991fc4 710
5025c139 711 if (GetMixedEvent()) {
712 Int_t evt=-1;
713 Int_t id = 0;
714 if (particle->GetCaloLabel(0) >= 0 ){
715 id=particle->GetCaloLabel(0);
716 if(id >= 0 )evt= GetMixedEvent()-> EventIndexForCaloCluster(id) ;
717 }
718 else if(particle->GetTrackLabel(0) >= 0 ){
719 id=particle->GetTrackLabel(0);
720 if(id >= 0 )evt= GetMixedEvent()->EventIndex(id) ;
721 }
722 else return;
723
724 if (TMath::Abs(GetVertex(evt)[2]) > GetZvertexCut())
725 return ;
726 }
727
c8fe2783 728 //Fill leading particle histogram
729 fhPtLeading->Fill(particle->Pt());
730 Float_t phi = particle->Phi();
731 if(phi<0)phi+=TMath::TwoPi();
732 fhPhiLeading->Fill(particle->Pt(), phi);
733 fhEtaLeading->Fill(particle->Pt(), particle->Eta());
734
9415d854 735 //Make correlation with charged hadrons
2244659d 736 if(GetReader()->IsCTSSwitchedOn() )
be518ab0 737 MakeChargedCorrelation(particle, GetCTSTracks(),kTRUE);
a70a8477 738
2244659d 739 TObjArray * pi0list = (TObjArray*) GetAODBranch(fPi0AODBranchName); //For the future, foresee more possible pi0 lists
740 if(fNeutralCorr && pi0list && pi0list->GetEntriesFast() > 0)
741 MakeNeutralCorrelation(particle, pi0list,kTRUE);
9415d854 742
477d6cee 743 }//Aod branch loop
744
a3aebfff 745 if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeAnalysisFillHistograms() - End fill histograms \n");
477d6cee 746
1c5acb87 747}
748
749//____________________________________________________________________________
233e0df8 750void AliAnaParticleHadronCorrelation::MakeChargedCorrelation(AliAODPWG4ParticleCorrelation *aodParticle, TObjArray* const pl, const Bool_t bFillHisto)
1c5acb87 751{
f8006433 752 // Charged Hadron Correlation Analysis
c8fe2783 753 if(GetDebug() > 1)printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Make trigger particle - charged hadron correlation \n");
dde5a268 754
eb3e2665 755 Int_t evtIndex11 = -1 ; //cluster trigger or pi0 trigger
756 Int_t evtIndex12 = -1 ; // pi0 trigger
757 Int_t evtIndex13 = -1 ; // charged trigger
f8006433 758 Int_t indexPhoton1 = -1 ;
759 Int_t indexPhoton2 = -1 ;
5025c139 760 Double_t v[3] = {0,0,0}; //vertex ;
761 GetReader()->GetVertex(v);
762 if(!GetMixedEvent() && TMath::Abs(v[2]) > GetZvertexCut()) return ;
763
be518ab0 764 Int_t nTracks = GetCTSTracks()->GetEntriesFast() ;
f8006433 765
c8fe2783 766 if (GetMixedEvent()) {
767 evtIndex11 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(0)) ;
768 evtIndex12 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(1)) ;
eb3e2665 769 evtIndex13 = GetMixedEvent()->EventIndex(aodParticle->GetTrackLabel(0)) ;
c8fe2783 770 }
771
772 Double_t ptTrig = aodParticle->Pt();
773 Double_t pxTrig = aodParticle->Px();
774 Double_t pyTrig = aodParticle->Py();
775
776 Double_t phiTrig = aodParticle->Phi();
5025c139 777 Double_t etaTrig = aodParticle->Eta();
c8fe2783 778
779 Double_t pt = -100.;
780 Double_t px = -100.;
781 Double_t py = -100.;
782 Double_t rat = -100.;
783 Double_t xE = -100.;
784 Double_t cosi = -100.;
785 Double_t phi = -100. ;
786 Double_t eta = -100. ;
787 TVector3 p3;
b6991fc4 788
f8006433 789 TObjArray * reftracks = 0x0;
c8fe2783 790 Int_t nrefs = 0;
a33b76ed 791
f8006433 792 Double_t ptDecay1 = 0. ;
793 Double_t pxDecay1 = 0. ;
794 Double_t pyDecay1 = 0. ;
795 Double_t phiDecay1 = 0. ;
796 Double_t ptDecay2 = 0. ;
797 Double_t pxDecay2 = 0. ;
798 Double_t pyDecay2 = 0. ;
799 Double_t phiDecay2 = 0. ;
800
801 Double_t ratDecay1 = -100.;
802 Double_t ratDecay2 = -100.;
803 Float_t deltaphi = -100. ;
804 Float_t deltaphiDecay1 = -100. ;
805 Float_t deltaphiDecay2 = -100. ;
806 TObjArray * clusters = 0x0 ;
807 TLorentzVector photonMom ;
808
809 if(fPi0Trigger){
810 indexPhoton1 = aodParticle->GetCaloLabel (0);
811 indexPhoton2 = aodParticle->GetCaloLabel (1);
812 if(GetDebug() > 1)printf("indexPhoton1 = %d, indexPhoton2 = %d \n", indexPhoton1, indexPhoton2);
813
814 if(indexPhoton1!=-1 && indexPhoton2!=-1){
be518ab0 815 if(aodParticle->GetDetector()=="EMCAL") clusters = GetEMCALClusters() ;
816 else clusters = GetPHOSClusters() ;
f8006433 817 for(Int_t iclus = 0; iclus < clusters->GetEntriesFast(); iclus++){
818 AliVCluster * photon = (AliVCluster*) (clusters->At(iclus));
819 photon->GetMomentum(photonMom,GetVertex(0)) ;
820 if(photon->GetID()==indexPhoton1) {
821 ptDecay1 = photonMom.Pt();
822 pxDecay1 = photonMom.Px();
823 pyDecay1 = photonMom.Py();
824 phiDecay1 = photonMom.Phi();
2244659d 825 if(ptTrig && bFillHisto) fhPtPi0DecayRatio->Fill(ptTrig, ptDecay1/ptTrig);
f8006433 826 }
827 if(photon->GetID()==indexPhoton2) {
828 ptDecay2 = photonMom.Pt();
829 pxDecay2 = photonMom.Px();
830 pyDecay2 = photonMom.Py();
831 phiDecay2 = photonMom.Phi();
2244659d 832 if(ptTrig && bFillHisto) fhPtPi0DecayRatio->Fill(ptTrig, ptDecay2/ptTrig);
f8006433 833 }
834 if(GetDebug() > 1)printf("Photon1 = %f, Photon2 = %f \n", ptDecay1, ptDecay2);
835 } //cluster loop
836 } //index of decay photons found
2244659d 837
f8006433 838 } //make decay-hadron correlation
839
840 //Track loop, select tracks with good pt, phi and fill AODs or histograms
c8fe2783 841 //Int_t currentIndex = -1 ;
842 for(Int_t ipr = 0;ipr < pl->GetEntriesFast() ; ipr ++ ){
88f9563f 843 AliVTrack * track = (AliVTrack *) (pl->At(ipr)) ;
2244659d 844
5025c139 845 //check if inside the vertex cut
846 //printf("charge = %d\n", track->Charge());
c8fe2783 847 Int_t evtIndex2 = 0 ;
848 if (GetMixedEvent()) {
849 evtIndex2 = GetMixedEvent()->EventIndex(track->GetID()) ;
eb3e2665 850 if (evtIndex11 == evtIndex2 || evtIndex12 == evtIndex2 || evtIndex13 == evtIndex2 ) // photon and track from different events
c8fe2783 851 continue ;
5025c139 852 //vertex cut
853 if (TMath::Abs(GetVertex(evtIndex2)[2]) > GetZvertexCut())
2244659d 854 return ;
f8006433 855 // if(currentIndex == evtIndex2) // tracks from different event
856 // continue ;
857 // currentIndex = evtIndex2 ;
c8fe2783 858 }
c8fe2783 859 Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
860 p3.SetXYZ(mom[0],mom[1],mom[2]);
861 pt = p3.Pt();
862 px = p3.Px();
863 py = p3.Py();
864 eta = p3.Eta();
865 phi = p3.Phi() ;
866 if(phi < 0) phi+=TMath::TwoPi();
2244659d 867
868 //Select only hadrons in pt range
869 if(pt < GetMinPt() || pt > GetMaxPt()) continue ;
870 //remove trigger itself for correlation when use charged triggers
871 if(track->GetID()==aodParticle->GetTrackLabel(0) && pt==ptTrig && phi==phiTrig && eta==etaTrig)
872 continue ;
873 if(IsFiducialCutOn()){
874 Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"CTS") ;
875 if(! in ) continue ;
876 }
877 //jumped out this event if near side associated partile pt larger than trigger
878 if(pt > ptTrig && TMath::Abs(phi-phiTrig)<TMath::PiOver2()) break ;
c8fe2783 879 rat = pt/ptTrig ;
880 xE = -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
881 if(xE <0.)xE =-xE;
882 cosi = TMath::Log(1/xE);
f8006433 883 // printf("rat = %f, xE = %f, cosi =%f \n", rat, xE, cosi);
884 // printf("phi = %f \n", phi);
885
2244659d 886 if(fPi0Trigger){
f8006433 887 if(indexPhoton1!=-1 && indexPhoton2!=-1){
888 if(ptDecay1) ratDecay1 = pt/ptDecay1 ;
889 if(ptDecay2) ratDecay2 = pt/ptDecay2 ;
890 deltaphiDecay1 = phiDecay1-phi;
891 deltaphiDecay2 = phiDecay2-phi;
892 if(deltaphiDecay1< -TMath::PiOver2()) deltaphiDecay1+=TMath::TwoPi();
893 if(deltaphiDecay1>3*TMath::PiOver2()) deltaphiDecay1-=TMath::TwoPi();
894 if(deltaphiDecay2< -TMath::PiOver2()) deltaphiDecay2+=TMath::TwoPi();
895 if(deltaphiDecay2>3*TMath::PiOver2()) deltaphiDecay2-=TMath::TwoPi();
896 }
897 } //do decay-hadron correlation
2244659d 898
f8006433 899 //Selection within angular range
900 deltaphi = phiTrig-phi;
c8fe2783 901 if(deltaphi< -TMath::PiOver2()) deltaphi+=TMath::TwoPi();
902 if(deltaphi>3*TMath::PiOver2()) deltaphi-=TMath::TwoPi();
2244659d 903
904 Double_t pout = pt*TMath::Sin(deltaphi) ;
dde5a268 905
c8fe2783 906 if(GetDebug() > 2)
907 printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Charged hadron: pt %f, phi %f, phi trigger %f. Cuts: delta phi %2.2f < %2.2f < %2.2f, pT min %2.2f \n",
908 pt,phi, phiTrig,fDeltaPhiMinCut, deltaphi, fDeltaPhiMaxCut, GetMinPt());
dde5a268 909
c8fe2783 910 if(bFillHisto){
f8006433 911 // Fill Histograms
c8fe2783 912 fhEtaCharged->Fill(pt,eta);
913 fhPhiCharged->Fill(pt,phi);
914 fhDeltaEtaCharged->Fill(ptTrig,aodParticle->Eta()-eta);
915 fhDeltaPhiCharged->Fill(ptTrig, deltaphi);
916 fhDeltaPhiDeltaEtaCharged->Fill(deltaphi,aodParticle->Eta()-eta);
917
918 if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeChargedCorrelation() - Selected charge for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
5025c139 919 //fill different multiplicity histogram
920 if(DoEventSelect()){
921 for(Int_t im=0; im<GetMultiBin(); im++){
59a0152b 922 if(nTracks < ( GetMaxMulti() - GetMinMulti() )/GetMultiBin()*(im+1))fhTrigDeltaPhiDeltaEtaCharged[im]->Fill(ptTrig,deltaphi,aodParticle->Eta()-eta);
5025c139 923 }
924 }
f8006433 925 //delta phi cut for correlation
c8fe2783 926 if( (deltaphi > fDeltaPhiMinCut) && ( deltaphi < fDeltaPhiMaxCut) ) {
927 fhDeltaPhiChargedPt->Fill(pt,deltaphi);
5025c139 928 fhPtImbalanceCharged->Fill(ptTrig,xE);
c8fe2783 929 fhPtHbpCharged->Fill(ptTrig,cosi);
2244659d 930 fhPoutPtTrigPtAssoc->Fill(ptTrig, pt, pout) ;
5025c139 931 fhPtTrigCharged->Fill(ptTrig, pt) ;
932 if(track->Charge()>0) fhPtImbalancePosCharged->Fill(ptTrig,xE) ;
933 else fhPtImbalanceNegCharged->Fill(ptTrig,xE) ;
934 //fill different multiplicity histogram
935 if(DoEventSelect()){
936 for(Int_t im=0; im<GetMultiBin(); im++){
59a0152b 937 if(nTracks < ( GetMaxMulti() - GetMinMulti() )/GetMultiBin()*(im+1))
5025c139 938 fhTrigCorr[im]->Fill(ptTrig,xE);
939 }
940 } //multiplicity events selection
941 } //delta phi cut for correlation
2244659d 942 else { //UE study
c8fe2783 943 fhDeltaPhiUeChargedPt->Fill(pt,deltaphi);
2244659d 944 fhUePoutPtTrigPtAssoc->Fill(ptTrig, pt, pout) ;
5025c139 945 fhPtImbalanceUeCharged->Fill(ptTrig,xE);
c8fe2783 946 fhPtHbpUeCharged->Fill(ptTrig,cosi);
5025c139 947 if(DoEventSelect()){
948 for(Int_t im=0; im<GetMultiBin(); im++){
59a0152b 949 if(nTracks < ( GetMaxMulti() - GetMinMulti() )/GetMultiBin()*(im+1))
5025c139 950 fhTrigUeCorr[im]->Fill(ptTrig,xE);
951 }
952 } //multiplicity events selection
953
2244659d 954 } //UE study
f8006433 955
956 if(fPi0Trigger){
957 if(indexPhoton1!=-1 && indexPhoton2!=-1){
5025c139 958 fhDeltaPhiDecayCharged->Fill(ptDecay1, deltaphiDecay1);
959 fhDeltaPhiDecayCharged->Fill(ptDecay2, deltaphiDecay2);
f8006433 960 if(GetDebug() > 1)printf("deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaphiDecay1, deltaphiDecay2);
961 if( (deltaphiDecay1 > fDeltaPhiMinCut) && ( deltaphiDecay1 < fDeltaPhiMaxCut) )
5025c139 962 fhPtImbalanceDecayCharged->Fill(ptDecay1,ratDecay1);
f8006433 963 if( (deltaphiDecay2 > fDeltaPhiMinCut) && ( deltaphiDecay2 < fDeltaPhiMaxCut) )
5025c139 964 fhPtImbalanceDecayCharged->Fill(ptDecay2,ratDecay2);
f8006433 965 if(GetDebug() > 1)printf("ratPhoton1 = %f, ratPhoton2 = %f \n", pt/ptDecay1, pt/ptDecay2);
966 } //index of decay photons found
967 } //make decay-hadron correlation
968
969 //several UE calculation
dde5a268 970 if(fMakeSeveralUE){
c8fe2783 971 if((deltaphi<-fUeDeltaPhiMinCut) && (deltaphi >-fUeDeltaPhiMaxCut)){
972 fhDeltaPhiUeLeftCharged->Fill(pt,deltaphi);
973 fhPtImbalanceUeLeftCharged->Fill(ptTrig,rat);
974 fhPtHbpUeLeftCharged->Fill(ptTrig,cosi);
975 }
976 if((deltaphi>fUeDeltaPhiMinCut) && (deltaphi <fUeDeltaPhiMaxCut)){
977 fhDeltaPhiUeRightCharged->Fill(pt,deltaphi);
978 fhPtImbalanceUeRightCharged->Fill(ptTrig,rat);
979 fhPtHbpUeRightCharged->Fill(ptTrig,cosi);
980
981 }
dde5a268 982 } //several UE calculation
c8fe2783 983
2244659d 984 } //Fill histogram
c8fe2783 985 else{
986 nrefs++;
987 if(nrefs==1){
988 reftracks = new TObjArray(0);
989 reftracks->SetName(GetAODObjArrayName()+"Tracks");
990 reftracks->SetOwner(kFALSE);
991 }
992 reftracks->Add(track);
993 }//aod particle loop
994 }// track loop
9415d854 995
f8006433 996 //Fill AOD with reference tracks, if not filling histograms
c8fe2783 997 if(!bFillHisto && reftracks) {
998 aodParticle->AddObjArray(reftracks);
999 }
1000
f8006433 1001 //delete reftracks;
9415d854 1002
1c5acb87 1003}
9415d854 1004
f8006433 1005
1006
1007//____________________________________________________________________________
1008//void AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD(AliAODPWG4ParticleCorrelation* const aodParticle,TObjArray* const pl, TString detector)
1009//{
1010// // Neutral Pion Correlation Analysis, find pi0, put them in new output aod, if correlation cuts passed
1011// if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Make trigger particle - neutral hadron correlation \n");
1012//
1013// if(!NewOutputAOD()){
1014// printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Output aod not created, set AOD class name and branch name in the configuration file, STOP! \n");
1015// abort();
1016// }
1017//
1018// Double_t phiTrig = aodParticle->Phi();
1019// Int_t tag = 0;
1020// TLorentzVector gammai;
1021// TLorentzVector gammaj;
1022//
1023// //Get vertex for photon momentum calculation
1024//
1025// if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC)
1026// {
1027// for (Int_t iev = 0; iev < GetNMixedEvent(); iev++) {
1028// if (!GetMixedEvent())
1029// GetReader()->GetVertex(GetVertex(iev));
1030// else
1031// GetMixedEvent()->GetVertexOfEvent(iev)->GetXYZ(GetVertex(iev));
1032// }
1033// }
1e68a3f4 1034// Double_t vertex2[] = {0.0,0.0,0.0} ; //vertex of second input aod
1035// if(GetReader()->GetDataType()!= AliCaloTrackReader::kMC)
1036// {
1037// if(GetReader()->GetSecondInputAODTree()) GetReader()->GetSecondInputAODVertex(vertex2);
1038// }
f8006433 1039//
1040// //Cluster loop, select pairs with good pt, phi and fill AODs or histograms
1041// //Int_t iEvent= GetReader()->GetEventNumber() ;
1042// Int_t nclus = pl->GetEntriesFast();
1043// for(Int_t iclus = 0;iclus < nclus ; iclus ++ ){
1044// AliVCluster * calo = (AliVCluster *) (pl->At(iclus)) ;
1045//
1046// Int_t evtIndex1 = 0 ;
1047// if (GetMixedEvent()) {
1048// evtIndex1=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
1049// }
1050//
1051//
1052// //Input from second AOD?
1053// Int_t inputi = 0;
be518ab0 1054// if (aodParticle->GetDetector() == "EMCAL" && GetReader()->GetEMCALClustersNormalInputEntries() <= iclus)
1e68a3f4 1055// inputi = 1 ;
be518ab0 1056// else if(aodParticle->GetDetector() == "PHOS" && GetReader()->GetPHOSClustersNormalInputEntries() <= iclus)
1e68a3f4 1057// inputi = 1;
f8006433 1058//
1059// //Cluster selection, not charged, with photon or pi0 id and in fiducial cut
1060// //FIXME
1061// Int_t pdg=0;
1062// //if (inputi == 0 && !SelectCluster(calo, GetVertex(evtIndex1), gammai, pdg))
1063// continue ;
1064// //MEFIX
1e68a3f4 1065// else if(inputi == 1 && !SelectCluster(calo, vertex2, gammai, pdg))
1066// continue ;
f8006433 1067//
1068// if(GetDebug() > 2)
1069// printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Neutral cluster in %s: pt %f, phi %f, phi trigger %f. Cuts: delta phi min %2.2f, max %2.2f, pT min %2.2f \n",
1070// detector.Data(), gammai.Pt(),gammai.Phi(),phiTrig,fDeltaPhiMinCut, fDeltaPhiMaxCut, GetMinPt());
1071//
1072// //2 gamma overlapped, found with PID
1073// if(pdg == AliCaloPID::kPi0){
1074//
1075// //Select only hadrons in pt range
1076// if(gammai.Pt() < GetMinPt() || gammai.Pt() > GetMaxPt())
1077// continue ;
1078//
1079// //Selection within angular range
1080// Float_t phi = gammai.Phi();
1081// if(phi < 0) phi+=TMath::TwoPi();
1082// //Float_t deltaphi = TMath::Abs(phiTrig-phi);
1083// //if( (deltaphi < fDeltaPhiMinCut) || ( deltaphi > fDeltaPhiMaxCut) ) continue ;
1084//
1085// AliAODPWG4Particle pi0 = AliAODPWG4Particle(gammai);
1086// //pi0.SetLabel(calo->GetLabel());
1087// pi0.SetPdg(AliCaloPID::kPi0);
1088// pi0.SetDetector(detector);
1089//
1090// if(IsDataMC()){
1091// pi0.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(),GetReader(),inputi));
1092// if(GetDebug() > 0) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Origin of candidate %d\n",pi0.GetTag());
1093// }//Work with stack also
1094// //Set the indeces of the original caloclusters
1095// pi0.SetCaloLabel(calo->GetID(),-1);
1096// AddAODParticle(pi0);
1097//
1098// if(GetDebug() > 2)
1099// printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Correlated with selected pi0 (pid): pt %f, phi %f\n",pi0.Pt(),pi0.Phi());
1100//
1101// }// pdg = 111
1102//
1103// //Make invariant mass analysis
1104// else if(pdg == AliCaloPID::kPhoton){
1105// //Search the photon companion in case it comes from a Pi0 decay
1106// //Apply several cuts to select the good pair;
1107// for(Int_t jclus = iclus+1; jclus < pl->GetEntries() ; jclus ++ ){
1108// AliVCluster * calo2 = (AliVCluster *) (pl->At(jclus)) ;
1109// Int_t evtIndex2 = 0 ;
1110// if (GetMixedEvent()) {
1111// evtIndex2=GetMixedEvent()->EventIndexForCaloCluster(calo->GetID()) ;
1112// }
1113// if (GetMixedEvent() && (evtIndex1 == evtIndex2))
1114// continue ;
1115//
1116// //Input from second AOD?
1117// Int_t inputj = 0;
be518ab0 1118// if (aodParticle->GetDetector() == "EMCAL" && GetReader()->GetEMCALClustersNormalInputEntries() <= jclus)
1e68a3f4 1119// inputj = 1;
be518ab0 1120// else if(aodParticle->GetDetector() == "PHOS" && GetReader()->GetPHOSClustersNormalInputEntries() <= jclus)
1e68a3f4 1121// inputj = 1;
f8006433 1122//
1123// //Cluster selection, not charged with photon or pi0 id and in fiducial cut
1124// Int_t pdgj=0;
1125// //FIXME
1126// //if (inputj == 0 && !SelectCluster(calo2, GetVertex(evtIndex2), gammaj, pdgj))
1127// continue ;
1128// //MEFIX
1129//
1e68a3f4 1130// else if(inputj == 1 && !SelectCluster(calo2, vertex2, gammaj, pdgj))
1131// continue ;
f8006433 1132// //FIXME
1133// //if(!SelectCluster(calo2,GetVertex(evtIndex2), gammaj, pdgj))
1134// //MEFIX
1135// continue ;
1136//
1137// if(pdgj == AliCaloPID::kPhoton ){
1138//
1139// if((gammai+gammaj).Pt() < GetMinPt() || (gammai+gammaj).Pt() > GetMaxPt())
1140// continue ;
1141//
1142// //Selection within angular range
1143// Float_t phi = (gammai+gammaj).Phi();
1144// if(phi < 0) phi+=TMath::TwoPi();
1145// //Float_t deltaphi = TMath::Abs(phiTrig-phi);
1146// //if( (deltaphi < fDeltaPhiMinCut) || ( deltaphi > fDeltaPhiMaxCut) ) continue ;
1147//
1148// //Select good pair (aperture and invariant mass)
1149// if(GetNeutralMesonSelection()->SelectPair(gammai, gammaj)){
1150//
1151// if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Neutral Hadron Correlation: AOD Selected gamma pair: pt %2.2f, phi %2.2f, eta %2.2f, M %2.3f\n",
1152// (gammai+gammaj).Pt(),(gammai+gammaj).Phi(),(gammai+gammaj).Eta(), (gammai+gammaj).M());
1153//
1154// TLorentzVector pi0mom = gammai+gammaj;
1155// AliAODPWG4Particle pi0 = AliAODPWG4Particle(pi0mom);
1156// //pi0.SetLabel(calo->GetLabel());
1157// pi0.SetPdg(AliCaloPID::kPi0);
1158// pi0.SetDetector(detector);
1159// if(IsDataMC()){
1160// //Check origin of the candidates
1161//
1162// Int_t label1 = calo->GetLabel();
1163// Int_t label2 = calo2->GetLabel();
1164// Int_t tag1 = GetMCAnalysisUtils()->CheckOrigin(label1, GetReader(), inputi);
1165// Int_t tag2 = GetMCAnalysisUtils()->CheckOrigin(label2, GetReader(), inputj);
1166//
1167// if(GetDebug() > 0)
1168// printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - Origin of: photon1 %d; photon2 %d \n",tag1, tag2);
1169// if(GetMCAnalysisUtils()->CheckTagBit(tag1,AliMCAnalysisUtils::kMCPi0Decay) && GetMCAnalysisUtils()->CheckTagBit(tag2,AliMCAnalysisUtils::kMCPi0Decay)){
1170//
1171// //Check if pi0 mother is the same
1172// if(GetReader()->ReadStack()){
1173// TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree
1174// label1 = mother1->GetFirstMother();
1175// //mother1 = GetMCStack()->Particle(label1);//pi0
1176//
1177// TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree
1178// label2 = mother2->GetFirstMother();
1179// //mother2 = GetMCStack()->Particle(label2);//pi0
1180// }
1181// else if(GetReader()->ReadAODMCParticles()){
1182// AliAODMCParticle * mother1 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(inputi))->At(label1);//photon in kine tree
1183// label1 = mother1->GetMother();
1184// //mother1 = GetMCStack()->Particle(label1);//pi0
1185// AliAODMCParticle * mother2 = (AliAODMCParticle *) (GetReader()->GetAODMCParticles(inputj))->At(label2);//photon in kine tree
1186// label2 = mother2->GetMother();
1187// //mother2 = GetMCStack()->Particle(label2);//pi0
1188// }
1189//
1190// //printf("mother1 %d, mother2 %d\n",label1,label2);
1191// if(label1 == label2)
1192// GetMCAnalysisUtils()->SetTagBit(tag,AliMCAnalysisUtils::kMCPi0);
1193// }
1194// }//Work with mc information also
1195// pi0.SetTag(tag);
1196// //Set the indeces of the original caloclusters
1197// pi0.SetCaloLabel(calo->GetID(), calo2->GetID());
1198// AddAODParticle(pi0);
1199//
1200//
1201// }//Pair selected
1202// }//if pair of gammas
1203// }//2nd loop
1204// }// if pdg = 22
1205// }//1st loop
1206//
1207// if(GetDebug() > 1)
1208// printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillAOD() - End, %d pi0's found \n",GetOutputAODBranch()->GetEntriesFast());
1209//}
9415d854 1210
1211//____________________________________________________________________________
f8006433 1212void AliAnaParticleHadronCorrelation::MakeNeutralCorrelation(AliAODPWG4ParticleCorrelation * const aodParticle, TObjArray* pi0list, const Bool_t bFillHisto)
9415d854 1213{
1214 // Neutral Pion Correlation Analysis
f8006433 1215 if(GetDebug() > 1) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Make trigger particle - pi0 correlation, %d pi0's \n",pi0list->GetEntriesFast());
1216
1217 Int_t evtIndex11 = 0 ;
1218 Int_t evtIndex12 = 0 ;
1219 if (GetMixedEvent()) {
1220 evtIndex11 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(0)) ;
1221 evtIndex12 = GetMixedEvent()->EventIndexForCaloCluster(aodParticle->GetCaloLabel(1)) ;
1222 }
9415d854 1223
f8006433 1224 Double_t pt = -100.;
dd4871cd 1225 Double_t px = -100.;
1226 Double_t py = -100.;
9415d854 1227 Double_t rat = -100.;
1228 Double_t phi = -100.;
1229 Double_t eta = -100.;
dd4871cd 1230 Double_t xE = -100.;
1231 Double_t cosi = -100.;
f8006433 1232
9415d854 1233 Double_t ptTrig = aodParticle->Pt();
1234 Double_t phiTrig = aodParticle->Phi();
1235 Double_t etaTrig = aodParticle->Eta();
dd4871cd 1236 Double_t pxTrig = aodParticle->Px();
1237 Double_t pyTrig = aodParticle->Py();
9415d854 1238
f8006433 1239
1240 Int_t indexPhoton1 = -1 ;
1241 Int_t indexPhoton2 = -1 ;
1242 Double_t ptDecay1 = 0. ;
1243 Double_t pxDecay1 = 0. ;
1244 Double_t pyDecay1 = 0. ;
1245 Double_t phiDecay1 = 0. ;
1246 Double_t ptDecay2 = 0. ;
1247 Double_t pxDecay2 = 0. ;
1248 Double_t pyDecay2 = 0. ;
1249 Double_t phiDecay2 = 0. ;
1250
1251 Double_t ratDecay1 = -100.;
1252 Double_t ratDecay2 = -100.;
1253 Float_t deltaphi = -100. ;
1254 Float_t deltaphiDecay1 = -100. ;
1255 Float_t deltaphiDecay2 = -100. ;
1256 TObjArray * clusters = 0x0 ;
1257 TLorentzVector photonMom ;
1258 if(fPi0Trigger){
1259 indexPhoton1 = aodParticle->GetCaloLabel (0);
1260 indexPhoton2 = aodParticle->GetCaloLabel (1);
1261 if(GetDebug() > 1)printf("indexPhoton1 = %d, indexPhoton2 = %d \n", indexPhoton1, indexPhoton2);
1262
1263 if(indexPhoton1!=-1 && indexPhoton2!=-1){
be518ab0 1264 if(aodParticle->GetDetector()=="EMCAL") clusters = GetEMCALClusters() ;
1265 else clusters = GetPHOSClusters() ;
f8006433 1266 for(Int_t iclus = 0; iclus < clusters->GetEntriesFast(); iclus++){
1267 AliVCluster * photon = (AliVCluster*) (clusters->At(iclus));
1268 photon->GetMomentum(photonMom,GetVertex(0)) ;
1269 if(photon->GetID()==indexPhoton1) {
1270 ptDecay1 = photonMom.Pt();
1271 pxDecay1 = photonMom.Px();
1272 pyDecay1 = photonMom.Py();
1273 phiDecay1 = photonMom.Phi();
1274 }
1275 if(photon->GetID()==indexPhoton2) {
1276 ptDecay2 = photonMom.Pt();
1277 pxDecay2 = photonMom.Px();
1278 pyDecay2 = photonMom.Py();
1279 phiDecay2 = photonMom.Phi();
1280 }
1281 if(GetDebug() > 1)printf("Photon1 = %f, Photon2 = %f \n", ptDecay1, ptDecay2);
1282 } //photonAOD loop
1283 } //index of decay photons found
1284 if(ptTrig && bFillHisto) fhPtPi0DecayRatio->Fill(ptTrig, ptDecay1/ptTrig, ptDecay2/ptTrig);
1285 } //make decay-hadron correlation
1286
1287 TObjArray * refpi0 =0x0;
1288 Int_t nrefs = 0;
9415d854 1289
1290 //Loop on stored AOD pi0
f8006433 1291 Int_t naod = pi0list->GetEntriesFast();
9415d854 1292 if(GetDebug() > 0) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelationFillHistograms() - aod branch entries %d\n", naod);
1293 for(Int_t iaod = 0; iaod < naod ; iaod++){
f8006433 1294 AliAODPWG4Particle* pi0 = (AliAODPWG4Particle*) (pi0list->At(iaod));
1295
1296 Int_t evtIndex2 = 0 ;
1297 Int_t evtIndex3 = 0 ;
1298 if (GetMixedEvent()) {
1299 evtIndex2 = GetMixedEvent()->EventIndexForCaloCluster(pi0->GetCaloLabel(0)) ;
1300 evtIndex3 = GetMixedEvent()->EventIndexForCaloCluster(pi0->GetCaloLabel(1)) ;
1301
1302 if (evtIndex11 == evtIndex2 || evtIndex12 == evtIndex2 || evtIndex11 == evtIndex3 || evtIndex12 == evtIndex3) // trigger and pi0 are not from different events
1303 continue ;
1304 }
1305
1306 //Int_t pdg = pi0->GetPdg();
1307 //if(pdg != AliCaloPID::kPi0) continue;
9415d854 1308
9415d854 1309 pt = pi0->Pt();
f8006433 1310 px = pi0->Px();
1311 py = pi0->Py();
9415d854 1312 if(pt < GetMinPt() || pt > GetMaxPt()) continue ;
2244659d 1313 //jumped out this event if near side associated partile pt larger than trigger
1314 if(pt > ptTrig && TMath::Abs(phi-phiTrig)<TMath::PiOver2()) break ;
1315
9415d854 1316 //Selection within angular range
1317 phi = pi0->Phi();
dde5a268 1318 //Float_t deltaphi = TMath::Abs(phiTrig-phi);
1319 //if( (deltaphi < fDeltaPhiMinCut) || ( deltaphi > fDeltaPhiMaxCut) ) continue ;
9415d854 1320
f8006433 1321 if(bFillHisto){
1322
1323 deltaphi = phiTrig-phi;
1324 if(deltaphi<-TMath::PiOver2()) deltaphi+=TMath::TwoPi();
1325 if(deltaphi>3*TMath::PiOver2()) deltaphi-=TMath::TwoPi();
1326
1327 rat = pt/ptTrig ;
1328 phi = pi0->Phi() ;
1329 eta = pi0->Eta() ;
1330 xE = -(px*pxTrig+py*pyTrig)/(ptTrig*ptTrig);
1331 if(xE <0.)xE =-xE;
1332 cosi = TMath::Log(1/xE);
1333
1334 if(fPi0Trigger){
1335 if(indexPhoton1!=-1 && indexPhoton2!=-1){
1336 if(ptDecay1) ratDecay1 = pt/ptDecay1 ;
1337 if(ptDecay2) ratDecay2 = pt/ptDecay2 ;
1338 deltaphiDecay1 = phiDecay1-phi;
1339 deltaphiDecay2 = phiDecay2-phi;
1340 if(deltaphiDecay1< -TMath::PiOver2()) deltaphiDecay1+=TMath::TwoPi();
1341 if(deltaphiDecay1>3*TMath::PiOver2()) deltaphiDecay1-=TMath::TwoPi();
1342 if(deltaphiDecay2< -TMath::PiOver2()) deltaphiDecay2+=TMath::TwoPi();
1343 if(deltaphiDecay2>3*TMath::PiOver2()) deltaphiDecay2-=TMath::TwoPi();
5025c139 1344 fhDeltaPhiDecayNeutral->Fill(ptDecay1, deltaphiDecay1);
1345 fhDeltaPhiDecayNeutral->Fill(ptDecay2, deltaphiDecay2);
f8006433 1346 if(GetDebug() > 1)printf("deltaPhoton1 = %f, deltaPhoton2 = %f \n", deltaphiDecay1, deltaphiDecay2);
1347 if( (deltaphiDecay1 > fDeltaPhiMinCut) && ( deltaphiDecay1 < fDeltaPhiMaxCut) )
5025c139 1348 fhPtImbalanceDecayNeutral->Fill(ptDecay1,ratDecay1);
f8006433 1349 if( (deltaphiDecay2 > fDeltaPhiMinCut) && ( deltaphiDecay2 < fDeltaPhiMaxCut) )
5025c139 1350 fhPtImbalanceDecayNeutral->Fill(ptDecay2,ratDecay2);
f8006433 1351 if(GetDebug() > 1)printf("ratPhoton1 = %f, ratPhoton2 = %f \n", pt/ptDecay1, pt/ptDecay2);
1352 }
1353 } //do decay-hadron correlation
1354
1355 fhEtaNeutral->Fill(pt,eta);
1356 fhPhiNeutral->Fill(pt,phi);
1357 fhDeltaEtaNeutral->Fill(ptTrig,etaTrig-eta);
1358 fhDeltaPhiNeutral->Fill(ptTrig,deltaphi);
1359 fhDeltaPhiDeltaEtaNeutral->Fill(deltaphi,etaTrig-eta);
1360
1361 //delta phi cut for correlation
1362 if( (deltaphi > fDeltaPhiMinCut) && ( deltaphi < fDeltaPhiMaxCut) ) {
1363 fhDeltaPhiNeutralPt->Fill(pt,deltaphi);
1364 fhPtImbalanceNeutral->Fill(ptTrig,rat);
1365 fhPtHbpNeutral->Fill(ptTrig,cosi);
1366 }
123fc3bd 1367 else {
f8006433 1368 fhDeltaPhiUeNeutralPt->Fill(pt,deltaphi);
1369 fhPtImbalanceUeNeutral->Fill(ptTrig,rat);
1370 fhPtHbpUeNeutral->Fill(ptTrig,cosi);
123fc3bd 1371 }
f8006433 1372 //several UE calculation
123fc3bd 1373 if(fMakeSeveralUE){
f8006433 1374 if((deltaphi<-fUeDeltaPhiMinCut) && (deltaphi >-fUeDeltaPhiMaxCut)){
1375 fhDeltaPhiUeLeftNeutral->Fill(pt,deltaphi);
1376 fhPtImbalanceUeLeftNeutral->Fill(ptTrig,rat);
1377 fhPtHbpUeLeftNeutral->Fill(ptTrig,cosi);
1378 }
1379 if((deltaphi>fUeDeltaPhiMinCut) && (deltaphi <fUeDeltaPhiMaxCut)){
1380 fhDeltaPhiUeRightNeutral->Fill(pt,deltaphi);
1381 fhPtImbalanceUeRightNeutral->Fill(ptTrig,rat);
1382 fhPtHbpUeRightNeutral->Fill(ptTrig,cosi);
1383 }
123fc3bd 1384 } //several UE calculation
f8006433 1385 }
1386 else{
1387 nrefs++;
1388 if(nrefs==1){
1389 refpi0 = new TObjArray(0);
1390 refpi0->SetName(GetAODObjArrayName()+"Pi0s");
1391 refpi0->SetOwner(kFALSE);
1392 }
1393 refpi0->Add(pi0);
1394 }//put references in trigger AOD
1395
1396 //if(GetDebug() > 2 ) printf("AliAnaParticleHadronCorrelation::MakeNeutralCorrelation() - Selected neutral for momentum imbalance: pt %2.2f, phi %2.2f, eta %2.2f \n",pt,phi,eta);
1397
1398 }//loop
1c5acb87 1399}
f8006433 1400
9415d854 1401
1c5acb87 1402//____________________________________________________________________________
f8006433 1403//Bool_t AliAnaParticleHadronCorrelation::SelectCluster(AliVCluster * calo, Double_t *vertex, TLorentzVector & mom, Int_t & pdg) {
1404// //Select cluster depending on its pid and acceptance selections
1405//
1406// //Skip matched clusters with tracks
1407// if(IsTrackMatched(calo)) return kFALSE;
1408//
1409// TString detector = "";
1410// if (calo->IsPHOS()) detector= "PHOS";
1411// else if(calo->IsEMCAL()) detector= "EMCAL";
1412//
1413// //Check PID
1414// calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line
1415// pdg = AliCaloPID::kPhoton;
1416// if(IsCaloPIDOn()){
1417// //Get most probable PID, 2 options check PID weights (in MC this option is mandatory)
1418// //or redo PID, recommended option for EMCal.
1419//
1420// if(!IsCaloPIDRecalculationOn() || GetReader()->GetDataType() == AliCaloTrackReader::kMC )
1421// pdg = GetCaloPID()->GetPdg(detector,calo->GetPID(),mom.E());//PID with weights
1422// else
1423// pdg = GetCaloPID()->GetPdg(detector,mom,calo);//PID recalculated
1424//
1425// if(GetDebug() > 5) printf("AliAnaParticleHadronCorrelation::SelectCluster() - PDG of identified particle %d\n",pdg);
1426//
1427// //If it does not pass pid, skip
1428// if(pdg != AliCaloPID::kPhoton && pdg != AliCaloPID::kPi0) {
1429// return kFALSE ;
1430// }
1431// }//PID on
1432//
1433// //Check acceptance selection
1434// if(IsFiducialCutOn()){
1435// Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,detector) ;
1436// if(! in ) return kFALSE ;
1437// }
1438//
1439// if(GetDebug() > 5) printf("AliAnaParticleHadronCorrelation::SelectCluster() - Correlation photon selection cuts passed: pT %3.2f, pdg %d\n",mom.Pt(), pdg);
1440//
1441// return kTRUE;
1442//
1443//}