]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/AliAnaGammaHadron.cxx
Changed \ingroup (for Doxygen), now in MUONcore.
[u/mrichter/AliRoot.git] / PWG4 / AliAnaGammaHadron.cxx
CommitLineData
f9cea31c 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/* History of cvs commits:
18 *
19 * $Log$
3788def4 20 * Revision 1.7 2007/10/29 13:48:42 gustavo
21 * Corrected coding violations
22 *
4b707925 23 * Revision 1.5 2007/08/17 12:40:04 schutz
24 * New analysis classes by Gustavo Conesa
25 *
bdcfac30 26 * Revision 1.4.4.2 2007/07/26 10:32:09 schutz
27 * new analysis classes in the the new analysis framework
2a1d8a29 28 *
f9cea31c 29 *
30 */
31
32//_________________________________________________________________________
bdcfac30 33// Class for the analysis of gamma - hadron correlations
f9cea31c 34//*-- Author: Gustavo Conesa (LNF-INFN)
35//////////////////////////////////////////////////////////////////////////////
36
37
38// --- ROOT system ---
f9cea31c 39#include "Riostream.h"
bdcfac30 40
41//---- AliRoot system ----
f9cea31c 42#include "AliLog.h"
bdcfac30 43#include "AliNeutralMesonSelection.h"
44#include "AliAnaGammaHadron.h"
f9cea31c 45
46ClassImp(AliAnaGammaHadron)
47
bdcfac30 48
f9cea31c 49//____________________________________________________________________________
bdcfac30 50 AliAnaGammaHadron::AliAnaGammaHadron() :
51 AliAnaGammaCorrelation(),
52 fhPhiCharged(0), fhPhiNeutral(0), fhEtaCharged(0), fhEtaNeutral(0),
53 fhDeltaPhiGammaCharged(0), fhDeltaPhiGammaNeutral(0),
4b707925 54 fhDeltaEtaGammaCharged(0), fhDeltaEtaGammaNeutral(0),
55 fhDeltaPhiChargedPt(0),
bdcfac30 56 fhCorrelationGammaNeutral(0), fhCorrelationGammaCharged(0)
f9cea31c 57{
bdcfac30 58 //Default Ctor
f9cea31c 59
bdcfac30 60 SetCorrelationType(kHadron);
61 //Initialize parameters
62 InitParameters();
f9cea31c 63}
64
f9cea31c 65//____________________________________________________________________________
bdcfac30 66AliAnaGammaHadron::AliAnaGammaHadron(const AliAnaGammaHadron & g) :
67 AliAnaGammaCorrelation(g),
68 fhPhiCharged(g.fhPhiCharged), fhPhiNeutral(g.fhPhiNeutral),
69 fhEtaCharged(g.fhEtaCharged), fhEtaNeutral(g.fhEtaNeutral),
70 fhDeltaPhiGammaCharged(g.fhDeltaPhiGammaCharged),
71 fhDeltaPhiGammaNeutral(g.fhDeltaPhiGammaNeutral),
72 fhDeltaEtaGammaCharged(g.fhDeltaEtaGammaCharged),
73 fhDeltaEtaGammaNeutral(g.fhDeltaEtaGammaNeutral),
4b707925 74 fhDeltaPhiChargedPt(g.fhDeltaPhiChargedPt),
bdcfac30 75 fhCorrelationGammaNeutral(g.fhCorrelationGammaNeutral),
76 fhCorrelationGammaCharged(g.fhCorrelationGammaCharged)
f9cea31c 77{
78 // cpy ctor
f9cea31c 79
80}
81
463ee300 82//_________________________________________________________________________
83AliAnaGammaHadron & AliAnaGammaHadron::operator = (const AliAnaGammaHadron & source)
84{
bdcfac30 85 // assignment operator
86
87 if(this == &source)return *this;
88 ((AliAnaGammaCorrelation *)this)->operator=(source);
463ee300 89
bdcfac30 90 fhPhiCharged = source.fhPhiCharged ; fhPhiNeutral = source.fhPhiNeutral ;
91 fhEtaCharged = source.fhEtaCharged ; fhEtaNeutral = source.fhEtaNeutral ;
92 fhDeltaPhiGammaCharged = source.fhDeltaPhiGammaCharged ;
93 fhDeltaPhiGammaNeutral = source.fhDeltaPhiGammaNeutral ;
94 fhDeltaEtaGammaCharged = source.fhDeltaEtaGammaCharged ;
95 fhDeltaEtaGammaNeutral = source.fhDeltaEtaGammaNeutral ;
4b707925 96 fhDeltaPhiChargedPt = source.fhDeltaPhiChargedPt ;
bdcfac30 97
98 fhCorrelationGammaNeutral = source.fhCorrelationGammaNeutral ;
99 fhCorrelationGammaCharged = source.fhCorrelationGammaCharged ;
463ee300 100
101 return *this;
bdcfac30 102
463ee300 103}
104
f9cea31c 105//____________________________________________________________________________
106AliAnaGammaHadron::~AliAnaGammaHadron()
107{
3788def4 108 // Remove all pointers except analysis output pointers.
f9cea31c 109}
110
2a1d8a29 111
112//________________________________________________________________________
bdcfac30 113TList * AliAnaGammaHadron::GetCreateOutputObjects()
2a1d8a29 114{
115
463ee300 116 // Create histograms to be saved in output file and
bdcfac30 117 // store them in fOutputContainer
118 TList * outputContainer = new TList() ;
119 outputContainer->SetName("GammaCorrelationHistos") ;
2a1d8a29 120
121 fhPhiCharged = new TH2F
122 ("PhiCharged","#phi_{#pi^{#pm}} vs p_{T #gamma}",
123 120,0,120,120,0,7);
124 fhPhiCharged->SetYTitle("#phi_{#pi^{#pm}} (rad)");
125 fhPhiCharged->SetXTitle("p_{T #gamma} (GeV/c)");
2a1d8a29 126
127 fhEtaCharged = new TH2F
128 ("EtaCharged","#eta_{#pi^{#pm}} vs p_{T #gamma}",
129 120,0,120,120,-1,1);
130 fhEtaCharged->SetYTitle("#eta_{#pi^{#pm}} (rad)");
131 fhEtaCharged->SetXTitle("p_{T #gamma} (GeV/c)");
bdcfac30 132
2a1d8a29 133 fhDeltaPhiGammaCharged = new TH2F
134 ("DeltaPhiGammaCharged","#phi_{#gamma} - #phi_{charged #pi} vs p_{T #gamma}",
135 200,0,120,200,0,6.4);
136 fhDeltaPhiGammaCharged->SetYTitle("#Delta #phi");
137 fhDeltaPhiGammaCharged->SetXTitle("p_{T #gamma} (GeV/c)");
4b707925 138
139 fhDeltaPhiChargedPt = new TH2F
140 ("DeltaPhiChargedPt","#phi_{#gamma} - #phi_{charged #pi} vs p_{T #pi}",
141 200,0,120,200,0,6.4);
142 fhDeltaPhiChargedPt->SetYTitle("#Delta #phi");
143 fhDeltaPhiChargedPt->SetXTitle("p_{T #pi} (GeV/c)");
144
2a1d8a29 145 fhDeltaEtaGammaCharged = new TH2F
146 ("DeltaEtaGammaCharged","#eta_{#gamma} - #eta_{#pi^{#pm}} vs p_{T #gamma}",
147 200,0,120,200,-2,2);
148 fhDeltaEtaGammaCharged->SetYTitle("#Delta #eta");
149 fhDeltaEtaGammaCharged->SetXTitle("p_{T #gamma} (GeV/c)");
2a1d8a29 150
bdcfac30 151 fhCorrelationGammaCharged =
152 new TH2F("CorrelationGammaCharged","z_{#gamma #pi} = p_{T #pi^{#pm}} / p_{T #gamma}",
153 240,0.,120.,1000,0.,1.2);
154 fhCorrelationGammaCharged->SetYTitle("z_{#gamma #pi}");
155 fhCorrelationGammaCharged->SetXTitle("p_{T #gamma}");
2a1d8a29 156
bdcfac30 157 outputContainer->Add(fhPhiCharged) ;
158 outputContainer->Add(fhEtaCharged) ;
159 outputContainer->Add(fhDeltaPhiGammaCharged) ;
160 outputContainer->Add(fhDeltaEtaGammaCharged) ;
161 outputContainer->Add(fhCorrelationGammaCharged) ;
4b707925 162 outputContainer->Add(fhDeltaPhiChargedPt) ;
bdcfac30 163
164 if(!AreJetsOnlyInCTS()){
165 //---- kHadron and kJetLeadCone ----
166 fhPhiNeutral = new TH2F
167 ("PhiNeutral","#phi_{#pi^{0}} vs p_{T #gamma}",
168 120,0,120,120,0,7);
169 fhPhiNeutral->SetYTitle("#phi_{#pi^{0}} (rad)");
170 fhPhiNeutral->SetXTitle("p_{T #gamma} (GeV/c)");
2a1d8a29 171
bdcfac30 172 fhEtaNeutral = new TH2F
173 ("EtaNeutral","#eta_{#pi^{0}} vs p_{T #gamma}",
174 120,0,120,120,-1,1);
175 fhEtaNeutral->SetYTitle("#eta_{#pi^{0}} (rad)");
176 fhEtaNeutral->SetXTitle("p_{T #gamma} (GeV/c)");
2a1d8a29 177
bdcfac30 178 fhDeltaPhiGammaNeutral = new TH2F
179 ("DeltaPhiGammaNeutral","#phi_{#gamma} - #phi_{#pi^{0}} vs p_{T #gamma}",
180 200,0,120,200,0,6.4);
181 fhDeltaPhiGammaNeutral->SetYTitle("#Delta #phi");
182 fhDeltaPhiGammaNeutral->SetXTitle("p_{T #gamma} (GeV/c)");
2a1d8a29 183
bdcfac30 184 fhDeltaEtaGammaNeutral = new TH2F
185 ("DeltaEtaGammaNeutral","#eta_{#gamma} - #eta_{#pi^{#pm}} vs p_{T #gamma}",
186 200,0,120,200,-2,2);
187 fhDeltaEtaGammaNeutral->SetYTitle("#Delta #eta");
188 fhDeltaEtaGammaNeutral->SetXTitle("p_{T #gamma} (GeV/c)");
2a1d8a29 189
2a1d8a29 190 fhCorrelationGammaNeutral =
191 new TH2F("CorrelationGammaNeutral","z_{#gamma #pi} = p_{T #pi^{0}} / p_{T #gamma}",
192 240,0.,120.,1000,0.,1.2);
193 fhCorrelationGammaNeutral->SetYTitle("z_{#gamma #pi}");
194 fhCorrelationGammaNeutral->SetXTitle("p_{T #gamma}");
f9cea31c 195
bdcfac30 196 outputContainer->Add(fhPhiNeutral) ;
197 outputContainer->Add(fhEtaNeutral) ;
198 outputContainer->Add(fhDeltaPhiGammaNeutral) ;
199 outputContainer->Add(fhDeltaEtaGammaNeutral) ;
200 outputContainer->Add(fhCorrelationGammaNeutral) ;
f9cea31c 201 }
bdcfac30 202
203 SetOutputContainer(outputContainer);
f9cea31c 204
bdcfac30 205 return outputContainer;
206}
f9cea31c 207
bdcfac30 208 //____________________________________________________________________________
209void AliAnaGammaHadron::InitParameters()
210{
211
212 //Initialize the parameters of the analysis.
f9cea31c 213
bdcfac30 214 SetMinPtHadron(2.) ;
215 SetDeltaPhiCutRange(1.5,4.5);
216 SetJetsOnlyInCTS(kFALSE) ;
f9cea31c 217
bdcfac30 218}
f9cea31c 219
bdcfac30 220//__________________________________________________________________
221void AliAnaGammaHadron::Print(const Option_t * opt) const
222{
f9cea31c 223
bdcfac30 224 //Print some relevant parameters set for the analysis
225 if(! opt)
226 return;
227
228 Info("Print", "%s %s", GetName(), GetTitle() ) ;
229 printf("Correlation analysis = %d\n", kHadron) ;
230 printf("pT Hadron > %f\n", GetMinPtHadron()) ;
231 printf("Phi gamma-Hadron < %f\n", GetDeltaPhiMaxCut()) ;
232 printf("Phi gamma-Hadron > %f\n", GetDeltaPhiMinCut()) ;
f9cea31c 233
f9cea31c 234
bdcfac30 235}
f9cea31c 236
bdcfac30 237//____________________________________________________________________________
238void AliAnaGammaHadron::MakeGammaCorrelation(TParticle * pGamma, TClonesArray * plCTS, TClonesArray * plCalo)
239{
240 //Gamma Hadron Correlation Analysis
241 AliDebug(2, "Make gamma-hadron correlation");
f9cea31c 242
bdcfac30 243 MakeGammaChargedCorrelation(pGamma, plCTS);
244 if(!AreJetsOnlyInCTS())
245 MakeGammaNeutralCorrelation(pGamma, plCalo);
f9cea31c 246
f9cea31c 247
bdcfac30 248}
f9cea31c 249
250//____________________________________________________________________________
bdcfac30 251void AliAnaGammaHadron::MakeGammaChargedCorrelation(TParticle * pGamma, TClonesArray * pl)
f9cea31c 252{
bdcfac30 253 //Gamma Charged Hadron Correlation Analysis
254 AliDebug(2,"Make gamma-charged hadron correlation");
255
f9cea31c 256 Double_t ptg = pGamma->Pt();
257 Double_t phig = pGamma->Phi();
258 Double_t pt = -100.;
259 Double_t rat = -100.;
260 Double_t phi = -100. ;
261
262 for(Int_t ipr = 0;ipr < pl->GetEntries() ; ipr ++ ){
263
264 TParticle * particle = dynamic_cast<TParticle *>(pl->At(ipr)) ;
265
266 pt = particle->Pt();
267 rat = pt/ptg ;
268 phi = particle->Phi() ;
269
bdcfac30 270 AliDebug(3,Form("pt %f, phi %f, phi gamma %f. Cuts: delta phi min %f, max%f, pT min %f",pt,phi,phig,GetDeltaPhiMinCut(),GetDeltaPhiMaxCut(),GetMinPtHadron()));
f9cea31c 271
272 fhEtaCharged->Fill(ptg,particle->Eta());
273 fhPhiCharged->Fill(ptg,phi);
274 fhDeltaEtaGammaCharged->Fill(ptg,pGamma->Eta()-particle->Eta());
275 fhDeltaPhiGammaCharged->Fill(ptg,phig-phi);
4b707925 276 fhDeltaPhiChargedPt->Fill(pt,phig-phi);
277
f9cea31c 278 //Selection within angular and energy limits
bdcfac30 279 if(((phig-phi)> GetDeltaPhiMinCut()) && ((phig-phi)<GetDeltaPhiMaxCut()) && pt > GetMinPtHadron()){
f9cea31c 280 AliDebug(2,Form("Selected: pt %f, phi %f",pt,phi));
281 fhCorrelationGammaCharged->Fill(ptg,rat);
282 }
283 }//particle loop
284}
285
286//____________________________________________________________________________
bdcfac30 287void AliAnaGammaHadron::MakeGammaNeutralCorrelation(TParticle * pGamma, TClonesArray * pl)
f9cea31c 288{
bdcfac30 289 //Gamma Neutral Hadron Correlation Analysis
290 AliDebug(2,"Make gamma-neutral hadron correlation");
f9cea31c 291
f9cea31c 292 Double_t pt = -100.;
293 Double_t rat = -100.;
294 Double_t phi = -100. ;
295 Double_t ptg = pGamma->Pt();
296 Double_t phig = pGamma->Phi();
f9cea31c 297
bdcfac30 298 TIter next(pl);
299 TParticle * particlei = 0;
300 TParticle * particlej = 0;
301 TLorentzVector gammai;
302 TLorentzVector gammaj;
303
f9cea31c 304 Int_t iPrimary = -1;
f9cea31c 305 Int_t ksPdg = 0;
306 Int_t jPrimary=-1;
bdcfac30 307
308 while ( (particlei = (TParticle*)next()) ) {
f9cea31c 309 iPrimary++;
bdcfac30 310 ksPdg = particlei->GetPdgCode();
311 AliDebug(2, Form("neutral particles opposite to gamma: pt %f, pdg %d", particlei->Pt(),ksPdg));
f9cea31c 312 //2 gamma overlapped, found with PID
313 if(ksPdg == 111){
bdcfac30 314 pt = particlei->Pt();
f9cea31c 315 rat = pt/ptg ;
bdcfac30 316 phi = particlei->Phi() ;
317 fhEtaNeutral->Fill(ptg,particlei->Eta());
318 fhPhiNeutral->Fill(ptg,phi);
319 fhDeltaEtaGammaNeutral->Fill(ptg,pGamma->Eta()-particlei->Eta());
320 fhDeltaPhiGammaNeutral->Fill(ptg,phig-phi);
321
f9cea31c 322 //Selection within angular and energy limits
bdcfac30 323 if( (phig-phi)>GetDeltaPhiMinCut() && (phig-phi)<GetDeltaPhiMaxCut() && pt > GetMinPtHadron()){
f9cea31c 324 fhCorrelationGammaNeutral ->Fill(ptg,rat);
bdcfac30 325 AliDebug(2,Form("Selected pi0: pt %f, phi %f",pt,phi));
f9cea31c 326 }// cuts
327 }// pdg = 111
328
329 //Make invariant mass analysis
bdcfac30 330 else if(ksPdg == 22){// gamma i
331
f9cea31c 332 //Search the photon companion in case it comes from a Pi0 decay
bdcfac30 333 //Apply several cuts to select the good pair;
334 particlei->Momentum(gammai);
335 jPrimary=-1;
f9cea31c 336 TIter next2(pl);
bdcfac30 337 while ( (particlej = (TParticle*)next2()) ) {
338 jPrimary++;
339 if(jPrimary>iPrimary){
340 ksPdg = particlej->GetPdgCode();
341 particlej->Momentum(gammaj);
342 if(ksPdg == 22 ){
343
f9cea31c 344 phi = (gammai+gammaj).Phi();
345 if(phi < 0)
346 phi+=TMath::TwoPi();
bdcfac30 347 rat = (gammai+gammaj).Pt()/ptg ;
348
349 //Fill histograms
f9cea31c 350 fhEtaNeutral->Fill(ptg,(gammai+gammaj).Eta());
351 fhPhiNeutral->Fill(ptg,phi);
352 fhDeltaEtaGammaNeutral->Fill(ptg,pGamma->Eta()-(gammai+gammaj).Eta());
353 fhDeltaPhiGammaNeutral->Fill(ptg,phig-phi);
bdcfac30 354
355 //Select good pair (good phit, pt cuts, aperture and invariant mass)
356 if(GetNeutralMesonSelection()->SelectPair(pGamma, gammai, gammaj)){
357 AliDebug(2,Form("Selected gamma pair: pt %f, phi %f",(gammai+gammaj).Pt(),phi));
358 //correlation histogram
359 fhCorrelationGammaNeutral ->Fill(ptg,rat);
360 }//pair selection
361 }//if pair of gammas
362 }//jPrimary>iPrimary
f9cea31c 363 }//while
364 }// if pdg = 22
365 }//while
bdcfac30 366
f9cea31c 367}