AliPhysics  ced2227 (ced2227)
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 "TClass.h"
19 
20 //---- ANALYSIS system ----
22 #include "AliMCEvent.h"
24 #include "AliVParticle.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("CaloTrackParticle");
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(), "AliCaloTrackParticleCorrelation"))
144  AliFatal(Form("Wrong type of AOD object, change AOD class name in input AOD: It should be <AliCaloTrackParticleCorrelation> 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  {
155 
156  if(!GetMC())
157  {
158  AliFatal("No Stack available, STOP");
159  return; // coverity
160  }
161 
162  if(GetMC()->GetNumberOfTracks() < 8)
163  {
164  AliWarning(Form("*** small number of particles, not a PYTHIA simulation? ***: n tracks %d", GetMC()->GetNumberOfPrimaries()));
165  continue ;
166  }
167 
168  //Fill AOD reference only with partons
169 
170  //Array with reference to partons, initialize
171  TObjArray * objarray = NULL;
172  Int_t nrefs = 0;
173 
174  AliVParticle * parton = NULL ;
175  for(Int_t ipr = 0;ipr < 8; ipr ++ )
176  {
177  parton = GetMC()->GetTrack(ipr) ;
178  nrefs++;
179 
180  if(nrefs==1)
181  {
182  objarray = new TObjArray(0);
183  objarray->SetName(GetAODObjArrayName());
184  objarray->SetOwner(kFALSE);
185  }
186  objarray->Add(parton);
187  }//parton loop
188 
189  if(objarray->GetEntriesFast() > 0) particle->AddObjArray(objarray);
190 
191  }//Aod branch loop
192 
193  AliDebug(1,"End fill AODs");
194 }
195 
196 //_________________________________________________________________
197 // Particle-Parton Correlation Analysis, fill histograms.
198 //_________________________________________________________________
200 {
201  if(!GetInputAODBranch())
202  {
203  AliFatal(Form("No input particles in AOD with name branch < %s >",GetInputAODName().Data()));
204  return; //coverity
205  }
206 
207  AliDebug(1,"Begin parton correlation analysis, fill histograms");
208  AliDebug(1,Form("In particle branch aod entries %d", GetInputAODBranch()->GetEntriesFast()));
209 
210  if(!GetMC())
211  {
212  AliFatal("No Stack available, STOP");
213  return;// coverity
214  }
215 
216  // Loop on stored AOD particles
217  Int_t naod = GetInputAODBranch()->GetEntriesFast();
218  AliVParticle * mom = NULL ;
219 
220  for(Int_t iaod = 0; iaod < naod ; iaod++){
222 
223  Float_t ptTrigg = particle->Pt();
224  Float_t phiTrigg = particle->Phi();
225  Float_t etaTrigg = particle->Eta();
226  Int_t imom = particle->GetLabel();
227  Int_t iparent = 2000;
228  Int_t iawayparent = -1;
229 
230  TObjArray * objarray = particle->GetObjArray(GetAODObjArrayName());
231  if(!(objarray) || (objarray->GetEntriesFast() < 7) )
232  {
233  AliFatal("Reference list with partons not filled, STOP analysis");
234  return; // coverity
235  }
236 
237  // Check and get indeces of mother and parton
238  if (imom < 8 )
239  iparent = imom ; //mother is already a parton
240  else if (imom < GetMC()->GetNumberOfTracks())
241  {
242  mom = GetMC()->GetTrack(imom);
243  if(mom)
244  {
245  iparent=mom->GetMother();
246  //cout<<" iparent "<<iparent<<endl;
247  while(iparent > 7 )
248  {
249  mom = GetMC()->GetTrack(iparent);
250  if (mom)
251  {
252  imom = iparent ; //Mother label is of the inmediate parton daughter
253  iparent = mom->GetMother();
254  }
255  else iparent = -1;
256  //cout<<" while iparent "<<iparent<<endl;
257  }
258  }
259  }
260 
261  AliDebug(1,Form("N reference partons %d; labels: mother %d, parent %d", objarray->GetEntriesFast(), imom, iparent));
262 
263  if(iparent < 0 || iparent > 8)
264  {
265  AliWarning(Form("Failed to find appropriate parton, index %d", iparent));
266  continue ;
267  }
268 
269  // Near parton is the parton that fragmented and created the mother
270  AliVParticle * nearParton = (AliVParticle*) objarray->At(iparent);
271  Float_t ptNearParton = nearParton->Pt();
272  Float_t phiNearParton = nearParton->Phi() ;
273  Float_t etaNearParton = nearParton->Eta() ;
274 
275  fhDeltaEtaNearParton->Fill(ptTrigg, etaTrigg-etaNearParton, GetEventWeight());
276  fhDeltaPhiNearParton->Fill(ptTrigg, phiTrigg-phiNearParton, GetEventWeight());
277  fhDeltaPtNearParton ->Fill(ptTrigg, ptTrigg-ptNearParton , GetEventWeight());
278  fhPtRatNearParton ->Fill(ptTrigg, ptNearParton/ptTrigg , GetEventWeight());
279 
280  if (iparent == 7) iawayparent = 6;
281  else if(iparent == 6) iawayparent = 7;
282  else
283  {
284  AliWarning("Parent parton is not final state, skip");
285  continue;
286  }
287 
288  // Away parton is the other final parton.
289  AliVParticle * awayParton = (AliVParticle*) objarray->At(iawayparent);
290  Float_t ptAwayParton = awayParton->Pt();
291  Float_t phiAwayParton = awayParton->Phi() ;
292  Float_t etaAwayParton = awayParton->Eta() ;
293  fhDeltaEtaAwayParton->Fill(ptTrigg, etaTrigg-etaAwayParton, GetEventWeight());
294  fhDeltaPhiAwayParton->Fill(ptTrigg, phiTrigg-phiAwayParton, GetEventWeight());
295  fhDeltaPtAwayParton ->Fill(ptTrigg, ptTrigg-ptAwayParton , GetEventWeight());
296  fhPtRatAwayParton ->Fill(ptTrigg, ptAwayParton/ptTrigg , GetEventWeight());
297 
298  }
299 
300  AliDebug(1,"End fill histograms");
301 }
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
virtual Double_t Eta() const
virtual Double_t Pt() const
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 Int_t GetLabel() const
virtual void SetInputAODName(TString name)
virtual void AddObjArray(TObjArray *refarray)
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 TObjArray * GetObjArray(TString refname) const
virtual TString GetAODObjArrayName() const
Daughter of AliCaloTrackParticle that includes correlation part.
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
virtual void SetAODObjArrayName(TString name)
virtual Double_t Phi() const
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