AliPhysics  a4b41ad (a4b41ad)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnaParticlePartonCorrelation.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 // --- ROOT system ---
17 #include "TH2F.h"
18 #include "TParticle.h"
19 #include "TClass.h"
20 
21 //---- ANALYSIS system ----
23 #include "AliStack.h"
24 #include "AliAODPWG4ParticleCorrelation.h"
25 
29 
30 //________________________________________________________________
32 //________________________________________________________________
35 fhDeltaEtaNearParton(0), fhDeltaPhiNearParton(0),
36 fhDeltaPtNearParton(0), fhPtRatNearParton(0),
37 fhDeltaEtaAwayParton(0), fhDeltaPhiAwayParton(0),
38 fhDeltaPtAwayParton(0), fhPtRatAwayParton(0)
39 {
41 }
42 
43 //________________________________________________________________
45 //________________________________________________________________
47 {
48  TList * outputContainer = new TList() ;
49  outputContainer->SetName("ParticlePartonHistos") ;
50 
52  ("DeltaPhiNearParton","#phi_{particle} - #phi_{parton} vs p_{T particle}",
53  200,0,120,200,0,6.4);
54  fhDeltaPhiNearParton->SetYTitle("#Delta #phi");
55  fhDeltaPhiNearParton->SetXTitle("p_{T particle} (GeV/c)");
56  outputContainer->Add(fhDeltaPhiNearParton);
57 
59  ("DeltaEtaNearParton","#eta_{particle} - #eta_{parton} vs p_{T particle}",
60  200,0,120,200,-2,2);
61  fhDeltaEtaNearParton->SetYTitle("#Delta #eta");
62  fhDeltaEtaNearParton->SetXTitle("p_{T particle} (GeV/c)");
63  outputContainer->Add(fhDeltaEtaNearParton);
64 
66  ("DeltaPtNearParton","#p_{T particle} - #p_{T parton} vs p_{T particle}",
67  200,0,120,100,-10,10);
68  fhDeltaPtNearParton->SetYTitle("#Delta #p_{T}");
69  fhDeltaPtNearParton->SetXTitle("p_{T particle} (GeV/c)");
70  outputContainer->Add(fhDeltaPtNearParton);
71 
73  ("PtRatNearParton","#p_{T parton} / #p_{T particle} vs p_{T particle}",
74  200,0,120,200,0,5);
75  fhPtRatNearParton->SetYTitle("ratio");
76  fhPtRatNearParton->SetXTitle("p_{T particle} (GeV/c)");
77  outputContainer->Add(fhPtRatNearParton);
78 
80  ("DeltaPhiAwayParton","#phi_{particle} - #phi_{parton} vs p_{T particle}",
81  200,0,120,200,0,6.4);
82  fhDeltaPhiAwayParton->SetYTitle("#Delta #phi");
83  fhDeltaPhiAwayParton->SetXTitle("p_{T particle} (GeV/c)");
84  outputContainer->Add(fhDeltaPhiAwayParton);
85 
87  ("DeltaEtaAwayParton","#eta_{particle} - #eta_{parton} vs p_{T particle}",
88  200,0,120,200,-2,2);
89  fhDeltaEtaAwayParton->SetYTitle("#Delta #eta");
90  fhDeltaEtaAwayParton->SetXTitle("p_{T particle} (GeV/c)");
91  outputContainer->Add(fhDeltaEtaAwayParton);
92 
94  ("DeltaPtAwayParton","#p_{T particle} - #p_{T parton} vs p_{T particle}",
95  200,0,120,100,-10,10);
96  fhDeltaPtAwayParton->SetYTitle("#Delta #p_{T}");
97  fhDeltaPtAwayParton->SetXTitle("p_{T particle} (GeV/c)");
98  outputContainer->Add(fhDeltaPtAwayParton);
99 
100  fhPtRatAwayParton = new TH2F
101  ("PtRatAwayParton","#p_{T parton} / #p_{T particle} vs p_{T particle}",
102  200,0,120,200,0,5);
103  fhPtRatAwayParton->SetYTitle("ratio");
104  fhPtRatAwayParton->SetXTitle("p_{T particle} (GeV/c)");
105  outputContainer->Add(fhPtRatAwayParton);
106 
107  return outputContainer;
108 }
109 
110 //____________________________________________________
111 // Initialize the parameters of the analysis.
112 //____________________________________________________
114 {
115  SetInputAODName("PWG4Particle");
116  SetAODObjArrayName("Partons");
117  AddToHistogramsName("AnaPartonCorr_");
118 }
119 
120 //_____________________________________________________________________
121 // Print some relevant parameters set for the analysis.
122 //_____________________________________________________________________
124 {
125  if(! opt)
126  return;
127 
128  printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
130 }
131 
132 //__________________________________________________________
137 //__________________________________________________________
139 {
140  if(!GetInputAODBranch())
141  AliFatal(Form("No input particles in AOD with name branch < %s > ",GetInputAODName().Data()));
142 
143  if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation"))
144  AliFatal(Form("Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s>",
145  GetInputAODBranch()->GetClass()->GetName()));
146 
147  AliDebug(1,"Begin fill AODs");
148  AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
149 
150  //Loop on stored AOD particles
151  Int_t naod = GetInputAODBranch()->GetEntriesFast();
152  for(Int_t iaod = 0; iaod < naod ; iaod++)
153  {
154  AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
155 
156  AliStack * stack = GetMCStack() ;
157  if(!stack)
158  {
159  AliFatal("No Stack available, STOP");
160  return; // coverity
161  }
162 
163  if(stack->GetNtrack() < 8)
164  {
165  AliWarning(Form("*** small number of particles, not a PYTHIA simulation? ***: n tracks %d", stack->GetNprimary()));
166  continue ;
167  }
168 
169  //Fill AOD reference only with partons
170 
171  //Array with reference to partons, initialize
172  TObjArray * objarray = NULL;
173  Int_t nrefs = 0;
174 
175  TParticle * parton = NULL ;
176  for(Int_t ipr = 0;ipr < 8; ipr ++ ){
177  parton = stack->Particle(ipr) ;
178  nrefs++;
179  if(nrefs==1){
180  objarray = new TObjArray(0);
181  objarray->SetName(GetAODObjArrayName());
182  objarray->SetOwner(kFALSE);
183  }
184  objarray->Add(parton);
185  }//parton loop
186 
187  if(objarray->GetEntriesFast() > 0) particle->AddObjArray(objarray);
188 
189  }//Aod branch loop
190 
191  AliDebug(1,"End fill AODs");
192 }
193 
194 //_________________________________________________________________
195 // Particle-Parton Correlation Analysis, fill histograms.
196 //_________________________________________________________________
198 {
199  if(!GetInputAODBranch())
200  {
201  AliFatal(Form("No input particles in AOD with name branch < %s >",GetInputAODName().Data()));
202  return; //coverity
203  }
204 
205  AliDebug(1,"Begin parton correlation analysis, fill histograms");
206  AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
207 
208  AliStack * stack = GetMCStack() ;
209  if(!stack)
210  {
211  AliFatal("No Stack available, STOP");
212  return;// coverity
213  }
214 
215  // Loop on stored AOD particles
216  Int_t naod = GetInputAODBranch()->GetEntriesFast();
217  TParticle * mom = NULL ;
218 
219  for(Int_t iaod = 0; iaod < naod ; iaod++){
220  AliAODPWG4ParticleCorrelation* particle = (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
221 
222  Float_t ptTrigg = particle->Pt();
223  Float_t phiTrigg = particle->Phi();
224  Float_t etaTrigg = particle->Eta();
225  Int_t imom = particle->GetLabel();
226  Int_t iparent = 2000;
227  Int_t iawayparent = -1;
228 
229  TObjArray * objarray = particle->GetObjArray(GetAODObjArrayName());
230  if(!(objarray) || (objarray->GetEntriesFast() < 7) )
231  {
232  AliFatal("Reference list with partons not filled, STOP analysis");
233  return; // coverity
234  }
235 
236  // Check and get indeces of mother and parton
237  if(imom < 8 ) iparent = imom ; //mother is already a parton
238  else if (imom < stack->GetNtrack()) {
239  mom = stack->Particle(imom);
240  if(mom){
241  iparent=mom->GetFirstMother();
242  //cout<<" iparent "<<iparent<<endl;
243  while(iparent > 7 ){
244  mom = stack->Particle(iparent);
245  if (mom) {
246  imom = iparent ; //Mother label is of the inmediate parton daughter
247  iparent = mom->GetFirstMother();
248  }
249  else iparent = -1;
250  //cout<<" while iparent "<<iparent<<endl;
251  }
252  }
253  }
254 
255  AliDebug(1,Form("N reference partons %d; labels: mother %d, parent %d", objarray->GetEntriesFast(), imom, iparent));
256 
257  if(iparent < 0 || iparent > 8)
258  {
259  AliWarning(Form("Failed to find appropriate parton, index %d", iparent));
260  continue ;
261  }
262 
263  // Near parton is the parton that fragmented and created the mother
264  TParticle * nearParton = (TParticle*) objarray->At(iparent);
265  Float_t ptNearParton = nearParton->Pt();
266  Float_t phiNearParton = nearParton->Phi() ;
267  Float_t etaNearParton = nearParton->Eta() ;
268 
269  fhDeltaEtaNearParton->Fill(ptTrigg, etaTrigg-etaNearParton, GetEventWeight());
270  fhDeltaPhiNearParton->Fill(ptTrigg, phiTrigg-phiNearParton, GetEventWeight());
271  fhDeltaPtNearParton ->Fill(ptTrigg, ptTrigg-ptNearParton , GetEventWeight());
272  fhPtRatNearParton ->Fill(ptTrigg, ptNearParton/ptTrigg , GetEventWeight());
273 
274  if (iparent == 7) iawayparent = 6;
275  else if(iparent == 6) iawayparent = 7;
276  else
277  {
278  AliWarning("Parent parton is not final state, skip");
279  continue;
280  }
281 
282  // Away parton is the other final parton.
283  TParticle * awayParton = (TParticle*) objarray->At(iawayparent);
284  Float_t ptAwayParton = awayParton->Pt();
285  Float_t phiAwayParton = awayParton->Phi() ;
286  Float_t etaAwayParton = awayParton->Eta() ;
287  fhDeltaEtaAwayParton->Fill(ptTrigg, etaTrigg-etaAwayParton, GetEventWeight());
288  fhDeltaPhiAwayParton->Fill(ptTrigg, phiTrigg-phiAwayParton, GetEventWeight());
289  fhDeltaPtAwayParton ->Fill(ptTrigg, ptTrigg-ptAwayParton , GetEventWeight());
290  fhPtRatAwayParton ->Fill(ptTrigg, ptAwayParton/ptTrigg , GetEventWeight());
291 
292  }
293 
294  AliDebug(1,"End fill histograms");
295 }
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
TH2F * fhDeltaEtaNearParton
! Difference of parton eta and prompt trigger particle eta
virtual void AddToHistogramsName(TString add)
TH2F * fhDeltaPtNearParton
! Difference of parton pT and prompt trigger particle pT
Definition: External.C:236
virtual void SetInputAODName(TString name)
TH2F * fhPtRatNearParton
! Ratio of parton pT and prompt trigger particle pT
TList * GetCreateOutputObjects()
Create histograms to be saved in output file.
void InitParameters()
Initialize the parameters of the analysis.
TH2F * fhDeltaPtAwayParton
! Difference of parton pT and prompt trigger particle pT
virtual TString GetAODObjArrayName() const
Base class for CaloTrackCorr analysis algorithms.
int Int_t
Definition: External.C:63
virtual TClonesArray * GetInputAODBranch() const
float Float_t
Definition: External.C:68
TH2F * fhDeltaPhiAwayParton
! Difference of parton phi and prompt trigger particle phi
virtual Double_t GetEventWeight() const
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
TH2F * fhDeltaPhiNearParton
! Difference of parton phi and prompt trigger particle phi
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
virtual void SetAODObjArrayName(TString name)
virtual void Print(const Option_t *) const
Print some relevant parameters set for the analysis.
AliAnaParticlePartonCorrelation()
Default Constructor. Initialize parameters.
const char Option_t
Definition: External.C:48
TH2F * fhDeltaEtaAwayParton
! Difference of parton eta and prompt trigger particle eta
TH2F * fhPtRatAwayParton
! Ratio of parton pT and prompt trigger particle pT