]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrDep/AliAnaParticlePartonCorrelation.cxx
remove unnecessary return
[u/mrichter/AliRoot.git] / PWG4 / PartCorrDep / AliAnaParticlePartonCorrelation.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-parton correlations
19// Particle (for example direct gamma) must be found in a previous analysis
20// -- Author: Gustavo Conesa (LNF-INFN)
21//////////////////////////////////////////////////////////////////////////////
22
23// --- ROOT system ---
24//#include "Riostream.h"
25#include "TH2F.h"
26#include "TParticle.h"
9415d854 27#include "TClass.h"
1c5acb87 28
29//---- ANALYSIS system ----
30#include "AliAnaParticlePartonCorrelation.h"
1c5acb87 31#include "AliStack.h"
32#include "AliAODPWG4ParticleCorrelation.h"
33
34 ClassImp(AliAnaParticlePartonCorrelation)
35
36
37//____________________________________________________________________________
38 AliAnaParticlePartonCorrelation::AliAnaParticlePartonCorrelation() :
39 AliAnaPartCorrBaseClass(),
40 fhDeltaEtaNearParton(0), fhDeltaPhiNearParton(0),
41 fhDeltaPtNearParton(0), fhPtRatNearParton(0),
42 fhDeltaEtaAwayParton(0), fhDeltaPhiAwayParton(0),
43 fhDeltaPtAwayParton(0), fhPtRatAwayParton(0)
44{
45 //Default Ctor
46
47 //Initialize parameters
48 InitParameters();
49}
78219bac 50/*
1c5acb87 51//____________________________________________________________________________
52AliAnaParticlePartonCorrelation::AliAnaParticlePartonCorrelation(const AliAnaParticlePartonCorrelation & g) :
53 AliAnaPartCorrBaseClass(g),
54 fhDeltaEtaNearParton(g.fhDeltaEtaNearParton), fhDeltaPhiNearParton(g.fhDeltaPhiNearParton),
55 fhDeltaPtNearParton(g.fhDeltaPtNearParton), fhPtRatNearParton(g.fhPtRatNearParton),
56 fhDeltaEtaAwayParton(g.fhDeltaEtaAwayParton), fhDeltaPhiAwayParton(g.fhDeltaPhiAwayParton),
57 fhDeltaPtAwayParton(g.fhDeltaPtAwayParton), fhPtRatAwayParton(g.fhPtRatAwayParton)
58{
59 // cpy ctor
60
61}
62
63//_________________________________________________________________________
64AliAnaParticlePartonCorrelation & AliAnaParticlePartonCorrelation::operator = (const AliAnaParticlePartonCorrelation & source)
65{
66 // assignment operator
67
68 if(this == &source)return *this;
69 ((AliAnaPartCorrBaseClass *)this)->operator=(source);
70
71 fhDeltaEtaAwayParton = source.fhDeltaEtaAwayParton;
72 fhDeltaPhiAwayParton = source.fhDeltaPhiAwayParton;
73 fhDeltaPtAwayParton = source.fhDeltaPtAwayParton;
74 fhPtRatAwayParton = source.fhPtRatAwayParton;
75 fhDeltaEtaNearParton = source.fhDeltaEtaNearParton;
76 fhDeltaPhiNearParton = source.fhDeltaPhiNearParton;
77 fhDeltaPtNearParton = source.fhDeltaPtNearParton;
78 fhPtRatNearParton = source.fhPtRatNearParton;
79
80 return *this;
81
82}
78219bac 83*/
1c5acb87 84
85//________________________________________________________________________
86TList * AliAnaParticlePartonCorrelation::GetCreateOutputObjects()
87{
88 // Create histograms to be saved in output file
89
1c5acb87 90 TList * outputContainer = new TList() ;
91 outputContainer->SetName("ParticlePartonHistos") ;
92
93 fhDeltaPhiNearParton = new TH2F
94 ("DeltaPhiNearParton","#phi_{particle} - #phi_{parton} vs p_{T particle}",
95 200,0,120,200,0,6.4);
96 fhDeltaPhiNearParton->SetYTitle("#Delta #phi");
97 fhDeltaPhiNearParton->SetXTitle("p_{T particle} (GeV/c)");
98 outputContainer->Add(fhDeltaPhiNearParton);
99
100 fhDeltaEtaNearParton = new TH2F
101 ("DeltaEtaNearParton","#eta_{particle} - #eta_{parton} vs p_{T particle}",
102 200,0,120,200,-2,2);
103 fhDeltaEtaNearParton->SetYTitle("#Delta #eta");
104 fhDeltaEtaNearParton->SetXTitle("p_{T particle} (GeV/c)");
105 outputContainer->Add(fhDeltaEtaNearParton);
106
107 fhDeltaPtNearParton = new TH2F
108 ("DeltaPtNearParton","#p_{T particle} - #p_{T parton} vs p_{T particle}",
109 200,0,120,100,-10,10);
110 fhDeltaPtNearParton->SetYTitle("#Delta #p_{T}");
111 fhDeltaPtNearParton->SetXTitle("p_{T particle} (GeV/c)");
112 outputContainer->Add(fhDeltaPtNearParton);
113
114 fhPtRatNearParton = new TH2F
115 ("PtRatNearParton","#p_{T parton} / #p_{T particle} vs p_{T particle}",
116 200,0,120,200,0,5);
117 fhPtRatNearParton->SetYTitle("ratio");
118 fhPtRatNearParton->SetXTitle("p_{T particle} (GeV/c)");
119 outputContainer->Add(fhPtRatNearParton);
120
121 fhDeltaPhiAwayParton = new TH2F
122 ("DeltaPhiAwayParton","#phi_{particle} - #phi_{parton} vs p_{T particle}",
123 200,0,120,200,0,6.4);
124 fhDeltaPhiAwayParton->SetYTitle("#Delta #phi");
125 fhDeltaPhiAwayParton->SetXTitle("p_{T particle} (GeV/c)");
126 outputContainer->Add(fhDeltaPhiAwayParton);
127
128 fhDeltaEtaAwayParton = new TH2F
129 ("DeltaEtaAwayParton","#eta_{particle} - #eta_{parton} vs p_{T particle}",
130 200,0,120,200,-2,2);
131 fhDeltaEtaAwayParton->SetYTitle("#Delta #eta");
132 fhDeltaEtaAwayParton->SetXTitle("p_{T particle} (GeV/c)");
133 outputContainer->Add(fhDeltaEtaAwayParton);
134
135 fhDeltaPtAwayParton = new TH2F
136 ("DeltaPtAwayParton","#p_{T particle} - #p_{T parton} vs p_{T particle}",
137 200,0,120,100,-10,10);
138 fhDeltaPtAwayParton->SetYTitle("#Delta #p_{T}");
139 fhDeltaPtAwayParton->SetXTitle("p_{T particle} (GeV/c)");
140 outputContainer->Add(fhDeltaPtAwayParton);
141
142 fhPtRatAwayParton = new TH2F
143 ("PtRatAwayParton","#p_{T parton} / #p_{T particle} vs p_{T particle}",
144 200,0,120,200,0,5);
145 fhPtRatAwayParton->SetYTitle("ratio");
146 fhPtRatAwayParton->SetXTitle("p_{T particle} (GeV/c)");
147 outputContainer->Add(fhPtRatAwayParton);
148
149 return outputContainer;
a3aebfff 150
1c5acb87 151}
152
153//____________________________________________________________________________
154void AliAnaParticlePartonCorrelation::InitParameters()
155{
156
157 //Initialize the parameters of the analysis.
a3aebfff 158 SetInputAODName("PWG4Particle");
591cc579 159 SetAODObjArrayName("Partons");
a3aebfff 160 AddToHistogramsName("AnaPartonCorr_");
161
1c5acb87 162}
163
164//__________________________________________________________________
165void AliAnaParticlePartonCorrelation::Print(const Option_t * opt) const
166{
167
168 //Print some relevant parameters set for the analysis
169 if(! opt)
170 return;
171
a3aebfff 172 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
173 AliAnaPartCorrBaseClass::Print(" ");
174
1c5acb87 175}
176
177//__________________________________________________________________
178void AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD()
179{
180 //Particle-Parton Correlation Analysis, create AODs
181 //Add partons to the reference list of the trigger particle
182 //Partons are considered those in the first eight possitions in the stack
183 //being 0, and 1 the 2 protons, and 6 and 7 the outgoing final partons.
477d6cee 184 if(!GetInputAODBranch()){
a3aebfff 185 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - No input particles in AOD with name branch < %s > \n",GetInputAODName().Data());
477d6cee 186 abort();
187 }
9415d854 188
189 if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation")){
190 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s> \n",GetInputAODBranch()->GetClass()->GetName());
191 abort();
192 }
193
1c5acb87 194 if(GetDebug() > 1){
a3aebfff 195 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - Begin fill AODs \n");
196 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
1c5acb87 197 }
198
199 //Loop on stored AOD particles
200 Int_t naod = GetInputAODBranch()->GetEntriesFast();
201 for(Int_t iaod = 0; iaod < naod ; iaod++){
202 AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
203
204 AliStack * stack = GetMCStack() ;
477d6cee 205 if(!stack){
a3aebfff 206 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - No Stack available, STOP\n");
477d6cee 207 abort();
208 }
1c5acb87 209 if(stack->GetNtrack() < 8) {
a3aebfff 210 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() *** small number of particles, not a PYTHIA simulation? ***: n tracks %d \n", stack->GetNprimary());
1c5acb87 211 continue ;
212 }
213
214 //Fill AOD reference only with partons
a3aebfff 215
216 //Array with reference to partons, initialize
f8006433 217 TObjArray * objarray = NULL;
218 Int_t nrefs = 0;
219
220 TParticle * parton = NULL ;
1c5acb87 221 for(Int_t ipr = 0;ipr < 8; ipr ++ ){
222 parton = stack->Particle(ipr) ;
f8006433 223 nrefs++;
224 if(nrefs==1){
225 objarray = new TObjArray(0);
226 objarray->SetName(GetAODObjArrayName());
227 objarray->SetOwner(kFALSE);
228 }
229 objarray->Add(parton);
a3aebfff 230 }//parton loop
231
591cc579 232 if(objarray->GetEntriesFast() > 0) particle->AddObjArray(objarray);
477d6cee 233
1c5acb87 234 }//Aod branch loop
477d6cee 235
a3aebfff 236 if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - End fill AODs \n");
1c5acb87 237}
a3aebfff 238
1c5acb87 239//__________________________________________________________________
240void AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
241{
242 //Particle-Parton Correlation Analysis, fill histograms
477d6cee 243 if(!GetInputAODBranch()){
a3aebfff 244 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - No input particles in AOD with name branch < %s > \n",GetInputAODName().Data());
477d6cee 245 abort();
246 }
1c5acb87 247 if(GetDebug() > 1){
a3aebfff 248 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Begin parton correlation analysis, fill histograms \n");
249 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
1c5acb87 250 }
477d6cee 251
1c5acb87 252 AliStack * stack = GetMCStack() ;
477d6cee 253 if(!stack) {
a3aebfff 254 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - No Stack available, STOP\n");
477d6cee 255 abort();
256 }
257
1c5acb87 258 //Loop on stored AOD particles
259 Int_t naod = GetInputAODBranch()->GetEntriesFast();
164a1d84 260 TParticle * mom = NULL ;
477d6cee 261
1c5acb87 262 for(Int_t iaod = 0; iaod < naod ; iaod++){
263 AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
264
265 Float_t ptTrigg = particle->Pt();
266 Float_t phiTrigg = particle->Phi();
267 Float_t etaTrigg = particle->Eta();
268 Int_t imom = particle->GetLabel();
269 Int_t iparent = 2000;
270 Int_t iawayparent = -1;
a3aebfff 271
591cc579 272 TObjArray * objarray = particle->GetObjArray(GetAODObjArrayName());
273 if(!(objarray) || (objarray->GetEntriesFast() < 7) ) {
a3aebfff 274 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Reference list with partons not filled, STOP analysis\n");
477d6cee 275 abort();
276 }
a3aebfff 277
1c5acb87 278 //Check and get indeces of mother and parton
279 if(imom < 8 ) iparent = imom ; //mother is already a parton
280 else if (imom < stack->GetNtrack()) {
281 mom = stack->Particle(imom);
164a1d84 282 if(mom){
283 iparent=mom->GetFirstMother();
284 //cout<<" iparent "<<iparent<<endl;
285 while(iparent > 7 ){
286 mom = stack->Particle(iparent);
287 if (mom) {
288 imom = iparent ; //Mother label is of the inmediate parton daughter
289 iparent = mom->GetFirstMother();
290 }
291 else iparent = -1;
292 //cout<<" while iparent "<<iparent<<endl;
293 }
294 }
1c5acb87 295 }
296
591cc579 297 if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - N reference partons %d; labels: mother %d, parent %d \n", objarray->GetEntriesFast(), imom, iparent);
477d6cee 298
1c5acb87 299
300 if(iparent < 0 || iparent > 8) {
a3aebfff 301 if(GetDebug() > 0 ) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Failed to find appropriate parton, index %d", iparent);
1c5acb87 302 continue ;
303 }
304
305 //Near parton is the parton that fragmented and created the mother
591cc579 306 TParticle * nearParton = (TParticle*) objarray->At(iparent);
1c5acb87 307 Float_t ptNearParton = nearParton->Pt();
308 Float_t phiNearParton = nearParton->Phi() ;
309 Float_t etaNearParton = nearParton->Eta() ;
310
311 fhDeltaEtaNearParton->Fill(ptTrigg,etaTrigg-etaNearParton);
312 fhDeltaPhiNearParton->Fill(ptTrigg,phiTrigg-phiNearParton);
313 fhDeltaPtNearParton->Fill(ptTrigg,ptTrigg-ptNearParton);
314 fhPtRatNearParton->Fill(ptTrigg,ptNearParton/ptTrigg);
315
316 if(iparent == 7) iawayparent =6;
317 else if(iparent == 6) iawayparent =7;
318 else{
a3aebfff 319 printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Parent parton is not final state, skip \n");
1c5acb87 320 continue;
321 }
322
323 //Away parton is the other final parton.
591cc579 324 TParticle * awayParton = (TParticle*) objarray->At(iawayparent);
1c5acb87 325 Float_t ptAwayParton = awayParton->Pt();
326 Float_t phiAwayParton = awayParton->Phi() ;
327 Float_t etaAwayParton = awayParton->Eta() ;
328 fhDeltaEtaAwayParton->Fill(ptTrigg,etaTrigg-etaAwayParton);
329 fhDeltaPhiAwayParton->Fill(ptTrigg,phiTrigg-phiAwayParton);
330 fhDeltaPtAwayParton->Fill(ptTrigg,ptTrigg-ptAwayParton);
331 fhPtRatAwayParton->Fill(ptTrigg,ptAwayParton/ptTrigg);
332
1c5acb87 333 }
334
a3aebfff 335 if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - End fill histograms \n");
1c5acb87 336
337}