TENDER becomes Tender, removing .so
[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>
839f7ade 29#include <TFile.h>
3b77b2d1 30#include <AliAnalysisManager.h>
31#include <AliInputEventHandler.h>
32#include <AliESDInputHandler.h>
33#include <AliAODInputHandler.h>
34a878c4 34#include <TGeoGlobalMagField.h>
3b77b2d1 35
2dd6ec26 36#include "AliConversionTrackCuts.h"
3b77b2d1 37#include "AliConversionCuts.h"
c15c23b8 38#include "AliConversionMesonCuts.h"
3b77b2d1 39#include "AliAODConversionPhoton.h"
40#include "AliAODConversionMother.h"
839f7ade 41#include "TGrid.h"
65ec4890 42// #include "AliAnaConvCorrPhoton.h"
43// #include "AliAnaConvCorrPion.h"
44// #include "AliAnaConvIsolation.h"
c15c23b8 45#include "AliV0ReaderV1.h"
3b77b2d1 46// Author Svein Lindal <slindal@fys.uio.no>
47using namespace std;
48
49ClassImp(AliAnalysisTaskdPhi)
50
51
52//________________________________________________________________________
53AliAnalysisTaskdPhi::AliAnalysisTaskdPhi(const char *name) : AliAnalysisTaskSE(name),
344100c4 54 fHistograms(NULL),
55 fCorrSparse(NULL),
56 fTrigSparse(NULL),
57 fTrackSparse(NULL),
58 fMassSparse(NULL),
59 fV0Reader(NULL),
60 fSaveReaderHists(kFALSE),
61 fV0FilterEvent(NULL),
62 fV0FilterPhoton(NULL),
63 fV0Filters(),
64 fEventFilters(),
65 fEventFilter(NULL),
66 fPhotonFilter(NULL),
67 fMesonFilter(NULL),
68 fMesonFilters(),
69 fTrackFilter(NULL),
70 fTrackFilters(),
71 fGammas(),
72 fTracks(),
73 hMEvents(NULL),
74 hTrackCent(NULL),
75 hTrigPt(NULL),
76 hTrackPt(NULL),
77 hTrigPhi(NULL),
78 fDeltaAODBranchName("AliAODGammaConversion_gamma"),
79 fAxistPt(),
80 fAxiscPt(),
81 fAxisdEta(),
82 fAxisTrigEta(),
83 fAxisAssEta(),
84 fAxisdPhi(),
85 fAxisCent(),
86 fAxisZ(),
87 fAxisPiM(),
88 fAxisTrackFilters(),
89 fAxisV0Filters(),
90 fAxisMesonFilters(),
91 fkTrackAxis(kFALSE),
92 fkV0Axis(kFALSE),
93 fkPionAxis(kFALSE),
94 fAxesList(),
95 fTrigAxesList(),
96 fTrackAxesList(),
97 fMassAxesList(),
98 fDoPhoton(kFALSE),
99 fCorrectionMap(NULL)
100{
101 //constructor
102 SetUpBins();
103
104 DefineInput(0, TChain::Class());
105 DefineOutput(1, TList::Class());
106
107 fGammas.SetOwner(kTRUE);
108 fTracks.SetOwner(kTRUE);
109}
110
111
3b77b2d1 112
344100c4 113//________________________________________________________________________
114AliAnalysisTaskdPhi::~AliAnalysisTaskdPhi(){
115 //destructor
c15c23b8 116
344100c4 117 if(fV0FilterEvent)
118 delete fV0FilterEvent;
119 fV0FilterEvent = NULL;
c15c23b8 120
344100c4 121 if(fV0FilterPhoton)
122 delete fV0FilterPhoton;
123 fV0FilterPhoton = NULL;
3b77b2d1 124
344100c4 125 if(fMesonFilter)
126 delete fMesonFilter;
127 fMesonFilter = NULL;
439cf020 128
344100c4 129 if(fEventFilter)
130 delete fEventFilter;
131 fEventFilter = NULL;
99d49b30 132
344100c4 133 if(fPhotonFilter)
134 delete fPhotonFilter;
135 fPhotonFilter = NULL;
65ec4890 136
344100c4 137 if(fHistograms)
138 delete fHistograms;
139 fHistograms = NULL;
65ec4890 140
344100c4 141 if(fTrackFilter)
142 delete fTrackFilter;
143 fTrackFilter = NULL;
65ec4890 144
344100c4 145 fGammas.Delete();
146 fTracks.Delete();
3b77b2d1 147
6252ea9d 148}
3b77b2d1 149
344100c4 150///________________________________________________________________________
151void AliAnalysisTaskdPhi::SetUpBins() {
152
153 fAxisTrigEta.SetNameTitle("tEta", "Eta");
154 fAxisTrigEta.Set(320, -0.8, 0.8);
155
156 fAxisAssEta.SetNameTitle("aEta", "Eta");
157 fAxisAssEta.Set(360, -0.9, 0.9);
158
159 fAxisdEta.SetNameTitle("dEta", "Eta");
160 fAxisdEta.Set(34, -1.7, 1.7);
161
162 fAxisdPhi.SetNameTitle("dPhi", "delta Phi");
163 fAxisdPhi.Set(32, -TMath::PiOver2(), 3*TMath::PiOver2());
164
165 Double_t tptbins[10] = {0.1, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 15, 50, 100}; fAxistPt.SetNameTitle("tPt", "tPt");
166 fAxistPt.Set(9, tptbins);
167
168 Double_t cptbins[13] = {0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 8.0, 10.0, 25, 50, 100}; fAxiscPt.SetNameTitle("cPt", "cPt");
169 fAxiscPt.Set(12, cptbins);
170
171 fAxisZ.SetNameTitle("vertexz", "Z");
172 fAxisZ.Set(4, -10, 10);
173
174 Double_t centbins[5] = {0, 10, 30, 60, 100.1};
175 fAxisCent.SetNameTitle("centrality", "Cent");
176 fAxisCent.Set(4, centbins);
6252ea9d 177
344100c4 178 fAxisPiM.SetNameTitle("InvMassPi0", "Invariant mass");
179 Double_t mbins[7] = {0.1, 0.11, 0.12, 0.15, 0.16, 0.18, 0.2};
180 fAxisPiM.Set(6, mbins);
181}
182
183
184///________________________________________________________________________
65ec4890 185// void AliAnalysisTaskdPhi::SetUpCorrObjects() {
186 // //Set up corr objects
187 // AliDebug(AliLog::kDebug + 5, "Set Up corr objects");
188
189 // if(fDoPhoton) {
190 // fPhotonCorr = new AliAnaConvCorrPhoton("PhotonCorr","photon %s");
191 // SetUpCorrAxes(fPhotonCorr);
192 // fPhotonCorr->CreateHistograms();
193 // fHistograms->Add(fPhotonCorr->GetHistograms());
194 // }
195
196 // fPionCorr = new AliAnaConvCorrPion("PionCorr", "pion");
197 // SetUpCorrAxes(fPionCorr);
198 // fPionCorr->GetAxisM().Set(fAxisPiM.GetNbins(), fAxisPiM.GetXbins()->GetArray());
199 // fPionCorr->CreateHistograms();
200 // fHistograms->Add(fPionCorr->GetHistograms());
201 //}
202
203 ///________________________________________________________________________
204// void AliAnalysisTaskdPhi::SetUpCorrAxes(AliAnaConvCorrBase * corr) {
205 ///Set up axes in corr object
206 // corr->GetAxisCent().Set(fAxisCent.GetNbins(), fAxisCent.GetXbins()->GetArray());
207 // const Double_t * zbins = fAxisZ.GetXbins()->GetArray();
208 // if(zbins) {
209 // corr->GetAxisZ().Set(fAxisZ.GetNbins(), fAxisZ.GetXbins()->GetArray());
210 // } else {
211 // corr->GetAxisZ().Set(fAxisZ.GetNbins(), fAxisZ.GetBinLowEdge(1), fAxisZ.GetBinUpEdge(fAxisZ.GetNbins()));
212 // }
213
214 // corr->GetAxistPt().Set(fAxistPt.GetNbins(), fAxistPt.GetXbins()->GetArray());
215 // corr->GetAxiscPt().Set(fAxiscPt.GetNbins(), fAxiscPt.GetXbins()->GetArray());
216 // corr->GetAxisdEta().Set(fAxisdEta.GetNbins(), fAxisdEta.GetBinLowEdge(1), fAxisdEta.GetBinUpEdge(fAxisdEta.GetNbins()));
217 // corr->GetAxisTrigEta().Set(fAxisTrigEta.GetNbins(), fAxisTrigEta.GetBinLowEdge(1), fAxisTrigEta.GetBinUpEdge(fAxisTrigEta.GetNbins()));
218 // corr->GetAxisAssEta().Set(fAxisAssEta.GetNbins(), fAxisAssEta.GetBinLowEdge(1), fAxisAssEta.GetBinUpEdge(fAxisAssEta.GetNbins()));
219// }
6252ea9d 220
3b77b2d1 221
222//________________________________________________________________________
223void AliAnalysisTaskdPhi::UserCreateOutputObjects() {
344100c4 224 // Create histograms
225 // TGrid::Connect("alien://",0,0,"t");
226 // if(!gGrid) AliWarning("no GGrid");
227 // TFile *tfile = TFile::Open("alien:///alice/cern.ch/user/s/slindal/trackMap.root", "READ");
228 // if(tfile) {
229 // THnF * corrmap = dynamic_cast<THnF*>(tfile->Get("hTrackCorr"));
230 // if (corrmap) {
231 // fCorrectionMap = dynamic_cast<THnF*>(THn::CreateHn("corr", "corr", corrmap));
232 // for(Int_t i = 0; i < fCorrectionMap->GetNdimensions(); i++) {
233 // TAxis * axis = fCorrectionMap->GetAxis(i);
234 // axis->SetRange(1, axis->GetNbins());
235 // }
236
237 // cout << "yessssssssssssssssssssssssssssssssssssssssssssssssss"<<endl;
238 // } else {
239 // cout << "xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxxx"<<endl;
240 // }
241 // tfile->Close();
242 // } else {
243 // cout << "no tfile shit shit shit "<<endl;
244 // AliFatal("file not ther!!!");
245 // }
839f7ade 246
344100c4 247
248 fHistograms = new TList();
249 fHistograms->SetName("dPhi_histograms");
250 fHistograms->SetOwner(kTRUE);
251
252
253 if(!fV0Reader){
254 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
255 }
256
257 if(!fV0Reader){
258 printf("Error: No V0 Reader");
259 } // GetV0Reader
260
261
262 if(fSaveReaderHists) {
263 AliConversionPhotonCuts * v0cuts = fV0Reader->GetConversionCuts();
264 if(v0cuts) {
265 TList * histograms = v0cuts->GetCutHistograms();
266 if(!histograms) {
267 AliWarning("initializing v0 reader hists");
268 v0cuts->InitCutHistograms("V0Reader", kTRUE);
269 }
270 histograms = v0cuts->GetCutHistograms();
271 if(histograms) {
272 fHistograms->Add(histograms);
273 }
274 }
275 }
276
277 for(Int_t igf = 0; igf < fV0Filters[0].GetEntriesFast(); igf ++){
278 AliConversionPhotonCuts * f = dynamic_cast<AliConversionPhotonCuts*>(fV0Filters[0].At(igf));
279 if(f) {
280 TList * histograms = f->GetCutHistograms();
281 if(histograms) fHistograms->Add(f->GetCutHistograms());
282 }
283 }
65ec4890 284
344100c4 285 for(Int_t igf = 0; igf < fV0Filters[1].GetEntriesFast(); igf ++){
286 AliConversionPhotonCuts * f = dynamic_cast<AliConversionPhotonCuts*>(fV0Filters[1].At(igf));
287 if(f) {
288 TList * histograms = f->GetCutHistograms();
289 if(histograms) fHistograms->Add(f->GetCutHistograms());
290 }
291 }
ca257f2a 292
344100c4 293 for(Int_t igf = 0; igf < fMesonFilters[0].GetEntriesFast(); igf ++){
294 AliConversionMesonCuts * f = dynamic_cast<AliConversionMesonCuts*>(fMesonFilters[0].At(igf));
295 if(f) {
296 TList * histograms = f->GetCutHistograms();
297 if(histograms) fHistograms->Add(f->GetCutHistograms());
298 }
299 }
99d49b30 300
344100c4 301 for(Int_t igf = 0; igf < fMesonFilters[1].GetEntriesFast(); igf ++){
302 AliConversionMesonCuts * f = dynamic_cast<AliConversionMesonCuts*>(fMesonFilters[1].At(igf));
303 if(f) {
304 TList * histograms = f->GetCutHistograms();
305 if(histograms) fHistograms->Add(f->GetCutHistograms());
306 }
307 }
ca257f2a 308
344100c4 309 if(fV0FilterEvent) {
310 fV0FilterEvent->InitCutHistograms("V0FilterEvent", kFALSE);
311 fHistograms->Add(fV0FilterEvent->GetCutHistograms());
312 }
313 if(fV0FilterPhoton) {
314 fV0FilterPhoton->InitCutHistograms("V0FilterPhoton", kFALSE);
315 fHistograms->Add(fV0FilterPhoton->GetCutHistograms());
316 }
317 if(fMesonFilter) {
318 fMesonFilter->InitCutHistograms("PionFilter", kFALSE);
319 fHistograms->Add(fMesonFilter->GetCutHistograms());
320 }
321 if(fPhotonFilter) {
322 fPhotonFilter->InitCutHistograms("PhotonFilter", kFALSE);
323 fHistograms->Add(fPhotonFilter->GetCutHistograms());
324 }
65ec4890 325
326
344100c4 327 AliConversionTrackCuts * tc = dynamic_cast<AliConversionTrackCuts*>(fTrackFilter);
328 if(tc) {
329 fHistograms->Add(tc->CreateHistograms());
330 }
65ec4890 331
3b77b2d1 332
344100c4 333 // for(Int_t i = 0; i < fTrackFilters.GetEntriesFast(); i++) {
334 // AliConversionTrackCuts * tc = dynamic_cast<AliConversionTrackCuts*>(fTrackFilters.At(i));
335 // if(tc) fHistograms->Add(tc->CreateHistograms());
336 // }
3b77b2d1 337
344100c4 338 //SetUpCorrObjects();
34a878c4 339
344100c4 340 ///Set up ME histograms
341 TList * MEHistograms = new TList();
342 MEHistograms->SetName("MEHistograms");
343 MEHistograms->SetOwner(kTRUE);
344 fHistograms->Add(MEHistograms);
345
346 hMEvents = new TH2I("hMEvents", "Nevents vs centrality vertexz",
347 fAxisZ.GetNbins(), fAxisZ.GetXbins()->GetArray(),
348 fAxisCent.GetNbins(), fAxisCent.GetXbins()->GetArray());
349 MEHistograms->Add(hMEvents);
350
351 hTrackCent = new TH2I("hTrackCent", "N accepted tracks vs centrality",
352 fAxisCent.GetNbins() > 1 ? (int) (10*(fAxisCent.GetXmax() - fAxisCent.GetXmin())) : 1,
353 fAxisCent.GetXmin(), fAxisCent.GetXmax(),
354 fAxisCent.GetNbins() > 1 ? 900 : 50,
355 0,
356 fAxisCent.GetNbins() > 1 ? 1800 : 50);
357 MEHistograms->Add(hTrackCent);
358
359 hTrigPt = new TH3F("hTrigPt", "trigger pt", 100, 0., 10.,
360 10, 0., 50.,
361 5, 0.05, 0.2);
362 MEHistograms->Add(hTrigPt);
363 hTrackPt = new TH2F("hTrackPt", "track pt", 100, 0, 10, 10, 0, 50);//fAxisCent.GetNbins(), fAxisCent.GetXbins()->GetArray());
364 MEHistograms->Add(hTrackPt);
365 hTrigPhi = new TH1F("hTrigPhi", "trigger pt", 32, 0, 2*TMath::Pi());
366 MEHistograms->Add(hTrigPhi);
367
368
369
370 Int_t ntrackfilters[2] = {fTrackFilters[0].GetEntriesFast(), fTrackFilters[1].GetEntriesFast()};
371 fkTrackAxis = kTRUE;
372 fAxisTrackFilters.SetNameTitle("trackCuts", "trackCuts");
373 fAxisTrackFilters.Set(ntrackfilters[0] + ntrackfilters[1] + 1, -ntrackfilters[0] -0.5, ntrackfilters[1] + 0.5);
374
375 Int_t nV0filters[2] = {fV0Filters[0].GetEntriesFast(), fV0Filters[1].GetEntriesFast()};
376 fkV0Axis = kTRUE;
377 fAxisV0Filters.SetNameTitle("V0Cuts", "V0Cuts");
378 fAxisV0Filters.Set(nV0filters[0] + nV0filters[1] + 1, -nV0filters[0] -0.5, nV0filters[1] + 0.5);
379
380 Int_t nmesonfilters[2] = {fMesonFilters[0].GetEntriesFast(), fMesonFilters[1].GetEntriesFast()};
381 fkPionAxis = kTRUE;
382 fAxisMesonFilters.SetNameTitle("mesonCuts", "mesonCuts");
383 fAxisMesonFilters.Set(nmesonfilters[0] + nmesonfilters[1] + 1, -nmesonfilters[0] -0.5, nmesonfilters[1] + 0.5);
384
385 fAxesList.AddAt(&fAxisdEta, 0);
386 fAxesList.AddAt(&fAxisdPhi, 1);
387 fAxesList.AddAt(&fAxistPt, 2);
388 fAxesList.AddAt(&fAxiscPt, 3);
389 fAxesList.AddAt(&fAxisCent, 4);
390 fAxesList.AddAt(&fAxisZ, 5);
391 fAxesList.AddAt(&fAxisPiM, 6);
392 fAxesList.AddAt(&fAxisTrackFilters, 7);
393 fAxesList.AddAt(&fAxisV0Filters, 8);
394 fAxesList.AddAt(&fAxisMesonFilters, 9);
395
396 fTrackAxesList.AddAt(&fAxisAssEta, 0);
397 fTrackAxesList.AddAt(&fAxistPt, 1);
398 fTrackAxesList.AddAt(&fAxiscPt, 2);
399 fTrackAxesList.AddAt(&fAxisCent, 3);
400 fTrackAxesList.AddAt(&fAxisZ, 4);
401 //fTrackAxesList.AddAt(&fAxisPiM, 5);
402 fTrackAxesList.AddAt(&fAxisTrackFilters, 5);
403 fTrackAxesList.AddAt(&fAxisV0Filters, 6);
404 fTrackAxesList.AddAt(&fAxisMesonFilters, 7);
405
406 fTrigAxesList.AddAt(&fAxisTrigEta, 0);
407 fTrigAxesList.AddAt(&fAxistPt, 1);
408 fTrigAxesList.AddAt(&fAxisCent, 2);
409 fTrigAxesList.AddAt(&fAxisZ, 3);
410 fTrigAxesList.AddAt(&fAxisPiM, 4);
411 fTrigAxesList.AddAt(&fAxisV0Filters, 5);
412 fTrigAxesList.AddAt(&fAxisMesonFilters, 6);
413
414 TList masslist;
415 TAxis massax;
416 massax.SetNameTitle("mass", "mass");
417 massax.Set(360, 0.04, 0.4); //hardcoded! change also in filling!
418
419 masslist.AddAt(&massax, 0);
420 masslist.AddAt(&fAxistPt, 1);
421 masslist.AddAt(&fAxisCent, 2);
422 masslist.AddAt(&fAxisV0Filters, 3);
423 masslist.AddAt(&fAxisMesonFilters, 4);
424
425 fCorrSparse = CreateSparse(TString("pionSparse"), TString("pionSparse"), &fAxesList);
426 fTrackSparse = CreateSparse(TString("trackSparse"), TString("trackSparse"), &fTrackAxesList);
427 fTrigSparse = CreateSparse(TString("trigSparse"), TString("trigSparse"), &fTrigAxesList);
428 fMassSparse = CreateSparse("massSparse", "massSparse", &masslist);
429
430 fHistograms->Add(fCorrSparse);
431 fHistograms->Add(fTrackSparse);
432 fHistograms->Add(fTrigSparse);
433 fHistograms->Add(fMassSparse);
34a878c4 434
435
344100c4 436 ///Add gamma and track containers:
437 for(Int_t i = 0; i < fV0Filters[1].GetEntriesFast() + 1; i++) {
438 fGammas.Add(new TObjArray());
439 }
839f7ade 440
344100c4 441 for(Int_t i = 0; i < fTrackFilters[1].GetEntriesFast() + 1; i++) {
442 fTracks.Add(new TObjArray());
443 }
444 PostData(1, fHistograms);
445}
65ec4890 446
344100c4 447///________________________________________________________________________
448THnSparseF * AliAnalysisTaskdPhi::CreateSparse(TString nameString, TString titleString, TList * axesList) {
449 //Create sparse
450 const Int_t dim = axesList->GetSize();
451
452 TAxis * axes[dim];
453 Int_t bins[dim];
454 Double_t min[dim];
455 Double_t max[dim];
456
457 for(Int_t i = 0; i<dim; i++) {
458 TAxis * axis = dynamic_cast<TAxis*>(axesList->At(i));
459 if(axis) axes[i] = axis;
460 else {
461 cout << "AliAnalysisTaskdPhi::CreateSparse: Error error, all the axes are not present in axis list" << endl;
462 return NULL;
463 }
464 }
465
466 for(Int_t i = 0; i<dim; i++) {
467 //cout << axes[i]->GetTitle() << endl;
468 bins[i] = axes[i]->GetNbins();
469 min[i] = axes[i]->GetBinLowEdge(1);
470 max[i] = axes[i]->GetBinUpEdge(axes[i]->GetNbins());
471 }
65ec4890 472
344100c4 473 THnSparseF * sparse = new THnSparseF(Form("%s", nameString.Data()),
474 Form("%s", titleString.Data()),
475 dim, bins, min, max);
476
477 for(Int_t i = 0; i<dim; i++) {
478 sparse->GetAxis(i)->SetNameTitle(axes[i]->GetName(), axes[i]->GetTitle() );
479 if(axes[i]->GetXbins()->GetSize() > 0) {
480 sparse->SetBinEdges(i, axes[i]->GetXbins()->GetArray() );
481 }
482 }
483 return sparse;
484}
65ec4890 485
344100c4 486//________________________________________________________________________
487void AliAnalysisTaskdPhi::UserExec(Option_t *) {
488 ///User exec.
489 ///This is a very ugly function, cut the complexity of the logic demands it.
490
99d49b30 491
344100c4 492 AliESDEvent * esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
493 if(esdEvent) {
494 if (!TGeoGlobalMagField::Instance()->GetField()) esdEvent->InitMagneticField();
495 }
65ec4890 496
497
344100c4 498 //if(! fV0Filter->EventIsSelected(fInputEvent)) return;
499 if(!fV0Reader){
500 AliError("Error: No V0 Reader");
501 return;
502 } // GetV0Reader
503
504 if(!fV0Reader->IsEventSelected()) {
505 return;
99d49b30 506 }
344100c4 507
508 AliDebug(5, "Processing event");
509
510
511 for(Int_t i = 0; i < fGammas.GetEntriesFast(); i++) {
512 static_cast<TObjArray*>(fGammas.At(i))->Clear();
65ec4890 513 }
65ec4890 514
344100c4 515 for(Int_t i = 0; i < fTracks.GetEntriesFast(); i++) {
516 static_cast<TObjArray*>(fTracks.At(i))->Clear();
65ec4890 517 }
65ec4890 518
d926594d 519
344100c4 520
521 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
522 Bool_t isAOD=man->GetInputEventHandler()->IsA()==AliAODInputHandler::Class();
523
524 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
525 if (!inputHandler) {
526 cout << "cout no input event handler"<<endl;
527 return;
528 }
d926594d 529
344100c4 530 for(Int_t igf = 0; igf < fV0Filters[0].GetEntriesFast(); igf++) {
531 AliConversionPhotonCuts * f = dynamic_cast<AliConversionPhotonCuts*>(fV0Filters[0].At(igf));
532 if ( f && !f->GetPIDResponse() ) {
533 if ( inputHandler->GetPIDResponse() ){
534 f->SetPIDResponse( inputHandler->GetPIDResponse() );
535 } else {
536 if (isAOD){
537 if (!f->GetPIDResponse()){
538 f->InitAODpidUtil(1);
539 }
540 }
541 }
542 } else {
543 break;
544 }
65ec4890 545 }
65ec4890 546
344100c4 547 for(Int_t igf = 0; igf < fV0Filters[1].GetEntriesFast(); igf++) {
548 AliConversionPhotonCuts * f = dynamic_cast<AliConversionPhotonCuts*>(fV0Filters[1].At(igf));
549 if ( f && !f->GetPIDResponse() ) {
550 if ( inputHandler->GetPIDResponse() ){
551 f->SetPIDResponse( inputHandler->GetPIDResponse() );
552 } else {
553 if (isAOD){
554 if (!f->GetPIDResponse()){
555 f->InitAODpidUtil(1);
556 }
557 }
558 }
559 } else {
560 break;
561 }
65ec4890 562 }
99d49b30 563
344100c4 564
565 if ( fV0FilterPhoton && !fV0FilterPhoton->GetPIDResponse() ) {
566 if ( inputHandler->GetPIDResponse() ){
567 fV0FilterPhoton->SetPIDResponse( inputHandler->GetPIDResponse() );
568 } else {
569 //AOD case
570 if (isAOD){
571 if (!fV0FilterPhoton->GetPIDResponse()){
572 fV0FilterPhoton->InitAODpidUtil(1);
573 }
574 }
575 }
576 }
65ec4890 577
65ec4890 578
344100c4 579 ///Initialize track cuts. Delete tracks that have been constrained to vertex (copies)
580 AliConversionTrackCuts * tc = dynamic_cast<AliConversionTrackCuts*>(fTrackFilter);
581 if(tc) {
582 tc->SetEvent(fInputEvent);
583 tc->DeleteTracks();
65ec4890 584 }
344100c4 585
586 for(Int_t i = 0; i < fTrackFilters[0].GetEntriesFast(); i++){
587 AliConversionTrackCuts * tct = dynamic_cast<AliConversionTrackCuts*>(fTrackFilters[0].At(i));
588 if(tct) {
589 tct->SetEvent(fInputEvent);
590 tct->DeleteTracks();
65ec4890 591 }
344100c4 592 }
593 for(Int_t i = 0; i < fTrackFilters[1].GetEntriesFast(); i++){
594 AliConversionTrackCuts * tct = dynamic_cast<AliConversionTrackCuts*>(fTrackFilters[1].At(i));
595 if(tct) {
596 tct->SetEvent(fInputEvent);
597 tct->DeleteTracks();
65ec4890 598 }
344100c4 599 }
600
601 Double_t centrality = 0.0;
602 Double_t vertexz = fInputEvent->GetPrimaryVertex()->GetZ();
603 if(isAOD) {
604 AliAODHeader * header = static_cast<AliAODHeader*>(fInputEvent->GetHeader());
605 centrality = header->GetCentrality();
606 } else {
607 centrality = static_cast<AliESDEvent*>(fInputEvent)->GetCentrality()->GetCentralityPercentile("V0M");
608 }
609
610 const Int_t centBin = GetBin(fAxisCent, centrality);
611 const Int_t vertexBin = GetBin(fAxisZ, vertexz);
612
613 if(DebugLevel () > 4) {
614 cout << "centrality: " << centrality << " " << GetBin(fAxisCent, centrality) << endl;
615 cout << "vertexz: " << vertexz << " " << GetBin(fAxisZ, vertexz) << endl;
616 }
617
618 if(centBin < 0 || vertexBin < 0) {
619 // AliError("bin out of range");
620 return;
621 }
622
623
624 //TClonesArray * aodGammas = GetConversionGammas(isAOD);
625 TClonesArray * aodGammas = fV0Reader->GetReconstructedGammas();
626 if(!aodGammas) {
627 AliError("no aod gammas found!");
628 return;
629 }
630
631 TObjArray * ggammas = static_cast<TObjArray*>(fGammas.At(0));
632
633 ///Fill arrays of accepted gammas
634 if(DebugLevel() > 1) printf("Number of conversion gammas %d \n", aodGammas->GetEntriesFast());
635 for(Int_t ig = 0; ig < aodGammas->GetEntriesFast(); ig++) {
636 AliAODConversionPhoton * photon = dynamic_cast<AliAODConversionPhoton*>(aodGammas->At(ig));
637 if(!photon) continue;
638 if(!fV0FilterPhoton || fV0FilterPhoton->PhotonIsSelected(photon, fInputEvent)) {
639 ggammas->Add(photon);
640 } else {
641 for(Int_t igf = 0; igf < fV0Filters[1].GetEntriesFast(); igf++) {
642 AliConversionPhotonCuts * gfilter = dynamic_cast<AliConversionPhotonCuts*>(fV0Filters[1].At(igf));
643 if(gfilter && gfilter->PhotonIsSelected(photon, fInputEvent)) {
644 static_cast<TObjArray*>(fGammas.At(igf+1))->Add(photon);
645 }
646 }
647 }
648 }
65ec4890 649
344100c4 650 Bool_t lowgmap[fV0Filters[0].GetEntriesFast()][ggammas->GetEntriesFast()];
65ec4890 651
344100c4 652 for(Int_t ig = 0; ig < ggammas->GetEntriesFast(); ig++ ) {
653 AliAODConversionPhoton * gamma = static_cast<AliAODConversionPhoton*>(ggammas->At(ig));
654 for(Int_t igf = 0; igf < fV0Filters[0].GetEntriesFast(); igf++) {
655
656 AliConversionPhotonCuts * v0cuts = static_cast<AliConversionPhotonCuts*>(fV0Filters[0].At(igf));
657 if(!(v0cuts->PhotonIsSelected(gamma, fInputEvent))) {
658 lowgmap[igf][ig] = kTRUE;
659 } else {
660 lowgmap[igf][ig] = kFALSE;
661 }
662 }
663 }
664
65ec4890 665
344100c4 666 if(DebugLevel() > 4) printf("Number of accepted gammas %d \n", ggammas->GetEntriesFast());
667 hMEvents->Fill(vertexz, centrality);
668
669 ///create track array
670 const Int_t ntrackfilters[2] = { fTrackFilters[0].GetEntriesFast(), fTrackFilters[1].GetEntriesFast()};
671
672 TObjArray * ttracks = static_cast<TObjArray*>(fTracks.At(0));
673 const Double_t aetalim[2] = { fAxisAssEta.GetXmin(), fAxisAssEta.GetXmax()};
674 const Double_t aptlim[2] = { fAxiscPt.GetXmin(), fAxiscPt.GetXmax()};
675 for(Int_t iTrack = 0; iTrack < fInputEvent->GetNumberOfTracks(); iTrack++) {
676 AliVTrack * track = static_cast<AliVTrack*>(fInputEvent->GetTrack(iTrack));
677 if(track->Pt() < aptlim[0] || track->Pt() > aptlim[1]) continue;
678 if(track->Eta() < aetalim[0] || track->Eta() > aetalim[1]) continue;
679 if(fTrackFilter->IsSelected(track)) {
680 hTrackPt->Fill(track->Pt(), centrality);
681 ttracks->Add(track);
65ec4890 682 } else {
344100c4 683 ///upside cuts
684 for(Int_t itf = 1; itf < ntrackfilters[1] + 1; itf++) {
685 AliAnalysisCuts * trackCuts = static_cast<AliAnalysisCuts*>(fTrackFilters[1].At(itf -1));
686 if(trackCuts->IsSelected(track)) {
687 static_cast<TObjArray*>(fTracks.At(itf))->Add(track);
688 }
689 }
65ec4890 690 }
344100c4 691 }
692
693
694 Bool_t lowtrackmap[ntrackfilters[0]][ttracks->GetEntriesFast()];
695 ///Check lowside cuts
696 for(Int_t iTrack = 0; iTrack < ttracks->GetEntriesFast(); iTrack++ ) {
697 AliVTrack * track = static_cast<AliVTrack*>(ttracks->At(iTrack));
698 for(Int_t itf = 0; itf < ntrackfilters[0]; itf++) {
699 AliAnalysisCuts * trackCuts = static_cast<AliAnalysisCuts*>(fTrackFilters[0].At(itf));
700 if(!trackCuts->IsSelected(track)) {
701 lowtrackmap[itf][iTrack] = kTRUE;
702 } else {
703 lowtrackmap[itf][iTrack] = kFALSE;
704 }
65ec4890 705 }
344100c4 706 }
65ec4890 707
344100c4 708 hTrackCent->Fill(centrality, ttracks->GetEntriesFast());
c15c23b8 709
344100c4 710 const Double_t etalim[2] = { fAxisTrigEta.GetXmin(), fAxisTrigEta.GetXmax()};
711 if(DebugLevel() > 4) printf("Number of accepted gammas, tracks %d %d \n", ggammas->GetEntriesFast(), ttracks->GetEntriesFast());
712
713 //AliAnaConvCorrBase * gCorr = fPhotonCorr; //GetCorrObject(vertexBin, centBin, fPhotonCorr);
714 // AliAnaConvCorrPion * piCorr = fPionCorr; //static_cast<AliAnaConvCorrPion*>(GetCorrObject(vertexBin, centBin, fPionCorr));
715 // if(!piCorr) {
716 // AliError("corr object missing");
717 // return;
718 // }
719
720 TObjArray pions;
266ffce4 721
344100c4 722 ///corr values
723 Double_t dphivalues[fAxesList.GetSize()];
724 dphivalues[4] = centrality;
725 dphivalues[5] = vertexz;
726
727 ///Trigger me counters
728 Double_t trigValues[7];
729 trigValues[2] = centrality;
730 trigValues[3] = vertexz;
731
732 ///Mass histogram
733 Double_t massval[5];
734 massval[2] = centrality;
735
736 ///Set up track me counters and initialize
737 const Int_t nbins = fAxistPt.GetNbins();
738 Bool_t tmap[fAxistPt.GetNbins()];
739 Bool_t lv0tmap[fAxistPt.GetNbins()][fV0Filters[0].GetEntriesFast()];
740 Bool_t uv0tmap[fAxistPt.GetNbins()][fV0Filters[1].GetEntriesFast()];
741
742 Bool_t lpitmap[fAxistPt.GetNbins()][fMesonFilters[0].GetEntriesFast()];
743 Bool_t upitmap[fAxistPt.GetNbins()][fMesonFilters[1].GetEntriesFast()];
744
745 for(Int_t igf = 0; igf < fV0Filters[0].GetEntriesFast(); igf++) {
746 for(Int_t ptbin = 0; ptbin < fAxistPt.GetNbins(); ptbin++) {
747 lv0tmap[ptbin][igf] = kFALSE;
65ec4890 748 }
344100c4 749 }
65ec4890 750
344100c4 751 for(Int_t igf = 0; igf < fV0Filters[1].GetEntriesFast(); igf++) {
752 for(Int_t ptbin = 0; ptbin < fAxistPt.GetNbins(); ptbin++) {
753 uv0tmap[ptbin][igf] = kFALSE;
754 }
755 }
65ec4890 756
344100c4 757 for(Int_t igf = 0; igf < fMesonFilters[0].GetEntriesFast(); igf++) {
758 for(Int_t ptbin = 0; ptbin < fAxistPt.GetNbins(); ptbin++) {
759 lpitmap[ptbin][igf] = kFALSE;
760 }
65ec4890 761 }
344100c4 762
763 for(Int_t igf = 0; igf < fMesonFilters[1].GetEntriesFast(); igf++) {
764 for(Int_t ptbin = 0; ptbin < fAxistPt.GetNbins(); ptbin++) {
765 upitmap[ptbin][igf] = kFALSE;
766 }
439cf020 767 }
344100c4 768
769 for(Int_t ptbin = 0; ptbin < nbins; ptbin++){
770 tmap[ptbin] = kFALSE;
3b77b2d1 771 }
c15c23b8 772
344100c4 773 /////////////////////////////////////////
65ec4890 774
775
344100c4 776 for(Int_t igf1 = 0; igf1 < fV0Filters[1].GetEntriesFast() + 1; igf1++) {
777 TObjArray * gamm1 = static_cast<TObjArray*>(fGammas.At(igf1));
778 for(Int_t i1 = 0; i1 < gamm1->GetEntriesFast(); i1++) {
779 AliAODConversionPhoton * ph1 = static_cast<AliAODConversionPhoton*>(gamm1->UncheckedAt(i1));
780 Int_t tIDs[4] = {ph1->GetLabel(0), ph1->GetLabel(1), -1, -1};
781
782 ///Combine gamma into pions
783 Int_t igmax = 0;
784 for(Int_t igf2 = 0; igf2 <= igf1; igf2++) {
785 TObjArray * gamm2 = NULL;
786 if(igf2 == igf1) {
787 gamm2 = gamm1;
788 igmax = i1;
789 } else {
790 gamm2 = static_cast<TObjArray*>(fGammas.At(igf2));
791 igmax = gamm2->GetEntriesFast();
792 }
65ec4890 793
344100c4 794 for(Int_t i2 = 0; i2 < igmax; i2++) {
795 AliAODConversionPhoton * ph2 = static_cast<AliAODConversionPhoton*>(gamm2->UncheckedAt(i2));
796
797 if( ph2->GetTrackLabelPositive()==ph1->GetTrackLabelPositive()
798 || ph2->GetTrackLabelNegative()==ph1->GetTrackLabelNegative()
799 || ph2->GetTrackLabelNegative()==ph1->GetTrackLabelPositive()
800 || ph2->GetTrackLabelPositive()==ph1->GetTrackLabelNegative()) {
801 continue;
802 }
803
804 AliAODConversionMother * pion = new AliAODConversionMother(ph1, ph2);
805 if(pion->Eta() < etalim[0] || pion->Eta() > etalim[1]) continue;
806 pion->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
807
808
809 tIDs[2] = ph2->GetLabel(0);
810 tIDs[3] = ph2->GetLabel(1);
811
812 massval[0] = pion->M();
813 massval[1] = pion->Pt();
814 massval[3] = igf1;
815 massval[4] = 0;
816
817 dphivalues[2] = pion->Pt();
818 dphivalues[6] = pion->M();
819 dphivalues[8] = igf1;
820 dphivalues[9] = 0;
821
822 trigValues[0] = pion->Eta();
823 trigValues[1] = pion->Pt();
824 trigValues[4] = pion->M();
825 trigValues[5] = igf1;
826 trigValues[6] = 0;
827
828
829 ///Check that particle is in histo phase space
830 if(pion->Pt() > fAxistPt.GetBinLowEdge(1) && pion->Pt() < fAxistPt.GetXmax() &&
831 pion->Eta() > etalim[0] && pion->Eta() < etalim[1] &&
832 pion->M() > 0.04 && pion->M() < 0.4
833 ) {
834
835
836 if(fMesonFilter->MesonIsSelected(pion, kTRUE)) {
837
838 fMassSparse->Fill(massval);
839
840 Bool_t lpimap[fMesonFilters[0].GetEntriesFast()];
841 ///See if it passes lowside cuts
842 if(igf1 == 0 && igf2 == 0) {
843
844 ///Low side pion
845 massval[3] = 0;
846 for(Int_t ilpf = 0; ilpf < fMesonFilters[0].GetEntriesFast(); ilpf++) {
847 if(!(static_cast<AliConversionMesonCuts*>(fMesonFilters[0].At(ilpf))->MesonIsSelected(pion, kTRUE))) {
848 lpimap[ilpf] = kTRUE;
849 massval[4] = -(ilpf + 1);
850 fMassSparse->Fill(massval);
851 } else {
852 lpimap[ilpf] = kFALSE;
853 }
854 massval[4] = 0;
855 }
856 ///Lowside v0
857 for(Int_t iglf = 0; iglf < fV0Filters[0].GetEntriesFast(); iglf++) {
858 if(lowgmap[iglf][i1] || lowgmap[iglf][i2]){
859 massval[3] = -(iglf+1);
860 fMassSparse->Fill(massval);
861 }
862 }
863 massval[3] = 0;
864 } /// End lowside mass histo fillers
865
866
867 ///Check that particle is in histo phase space
868 if(pion->Pt() > fAxistPt.GetBinLowEdge(1) && pion->Pt() < fAxistPt.GetXmax() &&
869 pion->M() > fAxisPiM.GetXmin() && pion->M() < fAxisPiM.GetXmax() &&
870 pion->Eta() > etalim[0] && pion->Eta() < etalim[1]) {
871
872 const Int_t tbin = fAxistPt.FindFixBin(pion->Pt());
873 ///Fill standard triggers including upside v0 filters
874 fTrigSparse->Fill(trigValues);
875 if(igf1 == 0 && igf2 == 0) {
876 // piCorr->FillTriggerCounters(pion);
877 // piCorr->CorrelateWithTracks(pion, &tracks[0], tIDs, centrality, vertexz);
878 ////Only mix events with pion in signal region
879 hTrigPt->Fill(pion->Pt(), centrality, pion->M());
880 if(pion->M() > 0.1 && pion->M() < 0.15) {
881 hTrigPhi->Fill(pion->Phi());
882 ///Check trigger bin
883 if (tbin > 0 && tbin < (nbins + 1)) {
884 tmap[tbin-1] = kTRUE;
885 }
886 ///Check if trigger also in low side (both gamma present in low side!)
887 for(Int_t ilgf = 0; ilgf < fV0Filters[0].GetEntriesFast(); ilgf++) {
888 if(!lowgmap[ilgf][i1] || !lowgmap[ilgf][i2]) {
889 lv0tmap[tbin-1][ilgf] = kTRUE;
890 }
891 }
892 ///See if the lowside pion filter also passes this, if not
893 for(Int_t ilpf = 0; ilpf < fMesonFilters[0].GetEntriesFast(); ilpf++) {
894 if(!lpimap[ilpf]) {
895 lpitmap[tbin-1][ilpf] = kTRUE;
896 }
897 }
898 }
899 } else {
900 if(pion->M() > 0.1 && pion->M() < 0.15) {
901 uv0tmap[tbin-1][igf1 - 1] = kTRUE;
902 }
903 }
904
905
906 ///Fill the triggers not selected in lowside filters only if passsing standard v0 filter
907 if(igf1 == 0 && igf2 == 0) {
908 ///Lowside v0 filters
909 for(Int_t iglf = 0; iglf < fV0Filters[0].GetEntriesFast(); iglf++) {
910 if(lowgmap[iglf][i1] || lowgmap[iglf][i2]){
911 trigValues[5] = -(iglf+1);
912 fTrigSparse->Fill(trigValues);
913 }
914 }
915 ////Low side pion filters
916 trigValues[5] = 0;
917 for(Int_t iplf = 0; iplf < fMesonFilters[0].GetEntriesFast(); iplf ++) {
918 if(lpimap[iplf]) {
919 trigValues[6] = -(iplf + 1);
920 fTrigSparse->Fill(trigValues);
921 }
922 }
923 } // ifg1 == 0
924
925 trigValues[5] = igf1;
926 trigValues[6] = 0;
927
928 ///////////////////////////////////////////////
929 /// Correlate with tracks
930 ///////////////////////////////////////////////
931
932 Int_t ntf = 1;
933 if(igf1 == 0 && igf2 == 0) {
934 ntf = fTrackFilters[1].GetEntriesFast() + 1;
935 }
936
937 for(Int_t itf = 0; itf < ntf; itf++) {
938 TObjArray * tracks = static_cast<TObjArray*>(fTracks.At(itf));
939 for(int ij = 0; ij < tracks->GetEntriesFast(); ij++) {
940 AliVTrack * track = static_cast<AliVTrack*>(tracks->At(ij));
941 Int_t tid = track->GetID();
942
943 if(tid == tIDs[0] || tid == tIDs[1] || tid == tIDs[2] || tid == tIDs[3]) {
944 continue;
945 }
946
947 if(tid < 0) {
948 if(-tid-1 == tIDs[0]+1 || -tid-1 == tIDs[1]+1 || -tid-1 == tIDs[2]+1 || -tid-1 == tIDs[3]+1) {
949 continue;
950 }
951 }
952
953 dphivalues[0] = pion->Eta() - track->Eta();
954 dphivalues[1] = GetDPhi(pion->Phi() - track->Phi());
955 dphivalues[3] = track->Pt();
956 dphivalues[7] = itf;
957 dphivalues[8] = igf1;
958 dphivalues[9] = 0;
959 fCorrSparse->Fill(dphivalues, GetTrackCorrection(vertexz, track));
960
961 if(itf == 0 && igf1 == 0 && igf2 == 0) {
962 ///Fill the low side track filters
963 for(Int_t itlf = 0; itlf < fTrackFilters[0].GetEntriesFast(); itlf++) {
964 if(lowtrackmap[itlf][ij]){
965 dphivalues[7] = -(itlf+1);
966 fCorrSparse->Fill(dphivalues, GetTrackCorrection(vertexz, track));
967 }
968 }
969 ///Fill the low side v0 filters
970 dphivalues[7] = 0;
971 for(Int_t iglf = 0; iglf < fV0Filters[0].GetEntriesFast(); iglf++) {
972 if(lowgmap[iglf][i1] || lowgmap[iglf][i2]){
973 dphivalues[8] = -(iglf+1);
974 fCorrSparse->Fill(dphivalues, GetTrackCorrection(vertexz, track));
975 }
976 }
977
978 ///Fill the low side pi filter
979 dphivalues[7] = 0;
980 dphivalues[8] = 0;
981 for(Int_t iplf = 0; iplf < fMesonFilters[0].GetEntriesFast(); iplf ++) {
982 if(lpimap[iplf]) {
983 dphivalues[9] = -(iplf + 1);
984 fCorrSparse->Fill(dphivalues, GetTrackCorrection(vertexz, track));
985 }
986 }
987 } /// end non standard filters track corr
988
989 } // end for tracks
990 } // end trackfilters loop
991 } //end check pion in histogram range to prevent overflow
992 } else {
993 /////////////////////////////
994 //// Not passing standard meson cuts, check upside filters
995 ////////////////////////////
996
997 ///Only check the pions from standard v0 filter
998 if(igf1 == 0 && igf2 == 0) {
999 for(Int_t ipuf = 0; ipuf < fMesonFilters[1].GetEntriesFast(); ipuf++) {
1000 if(static_cast<AliConversionMesonCuts*>(fMesonFilters[1].At(ipuf))->MesonIsSelected(pion, kTRUE)) {
1001 ///Fill invariant mass hist
1002 massval[4] = (ipuf + 1);
1003 fMassSparse->Fill(massval);
1004 ///Check that particle is in histo phase space --- redundant!
1005
1006
1007
1008 if(pion->Pt() > fAxistPt.GetBinLowEdge(1) && pion->Pt() < fAxistPt.GetXmax() &&
1009 pion->M() > fAxisPiM.GetXmin() && pion->M() < fAxisPiM.GetXmax() &&
1010 pion->Eta() > etalim[0] && pion->Eta() < etalim[1]) {
1011
1012
1013 ////Only mix events with pion in signal region
1014 if(pion->M() > 0.1 && pion->M() < 0.15) {
1015 const Int_t tbin = fAxistPt.FindFixBin(pion->Pt());
1016 upitmap[tbin-1][ipuf] = kTRUE;
1017 }
1018
1019 ///Fill trigger counters
1020 trigValues[6] = (ipuf + 1);
1021 fTrigSparse->Fill(trigValues);
1022
1023 ///Correlate with standard tracks
1024 for(int ij = 0; ij < ttracks->GetEntriesFast(); ij++) {
1025 AliVTrack * track = static_cast<AliVTrack*>(ttracks->At(ij));
1026 Int_t tid = track->GetID();
1027
1028 if(tid == tIDs[0] || tid == tIDs[1] || tid == tIDs[2] || tid == tIDs[3] ) {
1029 continue;
1030 }
1031
1032 if(tid < 0) {
1033 if(-tid-1 == tIDs[0]+1 || -tid-1 == tIDs[1]+1 || -tid-1 == tIDs[2]+1 || -tid-1 == tIDs[3]+1) {
1034 continue;
1035 }
1036 }
1037
1038 dphivalues[0] = pion->Eta() - track->Eta();
1039 dphivalues[1] = GetDPhi(pion->Phi() - track->Phi());
1040 dphivalues[3] = track->Pt();
1041 dphivalues[7] = 0; // track filter
1042 dphivalues[8] = 0; // v0 filter
1043 dphivalues[9] = ipuf + 1; // pion filter
1044 fCorrSparse->Fill(dphivalues, GetTrackCorrection(vertexz, track));
1045 } /// end track corr
1046 }
1047 } // MesonIsSelected
1048 }
1049 }
1050 } /// end else .. end upside meson filters
1051 /////////////////////////////////////////////
1052 } ///Etalim && pt limits
1053 } // i2 second gamma
1054 }
1055 } // i1 first gamma
1056 }
1057 //FillCounters(&pions, tracks, ntrackfilters, centrality, vertexz);
1058
1059 ///////Fill track counters after entire event has been passed through
1060 ////
1061
1062 Double_t trackValues[fTrackAxesList.GetSize()];
1063 trackValues[3] = centrality;
1064 trackValues[4] = vertexz;
1065 //trackValues[5] = particle->M(); remove !!!
1066
1067 for(Int_t tbin = 0; tbin < fAxistPt.GetNbins(); tbin++) {
1068 trackValues[1] = fAxistPt.GetBinCenter(tbin+1);
1069
1070 if(tmap[tbin]) {
1071
1072 for(Int_t itf = 0; itf < fTrackFilters[1].GetEntriesFast() + 1; itf++) {
1073 TObjArray * tracks = static_cast<TObjArray*>(fTracks.At(itf));
1074 for(Int_t iTrack = 0; iTrack < tracks->GetEntriesFast(); iTrack++) {
1075 AliVTrack * track = static_cast<AliVTrack*>(tracks->At(iTrack));
1076 trackValues[0] = track->Eta();
1077 trackValues[2] = track->Pt();
1078 trackValues[5] = itf;
1079 trackValues[6] = 0; ///v0 filter
1080 trackValues[7] = 0; ////Pi filter
1081 fTrackSparse->Fill(trackValues, GetTrackCorrection(vertexz, track));
1082
1083 if(itf == 0) {
1084 for(Int_t itlf = 0; itlf < fTrackFilters[0].GetEntriesFast(); itlf++) {
1085 if(lowtrackmap[itlf][iTrack]) {
1086 trackValues[5] = -(itlf + 1);
1087 fTrackSparse->Fill(trackValues, GetTrackCorrection(vertexz, track) );
1088 }
1089 }
1090 trackValues[5] = 0;
1091
1092 ///Check lowside gamma
1093 for(Int_t iglf = 0; iglf < fV0Filters[0].GetEntriesFast(); iglf++) {
1094 if(!lv0tmap[tbin][iglf]) {
1095 trackValues[6] = -(iglf + 1);
1096 fTrackSparse->Fill(trackValues, GetTrackCorrection(vertexz, track));
1097 }
1098 }
1099 trackValues[6] = 0;
1100
1101 ////Check lowside pion
1102 for(Int_t iplf = 0; iplf < fMesonFilters[0].GetEntriesFast(); iplf++) {
1103 if(!lpitmap[tbin][iplf]) {
1104 trackValues[7] = -(iplf + 1);
1105 fTrackSparse->Fill(trackValues, GetTrackCorrection(vertexz, track));
1106 }
1107 }
1108 } // itf == 00
1109 }
1110 }
1111 } else {
1112 ///If not in main, see if in upside filters
1113 ///Do upside v0 filters
1114 for(Int_t iguf = 0; iguf < fV0Filters[1].GetEntriesFast(); iguf++) {
1115 if (uv0tmap[tbin][iguf] ) {
1116
1117 //cout << "c vtx " << centrality << vertexz << endl;
1118
1119 for(Int_t iTrack = 0; iTrack < ttracks->GetEntriesFast(); iTrack++) {
1120 AliVTrack * track = static_cast<AliVTrack*>(ttracks->At(iTrack));
1121 trackValues[0] = track->Eta();
1122 trackValues[2] = track->Pt();
1123 trackValues[5] = 0;
1124 trackValues[6] = iguf+1; ///v0 filter
1125 trackValues[7] = 0; ////Pi filter
1126 fTrackSparse->Fill(trackValues, GetTrackCorrection(vertexz, track));
1127 }
1128 }
1129 }
1130 ///Do upside pi filter
1131 for(Int_t ipuf = 0; ipuf < fMesonFilters[1].GetEntriesFast(); ipuf++) {
1132 if (upitmap[tbin][ipuf] ) {
1133 //cout << "c2 vtx2 " << centrality << vertexz << endl;
1134 for(Int_t iTrack = 0; iTrack < ttracks->GetEntriesFast(); iTrack++) {
1135 AliVTrack * track = static_cast<AliVTrack*>(ttracks->At(iTrack));
1136 trackValues[0] = track->Eta();
1137 trackValues[2] = track->Pt();
1138 trackValues[5] = 0;
1139 trackValues[6] = 0; ///v0 filter
1140 trackValues[7] = ipuf+1; ////Pi filter
1141 fTrackSparse->Fill(trackValues, GetTrackCorrection(vertexz, track));
1142 }
1143 }
1144 }
1145 }
1146 }
1147 //////
1148 //////
65ec4890 1149
344100c4 1150 //piCorr->FillCounters(&pions, tracks, centrality, vertexz);
1151
1152 PostData(1, fHistograms);
65ec4890 1153
3b77b2d1 1154}
1155
65ec4890 1156//_______________________________________________________________________________
1157// void AliAnalysisTaskdPhi::FillCounters(TObjArray * particles, TObjArray tracks[], Int_t ntrackfilters, Float_t cent, Float_t vtxz) {
1158
1159// return;
1160
1161
1162// //Fill ME Counters
1163// const Int_t nbins = fAxistPt.GetNbins();
1164// Bool_t tmap[nbins];
1165// for(Int_t ptbin = 0; ptbin < nbins; ptbin++){
1166// tmap[ptbin] = kFALSE;
1167// }
1168// }
1169
1170
1171// Double_t trackValues[fTrackAxesList.GetSize()];
1172// trackValues[3] = cent;
1173// trackValues[4] = vtxz;
1174
1175// for(Int_t ip = 0; ip < particles->GetEntriesFast(); ip++){
1176// AliAODConversionParticle * particle = static_cast<AliAODConversionParticle*>(particles->At(ip));
1177
1178// Int_t tbin = fAxistPt.FindFixBin(particle->Pt());
1179// if (tbin > 0 && tbin < nbins + 1) {
1180// if(tmap[tbin - 1] == kTRUE) {
1181// continue;
1182// } else {
1183// tmap[tbin -1 ] = kTRUE;
1184
1185// trackValues[5] = particle->M();
1186// trackValues[1] = particle->Pt();
1187
1188// for(Int_t itf = 0; itf < ntrackfilters; itf++) {
1189// if(fkTrackAxis) trackValues[6] = itf;
1190// for(int ij = 0; ij < tracks[itf].GetEntriesFast(); ij++) {
1191// AliVTrack * track = static_cast<AliVTrack*>(tracks->UncheckedAt(ij));
1192// trackValues[0] = track->Eta();
1193// trackValues[2] = track->Pt();
1194// fTrackSparse->Fill(trackValues);
1195// }
1196// }
1197// }
1198// }
1199// }
1200// }
1201
1202
1203
1204
1205// //________________________________________________________________
1206// void AliAnalysisTaskdPhi::CorrelateWithTracks(AliAODConversionParticle * particle, TObjArray tracks[], Int_t ntrackfilters, Bool_t ** lowtrackmap, Int_t nltf, Int_t const tIDs[4], Double_t dphivalues[]) {
1207// //Correlate particle with tracks
1208// ///Correlate with tracks
1209
1210// }
1211
3b77b2d1 1212//________________________________________________________________________
1213void AliAnalysisTaskdPhi::Terminate(Option_t *) {
344100c4 1214
1215 // Draw result to the screen
1216 // Called once at the end of the query
3b77b2d1 1217}
1218
1219//________________________________________________________________________
1220TClonesArray * AliAnalysisTaskdPhi::GetConversionGammas(Bool_t isAOD) {
344100c4 1221 if(isAOD) {
1222
1223 TClonesArray * gammas = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fDeltaAODBranchName.Data()));
1224 if(gammas) {
1225 return gammas;
1226 }
1227
1228 FindDeltaAODBranchName(fInputEvent);
1229 gammas = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fDeltaAODBranchName.Data()));
1230 return gammas;
1231
1232 } else {
1233 TClonesArray * gammas = dynamic_cast<TClonesArray*>(GetInputData(1));
1234 return gammas;
1235 }
65ec4890 1236
3b77b2d1 1237}
1238
1239//________________________________________________________________________
e3598cd0 1240void AliAnalysisTaskdPhi::FindDeltaAODBranchName(AliVEvent * event){
344100c4 1241 ///Find aod branch
1242 TList *list=event->GetList();
1243 for(Int_t ii=0;ii<list->GetEntries();ii++){
1244 TString name((list->At(ii))->GetName());
1245 if(name.BeginsWith("GammaConv")&&name.EndsWith("gamma")){
1246 fDeltaAODBranchName=name;
1247 AliDebug(AliLog::kDebug + 5, Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
1248 return;
1249 }
1250 }
3b77b2d1 1251}
1252
1253
839f7ade 1254//________________________________________________________________________
1255Double_t AliAnalysisTaskdPhi::GetTrackCorrection(Double_t vtxz, AliVTrack * track) {
344100c4 1256 ////Get track correction from map
1257 Int_t coord[4] = {-1, -1, -1, -1};
1258 if(fCorrectionMap) {
1259 Double_t values[4] = { vtxz, track->Pt(), track->Eta(), track->Phi() };
1260 Double_t correction = fCorrectionMap->GetBinContent(fCorrectionMap->GetBin(values, kFALSE), coord);
1261 if (fCorrectionMap->IsInRange(coord)) {
1262 return correction;
1263 }
1264 }
1265 return 1.0;
839f7ade 1266}
1267
1268