]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/GammaConv/AliAnalysisTaskdPhi.cxx
allow embedding of MC events on particle level into recontructed Pb-Pb events (M...
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskdPhi.cxx
CommitLineData
3b77b2d1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Authors: Svein Lindal *
5 * Version 1.0 *
6 * *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17////////////////////////////////////////////////
18//---------------------------------------------
19// Class doing conversion gamma dPhi correlations
20// Gamma Conversion analysis
21//---------------------------------------------
22////////////////////////////////////////////////
23
24#include "AliAnalysisTaskdPhi.h"
25
26#include <TH2I.h>
27#include <TList.h>
28#include <TChain.h>
29
30#include <AliAnalysisManager.h>
31#include <AliInputEventHandler.h>
32#include <AliESDInputHandler.h>
33#include <AliAODInputHandler.h>
34#include <AliAnalysisFilter.h>
35
2dd6ec26 36#include "AliConversionTrackCuts.h"
3b77b2d1 37#include "AliConversionCuts.h"
38#include "AliAODConversionPhoton.h"
39#include "AliAODConversionMother.h"
40#include "AliAnaConvCorrPhoton.h"
41#include "AliAnaConvCorrPion.h"
42#include "AliAnaConvIsolation.h"
43// Author Svein Lindal <slindal@fys.uio.no>
44using namespace std;
45
46ClassImp(AliAnalysisTaskdPhi)
47
48
49//________________________________________________________________________
50AliAnalysisTaskdPhi::AliAnalysisTaskdPhi(const char *name) : AliAnalysisTaskSE(name),
51 fHistograms(NULL),
52 fHistoGamma(NULL),
53 fHistoPion(NULL),
3b77b2d1 54 fV0Filter(NULL),
4267afec 55 fTrackCuts(NULL),
3b77b2d1 56 fGammas(NULL),
57 fPions(NULL),
58 hMETracks(NULL),
59 hMEPhotons(NULL),
60 hMEPions(NULL),
61 hMEvents(NULL),
62 fPhotonCorr(NULL),
63 fPionCorr(NULL),
64 fIsoAna(NULL),
92efd725 65 fL1(-1),
66 fL2(-1),
3b77b2d1 67 fDeltaAODBranchName("AliAODGammaConversion_gamma"),
3bff49c3 68 fAxistPt(),
69 fAxiscPt(),
3b77b2d1 70 fAxisEta(),
71 fAxisPhi(),
72 fAxisCent(),
73 fAxisZ(),
74 fAxisPiM()
75{
76 //constructor
3bff49c3 77 fAxistPt.SetNameTitle("tPtAxis", "tPt");
78 fAxistPt.Set(20, 0, 100);
3b77b2d1 79
3bff49c3 80 fAxiscPt.SetNameTitle("cPtAxis", "cPt");
81 fAxiscPt.Set(20, 0, 100);
3b77b2d1 82
3b77b2d1 83 fAxisEta.SetNameTitle("EtaAxis", "Eta");
84 fAxisEta.Set(160, -0.8, 0.8);
3bff49c3 85
3b77b2d1 86 fAxisPhi.SetNameTitle("PhiAxis", "Phi");
87 fAxisPhi.Set(128, 0, TMath::TwoPi());
3bff49c3 88
3b77b2d1 89 fAxisZ.SetNameTitle("ZAxis", "Z");
90 fAxisZ.Set(4, -10, 10);
3b77b2d1 91
4267afec 92 fAxisCent.SetNameTitle("CentAxis", "Cent");
92efd725 93
94
3b77b2d1 95 Double_t centbins[5] = {0, 10, 30, 60, 100.1};
96 fAxisCent.Set(4, centbins);
97
92efd725 98 Double_t mbins[7] = {0.1, 0.11, 0.12, 0.15, 0.16, 0.18, 0.2};
3b77b2d1 99 fAxisPiM.SetNameTitle("InvMassPi0", "Invariant mass");
92efd725 100 fAxisPiM.Set(6, mbins);
3b77b2d1 101
102 fGammas = new TObjArray();
103 fGammas->SetOwner(kFALSE);
104
105 fPions = new TObjArray();
106 fPions->SetOwner(kFALSE);
d64241db 107
3b77b2d1 108 // Define input and output slots here
109 DefineInput(0, TChain::Class());
92efd725 110 DefineInput(1, TClonesArray::Class());
3b77b2d1 111 DefineOutput(1, TList::Class());
112 DefineOutput(2, TList::Class());
113 DefineOutput(3, TList::Class());
114}
115
116
117
118//________________________________________________________________________
119AliAnalysisTaskdPhi::~AliAnalysisTaskdPhi(){
120 //destructor
121 if(fPions)
122 delete fPions;
123 fPions = NULL;
124
125 if(fGammas)
126 delete fGammas;
127 fGammas = NULL;
128
129 if(fIsoAna)
130 delete fIsoAna;
131 fIsoAna = NULL;
132
133 if(fV0Filter)
134 delete fV0Filter;
135 fV0Filter = NULL;
136
137 if(fHistograms)
138 delete fHistograms;
139 fHistograms = NULL;
140
92efd725 141if(fHistoPion)
3b77b2d1 142 delete fHistoPion;
143 fHistoPion = NULL;
144
145 if(fHistoGamma)
146 delete fHistoGamma;
147 fHistoGamma = NULL;
148
149}
150
151///________________________________________________________________________
152void AliAnalysisTaskdPhi::SetUpCorrObjects() {
153 ///Creat corr obj
154 fIsoAna = new AliAnaConvIsolation();
155
156
157 fPhotonCorr = new TObjArray();
158 fPionCorr = new TObjArray();
159
160 TList * hPhoton = new TList();
161 hPhoton->SetName("hPhotonCorr");
162 hPhoton->SetOwner(kTRUE);
163 fHistoGamma->Add(hPhoton);
164
165 TList * hPion = new TList();
166 hPion->SetName("hPionCorr");
167 hPion->SetOwner(kTRUE);
168 fHistoPion->Add(hPion);
169
170
92efd725 171 for(Int_t iz = 0; iz < fAxisZ.GetNbins(); iz++) {
3b77b2d1 172 TObjArray * photonArray = new TObjArray();
173 photonArray->SetOwner(kTRUE);
92efd725 174 fPhotonCorr->AddAt(photonArray, iz);
3b77b2d1 175
176 TObjArray * pionArray = new TObjArray();
177 pionArray->SetOwner(kTRUE);
92efd725 178 fPionCorr->AddAt(pionArray, iz);
3b77b2d1 179
180 TList * photonList = new TList();
92efd725 181 photonList->SetName(Form("photon_%d", iz));
3b77b2d1 182 photonList->SetOwner(kTRUE);
92efd725 183 hPhoton->AddAt(photonList, iz);
3b77b2d1 184
185 TList * pionList = new TList();
92efd725 186 pionList->SetName(Form("pion_%d", iz));
3b77b2d1 187 pionList->SetOwner(kTRUE);
92efd725 188 hPion->AddAt(pionList, iz);
3b77b2d1 189
92efd725 190 for(Int_t ic = 0; ic < fAxisCent.GetNbins(); ic++) {
3b77b2d1 191
92efd725 192 TString nameString = Form("%d_%d", iz, ic);
3b77b2d1 193 TString titleString = Form("%f < Z < %f ... %f cent %f",
194 fAxisZ.GetBinLowEdge(iz+1), fAxisZ.GetBinUpEdge(iz+1),
195 fAxisCent.GetBinLowEdge(ic+1), fAxisCent.GetBinUpEdge(ic+1));
196
197
198
199 AliAnaConvCorrPhoton * photonCorr = new AliAnaConvCorrPhoton(Form("PhotonCorr_%s", nameString.Data()), Form("photon %s", titleString.Data()));
92efd725 200 photonArray->AddAt(photonCorr, ic);
201 //photonCorr->GetAxistPt().Set(fAxistPt.GetNbins(), fAxistPt.GetXbins()->GetArray());
202 //photonCorr->GetAxiscPt().Set(fAxiscPt.GetNbins(), fAxiscPt.GetXbins()->GetArray());
3b77b2d1 203 photonCorr->CreateHistograms();
204 photonList->Add(photonCorr->GetHistograms());
205
206 AliAnaConvCorrPion * pionCorr = new AliAnaConvCorrPion(Form("PionCorr_%s", nameString.Data()), Form("pion %s", titleString.Data()));
92efd725 207 pionArray->AddAt(pionCorr, ic);
208 //pionCorr->GetAxistPt().Set(fAxistPt.GetNbins(), fAxistPt.GetXbins()->GetArray());
209 //pionCorr->GetAxiscPt().Set(fAxiscPt.GetNbins(), fAxiscPt.GetXbins()->GetArray());
210 //pionCorr->GetAxisM().Set(fAxisPiM.GetNbins(), fAxisPiM.GetXbins()->GetArray());
3b77b2d1 211 pionCorr->CreateHistograms();
212 pionList->Add(pionCorr->GetHistograms());
213 }
214 }
215}
216
217//________________________________________________________________________
218void AliAnalysisTaskdPhi::UserCreateOutputObjects() {
219 // Create histograms
220
221 fHistograms = new TList();
222 fHistograms->SetName("dPhi_histograms");
223 fHistograms->SetOwner(kTRUE);
224
225 fHistoGamma = new TList();
226 fHistoGamma->SetName("Gamma_histo");
227 fHistoGamma->SetOwner(kTRUE);
228
229 fHistoPion = new TList();
230 fHistoPion->SetName("Pion_histo");
231 fHistoPion->SetOwner(kTRUE);
232
233
234 if(fV0Filter) {
235 fV0Filter->InitCutHistograms();
236 fHistograms->Add(fV0Filter->GetCutHistograms());
237 }
238
239
4267afec 240 AliConversionTrackCuts * tc = dynamic_cast<AliConversionTrackCuts*>(fTrackCuts);
241 if(tc) fHistograms->Add(tc->CreateHistograms());
5c76942e 242
3b77b2d1 243 SetUpCorrObjects();
244
245
246 ///Set up ME histograms
247 TList * MEHistograms = new TList();
248 MEHistograms->SetName("MEHistograms");
249 MEHistograms->SetOwner(kTRUE);
250 fHistograms->Add(MEHistograms);
251
92efd725 252 // hMETracks = new TObjArray();
253 // hMETracks->SetName("TrackArray");
254 // hMETracks->SetOwner(kTRUE);
255 // hMEPhotons = new TObjArray();
256 // hMEPhotons->SetName("PhotonArray");
257 // hMEPhotons->SetOwner(kTRUE);
258 // hMEPions = new TObjArray();
259 // hMEPions->SetName("PionArray");
260 // hMEPions->SetOwner(kTRUE);
261
262 // MEHistograms->Add(hMETracks);
263 // MEHistograms->Add(hMEPions);
264 // MEHistograms->Add(hMEPhotons);
3b77b2d1 265
266 hMEvents = new TH2I("hMEvents", "Nevents vs centrality vertexz",
267 fAxisZ.GetNbins(), fAxisZ.GetBinLowEdge(1), fAxisZ.GetBinUpEdge(fAxisZ.GetNbins()),
268 fAxisCent.GetNbins(), fAxisCent.GetBinLowEdge(1), fAxisCent.GetBinUpEdge(fAxisCent.GetNbins()));
269 hMEvents->GetYaxis()->Set(fAxisCent.GetNbins(), fAxisCent.GetXbins()->GetArray());
270 MEHistograms->Add(hMEvents);
271
92efd725 272
273 // TList axesList;
274 // axesList.AddAt(&GetAxisEta(), 0);
275 // axesList.AddAt(&GetAxisPhi(), 1);
276 // axesList.AddAt(&GetAxistPt(), 2);
277 // axesList.SetOwner(kFALSE);
278
279 // TList piAxesList;
280 // piAxesList.AddAt(&GetAxisEta(), 0);
281 // piAxesList.AddAt(&GetAxisPhi(), 1);
282 // piAxesList.AddAt(&GetAxistPt(), 2);
283 // piAxesList.AddAt(&GetAxisPiMass(), 3);
284 // piAxesList.SetOwner(kFALSE);
285
286
3b77b2d1 287 TList * outAxesList = new TList();
288 outAxesList->Add(&fAxisCent);
289 outAxesList->Add(&fAxisZ);
43cadb8a 290 fHistograms->Add(outAxesList);
3b77b2d1 291
92efd725 292 // for(Int_t iz = 0; iz < fAxisZ.GetNbins(); iz++) {
293 // TObjArray * trackArray = new TObjArray();
294 // trackArray->SetName(Form("METracks_%d", iz));
295 // trackArray->SetOwner(kTRUE);
296 // TObjArray * photonArray = new TObjArray();
297 // photonArray->SetName(Form("MEPhotons_%d", iz));
298 // photonArray->SetOwner(kTRUE);
299 // TObjArray * pionArray = new TObjArray();
300 // pionArray->SetName(Form("MEPions_%d", iz));
301 // pionArray->SetOwner(kTRUE);
302
303
304 // hMEPions->AddAt(pionArray, iz);
305 // hMETracks->AddAt(trackArray, iz);
306 // hMEPhotons->AddAt(photonArray, iz);
307
308 // for(Int_t ic = 0; ic < fAxisCent.GetNbins(); ic++) {
309
310 // TString nameString = Form("%d_%d", iz, ic);
311 // TString titleString = Form("%f < Z < %f ... %f cent %f",
312 // fAxisZ.GetBinLowEdge(iz+1), fAxisZ.GetBinUpEdge(iz+1),
313 // fAxisCent.GetBinLowEdge(ic+1), fAxisCent.GetBinUpEdge(ic+1));
314
315
316 // THnSparseF * trackHistogram = CreateSparse(Form("tracks_%s", nameString.Data()),
317 // Form("tracks %s", titleString.Data()), &axesList );
318 // trackArray->AddAt(trackHistogram, ic);
319
320 // THnSparseF * photonHistogram = CreateSparse(Form("photons_%s", nameString.Data()),
321 // Form("photons %s", titleString.Data()), &axesList );
322 // photonArray->AddAt(photonHistogram, ic);
323
324 // THnSparseF * pionHistogram = CreateSparse(Form("pions_%s", nameString.Data()),
325 // Form("pions %s", titleString.Data()), &piAxesList );
326 // pionArray->AddAt(pionHistogram, ic);
327 // }
328 // }
329
3b77b2d1 330 PostData(1, fHistograms);
331 PostData(2, fHistoGamma);
332 PostData(3, fHistoPion);
333
334}
335
336///________________________________________________________________________
337THnSparseF * AliAnalysisTaskdPhi::CreateSparse(TString nameString, TString titleString, TList * axesList) {
43cadb8a 338 ///Create sparse
3b77b2d1 339 const Int_t dim = axesList->GetSize();
340
341 TAxis * axes[dim];
342 Int_t bins[dim];
343 Double_t min[dim];
344 Double_t max[dim];
345
346 for(Int_t i = 0; i<dim; i++) {
347 TAxis * axis = dynamic_cast<TAxis*>(axesList->At(i));
348 if(axis) {
349 axes[i] = axis;
350 } else {
351 cout << "AliAnalysisTaskdPhi::CreateSparse: Error error, all the axes are not present in axis list" << endl;
352 return NULL;
353 }
354 }
355
356 for(Int_t i = 0; i<dim; i++) {
357 bins[i] = axes[i]->GetNbins();
358 min[i] = axes[i]->GetBinLowEdge(1);
359 max[i] = axes[i]->GetBinUpEdge(axes[i]->GetNbins());
360 }
361
362 THnSparseF * sparse = new THnSparseF(Form("METracks_%s", nameString.Data()),
363 Form("tracks %s", titleString.Data()),
364 dim, bins, min, max);
365
366 for(Int_t i = 0; i<dim; i++) {
367 sparse->GetAxis(i)->SetNameTitle(axes[i]->GetName(), axes[i]->GetTitle() );
368 if(axes[i]->GetXbins()->GetSize() > 0) {
369 sparse->SetBinEdges(i, axes[i]->GetXbins()->GetArray() );
370 }
371 }
372
373 return sparse;
374}
375
376//________________________________________________________________________
377void AliAnalysisTaskdPhi::UserExec(Option_t *) {
378 ///User exec.
379
380 //if(! fV0Filter->EventIsSelected(fInputEvent)) return;
3b77b2d1 381
92efd725 382
3b77b2d1 383 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
384 Bool_t isAOD=man->GetInputEventHandler()->IsA()==AliAODInputHandler::Class();
385
386 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
387 if (!inputHandler) {
388 cout << "cout no input event handler"<<endl;
389 return;
390 }
391
392
393 if ( fV0Filter && !fV0Filter->GetPIDResponse() ) {
394 if ( inputHandler->GetPIDResponse() ){
395 fV0Filter->SetPIDResponse( inputHandler->GetPIDResponse() );
396 } else {
397
398 //AOD case
399 if (isAOD){
400 if (!fV0Filter->GetPIDResponse()){
401 fV0Filter->InitAODpidUtil(1);
402 }
403 }
404 }
405 }
406
407 Double_t centrality = 0.0;
408 Double_t eventPlane = 0.0;
409 Double_t vertexz = fInputEvent->GetPrimaryVertex()->GetZ();
410 if(isAOD) {
411 AliAODHeader * header = static_cast<AliAODHeader*>(fInputEvent->GetHeader());
412 centrality = header->GetCentrality();
413 eventPlane = header->GetEventplane();
414 } else {
92efd725 415 centrality = static_cast<AliESDEvent*>(fInputEvent)->GetCentrality()->GetCentralityPercentile("kV0M");
3b77b2d1 416 eventPlane = fInputEvent->GetEventplane()->GetEventplane("Q");
417 }
418
4267afec 419
420 const Int_t centBin = GetBin(fAxisCent, centrality);
421 const Int_t vertexBin = GetBin(fAxisZ, vertexz);
422
423
3bff49c3 424 if(DebugLevel () > 4) {
3b77b2d1 425 cout << "centrality: " << centrality << " " << GetBin(fAxisCent, centrality) << endl;
426 cout << "vertexz: " << vertexz << " " << GetBin(fAxisZ, vertexz) << endl;
427 cout << "eventPlane: " << eventPlane << " " << endl;
428 }
429
3b77b2d1 430
92efd725 431
3b77b2d1 432 if(centBin < 0 || vertexBin < 0) {
433 AliError("bin out of range");
434 return;
435 }
436
437 fGammas->Clear();
438 fPions->Clear();
439
440 TClonesArray * aodGammas = GetConversionGammas(isAOD);
441 if(!aodGammas) {
442 AliError("no aod gammas found!");
443 return;
444 }
445
92efd725 446 if(aodGammas->GetEntriesFast() > 0) {
447 if( static_cast<AliAODConversionParticle*>(aodGammas->At(0))->GetLabel(0) == fL1 &&
448 static_cast<AliAODConversionParticle*>(aodGammas->At(0))->GetLabel(1) == fL2
449 ) {
450 return;
451 }
452 fL1 = static_cast<AliAODConversionParticle*>(aodGammas->At(0))->GetLabel(0);
453 fL2 = static_cast<AliAODConversionParticle*>(aodGammas->At(0))->GetLabel(1);
454 //cout << aodGammas->GetEntriesFast() << " " << fInputEvent->GetNumberOfTracks() << "c" << endl;
455 }
849102f9 456
3b77b2d1 457 if(DebugLevel() > 1) printf("Number of conversion gammas %d \n", aodGammas->GetEntriesFast());
458 for(Int_t ig = 0; ig < aodGammas->GetEntriesFast(); ig++) {
92efd725 459 AliAODConversionPhoton * photon = dynamic_cast<AliAODConversionPhoton*>(aodGammas->At(ig));
3b77b2d1 460
92efd725 461 if(!photon) continue;
3b77b2d1 462 if(!fV0Filter || fV0Filter->PhotonIsSelected(static_cast<AliConversionPhotonBase*>(photon), fInputEvent)) {
463 fGammas->Add(static_cast<TObject*>(photon));
464 }
465 }
466
467 if(DebugLevel() > 4) printf("Number of accepted gammas %d \n", fGammas->GetEntriesFast());
4267afec 468 hMEvents->Fill(vertexz, centrality);
469
3b77b2d1 470
4267afec 471
472 ///create track array
3b77b2d1 473 TObjArray tracks;
4267afec 474 const Double_t etalim[2] = { fAxisEta.GetBinLowEdge(1), fAxisEta.GetBinUpEdge(fAxisEta.GetNbins())};
3b77b2d1 475 for(Int_t iTrack = 0; iTrack < fInputEvent->GetNumberOfTracks(); iTrack++) {
476
92efd725 477 AliVTrack * track = static_cast<AliVTrack*>(fInputEvent->GetTrack(iTrack));
478 if(track->Pt() < fAxiscPt.GetBinLowEdge(1) ) continue;
479 if(track->Eta() < etalim[0] || track->Eta() > etalim[1]) continue;
480
481
482 if(fTrackCuts && fTrackCuts->IsSelected((track))) {
483 tracks.Add(track);
484 }
3b77b2d1 485 }
3eeea1ba 486
3b77b2d1 487 Process(fGammas, &tracks, vertexBin, centBin);
488
489 PostData(1, fHistograms);
490 PostData(2, fHistoGamma);
491 PostData(3, fHistoPion);
492
493}
494
495
496//________________________________________________________________________
497void AliAnalysisTaskdPhi::Process(TObjArray * gammas, TObjArray * tracks, Int_t vertexBin, Int_t centBin) {
498 ///Process stuff
499
4267afec 500 if(DebugLevel() > 4) printf("Number of accepted gammas, tracks %d %d \n", gammas->GetEntriesFast(), tracks->GetEntriesFast());
3b77b2d1 501
3b77b2d1 502 AliAnaConvCorrBase * gCorr = GetCorrObject(vertexBin, centBin, fPhotonCorr);
92efd725 503 AliAnaConvCorrBase * piCorr = GetCorrObject(vertexBin, centBin, fPionCorr);
3b77b2d1 504
505 if(!gCorr || !piCorr) {
506 AliError("corr object missing");
507 return;
508 }
509
3b77b2d1 510 for(Int_t i1 = 0; i1 < gammas->GetEntriesFast(); i1++) {
511 AliAODConversionPhoton * ph1 = static_cast<AliAODConversionPhoton*>(gammas->UncheckedAt(i1));
512 Int_t tIDs[4] = {ph1->GetLabel(0), ph1->GetLabel(1), -1, -1};
513
3bff49c3 514 Int_t leading = fIsoAna->IsLeading(static_cast<AliAODConversionParticle*>(ph1), tracks, tIDs);
e3598cd0 515 if(ph1->Pt() > fAxistPt.GetBinLowEdge(1)) {
516 gCorr->CorrelateWithTracks( static_cast<AliAODConversionParticle*>(ph1), tracks, tIDs, leading);
517 }
3b77b2d1 518 for(Int_t i2 = 0; i2 < i1; i2++) {
519 AliAODConversionPhoton * ph2 = static_cast<AliAODConversionPhoton*>(gammas->UncheckedAt(i2));
3bff49c3 520
3b77b2d1 521 if( ph2->GetTrackLabelPositive()==ph1->GetTrackLabelPositive()
522 || ph2->GetTrackLabelNegative()==ph1->GetTrackLabelNegative()
523 || ph2->GetTrackLabelNegative()==ph1->GetTrackLabelPositive()
524 || ph2->GetTrackLabelPositive()==ph1->GetTrackLabelNegative()) {
525 continue;
526 }
527
528 AliAODConversionMother * pion = new AliAODConversionMother(ph1, ph2);
529 pion->SetLabels(i1, i2);
3bff49c3 530
3b77b2d1 531 if(!fV0Filter || fV0Filter->MesonIsSelected(pion, kTRUE) ) {
92efd725 532
533
3bff49c3 534 Int_t leadingpi = fIsoAna->IsLeading(static_cast<AliAODConversionParticle*>(pion), tracks, tIDs);
d64241db 535 piCorr->FillTriggerCounters(pion, leadingpi);
3bff49c3 536 tIDs[2] = ph2->GetLabel(0);
537 tIDs[3] = ph2->GetLabel(1);
d64241db 538 if(pion->Pt() > fAxistPt.GetBinLowEdge(1) &&
539 pion->M() > fAxisPiM.GetBinLowEdge(1) &&
540 pion->M() < fAxisPiM.GetBinUpEdge(fAxisPiM.GetNbins())) {
e3598cd0 541 piCorr->CorrelateWithTracks(pion, tracks, tIDs, leadingpi);
542 }
3b77b2d1 543 }
544 }
545 }
546}
547
3b77b2d1 548//________________________________________________________________________
549void AliAnalysisTaskdPhi::Terminate(Option_t *) {
550
551 // Draw result to the screen
552 // Called once at the end of the query
553}
554
555//________________________________________________________________________
556TClonesArray * AliAnalysisTaskdPhi::GetConversionGammas(Bool_t isAOD) {
557
558
559 if(isAOD) {
560
561 TClonesArray * gammas = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fDeltaAODBranchName.Data()));
562 if(gammas) {
563 return gammas;
564 }
e3598cd0 565
566 FindDeltaAODBranchName(fInputEvent);
567 gammas = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fDeltaAODBranchName.Data()));
3b77b2d1 568 return gammas;
569
570 } else {
571 TClonesArray * gammas = dynamic_cast<TClonesArray*>(GetInputData(1));
572 return gammas;
573 }
574
575}
576
577//________________________________________________________________________
e3598cd0 578void AliAnalysisTaskdPhi::FindDeltaAODBranchName(AliVEvent * event){
3b77b2d1 579 ///Find aod branch
580 TList *list=event->GetList();
581 for(Int_t ii=0;ii<list->GetEntries();ii++){
582 TString name((list->At(ii))->GetName());
583 if(name.BeginsWith("GammaConv")&&name.EndsWith("gamma")){
584 fDeltaAODBranchName=name;
585 AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
586 return;
587 }
588 }
589}
590
591