]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/Correlations/DPhi/AliAnalysisTaskDiHadronPID.cxx
-add user task of julian
[u/mrichter/AliRoot.git] / PWGCF / Correlations / DPhi / AliAnalysisTaskDiHadronPID.cxx
CommitLineData
18a24423 1// ----------------------------------------------------------------------------
2// This class makes di-hadron correlations, with TOF and TPC signals for
3// the associated particles.
4//
5// ----------------------------------------------------------------------------
6// Author: Misha Veldhoen (misha.veldhoen@cern.ch)
7// Last edit: May 2nd 2012. (v 8.00)
8// ----------------------------------------------------------------------------
9
10#include <iostream>
11#include "TChain.h"
12#include "TTree.h"
13#include "TH1F.h"
14#include "TH2F.h"
15#include "TH3F.h"
16#include "TCanvas.h"
17#include "TFile.h"
18#include "TClonesArray.h"
19
20#include "AliAODTrack.h"
21#include "AliAODEvent.h"
22#include "AliAODInputHandler.h"
23#include "AliAODVertex.h"
24//#include "AliAODPid.h"
25
26#include "AliAnalysisManager.h"
27#include "AliInputEventHandler.h"
28#include "AliPIDResponse.h"
29#include "AliTPCPIDResponse.h"
30//#include "AliTOFPIDResponse.h"
31
32// Includes for a MC run.
33#include "AliAODMCParticle.h"
34
35using namespace std;
36
37#include "AliAnalysisTaskDiHadronPID.h"
38
39ClassImp(AliAnalysisTaskDiHadronPID);
40
41//_____________________________________________________________________________
42AliAnalysisTaskDiHadronPID::AliAnalysisTaskDiHadronPID():
43 AliAnalysisTaskSE(),
44 fPIDResponse(0x0),
45 fAODEvent(0x0),
46 fAODHeader(0x0),
47 fAODVertex(0x0),
48 fAODTrack(0x0),
49 fGlobalTracks(0x0),
50 fMCTracks(0x0),
51 fCentrality(0x0),
52 fVertexZ(0x0),
53 fDCA(0x0),
54 fDCAZoomed(0x0),
55 fDCAZoomedTwice(0x0),
56 fDCACut(0x0),
57 fDCAZoomedCut(0x0),
58 fDCAZoomedTwiceCut(0x0),
59 fITSHits(0x0),
60 fTrackCutsCount(0x0),
61 fTrackCutsPt(0x0),
62 fTrackCutsEta(0x0),
63 fTrackCutsPhi(0x0),
64 fEtaSpectrumTrig(0x0),
65 fEtaSpectrumAssoc(0x0),
66 fPhiSpectrumAssoc(0x0),
67 fTPCnSigmaProton(0x0),
68 fTOFnSigmaProton(0x0),
69 fTPCnSigmaPion(0x0),
70 fTOFnSigmaPion(0x0),
71 fTPCnSigmaKaon(0x0),
72 fTOFnSigmaKaon(0x0),
73 fTPCSignal(0x0),
74 fTOFSignal(0x0),
75 fDiHadron(0x0),
76 fMixedEvents(0x0),
77 fHistoList(0x0),
78 fCalculateMixedEvents(kFALSE),
79 fBeamType("PbPb"),
80 fMC(kFALSE),
81 fMaxEta(0.8),
82 fMaxPlotEta(0.8),
83 fMaxRap(0.5),
84 fMaxPt(10.),
85 fNEtaBins(32),
86 fNPhiBins(36),
87 fVertexZMixedEvents(2.),
88 fCentralityCutMax(0.),
89 fCentralityCutMin(10.),
90 fZoomed(kFALSE),
91 fDoITSCut(kFALSE),
92 fDoDCACut(kFALSE),
93 fDemandNoMismatch(kFALSE),
94 fVerbose(0),
95 fPrintBufferSize(kFALSE),
96 fTrigBufferIndex(0),
97 fTrigBufferSize(0),
98 fTrigBufferMaxSize(100)
99
100{
101
102 //
103 // Default Constructor.
104 //
105
106 // Trigger buffer.
107 for(Int_t ii=0; ii<25000; ii++) {
108 for(Int_t jj=0; jj<4; jj++) {
109 fTrigBuffer[ii][jj]=0;
110 }
111 }
112
113 // The identified di-hadron correlations.
114 for (Int_t ii = 0; ii < 3; ii++) {
115 //fMixedEventsTPCTOFCut[ii]=0x0;
116 for (Int_t jj = 0; jj < 10; jj++) {
117 fDiHadronTPCTOF[ii][jj]=0x0;
118 fMixedEventsTPCTOF[ii][jj]=0x0;
119 fInclusiveTPCTOF[ii][jj]=0x0;
120 fInclusiveTPCTOFRap[ii][jj]=0x0;
121 }
122 }
123
124 // Track cut labels.
125 for (Int_t ii=0; ii<8; ii++) {
126 fTrackCutLabelNumbers[ii]=ii+1;
127 }
128
129 // Monte Carlo Efficiency Histograms.
130 for (Int_t iSpecies=0; iSpecies<6; iSpecies++) {
131 fPtEtaDistrDataPrim[iSpecies]=0x0;
132 fPtEtaDistrDataSec[iSpecies]=0x0;
133 fPtRapDistrDataPrimRapCut[iSpecies]=0x0;
134 fPtRapDistrDataSecRapCut[iSpecies]=0x0;
135
136 fPtEtaDistrMCPrim[iSpecies]=0x0;
137 fPtEtaDistrMCSec[iSpecies]=0x0;
138 fPtRapDistrMCPrimRapCut[iSpecies]=0x0;
139 fPtRapDistrMCSecRapCut[iSpecies]=0x0;
140
141 fDiHadronMC[iSpecies]=0x0;
142
143 }
144
145}
146
147//_____________________________________________________________________________
148AliAnalysisTaskDiHadronPID::AliAnalysisTaskDiHadronPID(const char *name):
149 AliAnalysisTaskSE(name),
150 fPIDResponse(0x0),
151 fAODEvent(0x0),
152 fAODHeader(0x0),
153 fAODVertex(0x0),
154 fAODTrack(0x0),
155 fGlobalTracks(0x0),
156 fMCTracks(0x0),
157 fCentrality(0x0),
158 fVertexZ(0x0),
159 fDCA(0x0),
160 fDCAZoomed(0x0),
161 fDCAZoomedTwice(0x0),
162 fDCACut(0x0),
163 fDCAZoomedCut(0x0),
164 fDCAZoomedTwiceCut(0x0),
165 fITSHits(0x0),
166 fTrackCutsCount(0x0),
167 fTrackCutsPt(0x0),
168 fTrackCutsEta(0x0),
169 fTrackCutsPhi(0x0),
170 fEtaSpectrumTrig(0x0),
171 fEtaSpectrumAssoc(0x0),
172 fPhiSpectrumAssoc(0x0),
173 fTPCnSigmaProton(0x0),
174 fTOFnSigmaProton(0x0),
175 fTPCnSigmaPion(0x0),
176 fTOFnSigmaPion(0x0),
177 fTPCnSigmaKaon(0x0),
178 fTOFnSigmaKaon(0x0),
179 fTPCSignal(0x0),
180 fTOFSignal(0x0),
181 fDiHadron(0x0),
182 fMixedEvents(0x0),
183 fHistoList(0x0),
184 fCalculateMixedEvents(kFALSE),
185 fBeamType("PbPb"),
186 fMC(kFALSE),
187 fMaxEta(0.8),
188 fMaxPlotEta(0.8),
189 fMaxRap(0.5),
190 fMaxPt(10.),
191 fNEtaBins(32),
192 fNPhiBins(36),
193 fVertexZMixedEvents(2.),
194 fCentralityCutMax(0.),
195 fCentralityCutMin(10.),
196 fZoomed(kFALSE),
197 fDoITSCut(kFALSE),
198 fDoDCACut(kFALSE),
199 fDemandNoMismatch(kFALSE),
200 fVerbose(0),
201 fPrintBufferSize(kFALSE),
202 fTrigBufferIndex(0),
203 fTrigBufferSize(0),
204 fTrigBufferMaxSize(100)
205
206{
207
208 //
209 // Named Constructor.
210 //
211
212 DefineInput(0, TChain::Class());
213 DefineOutput(1, TList::Class());
214
215 // Trigger buffer.
216 for(Int_t ii=0; ii<25000; ii++) {
217 for(Int_t jj=0; jj<4; jj++) {
218 fTrigBuffer[ii][jj]=0;
219 }
220 }
221
222 // The identified di-hadron correlations.
223 for (Int_t ii = 0; ii < 3; ii++) {
224 //fMixedEventsTPCTOFCut[ii]=0x0;
225 for (Int_t jj = 0; jj < 10; jj++) {
226 fDiHadronTPCTOF[ii][jj]=0x0;
227 fMixedEventsTPCTOF[ii][jj]=0x0;
228 fInclusiveTPCTOF[ii][jj]=0x0;
229 fInclusiveTPCTOFRap[ii][jj]=0x0;
230 }
231 }
232
233 // Track cut labels.
234 for (Int_t ii=0; ii<8; ii++) {
235 fTrackCutLabelNumbers[ii]=ii+1;
236 }
237
238 // Monte Carlo Efficiency Histograms.
239 for (Int_t iSpecies=0; iSpecies<6; iSpecies++) {
240 fPtEtaDistrDataPrim[iSpecies]=0x0;
241 fPtEtaDistrDataSec[iSpecies]=0x0;
242 fPtRapDistrDataPrimRapCut[iSpecies]=0x0;
243 fPtRapDistrDataSecRapCut[iSpecies]=0x0;
244
245 fPtEtaDistrMCPrim[iSpecies]=0x0;
246 fPtEtaDistrMCSec[iSpecies]=0x0;
247 fPtRapDistrMCPrimRapCut[iSpecies]=0x0;
248 fPtRapDistrMCSecRapCut[iSpecies]=0x0;
249
250 fDiHadronMC[iSpecies]=0x0;
251
252 }
253
254}
255
256//_____________________________________________________________________________
257AliAnalysisTaskDiHadronPID::~AliAnalysisTaskDiHadronPID() {
258
259 //
260 // Destructor.
261 //
262
263 if(fGlobalTracks) {
264 delete fGlobalTracks;
265 fGlobalTracks=0x0;
266 }
267 /*
268 if (fMCTracks) {
269 delete fMCTracks;
270 fMCTracks=0x0;
271 }
272*/
273}
274
275//_____________________________________________________________________________
276void AliAnalysisTaskDiHadronPID::UserCreateOutputObjects()
277
278{
279 //
280 // Output objects.
281 //
282
283 // Print the settings of the analysis task.
284 cout<<endl;
285 cout<<"-----------------------------------------------"<<endl;
286 cout<<" AliAnalysisTaskDiHadronPID Settings:"<<endl;
287 cout<<"-----------------------------------------------"<<endl;
288 cout<<"Verbose Level: "<<fVerbose<<endl;
289 cout<<"Mixed Events Calculated: "<<fCalculateMixedEvents<<endl;
290 cout<<"Beam Type: "<<fBeamType<<endl;
291 cout<<"Run over MC: "<<fMC<<endl;
292 cout<<Form("Max eta: %3.1f",fMaxEta)<<endl;
293 cout<<Form("Max eta plotted: %3.1f",fMaxPlotEta)<<endl;
294 cout<<Form("Max rapidity in spectra: %3.1f",fMaxRap)<<endl;
295 cout<<Form("Max p_T for the triggers: %3.1f GeV/c.",fMaxPt)<<endl;
296 cout<<"Nbins in eta and delta eta: "<<fNEtaBins<<endl;
297 cout<<"Nbins in phi and delta phi: "<<fNPhiBins<<endl;
298 cout<<Form("Events mixed if vertices differ %3.1f cm.",fVertexZMixedEvents)<<endl;
299 cout<<Form("Centrality between %3.1f and %3.1f percent.",fCentralityCutMax,fCentralityCutMin)<<endl;
300 cout<<"Tracks are cut if less than 2 SPD hits: "<<fDoITSCut<<endl;
301 cout<<"Tracks cut if DCA is too big: "<<fDoDCACut<<endl;
302 cout<<"Tracks cut if there is a TPC-TOF mismatch: "<<fDemandNoMismatch<<endl;
303 cout<<"Maximum number of triggers stored: "<<fTrigBufferMaxSize<<endl;
304 cout<<"-----------------------------------------------"<<endl;
305 cout<<endl;
306
307 // Obtain a pointer to the analysis manager.
308 AliAnalysisManager* manager = AliAnalysisManager::GetAnalysisManager();
309 if (!manager) {
310 if (fVerbose>0) cout<<"AliAnalysisTaskDiHadronPID::UserCreateOutputObjects -> ERROR: Analysis manager not found."<<endl;
311 return;
312 }
313 if (fVerbose>1) {
314 cout<<"AliAnalysisTaskDiHadronPID::UserCreateOutputObjects -> Analysis manager found."<<endl;
315 }
316
317 // Obtain a pointer to the input handler.
318 AliInputEventHandler* inputHandler = dynamic_cast<AliInputEventHandler*> (manager->GetInputEventHandler());
319 if (!inputHandler) {
320 if (fVerbose>0) cout<<"AliAnalysisTaskDiHadronPID::UserCreateOutputObjects -> ERROR: Input handler not found."<<endl;
321 return;
322 }
323 if (fVerbose>1) {
324 cout<<"AliAnalysisTaskDiHadronPID::UserCreateOutputObjects -> Input handler found."<<endl;
325 }
326
327 // Obtain a pointer to the PID response object.
328 fPIDResponse = inputHandler->GetPIDResponse();
329 if (!fPIDResponse) {
330 if (fVerbose>0) cout<<"AliAnalysisTaskDiHadronPID::UserCreateOutputObjects -> ERROR: PID response object not found."<<endl;
331 return;
332 }
333 if (fVerbose>1) {
334 cout<<"AliAnalysisTaskDiHadronPID::UserCreateOutputObjects -> PID response object found."<<endl;
335 }
336
337 // Create the output of the task.
338 fHistoList = new TList();
339 fHistoList->SetOwner(kTRUE);
340
341 // Ranges in dPhi, dEta, and the number of bins for di-hadron correlations.
342 Int_t binsHisto[4] = {fNPhiBins,fNEtaBins};
343 Double_t minHisto[4] = {-TMath::Pi()/2.,-2*fMaxPlotEta};
344 Double_t maxHisto[4] = {3.*TMath::Pi()/2,2*fMaxPlotEta};
345
346 // --- EVENT QA PLOTS ---
347
348 fCentrality = new TH1F("fCentrality","Centrality;Centrality;N_{evt}",100,0,100);
349 fHistoList->Add(fCentrality);
350 fVertexZ = new TH1F("fVertexZ","Vertex Z position;z (cm);N_{evt}",30,-15,15);
351 fHistoList->Add(fVertexZ);
352
353 // --- TRACK QA PLOTS ---
354
355 fDCA = new TH2F("fDCA","DCA positions TPC only cuts;xy (cm);z (cm)",100,-5,5,100,-5,5);
356 fHistoList->Add(fDCA);
357 fDCAZoomed = new TH2F("fDCAZoomed","DCA positions TPC only cuts;xy (cm);z (cm)",100,-.5,.5,100,-.5,.5);
358 fHistoList->Add(fDCAZoomed);
359 fDCAZoomedTwice = new TH2F("fDCAZoomedTwice","DCA positions TPC only cuts;xy (cm);z (cm)",100,-.05,.05,100,-.05,.05);
360 fHistoList->Add(fDCAZoomedTwice);
361 fDCACut = new TH2F("fDCACut","DCA positions after DCA cut;xy (cm);z (cm)",100,-5,5,100,-5,5);
362 fHistoList->Add(fDCACut);
363 fDCAZoomedCut = new TH2F("fDCAZoomedCut","DCA positions after DCA cut;xy (cm);z (cm)",100,-.5,.5,100,-.5,.5);
364 fHistoList->Add(fDCAZoomedCut);
365 fDCAZoomedTwiceCut = new TH2F("fDCAZoomedTwiceCut","DCA positions after DCA cut;xy (cm);z (cm)",100,-.05,.05,100,-.05,.05);
366 fHistoList->Add(fDCAZoomedTwiceCut);
367
368 fITSHits = new TH1F("fITSHits","ITS hits",3,0,3);
369 (fITSHits->GetXaxis())->SetBinLabel(1,"No SPD hit");
370 (fITSHits->GetXaxis())->SetBinLabel(2,"One SPD hit");
371 (fITSHits->GetXaxis())->SetBinLabel(3,"Two SPD hits");
372 fHistoList->Add(fITSHits);
373
374 // Determine the bins used in the track cut histograms.
375 const Int_t ncuts = 5 + fDoITSCut + fDoDCACut + fDemandNoMismatch;
376
377 if (!fDoITSCut) {
378 fTrackCutLabelNumbers[3]--;
379 fTrackCutLabelNumbers[4]--;
380 fTrackCutLabelNumbers[5]--;
381 fTrackCutLabelNumbers[6]--;
382 fTrackCutLabelNumbers[7]--;
383 }
384
385 if (!fDoDCACut) {
386 fTrackCutLabelNumbers[4]--;
387 fTrackCutLabelNumbers[5]--;
388 fTrackCutLabelNumbers[6]--;
389 fTrackCutLabelNumbers[7]--;
390 }
391
392 fTrackCutsCount = new TH1F("fTrackCutsCount","Track Cuts;;Count",ncuts,0,ncuts);
393 (fTrackCutsCount->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[0],"Std. TPC Only");
394 (fTrackCutsCount->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[1],Form("#eta < %3.1f",fMaxEta));
395 if (fDoITSCut) (fTrackCutsCount->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[2],"1-2 SPD hits");
396 if (fDoDCACut) (fTrackCutsCount->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[3],"DCA cut");
397 (fTrackCutsCount->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[4],"p_{T} < 5.0 GeV/c");
398 (fTrackCutsCount->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[5],"TPCpid (p_{T} < 5.0 GeV/c)");
399 (fTrackCutsCount->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[6],"TOFpid (p_{T} < 5.0 GeV/c)");
400 if (fDemandNoMismatch) (fTrackCutsCount->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[7],"No Mismatch (p_{T} < 5.0 GeV/c)");
401 fHistoList->Add(fTrackCutsCount);
402
403 fTrackCutsPt = new TH2F("fTrackCutsPt","Track Cuts vs p_{T};;p_{T};Count",ncuts,0,ncuts,40,0,fMaxPt);
404 (fTrackCutsPt->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[0],"Std. TPC Only");
405 (fTrackCutsPt->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[1],Form("#eta < %3.1f",fMaxEta));
406 if (fDoITSCut) (fTrackCutsPt->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[2],"1-2 SPD hits");
407 if (fDoDCACut) (fTrackCutsPt->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[3],"DCA cut");
408 (fTrackCutsPt->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[4],"p_{T} < 5.0 GeV/c");
409 (fTrackCutsPt->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[5],"TPCpid (p_{T} < 5.0 GeV/c)");
410 (fTrackCutsPt->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[6],"TOFpid (p_{T} < 5.0 GeV/c)");
411 if (fDemandNoMismatch) (fTrackCutsPt->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[7],"No Mismatch (p_{T} < 5.0 GeV/c)");
412 fHistoList->Add(fTrackCutsPt);
413
414 fTrackCutsEta = new TH2F("fTrackCutsEta","Track Cuts vs #eta;;#eta;Count",ncuts,0,ncuts,4*binsHisto[1],-fMaxPlotEta,fMaxPlotEta);
415 (fTrackCutsEta->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[0],"Std. TPC Only");
416 (fTrackCutsEta->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[1],Form("#eta < %3.1f",fMaxEta));
417 if (fDoITSCut) (fTrackCutsEta->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[2],"1-2 SPD hits");
418 if (fDoDCACut) (fTrackCutsEta->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[3],"DCA cut");
419 (fTrackCutsEta->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[4],"p_{T} < 5.0 GeV/c");
420 (fTrackCutsEta->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[5],"TPCpid (p_{T} < 5.0 GeV/c)");
421 (fTrackCutsEta->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[6],"TOFpid (p_{T} < 5.0 GeV/c)");
422 if (fDemandNoMismatch) (fTrackCutsEta->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[7],"No Mismatch (p_{T} < 5.0 GeV/c)");
423 fHistoList->Add(fTrackCutsEta);
424
425 fTrackCutsPhi = new TH2F("fTrackCutsPhi","Track Cuts vs #phi;;#phi;Count",ncuts,0,ncuts,72,0,2.*TMath::Pi());
426 (fTrackCutsPhi->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[0],"Std. TPC Only");
427 (fTrackCutsPhi->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[1],Form("#eta < %3.1f",fMaxEta));
428 if (fDoITSCut) (fTrackCutsPhi->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[2],"1-2 SPD hits");
429 if (fDoDCACut) (fTrackCutsPhi->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[3],"DCA cut");
430 (fTrackCutsPhi->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[4],"p_{T} < 5.0 GeV/c");
431 (fTrackCutsPhi->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[5],"TPCpid (p_{T} < 5.0 GeV/c)");
432 (fTrackCutsPhi->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[6],"TOFpid (p_{T} < 5.0 GeV/c)");
433 if (fDemandNoMismatch) (fTrackCutsPhi->GetXaxis())->SetBinLabel(fTrackCutLabelNumbers[7],"No Mismatch (p_{T} < 5.0 GeV/c)");
434 fHistoList->Add(fTrackCutsPhi);
435
436 fEtaSpectrumTrig = new TH1F("fEtaSpectrumTrig","#eta Spectrum Triggers;#eta;Count",4*binsHisto[1],-fMaxPlotEta,fMaxPlotEta);
437 fHistoList->Add(fEtaSpectrumTrig);
438 fEtaSpectrumAssoc = new TH2F("fEtaSpectrumAssoc","#eta Spectrum Associateds;#eta;p_{T};Count",4*binsHisto[1],-fMaxPlotEta,fMaxPlotEta,10,0.,5.);
439 fHistoList->Add(fEtaSpectrumAssoc);
440 fPhiSpectrumAssoc = new TH2F("fPhiSpectrumAssoc","#phi Spectrum Associateds;#phi;p_{T};Count",72,0,2.*TMath::Pi(),10,0.,5.);
441 fHistoList->Add(fPhiSpectrumAssoc);
442
443 // --- QA PLOTS PID ---
444
445 fTPCnSigmaProton = new TH2F("fTPCnSigmaProton","n#sigma plot for the TPC (Protons);p (GeV/c);n#sigma",100,0.,5.,100,-10.,10.);
446 fHistoList->Add(fTPCnSigmaProton);
447 fTOFnSigmaProton = new TH2F("fTOFnSigmaProton","n#sigma plot for the TOF (Protons);p (GeV/c);n#sigma",100,0.,5.,100,-10.,10.);
448 fHistoList->Add(fTOFnSigmaProton);
449 fTPCnSigmaPion = new TH2F("fTPCnSigmaPion","n#sigma plot for the TPC (Pions);p (GeV/c);n#sigma",100,0.,5.,100,-10.,10.);
450 fHistoList->Add(fTPCnSigmaPion);
451 fTOFnSigmaPion = new TH2F("fTOFnSigmaPion","n#sigma plot for the TOF (Pions);p (GeV/c);n#sigma",100,0.,5.,100,-10.,10.);
452 fHistoList->Add(fTOFnSigmaPion);
453 fTPCnSigmaKaon = new TH2F("fTPCnSigmaKaon","n#sigma plot for the TPC (Kaons);p (GeV/c);n#sigma",100,0.,5.,100,-10.,10.);
454 fHistoList->Add(fTPCnSigmaKaon);
455 fTOFnSigmaKaon = new TH2F("fTOFnSigmaKaon","n#sigma plot for the TOF (Kaons);p (GeV/c);n#sigma",100,0.,5.,100,-10.,10.);
456 fHistoList->Add(fTOFnSigmaKaon);
457 fTPCSignal = new TH3F("fTPCSignal","TPC Signal;#eta;p_{T} GeV/c;dE/dx",25,-fMaxEta,fMaxEta,100,0.,5.,150,0.,300.);
458 fHistoList->Add(fTPCSignal);
459 fTOFSignal = new TH3F("fTOFSignal","TOF Signal;#eta;p_{T} GeV/c;t",25,-fMaxEta,fMaxEta,100,0.,5.,150,10000.,25000.);
460 fHistoList->Add(fTOFSignal);
461
462 // --- DI-HADRON CORRELATIONS AND MIXED EVENTS WITH TPC AND TOF SIGNALS ---
463
464 // Unzoomed pictures.
465 Int_t binsTPCnoZoom[3][10] = {{100,100,100,100,100,100,100,100,100,100},
466 {100,100,100,100,100,100,100,100,100,100},
467 {100,100,100,100,100,100,100,100,100,100}};
468
469 Double_t minTPCnoZoom[3][10] = {{ -50., -50.,-30.,-30.,-30.,-30.,-30.,-30.,-30.,-30.},
470 { -100., -50.,-20.,-20.,-20.,-20.,-20.,-20.,-20.,-20.},
471 { -200.,-150.,-50.,-30.,-20.,-20.,-20.,-20.,-20.,-20.}};
472 Double_t maxTPCnoZoom[3][10] = {{ 150., 100., 50., 30., 25., 25., 25., 25., 25., 25.},
473 { 50., 100., 40., 30., 30., 30., 30., 30., 30., 30.},
474 { 100., 50., 50., 30., 30., 30., 30., 30., 30., 30.}};
475
476 Int_t binsTOFnoZoom[3][10] = {{100,100,100,100,100,100,100,100,100,100},
477 {100,100,100,100,100,100,100,100,100,100},
478 {100,100,100,100,100,100,100,100,100,100}};
479
480 Double_t minTOFnoZoom[3][10] = {{-2000.,-2000.,-1000., -500., -500., -500., -500., -500., -500., -500.},
481 {-2000.,-2000.,-2000.,-1000.,-1000.,-1000.,-1000.,-1000.,-1000.,-1000.},
482 {-2000.,-2000.,-6000.,-3000.,-2000.,-1500.,-1500.,-1500.,-1500.,-1500.}};
483 Double_t maxTOFnoZoom[3][10] = {{ 2000., 2000., 5000., 3000., 2000., 1500., 1500., 1500., 1500., 1500.},
484 { 2000., 2000., 5000., 2000., 1500., 1500., 1500., 1500., 1500., 1500.},
485 { 2000., 2000., 2000., 1000., 1000., 1000., 1000., 1000., 1000., 1000.}};
486
487 // Zoomed pictures.
488 Int_t binsTPCZoom[3][10] = {{100,100,100,100,100,100,100,100,100,100},
489 {100,100,100,100,100,100,100,100,100,100},
490 {100,100,100,100,100,100,100,100,100,100}};
491
492 Double_t minTPCZoom[3][10] = {{ -20., -20.,-20.,-20.,-20.,-20.,-20.,-20.,-20.,-20.},
493 { -20., -20.,-20.,-20.,-20.,-20.,-20.,-20.,-20.,-20.},
494 { -40., -20.,-20.,-20.,-20.,-20.,-20.,-20.,-20.,-20.}};
495 Double_t maxTPCZoom[3][10] = {{ 20., 20., 20., 20., 20., 20., 20., 20., 20., 20.},
496 { 20., 20., 20., 20., 20., 20., 20., 20., 20., 20.},
497 { 40., 20., 20., 20., 20., 30., 30., 30., 30., 30.}};
498
499 Int_t binsTOFZoom[3][10] = {{100,100,100,100,100,100,100,100,100,100},
500 {100,100,100,100,100,100,100,100,100,100},
501 {100,100,100,100,100,100,100,100,100,100}};
502
503 Double_t minTOFZoom[3][10] = {{-1000.,-1000., -500., -500., -500., -400., -400., -400., -400., -400.},
504 { -800., -800., -800., -800., -800., -600., -500., -500., -400., -400.},
505 {-1000.,-1000.,-1000.,-1000., -800.,-1000.,-1000., -800., -700., -700.}};
506 Double_t maxTOFZoom[3][10] = {{ 1000., 1000., 1000., 1000., 1000., 1000., 1000., 900., 800., 700.},
507 { 1000., 1000., 500., 500., 500., 900., 700., 700., 600., 500.},
508 { 1000., 1000., 1000., 500., 500., 500., 500., 500., 500., 500.}};
509
510 const char* species[3] = {"Pion","Kaon","Proton"};
511
512 for (Int_t iSpecies = 0; iSpecies < 3; iSpecies++) {
513
514 for (Int_t iPtBin = 0; iPtBin < 10; iPtBin++) {
515
516 if (fZoomed) {
517 binsHisto[2] = binsTPCZoom[iSpecies][iPtBin];
518 binsHisto[3] = binsTOFZoom[iSpecies][iPtBin];
519 minHisto[2] = minTPCZoom[iSpecies][iPtBin];
520 minHisto[3] = minTOFZoom[iSpecies][iPtBin];
521 maxHisto[2] = maxTPCZoom[iSpecies][iPtBin];
522 maxHisto[3] = maxTOFZoom[iSpecies][iPtBin];
523 } else {
524 binsHisto[2] = binsTPCnoZoom[iSpecies][iPtBin];
525 binsHisto[3] = binsTOFnoZoom[iSpecies][iPtBin];
526 minHisto[2] = minTPCnoZoom[iSpecies][iPtBin];
527 minHisto[3] = minTOFnoZoom[iSpecies][iPtBin];
528 maxHisto[2] = maxTPCnoZoom[iSpecies][iPtBin];
529 maxHisto[3] = maxTOFnoZoom[iSpecies][iPtBin];
530 }
531
532 // Di-Hadron Correlations
533 fDiHadronTPCTOF[iSpecies][iPtBin] = new THnSparseF(Form("fDiHadronTPCTOF_%s_%i",species[iSpecies],iPtBin),
534 Form("Di-Hadron Correlation (%s) %3.1f < p_{T} < %3.1f;#Delta#phi;#Delta#eta;dE/dx;t (ms);",species[iSpecies],iPtBin*0.5,(iPtBin+1)*0.5),
535 4,binsHisto,minHisto,maxHisto);
536 fHistoList->Add(fDiHadronTPCTOF[iSpecies][iPtBin]);
537
538 // Mixed Events.
539 fMixedEventsTPCTOF[iSpecies][iPtBin] = new THnSparseF(Form("fMixedEventsTPCTOF_%s_%i",species[iSpecies],iPtBin),
540 Form("Mixed Events (%s) %3.1f < p_{T} < %3.1f;#Delta#phi;#Delta#eta;dE/dx;t (ms);",species[iSpecies],iPtBin*0.5,(iPtBin+1)*0.5),
541 4,binsHisto,minHisto,maxHisto);
542 //fHistoList->Add(fMixedEventsTPCTOF[iSpecies][iPtBin]);
543
544 // Inclusive spectra.
545 fInclusiveTPCTOF[iSpecies][iPtBin] = new TH3F(Form("fInclusiveTPCTOF_%s_%i",species[iSpecies],iPtBin),
546 Form("Inclusive Spectrum (%s) %3.1f < p_{T} < %3.1f;dE/dx;t (ms);#eta",species[iSpecies],iPtBin*0.5,(iPtBin+1)*0.5),
547 binsHisto[2],minHisto[2],maxHisto[2],binsHisto[3],minHisto[3],maxHisto[3],fNEtaBins,-fMaxEta,fMaxEta);
548 fHistoList->Add(fInclusiveTPCTOF[iSpecies][iPtBin]);
549
550 // Inclusive spectra with additional rapidity cut.
551 fInclusiveTPCTOFRap[iSpecies][iPtBin] = new TH3F(Form("fInclusiveTPCTOFRap_%s_%i",species[iSpecies],iPtBin),
552 Form("Inclusive Spectrum (%s) %3.1f < p_{T} < %3.1f |Y| < %3.1f;dE/dx;t (ms);Y",species[iSpecies],iPtBin*0.5,(iPtBin+1)*0.5,fMaxRap),
553 binsHisto[2],minHisto[2],maxHisto[2],binsHisto[3],minHisto[3],maxHisto[3],20,-fMaxRap,fMaxRap);
554 fHistoList->Add(fInclusiveTPCTOFRap[iSpecies][iPtBin]);
555
556
557 }
558 }
559
560 // Correlations without PID signals
561 fDiHadron = new TH3F("fDiHadron","Di-Hadron Correlations;#Delta#phi;#Delta#eta;p_{T_assoc}",binsHisto[0],minHisto[0],maxHisto[0],binsHisto[1],minHisto[1],maxHisto[1],10,0.,5.);
562 fDiHadron->Sumw2();
563 fHistoList->Add(fDiHadron);
564
565 fMixedEvents = new TH3F("fMixedEvents","Mixed Events;#Delta#phi;#Delta#eta;p_{T_assoc}",binsHisto[0],minHisto[0],maxHisto[0],binsHisto[1],minHisto[1],maxHisto[1],10,0.,5.);
566 fMixedEvents->Sumw2();
567 fHistoList->Add(fMixedEvents);
568
569 const char* MCSpeciesName[6] = {"piplus","pimin","Kplus","Kmin","p","pbar"};
570 const char* MCSpeciesTitle[6] = {"#pi^{+}","#pi^{-}","K^{+}","K^{-}","p","#bar{p}"};
571 //const char* Cuts[3] = {"nocut","DCAcut","PIDandDCAcut"};
572
573 // Efficiency Plots (Monte Carlo)
574 if (fMC) {
575
576 for (Int_t iSpecies=0; iSpecies<6; iSpecies++) {
577
578 // Without rapidity cut.
579 fPtEtaDistrDataPrim[iSpecies]=new TH2F(Form("fPtEtaDistrDataPrim_%s",MCSpeciesName[iSpecies]),
580 Form("p_{T}-#eta distribution Data Primaries (%s);p_{T};#eta;Count",MCSpeciesTitle[iSpecies]),
581 20,0.0,5.0,fNEtaBins,-fMaxEta,fMaxEta);
582 fPtEtaDistrDataPrim[iSpecies]->Sumw2();
583 fHistoList->Add(fPtEtaDistrDataPrim[iSpecies]);
584
585 fPtEtaDistrDataSec[iSpecies]=new TH2F(Form("fPtEtaDistrDataSec_%s",MCSpeciesName[iSpecies]),
586 Form("p_{T}-#eta distribution Data Secondaries (%s);p_{T};#eta;Count",MCSpeciesTitle[iSpecies]),
587 20,0.0,5.0,fNEtaBins,-fMaxEta,fMaxEta);
588 fPtEtaDistrDataSec[iSpecies]->Sumw2();
589 fHistoList->Add(fPtEtaDistrDataSec[iSpecies]);
590
591 fPtEtaDistrMCPrim[iSpecies]=new TH2F(Form("fPtEtaDistrMCPrim_%s",MCSpeciesName[iSpecies]),
592 Form("p_{T}-#eta distribution MC Primaries (%s);p_{T};#eta;Count",MCSpeciesTitle[iSpecies]),
593 20,0.0,5.0,fNEtaBins,-fMaxEta,fMaxEta);
594 fPtEtaDistrMCPrim[iSpecies]->Sumw2();
595 fHistoList->Add(fPtEtaDistrMCPrim[iSpecies]);
596
597 fPtEtaDistrMCSec[iSpecies]=new TH2F(Form("fPtEtaDistrMCSec_%s",MCSpeciesName[iSpecies]),
598 Form("p_{T}-#eta distribution MC Secondaries (%s);p_{T};#eta;Count",MCSpeciesTitle[iSpecies]),
599 20,0.0,5.0,fNEtaBins,-fMaxEta,fMaxEta);
600 fPtEtaDistrMCSec[iSpecies]->Sumw2();
601 fHistoList->Add(fPtEtaDistrMCSec[iSpecies]);
602
603 //fDiHadronMC[iSpecies]=new TH3F(Form("fDiHadronMC_%s",MCSpeciesName[iSpecies]),
604 // Form("Di-Hadron Correlations MC (%s);#Delta#phi;#Delta#eta;p_{T_assoc}",MCSpeciesTitle[iSpecies]),
605 // binsHisto[0],minHisto[0],maxHisto[0],binsHisto[1],minHisto[1],maxHisto[1],10,0.,5.);
606 //fHistoList->Add(fDiHadronMC[iSpecies]);
607
608 // With rapidity cut.
609 fPtRapDistrDataPrimRapCut[iSpecies]=new TH2F(Form("fPtRapDistrDataPrimRapCut_%s",MCSpeciesName[iSpecies]),
610 Form("p_{T}-Y distribution Data Primaries (%s) |Y| < %3.1f;p_{T};Y;Count",MCSpeciesTitle[iSpecies],fMaxRap),
611 20,0.0,5.0,20,-fMaxRap,fMaxRap);
612 fPtRapDistrDataPrimRapCut[iSpecies]->Sumw2();
613 fHistoList->Add(fPtRapDistrDataPrimRapCut[iSpecies]);
614
615 fPtRapDistrDataSecRapCut[iSpecies]=new TH2F(Form("fPtRapDistrDataSecRapCut_%s",MCSpeciesName[iSpecies]),
616 Form("p_{T}-Y distribution Data Secondaries (%s) |Y| < %3.1f;p_{T};Y;Count",MCSpeciesTitle[iSpecies],fMaxRap),
617 20,0.0,5.0,20,-fMaxRap,fMaxRap);
618 fPtRapDistrDataSecRapCut[iSpecies]->Sumw2();
619 fHistoList->Add(fPtRapDistrDataSecRapCut[iSpecies]);
620
621 fPtRapDistrMCPrimRapCut[iSpecies]=new TH2F(Form("fPtRapDistrMCPrimRapCut_%s",MCSpeciesName[iSpecies]),
622 Form("p_{T}-Y distribution MC Primaries (%s) |Y| < %3.1f;p_{T};Y;Count",MCSpeciesTitle[iSpecies],fMaxRap),
623 20,0.0,5.0,20,-fMaxRap,fMaxRap);
624 fPtRapDistrMCPrimRapCut[iSpecies]->Sumw2();
625 fHistoList->Add(fPtRapDistrMCPrimRapCut[iSpecies]);
626
627 fPtRapDistrMCSecRapCut[iSpecies]=new TH2F(Form("fPtRapDistrMCSecRapCut_%s",MCSpeciesName[iSpecies]),
628 Form("p_{T}-Y distribution MC Secondaries (%s) |Y| < %3.1f;p_{T};Y;Count",MCSpeciesTitle[iSpecies],fMaxRap),
629 20,0.0,5.0,20,-fMaxRap,fMaxRap);
630 fPtRapDistrMCSecRapCut[iSpecies]->Sumw2();
631 fHistoList->Add(fPtRapDistrMCSecRapCut[iSpecies]);
632
633 }
634 }
635
636 PostData(1, fHistoList);
637
638}
639
640//_____________________________________________________________________________
641Int_t AliAnalysisTaskDiHadronPID::ClassifyTrack(AliAODTrack *track)
642
643{
644 //
645 // This function both classifies tracks, and fills the track QA histograms.
646 //
647 // Classifies the track in:
648 // 0 -> Not Useful,
649 // 1 -> Associated,
650 // 2 -> Trigger.
651 //
652 // IDEA: later we can do this with filterbits.
653 //
654 // The following track cuts are applied for triggers:
655 //
656 // 1a) pT > 5.0 GeV/c, pT < fPtMax,
657 // 2) StandardTPCOnlyTrackCuts (filterbit 7 for AOD's),
658 // 3) eta < fMaxEta,
659 // 4) ITS track cut, a track is only selected if it has at least one hit in the SPD,
660 // that is, in one of the first two layers of the ITS. (can be switched on and off
661 // using (Bool_t)fDoITSCut),
662 // 5) DCA track cut, of all tracks with at least one SPD hit, the DCA is constrained as
663 // a function of pT, in order to remove lots of the secondaries. (can be switched on and
664 // off by using (Bool_t)fDoDCACut),
665 //
666 // For associateds all the same track cuts are applied, except 1a is
667 // replaced by 2b. Moreover the following cuts are applied too:
668 //
669 // 1b) pT < 5.0 GeV/c,
670 // 6) TPCpid,
671 // 7) TOFpid,
672 // 8) no TPCTOF mismatch.
673 //
674
675 // Check if a track is supplied.
676 if (!track) {
677 if (fVerbose>0) cout<<"AliAnalysisTaskDiHadronPID::SelectTrack -> ERROR: No track found."<<endl;
678 return 0;
679 }
680
681 // Get basic track information.
682 Int_t classification=0;
683 Double_t pt = track->Pt();
684 Double_t eta = track->Eta();
685 Double_t phi = track->Phi();
686
687 // 1) pT cut: First separation between triggers and associateds.
688 if (pt<5.0) classification=1;
689 if ((pt>5.0)&&(pt<fMaxPt)) classification = 2;
690 if (!classification) return 0;
691
692 // 2) StandardTPCOnlyTrackCuts.
693 if (!(track->TestFilterMask(1<<7))) {
694 //if (fVerbose>3) cout<<"Track Ignored: Did Not pass filterbit."<<endl;
695 return 0;
696 }
697
698 if (fVerbose>3) {
699 cout<<endl;
700 cout<<"pt: "<<pt<<" eta: "<<eta<<" phi: "<<phi<<endl;
701 }
702
703 fTrackCutsCount->Fill(fTrackCutLabelNumbers[0]-.5);
704 fTrackCutsPt->Fill(fTrackCutLabelNumbers[0]-.5,pt);
705 fTrackCutsEta->Fill(fTrackCutLabelNumbers[0]-.5,eta);
706 fTrackCutsPhi->Fill(fTrackCutLabelNumbers[0]-.5,phi);
707
708 // 3) eta cut.
709 if (TMath::Abs(eta)>fMaxEta) {
710 if (fVerbose>3) cout<<"Track Ignored: Eta too large."<<endl;
711 return 0;
712 }
713
714 fTrackCutsCount->Fill(fTrackCutLabelNumbers[1]-.5);
715 fTrackCutsPt->Fill(fTrackCutLabelNumbers[1]-.5,pt);
716 fTrackCutsEta->Fill(fTrackCutLabelNumbers[1]-.5,eta);
717 fTrackCutsPhi->Fill(fTrackCutLabelNumbers[1]-.5,phi);
718
719 // Obtaining ITS information.
720 AliAODTrack* globaltrack = GetGlobalTrack(track);
721 Bool_t ITSLayerHit[6];
722 for (Int_t iITSLayer=0; iITSLayer<6; iITSLayer++) {
723 ITSLayerHit[iITSLayer] = globaltrack->HasPointOnITSLayer(iITSLayer);
724 }
725 Int_t SPDHits=ITSLayerHit[0]+ITSLayerHit[1];
726
727 if (fVerbose>3) cout<<"SPD hits: "<<SPDHits<<endl;
728
729 // Fill the ITS hist.
730 fITSHits->Fill(SPDHits+0.5);
731
732 // 4) ITS cut.
733 if (fDoITSCut) {
734 if (!SPDHits) {
735 if (fVerbose>3) cout<<"Track Ignored: Not enough SPD hits."<<endl;
736 return 0;
737 }
738 fTrackCutsCount->Fill(fTrackCutLabelNumbers[2]-.5);
739 fTrackCutsPt->Fill(fTrackCutLabelNumbers[2]-.5,pt);
740 fTrackCutsEta->Fill(fTrackCutLabelNumbers[2]-.5,eta);
741 fTrackCutsPhi->Fill(fTrackCutLabelNumbers[2]-.5,phi);
742 }
743
744 // Propagate the global track to the DCA.
745 Double_t PosAtDCA[2] = {-999,-999};
746 Double_t covar[3] = {-999,-999,-999};
747 globaltrack->PropagateToDCA(fAODVertex,fAODEvent->GetMagneticField(),100.,PosAtDCA,covar);
748
749 // Fill the DCA hist (before cut)
750 fDCA->Fill(PosAtDCA[0],PosAtDCA[1]);
751 fDCAZoomed->Fill(PosAtDCA[0],PosAtDCA[1]);
752 fDCAZoomedTwice->Fill(PosAtDCA[0],PosAtDCA[1]);
753
754 // 5) DCA cut (See R_AA paper).
755 Double_t DCAcutvalue[2];
756 DCAcutvalue[0] = 0.018 + 0.035*TMath::Power(pt,-1.01);
757 DCAcutvalue[1] = 2.;
758 if (fDoDCACut) {
759 if (SPDHits&&((TMath::Abs(PosAtDCA[0])>DCAcutvalue[0])||(TMath::Abs(PosAtDCA[1])>DCAcutvalue[1]))) {
760 if (fVerbose>3) cout<<"Track Ignored: Enough SPD hits, but out of DCA range."<<endl;
761 return 0;
762 }
763 fTrackCutsCount->Fill(fTrackCutLabelNumbers[3]-.5);
764 fTrackCutsPt->Fill(fTrackCutLabelNumbers[3]-.5,pt);
765 fTrackCutsEta->Fill(fTrackCutLabelNumbers[3]-.5,eta);
766 fTrackCutsPhi->Fill(fTrackCutLabelNumbers[3]-.5,phi);
767
768 // Fill the DCA hist (after cut)
769 fDCACut->Fill(PosAtDCA[0],PosAtDCA[1]);
770 fDCAZoomedCut->Fill(PosAtDCA[0],PosAtDCA[1]);
771 fDCAZoomedTwiceCut->Fill(PosAtDCA[0],PosAtDCA[1]);
772 }
773
774 // Now all the common cuts have been performed. Tracks identified as a trigger will
775 // be returned. Note that they will not appear in the histograms after track cut 5.
776 if (classification==2) return 2;
777
778 // Now we're left with only tracks with pT < 5.0 GeV/c.
779 fTrackCutsCount->Fill(fTrackCutLabelNumbers[4]-.5);
780 fTrackCutsPt->Fill(fTrackCutLabelNumbers[4]-.5,pt);
781 fTrackCutsEta->Fill(fTrackCutLabelNumbers[4]-.5,eta);
782 fTrackCutsPhi->Fill(fTrackCutLabelNumbers[4]-.5,phi);
783
784 // Obtain the status of the track.
785 ULong_t status = globaltrack->GetStatus();
786
787 // 6) TPCpid
788 if (!((status&AliAODTrack::kTPCpid)==AliAODTrack::kTPCpid)) {
789 if (fVerbose>3) cout<<"Track Ignored: No TPC pid."<<endl;
790 return 0;
791 }
792
793 fTrackCutsCount->Fill(fTrackCutLabelNumbers[5]-.5);
794 fTrackCutsPt->Fill(fTrackCutLabelNumbers[5]-.5,pt);
795 fTrackCutsEta->Fill(fTrackCutLabelNumbers[5]-.5,eta);
796 fTrackCutsPhi->Fill(fTrackCutLabelNumbers[5]-.5,phi);
797
798 // 7) TOFpid
799 if (!((status&AliAODTrack::kTOFpid)==AliAODTrack::kTOFpid)) {
800 if (fVerbose>3) cout<<"Track Ignored: No TOF pid."<<endl;
801 return 0;
802 }
803
804 fTrackCutsCount->Fill(fTrackCutLabelNumbers[6]-.5);
805 fTrackCutsPt->Fill(fTrackCutLabelNumbers[6]-.5,pt);
806 fTrackCutsEta->Fill(fTrackCutLabelNumbers[6]-.5,eta);
807 fTrackCutsPhi->Fill(fTrackCutLabelNumbers[6]-.5,phi);
808
809 // 8) TPC, TOF mismatch.
810 if (fDemandNoMismatch) {
811 if ((status&AliAODTrack::kTOFmismatch)==AliAODTrack::kTOFmismatch) {
812 if (fVerbose>3) cout<<"Track Ignored: TOF mismatch found."<<endl;
813 return 0;
814 }
815 fTrackCutsCount->Fill(fTrackCutLabelNumbers[7]-.5);
816 fTrackCutsPt->Fill(fTrackCutLabelNumbers[7]-.5,pt);
817 fTrackCutsEta->Fill(fTrackCutLabelNumbers[7]-.5,eta);
818 fTrackCutsPhi->Fill(fTrackCutLabelNumbers[7]-.5,phi);
819 }
820
821 // All tracks which made it up to here are classified as associateds.
822
823 // Return associated.
824 return 1;
825
826}
827
828//____________________________________________________________________________
829Bool_t AliAnalysisTaskDiHadronPID::SelectEvent(AliAODVertex* vertex)
830
831{
832
833 //
834 // Event Selection.
835 //
836
837 Double_t primVtx[3];
838 vertex->GetXYZ(primVtx);
839 if (TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2])>10.) {
840 if (fVerbose>2) cout << "AliAnalysisTaskDiHadronPID::SelectEvent -> Vertex Out of Range." << endl;
841 if (fVerbose>2) cout << "AliAnalysisTaskDiHadronPID::SelectEvent -> Event not selected." << endl;
842 return kFALSE;
843 }
844 if (fVerbose>2) cout << "AliAnalysisTaskDiHadronPID::SelectEvent -> Vertex is OK." << endl;
845
846 // We also wish to make centrality cut, but only if run on Pb+Pb.
847 if (fBeamType=="PbPb") {
848 Double_t cent = fAODHeader->GetCentrality();
849 if (cent>fCentralityCutMin||cent<fCentralityCutMax) {
850 if (fVerbose>2) cout<<"AliAnalysisTaskDiHadronPID::SelectEvent -> Event did not pass centaltity cut."<<endl;
851 return kFALSE;
852 }
853 }
854
855 if (fVerbose>2) cout << "AliAnalysisTaskDiHadronPID::SelectEvent -> Event selected." << endl;
856 return kTRUE;
857
858}
859
860//_____________________________________________________________________________
861void AliAnalysisTaskDiHadronPID::FillGlobalTracksArray() {
862
863 // Initialize the mapping for corresponding PID tracks. (see
864 // GetGlobalTrack(AliAODTrack* track)).
865 //
866
867 if (!fAODEvent) {
868 if (fVerbose>0) cout << "AliAnalysisTaskDiHadronPID::FillGlobalTracksArray -> ERROR: fAODEvent not set." << endl;
869 return;
870 }
871
872 fGlobalTracks = new TObjArray();
873 AliAODTrack* track = 0x0;
874
875 for (Int_t iTrack = 0; iTrack < fAODEvent->GetNumberOfTracks(); iTrack++) {
876
877 track = fAODEvent->GetTrack(iTrack);
878
879 // I.e., if it does NOT pass the filtermask.
880 if (!(track->TestFilterMask(1<<7))) {
881 if (track->GetID()>-1) fGlobalTracks->AddAtAndExpand(track,track->GetID());
882 //if (track->GetID()<1) cout<<"Track ID: "<<track->GetID()<<" Partner ID: "<<(-track->GetID()-1)<<endl;
883 }
884
885 }
886
887}
888
889//_____________________________________________________________________________
890AliAODTrack* AliAnalysisTaskDiHadronPID::GetGlobalTrack(AliAODTrack* track) {
891
892 //
893 // Returns the "parner track" of track, which contains the pid information.
894 //
895
896 AliAODTrack* partner = 0x0;
897
898 partner = (AliAODTrack*)(fGlobalTracks->At(-track->GetID()-1));
899
900 if (!partner&&(fVerbose>3)) cout<<"AliAnalysisTaskDiHadronPID::GetGlobalTrack -> No Global Track Found!"<<endl;
901
902 return partner;
903
904}
905
906//_____________________________________________________________________________
907Double_t AliAnalysisTaskDiHadronPID::PhiRange(Double_t DPhi)
908
909{
910 //
911 // Puts the argument in the range [-pi/2,3 pi/2].
912 //
913
914 if (DPhi < -TMath::Pi()/2) DPhi += 2*TMath::Pi();
915 if (DPhi > 3*TMath::Pi()/2) DPhi -= 2*TMath::Pi();
916
917 return DPhi;
918
919}
920
921//_____________________________________________________________________________
922Int_t AliAnalysisTaskDiHadronPID::ConvertPdgCode(Int_t pdgcode) {
923
924 //
925 // Converts the pdg code to the bin number (0-5)
926 //
927
928 if (pdgcode==211) return 0; // Pi +
929 if (pdgcode==-211) return 1; // Pi -
930 if (pdgcode==321) return 2; // K +
931 if (pdgcode==-321) return 3; // K -
932 if (pdgcode==2212) return 4; // p +
933 if (pdgcode==-2212) return 5; // p -
934
935 return -999; // Any other particle.
936
937}
938
939//_____________________________________________________________________________
940void AliAnalysisTaskDiHadronPID::UserExec(Option_t *)
941
942{
943 //
944 // UserExec.
945 //
946
947 // Input the event.
948 fAODEvent = dynamic_cast<AliAODEvent*>(InputEvent());
949 if (!fAODEvent) {
950 if (fVerbose>0) cout << "AliAnalysisTaskDiHadronPID::UserExec -> ERROR: No AliAODEvent pointer could be created." << endl;
951 return;
952 }
953
954 // Get the event header.
955 fAODHeader = fAODEvent->GetHeader();
956 if (!fAODHeader) {
957 if (fVerbose>0) cout << "AliAnalysisTaskDiHadronPID::UserExec -> ERROR: No AliAODHeader pointer could be created."<<endl;
958 return;
959 }
960
961 // Get the event vertex.
962 fAODVertex = fAODEvent->GetPrimaryVertex();
963 if (!fAODVertex) {
964 if (fVerbose>0) cout << "AliAnalysisTaskDiHadronPID::UserExec -> ERROR: No AliAODVertex pointer could be created." << endl;
965 return;
966 }
967
968 // Get the MC tracks if ran on MC.
969 if (fMC) {
970 fMCTracks = dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(AliAODMCParticle::StdBranchName()));
971 if (!fMCTracks) {
972 if (fVerbose>0) {
973 cout<<"AliAnalysisTaskDiHadronPID::UserExec -> ERROR: No MC particles found."<<endl;
974 return;
975 }
976 }
977 }
978
979 AliTPCPIDResponse& TPCPIDResponse = fPIDResponse->GetTPCResponse();
980
981 // See if the event passes the event selection.
982 if (!SelectEvent(fAODVertex)) return;
983
984 // Display basic event information.
985 if ((fVerbose>2)) cout << endl;
986 if ((fVerbose>2)&&(fBeamType=="PbPb")) cout << "Event centrality: " << fAODHeader->GetCentrality() << endl;
987 if ((fVerbose>2)) cout << "Event Vertex Z: " << fAODVertex->GetZ() << endl;
988 if ((fVerbose>2)) cout << "Event tracks in AOD: " << fAODEvent->GetNumberOfTracks() << endl;
989 if ((fVerbose>2)) cout << endl;
990
991 // Filling Event QA plots.
992 if (fBeamType=="PbPb") fCentrality->Fill(fAODHeader->GetCentrality());
993 fVertexZ->Fill(fAODVertex->GetZ());
994
995 // Fill the TObjArray which holds Global tracks.
996 FillGlobalTracksArray();
997
998 // Create object arrays for triggers and associateds.
999 TObjArray *triggers = new TObjArray();
1000 TObjArray *associateds = new TObjArray();
1001
1002 // Loop over MC tracks to fill the spectra if ran on MC.
1003 if (fMC) {
1004 for (Int_t iTrack=0; iTrack<fMCTracks->GetEntriesFast(); iTrack++) {
1005
1006 AliAODMCParticle* mcparticle = (AliAODMCParticle*)fMCTracks->At(iTrack);
1007 Double_t mcPt = mcparticle->Pt();
1008 Double_t mcEta = mcparticle->Eta();
1009 //Double_t mcPhi = mcparticle->Phi();
1010 Double_t mcY = mcparticle->Y();
1011 Int_t mcPDG = mcparticle->PdgCode();
1012 Int_t mcSpeciesBin = ConvertPdgCode(mcPDG);
1013 if (mcSpeciesBin==-999) continue;
1014
1015 if (mcparticle->IsPhysicalPrimary()) {
1016 fPtEtaDistrMCPrim[mcSpeciesBin]->Fill(mcPt,mcEta);
1017 if (TMath::Abs(mcY)<fMaxRap) fPtRapDistrMCPrimRapCut[mcSpeciesBin]->Fill(mcPt,mcY);
1018 } else {
1019 fPtEtaDistrMCSec[mcSpeciesBin]->Fill(mcPt,mcEta);
1020 if (TMath::Abs(mcY)<fMaxRap) fPtRapDistrMCSecRapCut[mcSpeciesBin]->Fill(mcPt,mcY);
1021 }
1022 }
1023 }
1024
1025 // In this loop the triggers and associateds will be identified, track QA and PID QA histograms will be filled.
1026 for (Int_t iTrack = 0; iTrack < fAODEvent->GetNumberOfTracks(); iTrack++) {
1027
1028 // Obtain a pointer to the track.
1029 fAODTrack = fAODEvent->GetTrack(iTrack);
1030 if (!fAODTrack&&(fVerbose>0)) {
1031 cout << "AliAnalysisTaskDiHadronPID::UserExec -> ERROR: Track object not found." << endl;
1032 continue;
1033 }
1034
1035 //if (TMath::Abs(fAODTrack->Eta())>0.8&&fAODTrack->Pt()>0.5&&TMath::Abs(fAODTrack->Y(AliAODTrack::kProton))<0.5) cout<<"Eta: "<<fAODTrack->Eta()<<" Pt: "<<fAODTrack->Pt()<<" Ypion: "<<fAODTrack->Y(AliAODTrack::kPion)<<" Ykaon: "<<fAODTrack->Y(AliAODTrack::kKaon)<<" Yproton: "<<fAODTrack->Y(AliAODTrack::kProton)<<endl;
1036
1037 // Find the track classification.
1038 Int_t tracktype = ClassifyTrack(fAODTrack);
1039
1040 if (tracktype==0) {
1041 continue;
1042 }
1043
1044 if (tracktype==1) {
1045 if (fVerbose>3) cout<<"Track added to associated buffer."<<endl;
1046 associateds->AddLast(fAODTrack);
1047 fEtaSpectrumAssoc->Fill(fAODTrack->Eta(),fAODTrack->Pt());
1048 fPhiSpectrumAssoc->Fill(fAODTrack->Phi(),fAODTrack->Pt());
1049 }
1050
1051 if (tracktype==2) {
1052 if (fVerbose>3) cout<<"Track added to trigger buffer."<<endl;
1053 triggers->AddLast(fAODTrack);
1054 fEtaSpectrumTrig->Fill(fAODTrack->Eta());
1055
1056 }
1057
1058 if (tracktype==1) {
1059
1060 // Fill the PID QA histograms for the associateds
1061 AliAODTrack* globaltrack = GetGlobalTrack(fAODTrack);
1062 Double_t mom, nSigma;
1063
1064 Double_t pt = fAODTrack->Pt();
1065 Double_t eta = fAODTrack->Eta();
1066 const Int_t ptbin = (Int_t)(2*pt);
1067
1068 //cout<<pt<<" "<<ptbin<<endl;
1069
1070 mom = globaltrack->GetTPCmomentum();
1071 nSigma = fPIDResponse->NumberOfSigmasTPC(globaltrack,AliPID::kProton);
1072 fTPCnSigmaProton->Fill(mom,nSigma);
1073 nSigma = fPIDResponse->NumberOfSigmasTPC(globaltrack,AliPID::kPion);
1074 fTPCnSigmaPion->Fill(mom,nSigma);
1075 nSigma = fPIDResponse->NumberOfSigmasTPC(globaltrack,AliPID::kKaon);
1076 fTPCnSigmaKaon->Fill(mom,nSigma);
1077
1078 fTPCSignal->Fill(eta,pt,globaltrack->GetTPCsignal());
1079
1080 mom =globaltrack->P();
1081 nSigma = fPIDResponse->NumberOfSigmasTOF(globaltrack,AliPID::kProton);
1082 fTOFnSigmaProton->Fill(mom,nSigma);
1083 nSigma = fPIDResponse->NumberOfSigmasTOF(globaltrack,AliPID::kPion);
1084 fTOFnSigmaPion->Fill(mom,nSigma);
1085 nSigma = fPIDResponse->NumberOfSigmasTOF(globaltrack,AliPID::kKaon);
1086 fTOFnSigmaKaon->Fill(mom,nSigma);
1087
1088 fTOFSignal->Fill(eta,pt,globaltrack->GetTOFsignal());
1089
1090 // Fill the inclusives.
1091 Double_t TPCmom = globaltrack->GetTPCmomentum();
1092 Double_t TPCsignal = globaltrack->GetTPCsignal();
1093 Double_t expectedTPCsignalPion = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kPion);
1094 Double_t expectedTPCsignalKaon = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kKaon);
1095 Double_t expectedTPCsignalProton = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kProton);
1096
1097 Double_t TOFsignal = globaltrack->GetTOFsignal();
1098 Double_t times[AliPID::kSPECIES];
1099 globaltrack->GetIntegratedTimes(times);
1100 Double_t expectedTOFsignalPion = times[AliPID::kPion];
1101 Double_t expectedTOFsignalKaon = times[AliPID::kKaon];
1102 Double_t expectedTOFsignalProton = times[AliPID::kProton];
1103
1104 Double_t TPCsignalSubtracted = TPCsignal - expectedTPCsignalPion;
1105 Double_t TOFsignalSubtracted = TOFsignal - expectedTOFsignalPion;
1106 fInclusiveTPCTOF[0][ptbin]->Fill(TPCsignalSubtracted,TOFsignalSubtracted,eta);
1107 if (fAODTrack->Y(AliAODTrack::kPion)<fMaxRap) fInclusiveTPCTOFRap[0][ptbin]->Fill(TPCsignalSubtracted,TOFsignalSubtracted,fAODTrack->Y(AliAODTrack::kPion));
1108
1109 TPCsignalSubtracted = TPCsignal - expectedTPCsignalKaon;
1110 TOFsignalSubtracted = TOFsignal - expectedTOFsignalKaon;
1111 fInclusiveTPCTOF[1][ptbin]->Fill(TPCsignalSubtracted,TOFsignalSubtracted,eta);
1112 if (fAODTrack->Y(AliAODTrack::kKaon)<fMaxRap) fInclusiveTPCTOFRap[1][ptbin]->Fill(TPCsignalSubtracted,TOFsignalSubtracted,fAODTrack->Y(AliAODTrack::kKaon));
1113
1114 TPCsignalSubtracted = TPCsignal - expectedTPCsignalProton;
1115 TOFsignalSubtracted = TOFsignal - expectedTOFsignalProton;
1116 fInclusiveTPCTOF[2][ptbin]->Fill(TPCsignalSubtracted,TOFsignalSubtracted,eta);
1117 if (fAODTrack->Y(AliAODTrack::kProton)<fMaxRap) fInclusiveTPCTOFRap[2][ptbin]->Fill(TPCsignalSubtracted,TOFsignalSubtracted,fAODTrack->Y(AliAODTrack::kProton));
1118
1119 // Fill the MC reconstructed spectra histograms.
1120 if (fMC) {
1121
1122 Int_t aodlabel = TMath::Abs(fAODTrack->GetLabel());
1123 AliAODMCParticle* mcparticle = (AliAODMCParticle*)fMCTracks->At(aodlabel);
1124 Int_t mcPDG = mcparticle->PdgCode();
1125 Int_t mcSpeciesBin = ConvertPdgCode(mcPDG);
1126
1127 // Only fill hisotos for pions, kaons and protons.
1128 if (mcSpeciesBin!=-999) {
1129 Double_t dataPt = fAODTrack->Pt();
1130 Double_t dataY=-999;
1131 if (mcSpeciesBin==0||mcSpeciesBin==1) {dataY = fAODTrack->Y(AliAODTrack::kPion);}
1132 if (mcSpeciesBin==2||mcSpeciesBin==3) {dataY = fAODTrack->Y(AliAODTrack::kKaon);}
1133 if (mcSpeciesBin==4||mcSpeciesBin==5) {dataY = fAODTrack->Y(AliAODTrack::kProton);}
1134
1135 //if (TMath::Abs(fAODTrack->Eta())>0.8) cout<<"Eta: "<<fAODTrack->Eta()<<" Ypion: "<<fAODTrack->Y(AliAODTrack::kPion)<<" Ykaon: "<<fAODTrack->Y(AliAODTrack::kKaon)<<" Yproton: "<<fAODTrack->Y(AliAODTrack::kProton)<<endl;
1136
1137 if (mcparticle->IsPhysicalPrimary()) {
1138 fPtEtaDistrDataPrim[mcSpeciesBin]->Fill(dataPt,eta);
1139 if (TMath::Abs(dataY)<fMaxRap) fPtRapDistrDataPrimRapCut[mcSpeciesBin]->Fill(dataPt,dataY);
1140 } else {
1141 fPtEtaDistrDataSec[mcSpeciesBin]->Fill(dataPt,eta);
1142 if (TMath::Abs(dataY)<fMaxRap) fPtRapDistrDataSecRapCut[mcSpeciesBin]->Fill(dataPt,dataY);
1143 }
1144 }
1145 }
1146
1147
1148
1149 }
1150 }
1151
1152 // In This Loop the di-hadron correlation will be made.
1153 Double_t histoFill[4]; // {Dphi, Deta, TPC signal, TOF signal}
1154 AliAODTrack* currentTrigger = 0x0;
1155 AliAODTrack* currentAssociated = 0x0;
1156 AliAODTrack* currentAssociatedGlobal = 0x0;
1157
1158 for (Int_t iTrig = 0; iTrig < triggers->GetEntriesFast(); iTrig++){
1159
1160 currentTrigger = (AliAODTrack*)(triggers->At(iTrig));
1161
1162 for (Int_t iAssoc = 0; iAssoc < associateds->GetEntriesFast(); iAssoc++) {
1163
1164 currentAssociated = (AliAODTrack*)(associateds->At(iAssoc));
1165 currentAssociatedGlobal = GetGlobalTrack(currentAssociated);
1166
1167 Double_t pt = currentAssociated->Pt();
1168 histoFill[0] = PhiRange(currentTrigger->Phi() - currentAssociated->Phi());
1169 histoFill[1] = currentTrigger->Eta() - currentAssociated->Eta();
1170
1171 // Is there a caveat here when Pt = 5.00000000?
1172 const Int_t ptbin = (Int_t)(2*pt);
1173 // cout<<"pt: "<<pt<<" ptbin: "<<ptbin<<endl; // Works OK!
1174
1175 if (currentAssociatedGlobal) {
1176
1177 // Get TPC (expected) signals.
1178 Double_t TPCmom = currentAssociatedGlobal->GetTPCmomentum();
1179 Double_t TPCsignal = currentAssociatedGlobal->GetTPCsignal();
1180 Double_t expectedTPCsignalPion = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kPion);
1181 Double_t expectedTPCsignalKaon = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kKaon);
1182 Double_t expectedTPCsignalProton = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kProton);
1183
1184 // Get TOF (expected) signals.
1185 Double_t TOFsignal = currentAssociatedGlobal->GetTOFsignal();
1186 Double_t times[AliPID::kSPECIES];
1187 currentAssociatedGlobal->GetIntegratedTimes(times);
1188 Double_t expectedTOFsignalPion = times[AliPID::kPion];
1189 Double_t expectedTOFsignalKaon = times[AliPID::kKaon];
1190 Double_t expectedTOFsignalProton = times[AliPID::kProton];
1191
1192 // Fill the histograms.
1193 histoFill[2] = TPCsignal - expectedTPCsignalPion;
1194 histoFill[3] = TOFsignal - expectedTOFsignalPion;
1195 fDiHadronTPCTOF[0][ptbin]->Fill(histoFill);
1196
1197 histoFill[2] = TPCsignal - expectedTPCsignalKaon;
1198 histoFill[3] = TOFsignal - expectedTOFsignalKaon;
1199 fDiHadronTPCTOF[1][ptbin]->Fill(histoFill);
1200
1201 histoFill[2] = TPCsignal - expectedTPCsignalProton;
1202 histoFill[3] = TOFsignal - expectedTOFsignalProton;
1203 fDiHadronTPCTOF[2][ptbin]->Fill(histoFill);
1204
1205 fDiHadron->Fill(histoFill[0],histoFill[1],pt);
1206
1207 }
1208 }
1209 }
1210
1211 // In this loop we calculate the mixed events.
1212 if (fCalculateMixedEvents) {
1213
1214 // Loop over the trigger buffer.
1215 if (fVerbose>3) cout << "AliAnalysisTaskDiHadronPID::UserExec -> Mixing the events with "<<fTrigBufferSize<<" triggers from the buffer." <<endl;
1216 if (fVerbose>3) cout << "AliAnalysisTaskDiHadronPID::UserExec -> Buffer size: "<<fTrigBufferIndex<<endl;
1217
1218 for (Int_t iTrig=0;iTrig<fTrigBufferSize;iTrig++) {
1219
1220 // Check if the trigger and the associated have a reconstructed
1221 // vertext no further than 2cm apart.
1222
1223 // fTrigBuffer[i][0] = z
1224 // fTrigBuffer[i][1] = phi
1225 // fTrigBuffer[i][2] = eta
1226 // fTrigBuffer[i][3] = p_t
1227
1228 if (TMath::Abs(fTrigBuffer[iTrig][0]-fAODVertex->GetZ())<fVertexZMixedEvents) {
1229
1230 if (fVerbose>3) cout<<"AliAnalysisTaskDiHadronPID::UserExec -> Mixing with trigger Z: "<<fTrigBuffer[iTrig][0]<<", Pt: "<<fTrigBuffer[iTrig][3]<<endl;
1231
1232 for (Int_t iAssoc = 0; iAssoc < associateds->GetEntriesFast(); iAssoc++) {
1233
1234 currentAssociated = (AliAODTrack*)(associateds->At(iAssoc));
1235 currentAssociatedGlobal = GetGlobalTrack(currentAssociated);
1236
1237 if (currentAssociatedGlobal) {
1238
1239 Double_t pt = currentAssociated->Pt();
1240 histoFill[0] = PhiRange(fTrigBuffer[iTrig][1] - currentAssociated->Phi());
1241 histoFill[1] = fTrigBuffer[iTrig][2] - currentAssociated->Eta();
1242
1243 //const Int_t ptbin = (Int_t)(2*pt);
1244
1245 // Get TPC (expected) signals.
1246 Double_t TPCmom = currentAssociatedGlobal->GetTPCmomentum();
1247 Double_t TPCsignal = currentAssociatedGlobal->GetTPCsignal();
1248 Double_t expectedTPCsignalPion = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kPion);
1249 Double_t expectedTPCsignalKaon = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kKaon);
1250 Double_t expectedTPCsignalProton = TPCPIDResponse.GetExpectedSignal(TPCmom,AliPID::kProton);
1251
1252 // Get TOF (expected) signals.
1253 Double_t TOFsignal = currentAssociatedGlobal->GetTOFsignal();
1254 Double_t times[AliPID::kSPECIES];
1255 currentAssociatedGlobal->GetIntegratedTimes(times);
1256 Double_t expectedTOFsignalPion = times[AliPID::kPion];
1257 Double_t expectedTOFsignalKaon = times[AliPID::kKaon];
1258 Double_t expectedTOFsignalProton = times[AliPID::kProton];
1259
1260 // Fill the histograms.
1261 histoFill[2] = TPCsignal - expectedTPCsignalPion;
1262 histoFill[3] = TOFsignal - expectedTOFsignalPion;
1263 //if (ptbin==1) fMixedEventsTPCTOF[0][ptbin]->Fill(histoFill);
1264
1265 histoFill[2] = TPCsignal - expectedTPCsignalKaon;
1266 histoFill[3] = TOFsignal - expectedTOFsignalKaon;
1267 //if (ptbin==1) fMixedEventsTPCTOF[1][ptbin]->Fill(histoFill);
1268
1269 histoFill[2] = TPCsignal - expectedTPCsignalProton;
1270 histoFill[3] = TOFsignal - expectedTOFsignalProton;
1271 //if (ptbin==1) fMixedEventsTPCTOF[2][ptbin]->Fill(histoFill);
1272
1273 fMixedEvents->Fill(histoFill[0],histoFill[1],pt);
1274
1275 /*
1276 Double_t PionFillTPC = TPCsignal - expectedTPCsignalPion;
1277 Double_t PionFillTOF = TOFsignal - expectedTOFsignalPion;
1278
1279 Int_t PionMinTPC = (fDiHadronTPCTOF[0][ptbin]->GetAxis(2))->GetXmin();
1280 Int_t PionMaxTPC = (fDiHadronTPCTOF[0][ptbin]->GetAxis(2))->GetXmax();
1281 Int_t PionMinTOF = (fDiHadronTPCTOF[0][ptbin]->GetAxis(3))->GetXmin();
1282 Int_t PionMaxTOF = (fDiHadronTPCTOF[0][ptbin]->GetAxis(3))->GetXmax();
1283
1284 //cout<<PionMinTPC<<"<"<<PionFillTPC<<"<"<<PionMaxTPC<<"? "<<PionMinTOF<<"<"<<PionFillTOF<<"<"<<PionMaxTOF<<"?"<<endl;
1285 if (PionFillTPC<PionMaxTPC&&PionFillTPC>PionMinTPC&&PionFillTOF<PionMaxTOF&&PionFillTOF>PionMinTOF) {
1286 fMixedEventsTPCTOFCut[0]->Fill(DPhi,DEta,pt);
1287 //cout<<"Yes! Histogram will be filled."<<endl;
1288 }
1289
1290 Double_t KaonFillTPC = TPCsignal - expectedTPCsignalKaon;
1291 Double_t KaonFillTOF = TOFsignal - expectedTOFsignalKaon;
1292
1293 Int_t KaonMinTPC = (fDiHadronTPCTOF[1][ptbin]->GetAxis(2))->GetXmin();
1294 Int_t KaonMaxTPC = (fDiHadronTPCTOF[1][ptbin]->GetAxis(2))->GetXmax();
1295 Int_t KaonMinTOF = (fDiHadronTPCTOF[1][ptbin]->GetAxis(3))->GetXmin();
1296 Int_t KaonMaxTOF = (fDiHadronTPCTOF[1][ptbin]->GetAxis(3))->GetXmax();
1297 if (KaonFillTPC<KaonMaxTPC&&KaonFillTPC>KaonMinTPC&&KaonFillTOF<KaonMaxTOF&&KaonFillTOF>KaonMinTOF) {
1298 fMixedEventsTPCTOFCut[1]->Fill(DPhi,DEta,pt);
1299 }
1300
1301 Double_t ProtonFillTPC = TPCsignal - expectedTPCsignalProton;
1302 Double_t ProtonFillTOF = TOFsignal - expectedTOFsignalProton;
1303 Int_t ProtonMinTPC = (fDiHadronTPCTOF[2][ptbin]->GetAxis(2))->GetXmin();
1304 Int_t ProtonMaxTPC = (fDiHadronTPCTOF[2][ptbin]->GetAxis(2))->GetXmax();
1305 Int_t ProtonMinTOF = (fDiHadronTPCTOF[2][ptbin]->GetAxis(3))->GetXmin();
1306 Int_t ProtonMaxTOF = (fDiHadronTPCTOF[2][ptbin]->GetAxis(3))->GetXmax();
1307 if (ProtonFillTPC<ProtonMaxTPC&&ProtonFillTPC>ProtonMinTPC&&ProtonFillTOF<ProtonMaxTOF&&ProtonFillTOF>ProtonMinTOF) {
1308 fMixedEventsTPCTOFCut[2]->Fill(DPhi,DEta,pt);
1309 }
1310 */
1311
1312 }
1313 }
1314 }
1315 }
1316
1317 // Copy the triggers from the current event into the buffer.
1318 if (fAODVertex->GetZ()<10.) {
1319
1320 if (fVerbose>3) cout<<"AliAnalysisTaskDiHadronPID::UserExec -> Copying "<<triggers->GetEntriesFast()<<" triggers with vertex z = "<<fAODVertex->GetZ()<<" to the buffer."<<endl;
1321
1322 for (Int_t iTrig = 0; iTrig<triggers->GetEntriesFast(); iTrig++) {
1323
1324 currentTrigger = (AliAODTrack*)(triggers->At(iTrig));
1325 if (fVerbose>3) cout<<"AliAnalysisTaskDiHadronPID::UserExec -> Trigger pt = "<<currentTrigger->Pt()<<endl;
1326
1327 fTrigBuffer[fTrigBufferIndex][0] = fAODVertex->GetZ();
1328 fTrigBuffer[fTrigBufferIndex][1] = currentTrigger->Phi();
1329 fTrigBuffer[fTrigBufferIndex][2] = currentTrigger->Eta();
1330 fTrigBuffer[fTrigBufferIndex][3] = currentTrigger->Pt();
1331 fTrigBufferIndex++;
1332 if (fTrigBufferSize<fTrigBufferMaxSize) {fTrigBufferSize++;} // 250 triggers should be enough to get 10 times more data in mixed events.
1333 if (fTrigBufferIndex==fTrigBufferMaxSize) {fTrigBufferIndex=0;}
1334 }
1335 }
1336 }
1337
1338 if (fPrintBufferSize) cout<<"AliAnalysisTaskDiHadronPID::UserExec -> Trigger buffer index: "<<fTrigBufferIndex<<", and size: "<<fTrigBufferSize<<endl;
1339
1340 delete triggers;
1341 delete associateds;
1342
1343 PostData(1,fHistoList);
1344
1345}
1346
1347//_____________________________________________________________________________
1348void AliAnalysisTaskDiHadronPID::Terminate(Option_t *)
1349
1350{
1351 //
1352 // Terminate.
1353 //
1354
1355}
1356