1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //_________________________________________________________________________
17 // Do direct photon/decay photon (eta, pi0, other)/pi0/eta isolation
18 // and correlation with partons/jets/hadrons analysis at the generator level.
19 // For MC kinematics at ESD and AOD level.
20 // Jets only considered in the case of Pythia, check what to do with others.
22 // -- Author: Gustavo Conesa (LPSC-CNRS-Grenoble)
23 //////////////////////////////////////////////////////////////////////////////
25 // --- ROOT system ---
27 #include "TParticle.h"
28 #include "TDatabasePDG.h"
30 //---- ANALYSIS system ----
31 #include "AliAnaGeneratorKine.h"
33 #include "AliGenPythiaEventHeader.h"
34 #include "AliAODMCParticle.h"
36 ClassImp(AliAnaGeneratorKine)
39 //__________________________________________
40 AliAnaGeneratorKine::AliAnaGeneratorKine() :
41 AliAnaCaloTrackCorrBaseClass(),
42 fTriggerDetector(), fTriggerDetectorString(),
44 fMinChargedPt(0), fMinNeutralPt(0),
45 fStack(0), fAODMCparticles(0),
46 //fParton2(0), fParton3(0),
47 fParton6(), fParton7(),
48 fParton6PDG(0), fParton7PDG(0),
51 fNPrimaries(0), fPtHard(0),
52 fhPtHard(0), fhPtParton(0), fhPtJet(0),
53 fhPtPartonPtHard(0), fhPtJetPtHard(0), fhPtJetPtParton(0)
57 //Initialize parameters
62 for(Int_t p = 0; p < fgkNmcPrimTypes; p++)
66 for(Int_t i = 0; i < fgkNIso; i++)
68 fhPtLeading[p][i] = 0;
69 fhPtLeadingSumPt[p][i] = 0;
70 fhPtLeadingIsolated[p][i] = 0;
71 for(Int_t j = 0; j < 2; j++)
74 fhZHardIsolated[p][j][i] = 0;
75 fhZParton[p][j][i] = 0;
76 fhZPartonIsolated[p][j][i] = 0;
78 fhZJetIsolated[p][j][i] = 0;
80 fhXEIsolated[p][j][i] = 0;
82 fhXEUEIsolated[p][j][i] = 0;
84 fhPtPartonTypeNear[p][j][i] = 0;
85 fhPtPartonTypeNearIsolated[p][j][i] = 0;
87 fhPtPartonTypeAway[p][j][i] = 0;
88 fhPtPartonTypeAwayIsolated[p][j][i] = 0;
90 if( p == 0 ) fhPtAcceptedGammaJet[j][i] = 0;
97 //___________________________________________________________________________
98 Bool_t AliAnaGeneratorKine::CorrelateWithPartonOrJet(Int_t indexTrig,
100 Bool_t leading [fgkNIso],
101 Bool_t isolated[fgkNIso],
104 // Correlate trigger with partons or jets, get z
108 if( fNPrimaries < 7 )
110 AliDebug(1,Form("End, not enough partons, n primaries %d",fNPrimaries));
115 // Get the index of the mother
120 iparton = (fStack->Particle(indexTrig))->GetFirstMother();
121 TParticle * mother = fStack->Particle(iparton);
124 iparton = mother->GetFirstMother();
127 AliWarning("Negative index, skip event");
130 mother = fStack->Particle(iparton);
135 iparton = ((AliAODMCParticle*) fAODMCparticles->At(indexTrig))->GetMother();
136 AliAODMCParticle * mother = (AliAODMCParticle*) fAODMCparticles->At(iparton);
139 iparton = mother->GetMother();
142 AliWarning("Negative index, skip event");
145 mother = (AliAODMCParticle*) fAODMCparticles->At(iparton);
149 //printf("Mother is parton %d with pdg %d\n",imom,mother->GetPdgCode());
153 AliDebug(1,Form("This particle is not from hard process - pdg %d, parton index %d\n",partType, iparton));
158 // Get the kinematics
161 Float_t ptTrig = fTrigger.Pt();
162 Float_t phiTrig = fTrigger.Phi();
163 Float_t etaTrig = fTrigger.Eta();
165 AliDebug(1,Form("Trigger pdg %d pT %2.2f, phi %2.2f, eta %2.2f", partType,ptTrig,phiTrig*TMath::RadToDeg(),etaTrig));
167 Float_t jetPt = fJet6.Pt();
168 Float_t jetPhi = fJet6.Phi();
169 Float_t jetEta = fJet6.Eta();
171 AliDebug(1,Form("Jet 6 pT %2.2f, phi %2.2f, eta %2.2f",jetPt,jetPhi*TMath::RadToDeg(),jetEta));
173 Float_t awayJetPt = fJet7.Pt();
174 Float_t awayJetEta = fJet7.Eta();
175 Float_t awayJetPhi = fJet7.Phi();
177 AliDebug(1,Form("Jet 7 pT %2.2f, phi %2.2f, eta %2.2f",awayJetPt,awayJetPhi*TMath::RadToDeg(),awayJetEta));
179 Float_t partonPt = fParton6.Pt();
181 Int_t nearPDG = fParton6PDG;
182 Int_t awayPDG = fParton7PDG;
184 AliDebug(1,Form("Parton6 pT pT %2.2f, pdg %d",fParton6.Pt(),fParton6PDG));
185 AliDebug(1,Form("Parton7 pT pT %2.2f, pdg %d",fParton7.Pt(),fParton7PDG));
189 partonPt = fParton7.Pt();
192 jetPhi = fJet7.Phi();
193 jetEta = fJet7.Eta();
195 awayJetPt = fJet6.Pt();
196 awayJetEta = fJet6.Eta();
197 awayJetPhi = fJet6.Phi();
199 nearPDG = fParton7PDG;
200 awayPDG = fParton6PDG;
203 Float_t deltaPhi = TMath::Abs(phiTrig-awayJetPhi) *TMath::RadToDeg();
204 AliDebug(1,Form("Trigger Away jet phi %2.2f\n",deltaPhi));
207 // Get id of parton in near and away side
211 if (nearPDG == 22) near = 0;
212 else if(nearPDG == 21) near = 1;
215 if (awayPDG == 22) away = 0;
216 else if(awayPDG == 21) away = 1;
225 if( fPtHard > 0 ) zHard = ptTrig / fPtHard ;
226 if( partonPt > 0 ) zPart = ptTrig / partonPt;
227 if( jetPt > 0 ) zJet = ptTrig / jetPt ;
229 //if(zHard > 1 ) printf("*** Particle energy larger than pT hard z=%f\n",zHard);
231 //printf("Z: hard %2.2f, parton %2.2f, jet %2.2f\n",zHard,zPart,zJet);
234 for( Int_t i = 0; i < fgkNIso ; i++ )
236 fhPtPartonTypeNear[partType][leading[i]][i]->Fill(ptTrig,near);
237 fhPtPartonTypeAway[partType][leading[i]][i]->Fill(ptTrig,away);
239 fhZHard [partType][leading[i]][i]->Fill(ptTrig,zHard);
240 fhZParton[partType][leading[i]][i]->Fill(ptTrig,zPart);
241 fhZJet [partType][leading[i]][i]->Fill(ptTrig,zJet );
245 fhPtPartonTypeNearIsolated[partType][leading[i]][i]->Fill(ptTrig,near);
246 fhPtPartonTypeAwayIsolated[partType][leading[i]][i]->Fill(ptTrig,away);
248 fhZHardIsolated [partType][leading[i]][i]->Fill(ptTrig,zHard);
249 fhZPartonIsolated[partType][leading[i]][i]->Fill(ptTrig,zPart);
250 fhZJetIsolated [partType][leading[i]][i]->Fill(ptTrig,zJet);
253 if(partType == kmcPrimPhoton && deltaPhi < 220 && deltaPhi > 140 && TMath::Abs(awayJetEta) < 0.6)
255 //printf("Accept jet\n");
256 fhPtAcceptedGammaJet[leading[i]][i]->Fill(ptTrig,away);
258 //else printf("Reject jet!!!\n");
262 AliDebug(1,"End TRUE");
268 //____________________________________________________
269 TList * AliAnaGeneratorKine::GetCreateOutputObjects()
271 // Create histograms to be saved in output file
273 TList * outputContainer = new TList() ;
274 outputContainer->SetName("GenKineHistos") ;
276 Int_t nptbins = GetHistogramRanges()->GetHistoPtBins();
277 Float_t ptmax = GetHistogramRanges()->GetHistoPtMax();
278 Float_t ptmin = GetHistogramRanges()->GetHistoPtMin();
280 Int_t nptsumbins = GetHistogramRanges()->GetHistoNPtSumBins();
281 Float_t ptsummax = GetHistogramRanges()->GetHistoPtSumMax();
282 Float_t ptsummin = GetHistogramRanges()->GetHistoPtSumMin();
285 fhPtHard = new TH1F("hPtHard"," pt hard for selected triggers",nptbins,ptmin,ptmax);
286 fhPtHard->SetXTitle("#it{p}_{T}^{hard} (GeV/#it{c})");
287 outputContainer->Add(fhPtHard);
289 fhPtParton = new TH1F("hPtParton"," pt parton for selected triggers",nptbins,ptmin,ptmax);
290 fhPtParton->SetXTitle("#it{p}_{T}^{parton} (GeV/#it{c})");
291 outputContainer->Add(fhPtParton);
293 fhPtJet = new TH1F("hPtJet"," pt jet for selected triggers",nptbins,ptmin,ptmax);
294 fhPtJet->SetXTitle("#it{p}_{T}^{jet} (GeV/#it{c})");
295 outputContainer->Add(fhPtJet);
297 fhPtPartonPtHard = new TH2F("hPtPartonPtHard","parton pt / pt hard for selected triggers",nptbins,ptmin,ptmax,200,0,2);
298 fhPtPartonPtHard->SetXTitle("#it{p}_{T}^{hard} (GeV/#it{c})");
299 fhPtPartonPtHard->SetYTitle("#it{p}_{T}^{parton}/#it{p}_{T}^{hard}");
300 outputContainer->Add(fhPtPartonPtHard);
302 fhPtJetPtHard = new TH2F("hPtJetPtHard","jet pt / pt hard for selected triggers",nptbins,ptmin,ptmax,200,0,2);
303 fhPtJetPtHard->SetXTitle("#it{p}_{T}^{hard} (GeV/#it{c})");
304 fhPtJetPtHard->SetYTitle("#it{p}_{T}^{jet}/#it{p}_{T}^{hard}");
305 outputContainer->Add(fhPtJetPtHard);
307 fhPtJetPtParton = new TH2F("hPtJetPtParton","parton pt / pt hard for selected triggers",nptbins,ptmin,ptmax,200,0,2);
308 fhPtJetPtParton->SetXTitle("#it{p}_{T}^{hard} (GeV/#it{c})");
309 fhPtJetPtParton->SetYTitle("#it{p}_{T}^{jet}/#it{p}_{T}^{parton}");
310 outputContainer->Add(fhPtJetPtParton);
312 TString name [] = {"","_EMC","_Photon","_EMC_Photon"};
313 TString title [] = {"",", neutral in EMCal",", neutral only #gamma-like",", neutral in EMCal and only #gamma-like"};
314 TString leading[] = {"NotLeading","Leading"};
316 TString partTitl[] = {"#gamma_{direct}","#gamma_{decay}^{#pi}","#gamma_{decay}^{#eta}","#gamma_{decay}^{other}","#pi^{0}","#eta"};
317 TString particle[] = {"DirectPhoton" ,"Pi0DecayPhoton" ,"EtaDecayPhoton" ,"OtherDecayPhoton" ,"Pi0" ,"Eta"};
319 for(Int_t p = 0; p < fgkNmcPrimTypes; p++)
321 fhPt[p] = new TH1F(Form("h%sPt",particle[p].Data()),Form("Input %s p_{T}",partTitl[p].Data()),nptbins,ptmin,ptmax);
322 fhPt[p]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
323 outputContainer->Add(fhPt[p]);
325 for(Int_t i = 0; i < fgkNIso; i++)
329 fhPtLeading[p][i] = new TH1F(Form("h%sPtLeading%s", particle[p].Data(), name[i].Data()),
330 Form("%s: Leading of all particles%s",partTitl[p].Data(),title[i].Data()),
331 nptbins,ptmin,ptmax);
332 fhPtLeading[p][i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
333 outputContainer->Add(fhPtLeading[p][i]);
335 fhPtLeadingIsolated[p][i] = new TH1F(Form("h%sPtLeadingIsolated%s", particle[p].Data(), name[i].Data()),
336 Form("%s: Leading of all particles%s, isolated",partTitl[p].Data(),title[i].Data()),
337 nptbins,ptmin,ptmax);
338 fhPtLeadingIsolated[p][i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
339 outputContainer->Add(fhPtLeadingIsolated[p][i]);
341 fhPtLeadingSumPt[p][i] = new TH2F(Form("h%sPtLeadingSumPt%s", particle[p].Data(), name[i].Data()),
342 Form("%s: Leading of all particles%s",partTitl[p].Data(),title[i].Data()),
343 nptbins,ptmin,ptmax,nptsumbins,ptsummin,ptsummax);
344 fhPtLeadingSumPt[p][i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
345 fhPtLeadingSumPt[p][i]->SetYTitle("#Sigma #it{p}_{T} (GeV/#it{c})");
346 outputContainer->Add(fhPtLeadingSumPt[p][i]);
349 // Leading or not loop
350 for(Int_t j = 0; j < fgkNLead; j++)
354 fhPtAcceptedGammaJet[j][i] = new TH2F(Form("hPtAcceptedGammaJet%s%s", leading[j].Data(), name[i].Data()),
355 Form("#gamma-jet: %s of all particles%s", leading[j].Data(), title[i].Data()),
356 nptbins,ptmin,ptmax,3,0,3);
357 fhPtAcceptedGammaJet[j][i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
358 fhPtAcceptedGammaJet[j][i]->SetYTitle("Parton type");
359 fhPtAcceptedGammaJet[j][i]->GetYaxis()->SetBinLabel(1,"#gamma");
360 fhPtAcceptedGammaJet[j][i]->GetYaxis()->SetBinLabel(2,"g");
361 fhPtAcceptedGammaJet[j][i]->GetYaxis()->SetBinLabel(3,"q");
362 outputContainer->Add(fhPtAcceptedGammaJet[j][i]);
366 fhPtPartonTypeNear[p][j][i] = new TH2F(Form("h%sPtPartonTypeNear%s%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
367 Form("%s: %s of all particles%s", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
368 nptbins,ptmin,ptmax,3,0,3);
369 fhPtPartonTypeNear[p][j][i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
370 fhPtPartonTypeNear[p][j][i]->SetYTitle("Parton type");
371 fhPtPartonTypeNear[p][j][i]->GetYaxis()->SetBinLabel(1,"#gamma");
372 fhPtPartonTypeNear[p][j][i]->GetYaxis()->SetBinLabel(2,"g");
373 fhPtPartonTypeNear[p][j][i]->GetYaxis()->SetBinLabel(3,"q");
374 outputContainer->Add(fhPtPartonTypeNear[p][j][i]);
376 fhPtPartonTypeNearIsolated[p][j][i] = new TH2F(Form("h%sPtPartonTypeNear%sIsolated%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
377 Form("%s: %s of all particles%s, isolated", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
378 nptbins,ptmin,ptmax,3,0,3);
379 fhPtPartonTypeNearIsolated[p][j][i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
380 fhPtPartonTypeNearIsolated[p][j][i]->SetYTitle("Parton type");
381 fhPtPartonTypeNearIsolated[p][j][i]->GetYaxis()->SetBinLabel(1,"#gamma");
382 fhPtPartonTypeNearIsolated[p][j][i]->GetYaxis()->SetBinLabel(2,"g");
383 fhPtPartonTypeNearIsolated[p][j][i]->GetYaxis()->SetBinLabel(3,"q");
384 outputContainer->Add(fhPtPartonTypeNearIsolated[p][j][i]);
389 fhPtPartonTypeAway[p][j][i] = new TH2F(Form("h%sPtPartonTypeAway%s%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
390 Form("%s: %s of all particles%s", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
391 nptbins,ptmin,ptmax,3,0,3);
392 fhPtPartonTypeAway[p][j][i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
393 fhPtPartonTypeAway[p][j][i]->SetYTitle("Parton type");
394 fhPtPartonTypeAway[p][j][i]->GetYaxis()->SetBinLabel(1,"#gamma");
395 fhPtPartonTypeAway[p][j][i]->GetYaxis()->SetBinLabel(2,"g");
396 fhPtPartonTypeAway[p][j][i]->GetYaxis()->SetBinLabel(3,"q");
397 outputContainer->Add(fhPtPartonTypeAway[p][j][i]);
399 fhPtPartonTypeAwayIsolated[p][j][i] = new TH2F(Form("h%sPtPartonTypeAway%sIsolated%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
400 Form("%s: %s of all particles%s, isolated", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
401 nptbins,ptmin,ptmax,3,0,3);
402 fhPtPartonTypeAwayIsolated[p][j][i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
403 fhPtPartonTypeAwayIsolated[p][j][i]->SetYTitle("Parton type");
404 fhPtPartonTypeAwayIsolated[p][j][i]->GetYaxis()->SetBinLabel(1,"#gamma");
405 fhPtPartonTypeAwayIsolated[p][j][i]->GetYaxis()->SetBinLabel(2,"g");
406 fhPtPartonTypeAwayIsolated[p][j][i]->GetYaxis()->SetBinLabel(3,"q");
407 outputContainer->Add(fhPtPartonTypeAwayIsolated[p][j][i]);
411 fhZHard[p][j][i] = new TH2F(Form("h%sZHard%s%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
412 Form("#it{z}_{Hard} of %s: %s of all particles%s", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
413 nptbins,ptmin,ptmax,200,0,2);
414 fhZHard[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
415 fhZHard[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
416 outputContainer->Add(fhZHard[p][j][i]);
418 fhZHardIsolated[p][j][i] = new TH2F(Form("h%sZHard%sIsolated%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
419 Form("#it{z}_{Hard} of %s: %s of all particles%s, isolated", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
420 nptbins,ptmin,ptmax,200,0,2);
421 fhZHardIsolated[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
422 fhZHardIsolated[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
423 outputContainer->Add(fhZHardIsolated[p][j][i]);
427 fhZParton[p][j][i] = new TH2F(Form("h%sZParton%s%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
428 Form("#it{z}_{Parton} of %s: %s of all particles%s", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
429 nptbins,ptmin,ptmax,200,0,2);
430 fhZParton[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
431 fhZParton[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
432 outputContainer->Add(fhZParton[p][j][i]);
434 fhZPartonIsolated[p][j][i] = new TH2F(Form("h%sZParton%sIsolated%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
435 Form("#it{z}_{Parton} of %s: %s of all particles%s, isolated", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
436 nptbins,ptmin,ptmax,200,0,2);
437 fhZPartonIsolated[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
438 fhZPartonIsolated[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
439 outputContainer->Add(fhZPartonIsolated[p][j][i]);
444 fhZJet[p][j][i] = new TH2F(Form("h%sZJet%s%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
445 Form("#it{z}_{Jet} of %s: %s of all particles%s", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
446 nptbins,ptmin,ptmax,200,0,2);
447 fhZJet[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
448 fhZJet[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
449 outputContainer->Add(fhZJet[p][j][i]);
451 fhZJetIsolated[p][j][i] = new TH2F(Form("h%sZJet%sIsolated%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
452 Form("#it{z}_{Jet} of %s: %s of all particles%s, isolated", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
453 nptbins,ptmin,ptmax,200,0,2);
454 fhZJetIsolated[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
455 fhZJetIsolated[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
456 outputContainer->Add(fhZJetIsolated[p][j][i]);
461 fhXE[p][j][i] = new TH2F(Form("h%sXE%s%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
462 Form("#it{z}_{Jet} of %s: %s of all particles%s", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
463 nptbins,ptmin,ptmax,200,0,2);
464 fhXE[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
465 fhXE[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
466 outputContainer->Add(fhXE[p][j][i]);
468 fhXEIsolated[p][j][i] = new TH2F(Form("h%sXE%sIsolated%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
469 Form("#it{z}_{Jet} of %s: %s of all particles%s, isolated", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
470 nptbins,ptmin,ptmax,200,0,2);
471 fhXEIsolated[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
472 fhXEIsolated[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
473 outputContainer->Add(fhXEIsolated[p][j][i]);
478 fhXEUE[p][j][i] = new TH2F(Form("h%sXEUE%s%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
479 Form("#it{z}_{Jet} of %s: %s of all particles%s", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
480 nptbins,ptmin,ptmax,200,0,2);
481 fhXEUE[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
482 fhXEUE[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
483 outputContainer->Add(fhXEUE[p][j][i]);
485 fhXEUEIsolated[p][j][i] = new TH2F(Form("h%sXEUE%sIsolated%s", particle[p].Data(), leading[j].Data(), name[i].Data()),
486 Form("#it{z}_{Jet} of %s: %s of all particles%s, isolated", partTitl[p].Data(), leading[j].Data(), title[i].Data()),
487 nptbins,ptmin,ptmax,200,0,2);
488 fhXEUEIsolated[p][j][i]->SetYTitle("#it{p}_{T}^{particle}/#it{p}_{T}^{hard}");
489 fhXEUEIsolated[p][j][i]->SetXTitle("#it{p}_{T}^{particle} (GeV/#it{c})");
490 outputContainer->Add(fhXEUEIsolated[p][j][i]);
495 return outputContainer;
499 //____________________________________________
500 void AliAnaGeneratorKine::GetPartonsAndJets()
502 // Fill data members with partons,jets and generated pt hard
506 // if( nPrimary > 2 ) fParton2 = fStack->Particle(2) ;
507 // if( nPrimary > 3 ) fParton3 = fStack->Particle(3) ;
512 if( fNPrimaries > 6 )
514 p6pt = fParton6.Pt();
515 p6eta = fParton6.Eta();
516 p6phi = fParton6.Phi();
517 if(p6phi < 0) p6phi +=TMath::TwoPi();
523 if( fNPrimaries > 7 )
525 p7pt = fParton7.Pt();
526 p7phi = fParton7.Eta();
527 p7phi = fParton7.Phi();
528 if(p7phi < 0) p7phi +=TMath::TwoPi();
531 //printf("parton6: pt %2.2f, eta %2.2f, phi %2.2f with pdg %d\n",p6pt,p6eta,p6phi, fParton6PDG);
532 //printf("parton7: pt %2.2f, eta %2.2f, phi %2.2f with pdg %d\n",p7pt,p7eta,p7phi, fParton7PDG);
534 // Get the jets, only for pythia
535 if(!strcmp(GetReader()->GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader"))
537 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetReader()->GetGenEventHeader();
539 fPtHard = pygeh->GetPtHard();
541 //printf("pt Hard %2.2f\n",fPtHard);
543 const Int_t nTriggerJets = pygeh->NTriggerJets();
545 Float_t tmpjet[]={0,0,0,0};
547 // select the closest jet to parton
551 for(Int_t ijet = 0; ijet< nTriggerJets; ijet++)
553 pygeh->TriggerJet(ijet, tmpjet);
555 fLVTmp.SetPxPyPzE(tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3]);
556 Float_t jphi = fLVTmp.Phi();
557 if(jphi < 0) jphi +=TMath::TwoPi();
559 Double_t radius6 = GetIsolationCut()->Radius(p6eta, p6phi, fLVTmp.Eta() , jphi) ;
560 Double_t radius7 = GetIsolationCut()->Radius(p7eta, p7phi, fLVTmp.Eta() , jphi) ;
562 //printf("jet %d: pt %2.2f, eta %2.2f, phi %2.2f, r6 %2.2f, r7 %2.2f\n",ijet,jet.Pt(),jet.Eta(),jphi,radius6, radius7);
579 //printf("jet6: pt %2.2f, eta %2.2f, phi %2.2f\n",fJet6.Pt(),fJet6.Eta(),fJet6.Phi());
580 //printf("jet7: pt %2.2f, eta %2.2f, phi %2.2f\n",fJet7.Pt(),fJet7.Eta(),fJet6.Phi());
584 fhPtHard ->Fill(fPtHard);
585 fhPtJet ->Fill(fJet6.Pt());
586 fhPtJet ->Fill(fJet7.Pt());
587 fhPtParton ->Fill(p6pt);
588 fhPtParton ->Fill(p7pt);
592 fhPtPartonPtHard->Fill(fPtHard, p6pt/fPtHard);
593 fhPtPartonPtHard->Fill(fPtHard, p7pt/fPtHard);
594 fhPtJetPtHard ->Fill(fPtHard, fJet6.Pt()/fPtHard);
595 fhPtJetPtHard ->Fill(fPtHard, fJet7.Pt()/fPtHard);
598 if( p6pt > 0 ) fhPtJetPtParton ->Fill(fPtHard, fJet6.Pt()/p6pt);
599 if( p7pt > 0 ) fhPtJetPtParton ->Fill(fPtHard, fJet7.Pt()/p7pt);
605 //_____________________________________________________
606 void AliAnaGeneratorKine::GetXE(Int_t indexTrig,
608 Bool_t leading [fgkNIso],
609 Bool_t isolated[fgkNIso],
613 // Calculate the real XE and the UE XE
617 Float_t ptTrig = fTrigger.Pt();
618 Float_t phiTrig = fTrigger.Phi();
619 if(phiTrig < 0 ) phiTrig += TMath::TwoPi();
623 Int_t ipartonAway = 0;
625 //Loop on primaries, start from position 8, no partons
626 for(Int_t ipr = 8; ipr < fNPrimaries; ipr ++ )
629 if(ipr==indexTrig) continue;
631 // Get ESD particle kinematics
634 TParticle * particle = fStack->Particle(ipr) ;
636 pdg = particle->GetPdgCode();
637 status = particle->GetStatusCode();
639 // Compare trigger with final state particles
640 if( status != 1) continue ; // do it here to avoid crashes
642 particle->Momentum(fLVTmp);
644 charge = (Int_t) TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
646 else // AOD particle kinematics
648 AliAODMCParticle * particle = (AliAODMCParticle*) fAODMCparticles->At(ipr) ;
650 pdg = particle->GetPdgCode();
651 status = particle->GetStatus();
653 // Compare trigger with final state particles
654 if( status != 1) continue ; // do it here to avoid crashes
656 fLVTmp.SetPxPyPzE(particle->Px(),particle->Py(),particle->Pz(),particle->E());
658 charge = particle->Charge();
661 // construct xe only with charged
662 if( charge == 0 ) continue;
664 Float_t pt = fLVTmp.Pt();
665 Float_t phi = fLVTmp.Phi();
666 if(phi < 0 ) phi += TMath::TwoPi();
668 if( pt < fMinChargedPt) continue ;
670 Bool_t inTPC = GetFiducialCut()->IsInFiducialCut(fLVTmp.Eta(),fLVTmp.Phi(),kCTS) ;
674 // ---------------------------------------------------
675 // Get the index of the mother, get from what parton
679 ipartonAway = fStack->Particle(ipr)->GetFirstMother();
682 AliDebug(1,"End, no mother index");
686 TParticle * mother = fStack->Particle(ipartonAway);
687 while (ipartonAway > 7)
689 ipartonAway = mother->GetFirstMother();
690 if(ipartonAway < 0) break;
691 mother = fStack->Particle(ipartonAway);
696 ipartonAway = ((AliAODMCParticle*) fAODMCparticles->At(ipr))->GetMother();
699 AliDebug(1,"End, no mother index");
703 AliAODMCParticle * mother = (AliAODMCParticle*) fAODMCparticles->At(ipartonAway);
704 while (ipartonAway > 7)
706 ipartonAway = mother->GetMother();
707 if(ipartonAway < 0) break;
708 mother = (AliAODMCParticle*) fAODMCparticles->At(ipartonAway);
712 //-----------------------------------------
713 // Get XE of particles belonging to the jet
714 // on the opposite side of the trigger
716 Float_t xe = -pt/ptTrig*TMath::Cos(phi-phiTrig);
718 if((ipartonAway==6 || ipartonAway==7) && iparton!=ipartonAway)
720 for( Int_t i = 0; i < fgkNIso; i++ )
722 fhXE[partType][leading[i]][i] ->Fill(ptTrig,xe);
726 fhXEIsolated[partType][leading[i]][i] ->Fill(ptTrig,xe);
731 //----------------------------------------------------------
732 // Get the XE from particles not attached to any of the jets
733 if(ipartonAway!=6 && ipartonAway!=7)
735 for( Int_t i = 0; i < fgkNIso; i++ )
737 fhXEUE[partType][leading[i]][i] ->Fill(ptTrig,xe);
741 fhXEUEIsolated[partType][leading[i]][i] ->Fill(ptTrig,xe);
752 //________________________________________
753 void AliAnaGeneratorKine::InitParameters()
756 //Initialize the parameters of the analysis.
757 AddToHistogramsName("AnaGenKine_");
759 fTriggerDetector = kEMCAL;
766 //_____________________________________________________________________
767 void AliAnaGeneratorKine::IsLeadingAndIsolated(Int_t indexTrig,
769 Bool_t leading[fgkNIso],
770 Bool_t isolated[fgkNIso])
772 // Check if the trigger is the leading particle and if it is isolated
773 // In case of neutral particles check all neutral or neutral in EMCAL acceptance
777 Float_t ptMaxCharged = 0; // all charged
778 Float_t ptMaxNeutral = 0; // all neutral
779 Float_t ptMaxNeutEMCAL = 0; // for neutral, select them in EMCAL acceptance
780 Float_t ptMaxNeutPhot = 0; // for neutral, take only photons
781 Float_t ptMaxNeutEMCALPhot = 0; // for neutral, take only photons in EMCAL acceptance
793 Float_t ptTrig = fTrigger.Pt();
794 Float_t etaTrig = fTrigger.Eta();
795 Float_t phiTrig = fTrigger.Phi();
796 if(phiTrig < 0 ) phiTrig += TMath::TwoPi();
798 // Minimum track or cluster energy
801 Float_t ptThresIC = GetIsolationCut()->GetPtThreshold();
802 Float_t sumThresIC = GetIsolationCut()->GetPtThreshold();
803 Float_t rThresIC = GetIsolationCut()->GetConeSize();
804 Float_t isoMethod = GetIsolationCut()->GetICMethod();
808 Int_t nICNeutral = 0;
809 Int_t nICNeutEMCAL = 0;
810 Int_t nICNeutPhot = 0;
811 Int_t nICNeutEMCALPhot = 0;
815 Float_t sumNePtPhot = 0;
816 Float_t sumNePtEMC = 0;
817 Float_t sumNePtEMCPhot = 0;
820 //Loop on primaries, start from position 8, no partons
826 for(Int_t ipr = 8; ipr < fNPrimaries; ipr ++ )
828 if(ipr == indexTrig) continue;
832 TParticle * particle = fStack->Particle(ipr) ;
834 imother = particle->GetFirstMother();
835 pdg = particle->GetPdgCode();
836 status = particle->GetStatusCode();
838 // Compare trigger with final state particles
839 if( status != 1) continue ; // do it here to avoid crashes
841 charge = (Int_t) TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
842 particle->Momentum(fLVTmp);
846 AliAODMCParticle * particle = (AliAODMCParticle*) fAODMCparticles->At(ipr) ;
848 imother = particle->GetMother();
849 pdg = particle->GetPdgCode();
850 status = particle->GetStatus();
852 // Compare trigger with final state particles
853 if( status != 1) continue ; // do it here to avoid crashes
855 charge = particle->Charge();
856 fLVTmp.SetPxPyPzE(particle->Px(),particle->Py(),particle->Pz(),particle->E());
859 // Do not consider the photon decays from pi0 and eta
860 //printf("Leading ipr %d - mother %d - iTrig\n",ipr, imother,indexTrig);
861 if( imother == indexTrig) continue ;
863 Float_t pt = fLVTmp.Pt();
864 Float_t eta = fLVTmp.Eta();
865 Float_t phi = fLVTmp.Phi();
866 if(phi < 0 ) phi += TMath::TwoPi();
868 // Select all particles in at least the TPC acceptance
869 Bool_t inTPC = GetFiducialCut()->IsInFiducialCut(eta,phi,kCTS) ;
873 Double_t radius = GetIsolationCut()->Radius(etaTrig, phiTrig, eta , phi) ;
877 if(pt < fMinNeutralPt) continue ;
879 if( ptMaxNeutral < pt ) ptMaxNeutral = pt;
881 if( radius < rThresIC )
883 if( pt > ptThresIC ) nICNeutral++ ;
887 Bool_t phPDG = kFALSE;
888 if(pdg==22 || pdg==111) phPDG = kTRUE;
890 // if(pt > ptTrig) printf(" --- pdg %d, phPDG %d pT %2.2f, pTtrig %2.2f, eta %2.2f, phi %2.2f\n",pdg,phPDG,pt,ptTrig,eta, phi*TMath::RadToDeg());
893 if( ptMaxNeutPhot < pt) ptMaxNeutPhot = pt;
895 if( radius < rThresIC )
897 if(pt > ptThresIC) nICNeutPhot++ ;
902 //Calorimeter acceptance
903 Bool_t inCalo = GetFiducialCut()->IsInFiducialCut(eta,phi,GetCalorimeter()) ;
904 if(!inCalo) continue;
906 if( ptMaxNeutEMCAL < pt ) ptMaxNeutEMCAL = pt;
907 if( radius < rThresIC )
909 if( pt > ptThresIC ) nICNeutEMCAL++ ;
915 if( ptMaxNeutEMCALPhot < pt ) ptMaxNeutEMCALPhot = pt;
916 if( radius < rThresIC )
918 if (pt > ptThresIC) nICNeutEMCALPhot++ ;
919 sumNePtEMCPhot += pt;
925 if( pt < fMinChargedPt) continue ;
927 if( ptMaxCharged < pt ) ptMaxCharged = pt;
929 if( radius < rThresIC )
931 // printf("UE track? pTtrig %2.2f, pt %2.2f, etaTrig %2.2f, eta %2.2f, phiTrig %2.2f, phi %2.2f, radius %2.2f\n",
932 // ptTrig, pt,etaTrig, eta, phiTrig*TMath::RadToDeg(), phi*TMath::RadToDeg(),radius);
933 if( pt > ptThresIC ) nICTrack++ ;
942 if(ptTrig > ptMaxCharged)
944 // printf("pt charged %2.2f, pt neutral %2.2f, pt neutral emcal %2.2f, pt photon %2.2f, pt photon emcal %2.2f\n",
945 // ptMaxCharged, ptMaxNeutral, ptMaxNeutEMCAL,ptMaxNeutPhot, ptMaxNeutEMCALPhot);
946 if(ptTrig > ptMaxNeutral ) leading[0] = kTRUE ;
947 if(ptTrig > ptMaxNeutEMCAL ) leading[1] = kTRUE ;
948 if(ptTrig > ptMaxNeutPhot ) leading[2] = kTRUE ;
949 if(ptTrig > ptMaxNeutEMCALPhot) leading[3] = kTRUE ;
952 // printf("N in cone over threshold: tracks %d, neutral %d, neutral emcal %d, photon %d, photon emcal %d\n",
953 // nICTrack, nICNeutral ,nICNeutEMCAL,nICNeutPhot, nICNeutEMCALPhot);
956 // Isolation decision
957 if( isoMethod == AliIsolationCut::kPtThresIC )
961 if(nICNeutral == 0 ) isolated[0] = kTRUE ;
962 if(nICNeutEMCAL == 0 ) isolated[1] = kTRUE ;
963 if(nICNeutPhot == 0 ) isolated[2] = kTRUE ;
964 if(nICNeutEMCALPhot == 0 ) isolated[3] = kTRUE ;
967 else if( isoMethod == AliIsolationCut::kSumPtIC )
969 if(sumChPt + sumNePt < sumThresIC ) isolated[0] = kTRUE ;
970 if(sumChPt + sumNePtEMC < sumThresIC ) isolated[1] = kTRUE ;
971 if(sumChPt + sumNePtPhot < sumThresIC ) isolated[2] = kTRUE ;
972 if(sumChPt + sumNePtEMCPhot < sumThresIC ) isolated[3] = kTRUE ;
976 //----------------------------------------------------
977 // Fill histograms if conditions apply for all 4 cases
978 for( Int_t i = 0; i < fgkNIso; i++ )
982 fhPtLeading[partType][i]->Fill(ptTrig);
984 if (i == 0) fhPtLeadingSumPt[partType][i]->Fill(ptTrig, sumChPt + sumNePt);
985 else if(i == 1) fhPtLeadingSumPt[partType][i]->Fill(ptTrig, sumChPt + sumNePtEMC);
986 else if(i == 2) fhPtLeadingSumPt[partType][i]->Fill(ptTrig, sumChPt + sumNePtPhot);
987 else if(i == 3) fhPtLeadingSumPt[partType][i]->Fill(ptTrig, sumChPt + sumNePtEMCPhot);
989 if(isolated[i]) fhPtLeadingIsolated[partType][i]->Fill(ptTrig);
997 //_____________________________________________________
998 void AliAnaGeneratorKine::MakeAnalysisFillHistograms()
1000 // Particle-Parton/Jet/Hadron Correlation Analysis, main method
1002 AliDebug(1,"Start");
1004 fParton6.SetPxPyPzE(0,0,0,0);
1005 fParton7.SetPxPyPzE(0,0,0,0);
1010 // Get the ESD MC particles container
1012 if( GetReader()->ReadStack() )
1014 fStack = GetMCStack();
1017 AliFatal("Stack not available, is the MC handler called? STOP");
1021 fNPrimaries = fStack->GetNprimary(); // GetNtrack();
1025 (fStack->Particle(6))->Momentum(fParton6) ;
1026 fParton6PDG = (fStack->Particle(6))->GetPdgCode();
1031 (fStack->Particle(7))->Momentum(fParton7) ;
1032 fParton7PDG = (fStack->Particle(7))->GetPdgCode();
1036 // Get the AOD MC particles container
1037 fAODMCparticles = 0;
1038 if( GetReader()->ReadAODMCParticles() )
1040 fAODMCparticles = GetReader()->GetAODMCParticles();
1041 if( !fAODMCparticles )
1043 AliFatal("Standard MCParticles not available!");
1047 fNPrimaries = fAODMCparticles->GetEntriesFast();
1048 AliAODMCParticle * primAOD = 0;
1051 primAOD = (AliAODMCParticle *) fAODMCparticles->At(6);
1052 fParton6.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
1054 fParton6PDG = primAOD->GetPdgCode();
1059 primAOD = (AliAODMCParticle *) fAODMCparticles->At(7);
1060 fParton7.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
1062 fParton7PDG = primAOD->GetPdgCode();
1067 GetPartonsAndJets();
1069 // Main particle loop
1071 Int_t statusTrig = 0;
1074 Int_t momStatus = 0;
1080 Int_t nDaughters = 0;
1082 for(Int_t ipr = 0; ipr < fNPrimaries; ipr ++ )
1086 TParticle * particle = fStack->Particle(ipr) ;
1088 pdgTrig = particle->GetPdgCode();
1089 statusTrig = particle->GetStatusCode();
1090 imother = particle->GetFirstMother();
1091 ptTrig = particle->Pt();
1092 nDaughters = particle->GetNDaughters();
1093 id0 = particle->GetDaughter(0);
1094 id1 = particle->GetDaughter(1);
1095 // Recover the kinematics:
1096 particle->Momentum(fTrigger);
1100 AliAODMCParticle* particle = (AliAODMCParticle*) fAODMCparticles->At(ipr) ;
1102 pdgTrig = particle->GetPdgCode();
1103 statusTrig = particle->GetStatus();
1104 imother = particle->GetMother();
1105 nDaughters = particle->GetNDaughters();
1106 id0 = particle->GetDaughter(0);
1107 id1 = particle->GetDaughter(1);
1108 // Recover the kinematics:
1109 fTrigger.SetPxPyPzE(particle->Px(),particle->Py(),particle->Pz(),particle->E());
1112 // Select final state photons or pi0s or eta's
1114 if( pdgTrig == 22 && statusTrig != 1 ) continue ;
1116 if( pdgTrig != 111 && pdgTrig != 22 && pdgTrig !=221 ) continue ;
1118 // Acceptance and kinematical cuts
1120 Float_t ptTrig = fTrigger.Pt();
1122 if( ptTrig < GetMinPt() ) continue ;
1124 Bool_t in = GetFiducialCutForTrigger()->IsInFiducialCut(fTrigger.Eta(),fTrigger.Phi(),fTriggerDetector) ;
1125 if(! in ) continue ;
1127 // Identify the particle to fill appropriate histogram
1128 Int_t partType = -1;
1136 momStatus = (fStack->Particle(imother))->GetStatusCode();
1137 momPdg = (fStack->Particle(imother))->GetPdgCode();
1141 momStatus = ((AliAODMCParticle*) fAODMCparticles->At(imother))->GetStatus();
1142 momPdg = ((AliAODMCParticle*) fAODMCparticles->At(imother))->GetPdgCode();
1145 if (imother < 8 && statusTrig == 1) partType = kmcPrimPhoton ;
1146 else if(momPdg == 111 ) partType = kmcPrimPi0Decay ;
1147 else if(momPdg == 221 ) partType = kmcPrimEtaDecay ;
1148 else if(momStatus > 0 ) partType = kmcPrimOtherDecay ;
1151 else if( (pdgTrig==111 || pdgTrig==221) && nDaughters == 2 )
1155 pdg0 = fStack->Particle(id0)->GetPdgCode();
1156 pdg1 = fStack->Particle(id1)->GetPdgCode();
1160 pdg0 = ((AliAODMCParticle*) fAODMCparticles->At(id0))->GetPdgCode();
1161 pdg1 = ((AliAODMCParticle*) fAODMCparticles->At(id1))->GetPdgCode();
1164 if( pdg0 == 22 && pdg1== 22 )
1166 if ( pdgTrig==111 ) partType = kmcPrimPi0;
1167 else if( pdgTrig==221 ) partType = kmcPrimEta;
1171 if(partType < 0 ) continue ;
1173 AliDebug(1,Form("Select trigger particle %d: pdg %d, type %d, status %d, mother index %d, pT %2.2f, eta %2.2f, phi %2.2f",
1174 ipr, pdgTrig, partType, statusTrig, imother, ptTrig, fTrigger.Eta(), fTrigger.Phi()*TMath::RadToDeg()));
1178 // printf("\t pi0 daughters %d, %d\n", particle->GetDaughter(0), particle->GetDaughter(1));
1181 // Fill histograms do analysis
1183 fhPt[partType]->Fill(ptTrig);
1185 // Check if it is leading
1186 Bool_t leading [fgkNIso] ;
1187 Bool_t isolated[fgkNIso] ;
1189 IsLeadingAndIsolated(ipr, partType, leading, isolated);
1192 Int_t ok = CorrelateWithPartonOrJet(ipr, partType, leading, isolated, iparton);
1195 GetXE(ipr,partType,leading,isolated,iparton) ;
1199 AliDebug(1,"End fill histograms");
1203 //_________________________________________________________
1204 void AliAnaGeneratorKine::SetTriggerDetector(TString & det)
1206 // Set the detrimeter for the analysis
1208 fTriggerDetectorString = det;
1210 if (det=="EMCAL") fTriggerDetector = kEMCAL;
1211 else if(det=="PHOS" ) fTriggerDetector = kPHOS;
1212 else if(det=="CTS") fTriggerDetector = kCTS;
1213 else if(det=="DCAL") fTriggerDetector = kDCAL;
1214 else if(det.Contains("DCAL") && det.Contains("PHOS")) fTriggerDetector = kDCALPHOS;
1215 else AliFatal(Form("Detector < %s > not known!", det.Data()));
1219 //_____________________________________________________
1220 void AliAnaGeneratorKine::SetTriggerDetector(Int_t det)
1222 // Set the detrimeter for the analysis
1224 fTriggerDetector = det;
1226 if (det==kEMCAL) fTriggerDetectorString = "EMCAL";
1227 else if(det==kPHOS ) fTriggerDetectorString = "PHOS";
1228 else if(det==kCTS) fTriggerDetectorString = "CTS";
1229 else if(det==kDCAL) fTriggerDetectorString = "DCAL";
1230 else if(det==kDCALPHOS) fTriggerDetectorString = "DCAL_PHOS";
1231 else AliFatal(Form("Detector < %d > not known!", det));