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