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