]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/Correlations/DPhi/DiHadronPID/AliAnalysisTaskDiHadronPID.cxx
New train for Kch pair cut analysis
[u/mrichter/AliRoot.git] / PWGCF / Correlations / DPhi / DiHadronPID / AliAnalysisTaskDiHadronPID.cxx
CommitLineData
6788af99 1// -------------------------------------------------------------------------
2// INFO
3// -------------------------------------------------------------------------
4
5#include <iostream>
6
7// Basic Includes
8#include "TH1F.h"
9#include "TH2F.h"
10#include "TH3F.h"
11#include "THn.h"
12#include "TFile.h"
13#include "TChain.h"
14#include "TObject.h"
15#include "TObjArray.h"
16
17// Manager/ Handler
18#include "AliAnalysisManager.h"
19#include "AliInputEventHandler.h"
20
21// Event pool includes.
22#include "AliEventPoolManager.h"
23
24// PID includes.
25#include "AliPIDResponse.h"
26
27// AOD includes.
28#include "AliAODEvent.h"
29#include "AliAODTrack.h"
30#include "AliAODHandler.h"
31#include "AliAODVertex.h"
32#include "AliAODInputHandler.h"
33#include "AliAODMCParticle.h"
34#include "AliAODMCHeader.h"
35
36// Additional includes.
37#include "AliTrackDiHadronPID.h"
38#include "AliAODTrackCutsDiHadronPID.h"
39#include "AliAODEventCutsDiHadronPID.h"
40#include "AliHistToolsDiHadronPID.h"
41
42// AnalysisTask headers.
43#include "AliAnalysisTaskSE.h"
44#include "AliAnalysisTaskDiHadronPID.h"
45
46using namespace std;
47
48ClassImp(AliAnalysisTaskDiHadronPID);
49
50// -------------------------------------------------------------------------
51AliAnalysisTaskDiHadronPID::AliAnalysisTaskDiHadronPID():
52 AliAnalysisTaskSE(),
53 fPIDResponse(0x0),
54 fEventCuts(0x0),
55 fTrackCutsTrigger(0x0),
56 fTrackCutsAssociated(0x0),
57 fPoolMgr(0x0),
58 fTriggerTracks(0x0),
59 fAssociatedTracks(0x0),
60 fCurrentAODEvent(0x0),
61 fOutputList(0x0),
62 fPtSpectrum(0x0),
63 fCorrelations(0x0),
64 fMixedEvents(0x0),
65 fTOFhistos(0x0),
66 fNDEtaBins(32),
67 fNDPhiBins(32),
68 fMinNEventsForMixing(5),
69 fPoolTrackDepth(2000),
70 fPoolSize(1000),
50dfda71 71 fMixEvents(kTRUE),
72 fMixTriggers(kFALSE),
6788af99 73 fCalculateTOFmismatch(kTRUE),
74 fT0Fill(0x0),
75 fLvsEta(0x0),
76 fLvsEtaProjections(0x0),
77 fDebug(0)
78
79{
80
81 //
82 // Default Constructor.
83 //
84
85 if (fDebug > 0) {AliInfo("AliAnalysisTaskDiHadronPID Default Constructor.");}
86
87 for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) {
88 for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
89 fCorrelationsTOF[iPtClass][iSpecies] = 0x0;
90 fCorrelationsTOFTPC[iPtClass][iSpecies] = 0x0;
91 }
92 }
93
94
95}
96
97// -------------------------------------------------------------------------
98AliAnalysisTaskDiHadronPID::AliAnalysisTaskDiHadronPID(const char* name):
99 AliAnalysisTaskSE(name),
100 fPIDResponse(0x0),
101 fEventCuts(0x0),
102 fTrackCutsTrigger(0x0),
103 fTrackCutsAssociated(0x0),
104 fPoolMgr(0x0),
105 fTriggerTracks(0x0),
106 fAssociatedTracks(0x0),
107 fCurrentAODEvent(0x0),
108 fOutputList(0x0),
109 fPtSpectrum(0x0),
110 fCorrelations(0x0),
111 fMixedEvents(0x0),
112 fTOFhistos(0x0),
113 fNDEtaBins(32),
114 fNDPhiBins(32),
115 fMinNEventsForMixing(5),
116 fPoolTrackDepth(2000),
117 fPoolSize(1000),
50dfda71 118 fMixEvents(kTRUE),
119 fMixTriggers(kFALSE),
6788af99 120 fCalculateTOFmismatch(kTRUE),
121 fT0Fill(0x0),
122 fLvsEta(0x0),
123 fLvsEtaProjections(0x0),
124 fDebug(0)
125
126{
127
128 //
129 // Named Constructor.
130 //
131
50dfda71 132 if (fDebug > 0) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;}
6788af99 133
134 for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) {
135 for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
136 fCorrelationsTOF[iPtClass][iSpecies] = 0x0;
137 fCorrelationsTOFTPC[iPtClass][iSpecies] = 0x0;
138 }
139 }
140
141 DefineInput(0,TChain::Class());
142 DefineOutput(1,TList::Class());
143
144}
145
146// -------------------------------------------------------------------------
147AliAnalysisTaskDiHadronPID::~AliAnalysisTaskDiHadronPID() {;
148
149 //
150 // Destructor.
151 //
152
50dfda71 153 if (fDebug > 0) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;}
6788af99 154
155}
156
157// -------------------------------------------------------------------------
158void AliAnalysisTaskDiHadronPID::UserCreateOutputObjects() {
159
160 //
161 // Create Output objects.
162 //
163
50dfda71 164 if (fDebug > 0) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;}
6788af99 165
166 // --- BEGIN: Initialization on the worker nodes ---
167 AliAnalysisManager* manager = AliAnalysisManager::GetAnalysisManager();
168 AliInputEventHandler* inputHandler = dynamic_cast<AliInputEventHandler*> (manager->GetInputEventHandler());
169
170 // Getting the pointer to the PID response object.
171 fPIDResponse = inputHandler->GetPIDResponse();
172
173 // Not very neat - only set up for 0-5% analysis.
174 Int_t nCentralityBins = 5;
175 Double_t centralityBins[] = {0.,1.,2.,3.,4.,5.};
176
177 Int_t nZvtxBins = 7;
178 Double_t vertexBins[] = {-7.,-5.,-3.,-1.,1.,3.,5.,7.};
179
180 fPoolMgr = new AliEventPoolManager(fPoolSize, fPoolTrackDepth, nCentralityBins, (Double_t*) centralityBins, nZvtxBins, (Double_t*) vertexBins);
181 // --- END ---
182
183 // Create the output list.
184 fOutputList = new TList();
185 fOutputList->SetOwner(kTRUE);
186
187 // Creating all requested histograms locally.
188 fEventCuts->CreateHistos();
189 fOutputList->Add(fEventCuts);
190
191 fTrackCutsTrigger->CreateHistos();
192 fOutputList->Add(fTrackCutsTrigger);
193
194 fTrackCutsAssociated->CreateHistos();
195 fOutputList->Add(fTrackCutsAssociated);
196
197 // Get the pT axis for the PID histograms.
50dfda71 198 Double_t* ptaxis = fTrackCutsAssociated->GetPtAxisPID();
6788af99 199 Int_t nptbins = fTrackCutsAssociated->GetNPtBinsPID();
200
201 // Create Pt spectrum histogram.
202 fPtSpectrum = new TH1F("fPtSpectrum","p_{T} Spectrum;p_{T} (GeV/c);Count",nptbins,ptaxis);
203 fOutputList->Add(fPtSpectrum);
204
205 // Create unidentified correlations histogram.
206 fCorrelations = AliHistToolsDiHadronPID::MakeHist3D("fCorrelations","Correlations;#Delta#phi;#Delta#eta;p_{T} (GeV/c)",
207 fNDPhiBins,-TMath::Pi()/2.,3.*TMath::Pi()/2.,
208 fNDEtaBins,-1.6,1.6,
209 nptbins, ptaxis);
210 fOutputList->Add(fCorrelations);
211
212 // Create unidentified mixed events histogram.
213 fMixedEvents = AliHistToolsDiHadronPID::MakeHist3D("fMixedEvents","Mixed Events;#Delta#phi;#Delta#eta;p_{T} (GeV/c)",
214 fNDPhiBins,-TMath::Pi()/2.,3.*TMath::Pi()/2.,
215 fNDEtaBins,-1.6,1.6,
216 nptbins, ptaxis);
217 fOutputList->Add(fMixedEvents);
218
219 // Create TOF correlations histograms (DPhi,DEta,pt,TOF).
220 fTOFhistos = new TObjArray(15);
221 fTOFhistos->SetName("CorrelationsTOF");
7fcceff8 222 fTOFhistos->SetOwner(kTRUE);
6788af99 223
f054df96 224 Int_t nbins[4] = {fNDPhiBins,fNDEtaBins,0,0};
6788af99 225 Double_t min[4] = {-TMath::Pi()/2.,-1.6,0.,0.};
226 Double_t max[4] = {3.*TMath::Pi()/2.,1.6,0.,0.};
227
228 for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) {
229
230 nbins[2] = fTrackCutsAssociated->GetNPtBinsPID(iPtClass);
231 min[2] = fTrackCutsAssociated->GetPtClassMin(iPtClass);
232 max[2] = fTrackCutsAssociated->GetPtClassMax(iPtClass);
233
234 for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
235
236 nbins[3] = fTrackCutsAssociated->GetNTOFbins(iPtClass,iSpecies);
237 min[3] = fTrackCutsAssociated->GetTOFmin(iPtClass,iSpecies);
238 max[3] = fTrackCutsAssociated->GetTOFmax(iPtClass,iSpecies);
239
240 fCorrelationsTOF[iPtClass][iSpecies] = new THnF(
241 Form("fCorrelationsTOF_%i_%i",iPtClass,iSpecies),
242 Form("CorrelationsTOF_%i_%i",iPtClass,iSpecies),
243 4,nbins,min,max);
244
245 fTOFhistos->Add(fCorrelationsTOF[iPtClass][iSpecies]);
246
247 }
248 }
249
250 fOutputList->Add(fTOFhistos);
251
252 // TODO: Create TOF/TPC correlations histogram.
253
254 // Load external TOF histograms if flag is set.
255 if (fCalculateTOFmismatch) {LoadExtMismatchHistos();}
256
257 PostData(1,fOutputList);
258
259}
260
261// -------------------------------------------------------------------------
262void AliAnalysisTaskDiHadronPID::LocalInit() {
263
264 //
265 // Initialize on the client. (or on my computer?? - I think so...)
266 //
267
50dfda71 268 if (fDebug > 0) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;}
6788af99 269
270}
271
272// -------------------------------------------------------------------------
273void AliAnalysisTaskDiHadronPID::UserExec(Option_t*) {
274
275 //
276 // Main Loop.
277 //
278
50dfda71 279 if (fDebug > 0) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;}
6788af99 280
281 // Input Current Event.
282 fCurrentAODEvent = dynamic_cast<AliAODEvent*>(InputEvent());
283 if (!fCurrentAODEvent) AliFatal("No Event Found!");
284
285 if (!fEventCuts->IsSelected(fCurrentAODEvent)) {return;}
286
287 // Fill the global tracks array. - NOT NEEDED I THINK, since we're not using
288 // bit 1<<7 for the associated tracks!
289
290 // Let the track cut objects know that a new event will start.
291 fTrackCutsTrigger->StartNewEvent();
292 fTrackCutsAssociated->StartNewEvent();
293
294 // Create arrays for trigger/associated particles.
295 fTriggerTracks = new TObjArray(350);
296 fTriggerTracks->SetOwner(kTRUE);
297
298 fAssociatedTracks = new TObjArray(3500);
299 fAssociatedTracks->SetOwner(kTRUE);
300
301 for (Int_t iTrack = 0; iTrack < fCurrentAODEvent->GetNumberOfTracks(); iTrack++) {
302
303 AliAODTrack* track = (AliAODTrack*)fCurrentAODEvent->GetTrack(iTrack);
304 AliTrackDiHadronPID* pidtrack = new AliTrackDiHadronPID(track,0x0,0x0,fPIDResponse);
305 pidtrack->ForgetAboutPointers();
306 pidtrack->SetDebugLevel(fDebug);
307
308 Double_t rndhittime = -1.e21;
309 if (fCalculateTOFmismatch) rndhittime = GenerateRandomHit(pidtrack->Eta());
310
311 // Fill p_T spectrum.
312 fPtSpectrum->Fill(pidtrack->Pt());
313
314 // Fill the trigger/associated tracks array.
315 if (fTrackCutsTrigger->IsSelectedData(pidtrack,rndhittime)) {fTriggerTracks->AddLast(pidtrack);}
316 else if (fTrackCutsAssociated->IsSelectedData(pidtrack,rndhittime)) {fAssociatedTracks->AddLast(pidtrack);}
317 else {delete pidtrack;}
318
319 }
320
321 // Fill Correlation histograms.
322 for (Int_t iTrigger = 0; iTrigger < fTriggerTracks->GetEntriesFast(); iTrigger++) {
323 AliTrackDiHadronPID* triggertrack = (AliTrackDiHadronPID*)fTriggerTracks->At(iTrigger);
324
325 for (Int_t iAssociated = 0; iAssociated < fAssociatedTracks->GetEntriesFast(); iAssociated++) {
326 AliTrackDiHadronPID* associatedtrack = (AliTrackDiHadronPID*)fAssociatedTracks->At(iAssociated);
327
328 Double_t DPhi = triggertrack->Phi() - associatedtrack->Phi();
329 if (DPhi < -TMath::Pi()/2.) {DPhi += 2.*TMath::Pi();}
330 if (DPhi > 3.*TMath::Pi()/2.) {DPhi -= 2.*TMath::Pi();}
331
332 Double_t DEta = triggertrack->Eta() - associatedtrack->Eta();
333 fCorrelations->Fill(DPhi,DEta,associatedtrack->Pt());
334
335 Double_t tofhistfill[4] = {DPhi,DEta,associatedtrack->Pt(),-999.};
336
337 for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
338 tofhistfill[3] = associatedtrack->GetTOFsignalMinusExpected(iSpecies);
339
340 for (Int_t iPtClass = 0; iPtClass < 5; iPtClass++) {
341
342 // prevent under/over-flow bins to be filled.
343 Double_t ptmin = fTrackCutsAssociated->GetPtClassMin(iPtClass);
344 Double_t ptmax = fTrackCutsAssociated->GetPtClassMax(iPtClass);
345 Double_t apt = associatedtrack->Pt();
346
347 if ( (apt > ptmin) && (apt < ptmax) ) {
348 fCorrelationsTOF[iPtClass][iSpecies]->Fill(tofhistfill);
349 }
350
351 }
352 }
353 }
354 }
355
356 cout<<"Triggers: "<<fTriggerTracks->GetEntriesFast()<<" Associateds: "<<fAssociatedTracks->GetEntriesFast()<<endl;
357
358 // Determine centrality of current event.
359 TString centralityestimator = fEventCuts->GetCentralityEstimator();
360 AliCentrality* currentcentrality = fCurrentAODEvent->GetCentrality();
361 Float_t percentile = currentcentrality->GetCentralityPercentile(centralityestimator.Data());
362
363 // Determine vtxz of current event.
364 AliAODVertex* currentprimaryvertex = fCurrentAODEvent->GetPrimaryVertex();
365 Double_t vtxz = currentprimaryvertex->GetZ();
366
6788af99 367 AliEventPool* poolin = fPoolMgr->GetEventPool(percentile, vtxz);
368 if (!poolin) {AliFatal(Form("No pool found for centrality = %f, vtxz = %f", percentile, vtxz));}
369 // TObjArray* fGlobalTracksArray;
370
50dfda71 371 // Give a print out of the pool manager's contents.
f054df96 372 if (fDebug > 0) PrintPoolManagerContents();
50dfda71 373
374 // Mix events if there are enough events in the pool.
6788af99 375 if (poolin->GetCurrentNEvents() >= fMinNEventsForMixing) {
50dfda71 376 {cout << "Mixing Events." << endl;}
377
378 // Loop over all events in the event pool.
379 for (Int_t iMixEvent = 0; iMixEvent < poolin->GetCurrentNEvents(); iMixEvent++) {
380 TObjArray* mixtracks = poolin->GetEvent(iMixEvent);
381
382 // Mix either the triggers or the associateds.
383 if (fMixTriggers) {
384
385 // Loop over all associateds in this event.
386 for (Int_t iAssociated = 0; iAssociated < fAssociatedTracks->GetEntriesFast(); iAssociated++) {
387 AliTrackDiHadronPID* associatedtrack = (AliTrackDiHadronPID*)fAssociatedTracks->At(iAssociated);
388
389 // Loop over all mixed tracks.
390 for (Int_t iMixTrack = 0; iMixTrack < mixtracks->GetEntriesFast(); iMixTrack++) {
391 AliTrackDiHadronPID* mixtrack = (AliTrackDiHadronPID*)mixtracks->At(iMixTrack);
392
393 Double_t DPhi = mixtrack->Phi() - associatedtrack->Phi();
394 if (DPhi < -TMath::Pi()/2.) {DPhi += 2.*TMath::Pi();}
395 if (DPhi > 3.*TMath::Pi()/2.) {DPhi -= 2.*TMath::Pi();}
396
397 Double_t DEta = mixtrack->Eta() - associatedtrack->Eta();
398 fMixedEvents->Fill(DPhi,DEta,associatedtrack->Pt());
399
400 }
401 }
6788af99 402
50dfda71 403 } else {
6788af99 404
50dfda71 405 // Loop over all triggers in this event.
406 for (Int_t iTrigger = 0; iTrigger < fTriggerTracks->GetEntriesFast(); iTrigger++) {
407 AliTrackDiHadronPID* triggertrack = (AliTrackDiHadronPID*)fTriggerTracks->At(iTrigger);
6788af99 408
50dfda71 409 // Loop over all mixed tracks.
410 for (Int_t iMixTrack = 0; iMixTrack < mixtracks->GetEntriesFast(); iMixTrack++) {
411 AliTrackDiHadronPID* mixtrack = (AliTrackDiHadronPID*)mixtracks->At(iMixTrack);
412
413 Double_t DPhi = triggertrack->Phi() - mixtrack->Phi();
414 if (DPhi < -TMath::Pi()/2.) {DPhi += 2.*TMath::Pi();}
415 if (DPhi > 3.*TMath::Pi()/2.) {DPhi -= 2.*TMath::Pi();}
6788af99 416
50dfda71 417 Double_t DEta = triggertrack->Eta() - mixtrack->Eta();
418 fMixedEvents->Fill(DPhi,DEta,mixtrack->Pt());
6788af99 419
50dfda71 420 }
421 }
422
423 } // End if
6788af99 424 }
425 }
426
427 // Update the event pool.
428 AliEventPool* poolout = fPoolMgr->GetEventPool(percentile, vtxz); // Get the buffer associated with the current centrality and z-vtx
429 if (!poolout) AliFatal(Form("No pool found for centrality = %f, vtx_z = %f", percentile, vtxz));
430
431 // Q: is it a problem that the fAssociatedTracks array can be bigger than the number of tracks inside?
50dfda71 432 if (fMixTriggers) {
433 poolout->UpdatePool(fTriggerTracks);
434 fAssociatedTracks->Delete();
435 delete fAssociatedTracks;
436 }
437 else {
438 poolout->UpdatePool(fAssociatedTracks);
439 fTriggerTracks->Delete();
440 delete fTriggerTracks;
441 }
6788af99 442
6788af99 443 fTriggerTracks = 0x0;
444 fAssociatedTracks = 0x0;
445
446 // Tell the track cut object that the event is done.
447 fTrackCutsTrigger->EventIsDone(0);
448 fTrackCutsAssociated->EventIsDone(0);
449
450 PostData(1,fOutputList);
451
452}
453
454// -------------------------------------------------------------------------
455Bool_t AliAnalysisTaskDiHadronPID::LoadExtMismatchHistos() {
456
457 //
458 // Attempting to load a root file containing information needed
459 // to generate random TOF hits.
460 //
461
50dfda71 462 if (fDebug > 0) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;}
6788af99 463
464 // Opening external TOF file.
465 if (fDebug > 0) cout<<"Trying to open TOFmismatchHistos.root ..."<<endl;
466 TFile* fin = 0x0;
467 fin = TFile::Open("alien:///alice/cern.ch/user/m/mveldhoe/rootfiles/TOFmismatchHistos.root");
468 if (!fin) {
469 AliWarning("Couln't open TOFmismatchHistos, will not calculate mismatches...");
470 fCalculateTOFmismatch = kFALSE;
471 return kFALSE;
472 }
473
474 // Check if the required histograms are present.
475 TH1F* tmp1 = (TH1F*)fin->Get("hNewT0Fill");
476 if (!tmp1) {
477 AliWarning("Couln't find hNewT0Fill, will not calculate mismatches...");
478 fCalculateTOFmismatch = kFALSE;
479 return kFALSE;
480 }
481 TH2F* tmp2 = (TH2F*)fin->Get("hLvsEta");
482 if (!tmp2) {
483 AliWarning("Couln't find hLvsEta, will not calculate mismatches...");
484 fCalculateTOFmismatch = kFALSE;
485 return kFALSE;
486 }
487
488 // Make a deep copy of the files in the histogram.
489 fT0Fill = (TH1F*)tmp1->Clone("fT0Fill");
490 fLvsEta = (TH2F*)tmp2->Clone("fLvsEta");
491
492 // Close the external file.
493 AliInfo("Closing external file.");
494 fin->Close();
495
496 // Creating a TObjArray for LvsEta projections.
497 const Int_t nbinseta = fLvsEta->GetNbinsX();
498 fLvsEtaProjections = new TObjArray(nbinseta);
499 fLvsEtaProjections->SetOwner(kTRUE);
500
501 // Making the projections needed (excluding underflow/ overflow).
502 for (Int_t iEtaBin = 1; iEtaBin < (nbinseta + 1); iEtaBin++) {
503 TH1F* tmp = (TH1F*)fLvsEta->ProjectionY(Form("LvsEtaProjection_%i",iEtaBin),iEtaBin,iEtaBin);
504 tmp->SetDirectory(0);
505 fLvsEtaProjections->AddAt(tmp,iEtaBin);
506 }
507
508 return kTRUE;
509
510}
511
512// -------------------------------------------------------------------------
513Double_t AliAnalysisTaskDiHadronPID::GenerateRandomHit(Double_t eta) {
514
515 //
516 // Returns a random TOF time.
517 //
518
50dfda71 519 if (fDebug > 0) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;}
6788af99 520
521 // Default (error) value:
522 Double_t rndhittime = -1.e21;
523
524 // TOF mismatch flag is not turned on.
525 if (!fCalculateTOFmismatch) {
526 AliFatal("Called GenerateRandomHit() method, but flag fCalculateTOFmismatch not set.");
527 return rndhittime;
528 }
529
530 // TOF doesn't extend much further than 0.8.
531 if (TMath::Abs(eta) > 0.8) {
532 if (fDebug) {AliInfo("Tried to get a random hit for a track with eta > 0.8.");}
533 return rndhittime;
534 }
535
536 // Finding the bin of the eta.
537 TAxis* etaAxis = fLvsEta->GetXaxis();
538 Int_t etaBin = etaAxis->FindBin(eta);
539 //cout<<"Eta: "<<eta<<" bin: "<<etaBin<<endl;
540 const TH1F* lengthDistribution = (const TH1F*)fLvsEtaProjections->At(etaBin);
541
542 if (!lengthDistribution) {
543 AliFatal("length Distribution not found.");
544 return rndhittime;
545 }
546
547 Double_t currentRndLength = lengthDistribution->GetRandom(); // in cm.
548
549 // Similar to Roberto's code.
550 Double_t currentRndTime = currentRndLength / (TMath::C() * 1.e2 / 1.e12);
551 Double_t t0fill = -1.26416e+04;
552 rndhittime = fT0Fill->GetRandom() - t0fill + currentRndTime;
553
554 return rndhittime;
555
556}
557
50dfda71 558// -------------------------------------------------------------------------
559void AliAnalysisTaskDiHadronPID::PrintPoolManagerContents() {
560
561 //
562 // Prints out the current contents of the event pool manager.
563 //
564
565 // Determine the number of pools in the pool manager.
566 AliEventPool* poolin = fPoolMgr->GetEventPool(0,0);
567 Int_t NPoolsCentrality = 0;
568 while (poolin) {
569 NPoolsCentrality++;
570 poolin = fPoolMgr->GetEventPool(NPoolsCentrality,0);
571 }
572
573 poolin = fPoolMgr->GetEventPool(0,0);
574 Int_t NPoolsVtxZ = 0;
575 while (poolin) {
576 NPoolsVtxZ++;
577 poolin = fPoolMgr->GetEventPool(0,NPoolsVtxZ);
578 }
579
580 // Loop over all Pools in the matrix of the pool manager.
581 cout<<" Pool manager contents: (Nevt,NTrack)"<<endl;
582 for (Int_t iCentrality = 0; iCentrality < NPoolsCentrality; iCentrality++) {
583 cout<<Form("Centrality Bin: %2i --> ", iCentrality);
584
585 for (Int_t iVtxZ = 0; iVtxZ < NPoolsVtxZ; iVtxZ++) {
586
587 poolin = fPoolMgr->GetEventPool(iCentrality, iVtxZ);
588
589 cout<<Form("(%2i,%4i) ",poolin->GetCurrentNEvents(), poolin->NTracksInPool());
590
591 }
592
593 cout<<endl;
594 }
595
596}
597
6788af99 598// -------------------------------------------------------------------------
599void AliAnalysisTaskDiHadronPID::Terminate(Option_t*) {;
600
601 //
602 // Called when task is done.
603 //
604
50dfda71 605 if (fDebug > 0) {cout << Form("File: %s, Line: %i, Function: %s",__FILE__,__LINE__,__func__) << endl;}
6788af99 606
607 delete fT0Fill;
608 fT0Fill = 0x0;
609 delete fLvsEta;
610 fLvsEta = 0x0;
611 delete fLvsEtaProjections;
612 fLvsEtaProjections = 0x0;
613
614}