]>
Commit | Line | Data |
---|---|---|
7cbcecc6 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //Modified..... | |
17 | ||
18 | #include "AliAnalysisTaskPIDCORR.h" | |
19 | ||
20 | #include "Riostream.h" | |
21 | #include "TChain.h" | |
22 | #include "TTree.h" | |
23 | #include "TH1F.h" | |
24 | #include "TH2F.h" | |
25 | #include "TCanvas.h" | |
26 | #include "TList.h" | |
27 | ||
28 | #include "AliAODEvent.h" | |
29 | #include "AliAODTrack.h" | |
30 | #include "AliPIDResponse.h" | |
31 | #include "AliPID.h" | |
32 | #include "AliAODInputHandler.h" | |
33 | #include "AliVEvent.h" | |
34 | #include "AliVParticle.h" | |
35 | ||
36 | #include "AliAODMCHeader.h" | |
37 | #include "AliAODMCParticle.h" | |
38 | #include "AliMCEventHandler.h" | |
39 | #include "AliMCEvent.h" | |
40 | #include "TParticle.h" | |
41 | #include <TDatabasePDG.h> | |
42 | #include <TParticlePDG.h> | |
43 | ||
44 | #include "AliAnalysisManager.h" | |
45 | #include "AliAnalysisTaskSE.h" | |
46 | ||
47 | #include "AliEventPoolManager.h" | |
48 | ||
49 | ||
50 | ClassImp(AliAnalysisTaskPIDCORR) | |
51 | ClassImp(AliPIDCorrParticle) | |
52 | ||
53 | //________________________________________________________________________ | |
54 | AliAnalysisTaskPIDCORR::AliAnalysisTaskPIDCORR() // All data members should be initialised here | |
55 | :AliAnalysisTaskSE(), | |
56 | fAOD(0), | |
57 | fAODVertex(0), | |
58 | fPIDResponse(0), | |
59 | fOutputList(0), | |
60 | fHistPt(0), | |
61 | fHistdEdx(0), | |
62 | fTriggerPhiAll(0), | |
63 | fTriggerPhiPion(0), | |
64 | fTriggerPhiKaonProton(0), | |
65 | fTriggerEtaAll(0), | |
66 | fTriggerEtaPion(0), | |
67 | fTriggerEtaKaonProton(0), | |
68 | fAssoPhi(0), | |
69 | fAssoEta(0), | |
70 | fGlobalTracks(0), | |
71 | fArrayMC(0), | |
72 | fPoolMgr(0), | |
73 | EffEtaTrigPr(1), | |
74 | EffEtaTrigPi(1), | |
75 | EffEtaTrigAll(1) | |
76 | ||
77 | { | |
78 | ||
79 | ||
80 | ||
81 | ||
82 | for(int i=0;i<10;i++) | |
83 | { | |
84 | fDihadronCorrelation[i]=NULL; | |
85 | fDihadronCorrelationPion[i]=NULL; | |
86 | fDihadronCorrelationProtonKaon[i]=NULL; | |
87 | fHistNSigmaTPCPion[i]=NULL; | |
88 | fMixedEvent[i]=NULL; | |
89 | fMixedPion[i]=NULL; | |
90 | fMixedProtonKaon[i]=NULL; | |
91 | } | |
92 | ||
93 | for(int j=0;j<3;j++) | |
94 | { | |
95 | fHistNSAll[j]=NULL; | |
96 | fHistNSPion[j]=NULL; | |
97 | fHistNSProton[j]=NULL; | |
98 | fHistASAll[j]=NULL; | |
99 | fHistASPion[j]=NULL; | |
100 | fHistASProton[j]=NULL; | |
101 | fHistBgAll[j]=NULL; | |
102 | fHistBgPion[j]=NULL; | |
103 | fHistBgProton[j]=NULL; | |
104 | fHistBulkAll[j]=NULL; | |
105 | fHistBulkPion[j]=NULL; | |
106 | fHistBulkProton[j]=NULL; | |
107 | ||
108 | ||
109 | } | |
110 | ||
111 | ||
112 | } | |
113 | ||
114 | //________________________________________________________________________ | |
115 | AliAnalysisTaskPIDCORR::AliAnalysisTaskPIDCORR(const char *name) // All data members should be initialised here | |
116 | :AliAnalysisTaskSE(name), | |
117 | fAOD(0), | |
118 | fAODVertex(0), | |
119 | fPIDResponse(0), | |
120 | fOutputList(0), | |
121 | fHistPt(0), | |
122 | fHistdEdx(0), | |
123 | fTriggerPhiAll(0), | |
124 | fTriggerPhiPion(0), | |
125 | fTriggerPhiKaonProton(0), | |
126 | fTriggerEtaAll(0), | |
127 | fTriggerEtaPion(0), | |
128 | fTriggerEtaKaonProton(0), | |
129 | fAssoPhi(0), | |
130 | fAssoEta(0), | |
131 | fGlobalTracks(0), | |
132 | fArrayMC(0), | |
133 | fPoolMgr(0), | |
134 | EffEtaTrigPr(1), | |
135 | EffEtaTrigPi(1), | |
136 | EffEtaTrigAll(1) | |
137 | ||
138 | { | |
139 | ||
140 | ||
141 | ||
142 | for(int i=0;i<10;i++) | |
143 | { | |
144 | fDihadronCorrelation[i]=NULL; | |
145 | fDihadronCorrelationPion[i]=NULL; | |
146 | fDihadronCorrelationProtonKaon[i]=NULL; | |
147 | fHistNSigmaTPCPion[i]=NULL; | |
148 | fMixedEvent[i]=NULL; | |
149 | fMixedPion[i]=NULL; | |
150 | fMixedProtonKaon[i]=NULL; | |
151 | } | |
152 | ||
153 | for(int j=0;j<3;j++) | |
154 | { | |
155 | fHistNSAll[j]=NULL; | |
156 | fHistNSPion[j]=NULL; | |
157 | fHistNSProton[j]=NULL; | |
158 | fHistASAll[j]=NULL; | |
159 | fHistASPion[j]=NULL; | |
160 | fHistASProton[j]=NULL; | |
161 | fHistBgAll[j]=NULL; | |
162 | fHistBgPion[j]=NULL; | |
163 | fHistBgProton[j]=NULL; | |
164 | fHistBulkAll[j]=NULL; | |
165 | fHistBulkPion[j]=NULL; | |
166 | fHistBulkProton[j]=NULL; | |
167 | ||
168 | ||
169 | } | |
170 | ||
171 | ||
172 | // The last in the above list should not have a comma after it | |
173 | ||
174 | // Constructor | |
175 | // Define input and output slots here (never in the dummy constructor) | |
176 | // Input slot #0 works with a TChain - it is connected to the default input container | |
177 | // Output slot #1 writes into a TH1 container | |
178 | ||
179 | DefineOutput(1, TList::Class()); // for output list | |
180 | } | |
181 | ||
182 | //________________________________________________________________________ | |
183 | AliAnalysisTaskPIDCORR::~AliAnalysisTaskPIDCORR() | |
184 | { | |
185 | // Destructor. Clean-up the output list, but not the histograms that are put inside | |
186 | // (the list is owner and will clean-up these histograms). Protect in PROOF case. | |
187 | if (fOutputList && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { | |
188 | delete fOutputList; | |
189 | } | |
190 | ||
191 | } | |
192 | ||
193 | //________________________________________________________________________ | |
194 | void AliAnalysisTaskPIDCORR::UserCreateOutputObjects() | |
195 | { | |
196 | // Create histograms | |
197 | // Called once (on the worker node) | |
198 | ||
199 | AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager(); | |
200 | AliInputEventHandler *inputHandler = (AliInputEventHandler*)man->GetInputEventHandler(); | |
201 | fPIDResponse = inputHandler->GetPIDResponse(); | |
202 | ||
203 | fOutputList = new TList(); | |
204 | fOutputList->SetOwner(); // IMPORTANT! | |
205 | ||
206 | ||
207 | ||
208 | ||
209 | ||
210 | ||
211 | fHistPt = new TH1F("fHistPt", "P_{T} distribution", 15, 0.1, 3.1); | |
212 | fHistdEdx = new TH2F("fHistdEdx","TPC signal distribution",1000,0.,50.,1000,0,500); | |
213 | ||
214 | ||
215 | TString HistName; | |
216 | ||
217 | for(int i=0;i<10;i++) | |
218 | { | |
219 | HistName="fDihadronCorrelation";HistName+=i; | |
220 | fDihadronCorrelation[i]= new TH2F(HistName.Data(),"#delta#eta-#delta#phi correlation",36,-TMath::Pi()/2,3.*TMath::Pi()/2,32,-1.6,1.6); | |
221 | fDihadronCorrelation[i]->Sumw2(); | |
222 | fOutputList->Add(fDihadronCorrelation[i]); | |
223 | ||
224 | HistName="fDihadronCorrelationPion";HistName+=i; | |
225 | fDihadronCorrelationPion[i]= new TH2F(HistName.Data(),"#delta#eta-#delta#phi correlation",36,-TMath::Pi()/2,3.*TMath::Pi()/2,32,-1.6,1.6); | |
226 | fDihadronCorrelationPion[i]->Sumw2(); | |
227 | fOutputList->Add(fDihadronCorrelationPion[i]); | |
228 | ||
229 | HistName="fDihadronCorrelationProtonKaon";HistName+=i; | |
230 | fDihadronCorrelationProtonKaon[i]= new TH2F(HistName.Data(),"#delta#eta-#delta#phi correlation",36,-TMath::Pi()/2,3.*TMath::Pi()/2,32,-1.6,1.6); | |
231 | fDihadronCorrelationProtonKaon[i]->Sumw2(); | |
232 | fOutputList->Add(fDihadronCorrelationProtonKaon[i]); | |
233 | ||
234 | HistName="fMixedEvent";HistName+=i; | |
235 | fMixedEvent[i]= new TH2F(HistName.Data(),"#delta#eta-#delta#phi correlation",36,-TMath::Pi()/2,3.*TMath::Pi()/2,32,-1.6,1.6); | |
236 | fMixedEvent[i]->Sumw2(); | |
237 | fOutputList->Add(fMixedEvent[i]); | |
238 | ||
239 | HistName="fMixedPion";HistName+=i; | |
240 | fMixedPion[i]= new TH2F(HistName.Data(),"#delta#eta-#delta#phi correlation",36,-TMath::Pi()/2,3.*TMath::Pi()/2,32,-1.6,1.6); | |
241 | fMixedPion[i]->Sumw2(); | |
242 | fOutputList->Add(fMixedPion[i]); | |
243 | ||
244 | HistName="fMixedProtonKaon";HistName+=i; | |
245 | fMixedProtonKaon[i]= new TH2F(HistName.Data(),"#delta#eta-#delta#phi correlation",36,-TMath::Pi()/2,3.*TMath::Pi()/2,32,-1.6,1.6); | |
246 | fMixedProtonKaon[i]->Sumw2(); | |
247 | fOutputList->Add(fMixedProtonKaon[i]); | |
248 | ||
249 | HistName="fHistNSigmaTPCPion";HistName+=i; | |
250 | fHistNSigmaTPCPion[i]= new TH1F(HistName.Data(),"NSigma distribution for all particles",200,-10,10); | |
251 | fHistNSigmaTPCPion[i]->Sumw2(); | |
252 | fOutputList->Add(fHistNSigmaTPCPion[i]); | |
253 | } | |
254 | ||
255 | for(Int_t l=0;l<3;l++) | |
256 | { | |
257 | HistName="fHistNSPtSpectraAll";HistName+=l; | |
258 | fHistNSAll[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
259 | fHistNSAll[l]->Sumw2(); | |
260 | fOutputList->Add(fHistNSAll[l]); | |
261 | ||
262 | HistName="fHistNSPtSpectraPion";HistName+=l; | |
263 | fHistNSPion[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
264 | fHistNSPion[l]->Sumw2(); | |
265 | fOutputList->Add(fHistNSPion[l]); | |
266 | ||
267 | HistName="fHistNSPtSpectraProton";HistName+=l; | |
268 | fHistNSProton[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
269 | fHistNSProton[l]->Sumw2(); | |
270 | fOutputList->Add(fHistNSProton[l]); | |
271 | ||
272 | HistName="fHistASPtSpectraAll";HistName+=l; | |
273 | fHistASAll[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
274 | fHistASAll[l]->Sumw2(); | |
275 | fOutputList->Add(fHistASAll[l]); | |
276 | ||
277 | HistName="fHistASPtSpectraPion";HistName+=l; | |
278 | fHistASPion[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
279 | fHistASPion[l]->Sumw2(); | |
280 | fOutputList->Add(fHistASPion[l]); | |
281 | ||
282 | HistName="fHistASPtSpectraProton";HistName+=l; | |
283 | fHistASProton[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
284 | fHistASProton[l]->Sumw2(); | |
285 | fOutputList->Add(fHistASProton[l]); | |
286 | ||
287 | HistName="fHistBgPtSpectraAll";HistName+=l; | |
288 | fHistBgAll[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
289 | fHistBgAll[l]->Sumw2(); | |
290 | fOutputList->Add(fHistBgAll[l]); | |
291 | ||
292 | HistName="fHistBgPtSpectraPion";HistName+=l; | |
293 | fHistBgPion[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
294 | fHistBgPion[l]->Sumw2(); | |
295 | fOutputList->Add(fHistBgPion[l]); | |
296 | ||
297 | HistName="fHistBgPtSpectraProton";HistName+=l; | |
298 | fHistBgProton[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
299 | fHistBgProton[l]->Sumw2(); | |
300 | fOutputList->Add(fHistBgProton[l]); | |
301 | ||
302 | ||
303 | ||
304 | HistName="fHistBulkPtSpectraAll";HistName+=l; | |
305 | fHistBulkAll[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
306 | fHistBulkAll[l]->Sumw2(); | |
307 | fOutputList->Add(fHistBulkAll[l]); | |
308 | ||
309 | HistName="fHistBulkPtSpectraPion";HistName+=l; | |
310 | fHistBulkPion[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
311 | fHistBulkPion[l]->Sumw2(); | |
312 | fOutputList->Add(fHistBulkPion[l]); | |
313 | ||
314 | HistName="fHistBulkPtSpectraProton";HistName+=l; | |
315 | fHistBulkProton[l]= new TH1F(HistName.Data(),"Pt_spectra of Associated",15,0.5,3.5); | |
316 | fHistBulkProton[l]->Sumw2(); | |
317 | fOutputList->Add(fHistBulkProton[l]); | |
318 | ||
319 | } | |
320 | ||
321 | fTriggerPhiAll = new TH1F("fTriggerPhiAll","Phi distribution of All trigger particles",340,0.0,2*TMath::Pi()); | |
322 | fTriggerPhiPion = new TH1F("fTriggerPhiPion","Phi distribution of Pion trigger particles",340,0.0,2*TMath::Pi()); | |
323 | fTriggerPhiKaonProton = new TH1F("fTriggerPhiKaonProton","Phi distribution of Kaon & Proton trigger particles",340,0.0,2*TMath::Pi()); | |
324 | ||
325 | fTriggerEtaAll = new TH1F("fTriggerEtaAll","Eta distribution of All trigger particles",16,-0.8,0.8); | |
326 | fTriggerEtaPion = new TH1F("fTriggerEtaPion","Eta distribution of Pion trigger particles",16,-0.8,0.8); | |
327 | fTriggerEtaKaonProton = new TH1F("fTriggerEtaKaonProton","Eta distribution of Kaon & Proton trigger particles",16,-0.8,0.8); | |
328 | ||
329 | fAssoPhi = new TH1F("fAssoPhi","Phi distribution of Associated particles",340,0.0,2*TMath::Pi()); | |
330 | fAssoEta = new TH1F("fAssoEta","Eta distribution of Associated particles",16,-0.8,0.8); | |
331 | ||
332 | ||
333 | ||
334 | fOutputList->Add(fTriggerPhiAll); | |
335 | fOutputList->Add(fTriggerPhiPion); | |
336 | fOutputList->Add(fTriggerPhiKaonProton); | |
337 | fOutputList->Add(fTriggerEtaAll); | |
338 | fOutputList->Add(fTriggerEtaPion); | |
339 | fOutputList->Add(fTriggerEtaKaonProton); | |
340 | fOutputList->Add(fAssoPhi); | |
341 | fOutputList->Add(fAssoEta); | |
342 | fOutputList->Add(fHistPt); | |
343 | fOutputList->Add(fHistdEdx); | |
344 | ||
345 | ||
346 | ||
347 | ||
348 | ||
349 | ||
350 | ||
351 | ||
352 | //Mixing | |
353 | DefineEventPool(); | |
354 | ||
355 | ||
356 | PostData(1, fOutputList); // Post data for ALL output slots >0 here, to get at least an empty histogram | |
357 | } | |
358 | ||
359 | //________________________________________________________________________ | |
360 | Bool_t AliAnalysisTaskPIDCORR :: SelectEvent(AliAODVertex* vertex) | |
361 | ||
362 | { | |
363 | ||
364 | // | |
365 | // Event Selection. | |
366 | // | |
367 | ||
368 | ||
369 | Double_t primVtx[3]; | |
370 | vertex->GetXYZ(primVtx); | |
371 | if (TMath::Sqrt(primVtx[0]*primVtx[0] + primVtx[1]*primVtx[1])>1. || TMath::Abs(primVtx[2])>10.) { | |
372 | ||
373 | return kFALSE; | |
374 | } | |
375 | ||
376 | return kTRUE; | |
377 | ||
378 | } | |
379 | //_______________________________________________________________________ | |
380 | Int_t AliAnalysisTaskPIDCORR::ClassifyTrack(AliAODTrack* track) | |
381 | { | |
382 | //Int_t Classification=999; | |
383 | Double_t pt = track->Pt(); | |
384 | Double_t eta = track->Eta(); | |
385 | //Double_t phi = track->Phi(); | |
386 | ||
387 | if (!(track->TestFilterMask(1<<7))) { | |
388 | ||
389 | return 0; | |
390 | } | |
391 | ||
392 | if(pt< 0.2) | |
393 | { | |
394 | return 0; | |
395 | } | |
396 | ||
397 | if (TMath::Abs(eta)>=0.8) { | |
398 | ||
399 | return 0; | |
400 | } | |
401 | ||
402 | //DCA cut | |
403 | ||
404 | /*if(PtDependentCut) | |
405 | { | |
406 | ||
407 | ||
408 | }*/ | |
409 | ||
410 | if(track->Charge()==0) return 0; | |
411 | ||
412 | AliAODTrack *globaltrack=GetGlobalTrack(track->GetID()); | |
413 | if(!globaltrack) return 0; | |
414 | ||
415 | ||
416 | Float_t dxy, dz; | |
417 | ||
418 | dxy = track->DCA(); | |
419 | dz = track->ZAtDCA(); | |
420 | //cout<<dxy<<" "<<dz<<endl; | |
421 | if(TMath ::Abs(dxy) >2.4 || TMath ::Abs(dz)>3.2) return 0; | |
422 | ||
423 | Double_t chi2ndf = track->Chi2perNDF(); | |
424 | if(chi2ndf>4.0) return 0; | |
425 | ||
426 | Double_t nclus = track->GetTPCClusterInfo(2,1); | |
427 | if(nclus<80) return 0; | |
428 | ||
429 | //select primary: | |
33ff586d | 430 | if(track->GetType() != AliAODTrack::kPrimary) return 0; |
7cbcecc6 | 431 | |
432 | return 1; | |
433 | } | |
434 | //________________________________________________________________ | |
435 | void AliAnalysisTaskPIDCORR::FillGlobalTracksArray() { | |
436 | ||
437 | ||
438 | ||
439 | if (!fAOD) { | |
440 | //if (fVerbose>0) cout << "AliAnalysisTaskDiHadronPID::FillGlobalTracksArray -> ERROR: fAODEvent not set." << endl; | |
441 | return; | |
442 | } | |
443 | ||
444 | ||
445 | ||
446 | fGlobalTracks = new TObjArray(); | |
447 | AliAODTrack* track = 0x0; | |
448 | ||
449 | for (Int_t iTrack = 0; iTrack < fAOD->GetNumberOfTracks(); iTrack++) { | |
450 | ||
f15c1f69 | 451 | track = dynamic_cast<AliAODTrack*>(fAOD->GetTrack(iTrack)); |
452 | if(!track) AliFatal("Not a standard AOD"); | |
7cbcecc6 | 453 | |
454 | // I.e., if it does NOT pass the filtermask. | |
455 | if (!(track->TestFilterMask(1<<7))) { | |
456 | if (track->GetID()>-1) fGlobalTracks->AddAtAndExpand(track,track->GetID()); | |
457 | //cout<<"Track ID: "<<track->GetID()<<" Partner ID: "<<(-track->GetID()-1)<<endl; | |
458 | } | |
459 | ||
460 | } | |
461 | } | |
462 | //_______________________________________________________________________ | |
463 | ||
464 | AliAODTrack* AliAnalysisTaskPIDCORR::GetGlobalTrack(Int_t trackID) { | |
465 | ||
466 | ||
467 | ||
468 | AliAODTrack* partner = 0x0; | |
469 | ||
470 | partner = (AliAODTrack*)(fGlobalTracks->At(-trackID-1)); | |
471 | ||
472 | ||
473 | return partner; | |
474 | ||
475 | } | |
476 | ||
477 | ||
478 | //________________________________________________________________________ | |
479 | void AliAnalysisTaskPIDCORR::UserExec(Option_t *) | |
480 | { | |
481 | // Main loop | |
482 | // Called for each event | |
483 | ||
484 | // Post output data. | |
485 | ||
486 | AliVEvent *event = InputEvent(); | |
487 | if (!event) { return; } | |
488 | ||
489 | ||
490 | fAOD = dynamic_cast<AliAODEvent*>(InputEvent()); | |
491 | if (!fAOD) { | |
492 | // printf("ERROR: fAOD not available\n"); | |
493 | return; | |
494 | } | |
495 | ||
496 | ||
497 | ||
498 | ||
499 | Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB); | |
500 | if(!isSelected) return; | |
501 | ||
502 | fAODVertex = fAOD->GetPrimaryVertex(); | |
503 | if (!fAODVertex) { | |
504 | //if (fVerbose>0) cout << "AliAnalysisTaskDiHadronPID::UserExec -> ERROR: No AliAODVertex pointer could be created." << endl; | |
505 | return; | |
506 | } | |
507 | ||
508 | //select vertex | |
509 | if(!SelectEvent(fAODVertex)) return; | |
510 | ||
511 | /*fHistVx->Fill(fAODVertex->GetX()); | |
512 | fHistVy->Fill(fAODVertex->GetY()); | |
513 | fHistVz->Fill(fAODVertex->GetZ());*/ | |
514 | ||
515 | ||
516 | //Float_t bSign = (fAOD->GetMagneticField() > 0) ? 1 : -1; | |
517 | ||
518 | /*fArrayMC = (TClonesArray*)fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName()); | |
519 | if (!fArrayMC) { | |
520 | // AliFatal("Error: MC particles branch not found!\n"); | |
521 | return; | |
522 | } | |
523 | */ | |
524 | /*AliAODMCHeader *mcHdr=NULL; | |
525 | mcHdr=(AliAODMCHeader*)fAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName()); | |
526 | if(!mcHdr) { | |
527 | //printf("MC header branch not found!\n"); | |
528 | return; | |
529 | } | |
530 | */ | |
531 | // Fill the TObjArray which holds Global tracks. | |
532 | FillGlobalTracksArray(); | |
533 | ||
534 | // Create object arrays for associateds. | |
535 | TObjArray *associateds = new TObjArray(); | |
536 | ||
537 | ||
538 | Int_t TriggerIndx=-99999; | |
539 | Double_t TriggerPtMin=4.00; | |
540 | Double_t TriggerPtMax=8.00; | |
541 | Double_t TriggerPhi=1e-10; | |
542 | Double_t TriggerEta=1e-10; | |
543 | Double_t TriggerPt=TriggerPtMin; | |
544 | ||
545 | ||
546 | ||
547 | ||
548 | ||
549 | // Track loop to fill a pT spectrum | |
550 | for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) | |
551 | { | |
f15c1f69 | 552 | AliAODTrack* track = dynamic_cast<AliAODTrack*>(fAOD->GetTrack(iTracks)); |
553 | if(!track) AliFatal("Not a standard AOD"); | |
7cbcecc6 | 554 | if (!track) { |
555 | //printf("ERROR: Could not receive track %d\n", iTracks); | |
556 | continue; | |
557 | } | |
558 | ||
559 | Int_t tracktype=ClassifyTrack(track); | |
560 | ||
561 | if(tracktype==0) continue; | |
562 | ||
563 | if(tracktype==1) | |
564 | { | |
565 | ||
566 | AliAODTrack *globaltrack=GetGlobalTrack(track->GetID()); | |
567 | Double_t pT=globaltrack->Pt(); | |
568 | Double_t Eta=globaltrack->Eta(); | |
569 | ||
570 | ||
571 | Double_t dEdx=globaltrack->GetTPCsignal(); | |
572 | if(dEdx==0) continue; | |
573 | ||
574 | ||
575 | fHistdEdx->Fill(globaltrack->P(),dEdx); | |
576 | fHistPt->Fill(pT); | |
577 | ||
578 | ||
579 | if(pT>TriggerPtMin && pT<=TriggerPtMax) | |
580 | { | |
581 | TriggerPt=pT; | |
582 | TriggerPhi=globaltrack->Phi(); | |
583 | TriggerEta=globaltrack->Eta(); | |
584 | TriggerIndx=track->GetID(); | |
585 | TriggerPtMin=TriggerPt; | |
586 | } | |
587 | ||
588 | if(pT>0.2 && TMath::Abs(Eta)<0.8) | |
589 | associateds->AddLast(globaltrack); | |
590 | ||
591 | ||
592 | } | |
593 | ||
594 | ||
595 | } //track loop | |
596 | ||
597 | ||
598 | Bool_t IsPion=kFALSE; | |
599 | Bool_t IsKaonProton=kFALSE; | |
600 | //cout<<"***************************************************************************"<<TriggerEta<<endl; | |
601 | if(TMath::Abs(TriggerEta)>0.8) return; | |
602 | ||
603 | if(TriggerIndx!=-99999) | |
604 | { | |
605 | ||
606 | //Float_t bSign = (fAOD->GetMagneticField() > 0) ? 1 : -1; | |
607 | ||
608 | AliAODTrack *currentAssociateds=0x0; | |
609 | ||
610 | AliAODTrack *TriggerTrck=GetGlobalTrack(TriggerIndx); | |
611 | ||
612 | if(!TriggerTrck) return; | |
613 | ||
614 | ||
615 | ||
616 | ||
617 | ||
618 | ||
619 | ||
620 | Int_t TrgrPtBin=GetTriggerPtBin(TriggerTrck); | |
621 | ||
622 | if(TrgrPtBin> 7) return; | |
623 | ||
624 | Bool_t CheckTrackPIDqa=GetTrackStatus(TriggerTrck); | |
625 | if(!CheckTrackPIDqa) return; | |
626 | ||
627 | Double_t nSigma_TPC=(fPIDResponse->NumberOfSigmasTPC(TriggerTrck, (AliPID ::EParticleType)2)); | |
628 | ||
629 | ||
630 | fHistNSigmaTPCPion[TrgrPtBin]->Fill(nSigma_TPC); | |
631 | //if(nSigma_TPC >= 4.0 || nSigma_TPC< -7.5) return; | |
632 | if(nSigma_TPC > 0.0 && nSigma_TPC< 4.0) IsPion=kTRUE; | |
633 | if(nSigma_TPC > -6.0 && nSigma_TPC< -3.0) IsKaonProton=kTRUE; | |
634 | //cout<<"NSigma_TPC********************************************************************************"<<nSigma_TPC<<" "<<TriggerTrck->GetTPCsignalN()<<endl; | |
635 | ||
636 | EffEtaTrigAll=GetEtaCorrectionFactorTrigAll(TriggerEta) ; | |
637 | fTriggerPhiAll->Fill(TriggerPhi); | |
638 | fTriggerEtaAll->Fill(TriggerEta,1./(EffEtaTrigAll)); | |
639 | if(IsPion) | |
640 | { | |
641 | EffEtaTrigPi=GetEtaCorrectionFactorTrigPion(TriggerEta) ; | |
642 | fTriggerPhiPion->Fill(TriggerPhi); | |
643 | fTriggerEtaPion->Fill(TriggerEta,1./(EffEtaTrigPi)); | |
644 | } | |
645 | if(IsKaonProton) | |
646 | { | |
647 | EffEtaTrigPr=GetEtaCorrectionFactorTrigProton(TriggerEta) ;//Eff value of triggers | |
648 | fTriggerPhiKaonProton->Fill(TriggerPhi); | |
649 | fTriggerEtaKaonProton->Fill(TriggerEta,1./(EffEtaTrigPr)); | |
650 | ||
651 | //cout<<"PROTON TRIGGER***************************************************************"<<" "<<EffEtaTrigP<<endl; | |
652 | } | |
653 | ||
654 | ||
655 | ||
656 | for(Int_t iasso=0;iasso<associateds->GetEntriesFast();iasso++ ) | |
657 | { | |
658 | currentAssociateds = (AliAODTrack*)(associateds->At(iasso)); | |
659 | Double_t assoPt=currentAssociateds->Pt(); | |
660 | ||
661 | Int_t AssoPtBin=(Int_t)(2*assoPt); | |
662 | ||
663 | if(assoPt<4.0) | |
664 | { | |
665 | //Bool_t TwoTrackEff=TwoTrackEfficiency(TriggerTrck,currentAssociateds,0.02,bSign); | |
666 | ||
667 | //if(!TwoTrackEff) continue; | |
668 | ||
669 | //Identify Associated********************************************************************** | |
670 | ||
671 | IdentifyAssociated(TriggerEta,TriggerPhi,IsPion,IsKaonProton,currentAssociateds); | |
672 | ||
673 | //Identify Associated*********************************************************************** | |
674 | ||
675 | fAssoPhi->Fill(currentAssociateds->Phi()); | |
676 | fAssoEta->Fill(currentAssociateds->Eta()); | |
677 | ||
678 | Double_t delphi= PhiRange(TriggerPhi - currentAssociateds->Phi()); | |
679 | Double_t deleta=TriggerEta - currentAssociateds->Eta(); | |
680 | ||
681 | Float_t EffEtaAsso=GetEtaCorrectionFactorAsso(currentAssociateds->Eta());//Eff value of associateds | |
682 | ||
683 | Float_t WeightSAll=(1./(EffEtaAsso*EffEtaTrigAll)); | |
684 | fDihadronCorrelation[AssoPtBin]->Fill(delphi,deleta,WeightSAll); | |
685 | if(IsPion) | |
686 | { | |
687 | Float_t WeightSPi=(1./(EffEtaAsso*EffEtaTrigPi)); | |
688 | fDihadronCorrelationPion[AssoPtBin]->Fill(delphi,deleta,WeightSPi); | |
689 | ||
690 | } | |
691 | if(IsKaonProton) | |
692 | { | |
693 | ||
694 | Float_t WeightSPr=(1./(EffEtaAsso*EffEtaTrigPr)); | |
695 | //cout<<WeightS<<endl; | |
696 | fDihadronCorrelationProtonKaon[AssoPtBin]->Fill(delphi,deleta,WeightSPr);//Applied Efficiency Correction | |
697 | } | |
698 | ||
699 | } | |
700 | ||
701 | } | |
702 | ||
703 | } | |
704 | ||
705 | //Mixing starts here---------------------------------------------------------------------------------------------------------------- | |
706 | ||
707 | Double_t multiplicity=fAOD->GetNumberOfTracks(); | |
708 | Double_t MultipORcent=multiplicity; | |
709 | AliAODVertex *vtx =fAOD->GetPrimaryVertex(); | |
710 | Double_t zvertex =vtx->GetZ(); | |
711 | Double_t poolmin=0; | |
712 | Double_t poolmax=150; | |
713 | if(TMath:: Abs(zvertex)>=10 || MultipORcent>poolmax || MultipORcent<poolmin) return ; | |
714 | AliEventPool* pool =NULL; | |
715 | pool=fPoolMgr->GetEventPool(MultipORcent, zvertex); | |
716 | if(pool==NULL) | |
717 | { | |
718 | //AliInfo(Form("No pool found for multiplicity = %f, zVtx = %f cm", MultipORcent, zvertex)); | |
719 | return; | |
720 | } | |
721 | if (pool->IsReady() || pool->NTracksInPool() > 50000/ 10 || pool->GetCurrentNEvents() >=5) | |
722 | { | |
723 | const Int_t nMix = pool->GetCurrentNEvents(); | |
724 | ||
725 | for (Int_t jMix=0; jMix<nMix; jMix++) | |
726 | { | |
727 | TObjArray* bgTracks = NULL; | |
728 | bgTracks=pool->GetEvent(jMix); | |
729 | if(!bgTracks) continue; | |
730 | for(Int_t itrack=0;itrack<bgTracks->GetEntriesFast();++itrack) | |
731 | { | |
732 | AliPIDCorrParticle *PIDCorrParticle =NULL; | |
733 | PIDCorrParticle=(AliPIDCorrParticle*)(bgTracks->At(itrack)); | |
734 | Double_t assoPt=PIDCorrParticle->Pt(); | |
735 | Int_t Ptbinbg=(Int_t)(assoPt*2); | |
736 | if(assoPt<4.0) | |
737 | { | |
738 | ||
739 | Float_t EffEtaAssoMixed=GetEtaCorrectionFactorAsso(PIDCorrParticle->Eta()); | |
740 | ||
741 | Double_t mixedDelPhi=PhiRange(TriggerPhi-PIDCorrParticle->Phi()); | |
742 | Double_t mixedDelEta=TriggerEta-PIDCorrParticle->Eta(); | |
743 | ||
744 | ||
745 | if(TriggerIndx!=-99999) | |
746 | { | |
747 | Float_t WeightMAll=(1./(EffEtaAssoMixed*EffEtaTrigAll)); | |
748 | fMixedEvent[Ptbinbg]->Fill(mixedDelPhi,mixedDelEta,WeightMAll); | |
749 | if(IsPion) | |
750 | { | |
751 | Float_t WeightMPi=(1./(EffEtaAssoMixed*EffEtaTrigPi)); | |
752 | fMixedPion[Ptbinbg]->Fill(mixedDelPhi,mixedDelEta,WeightMPi); | |
753 | ||
754 | } | |
755 | if(IsKaonProton) | |
756 | { | |
757 | Float_t WeightMPr=(1./(EffEtaAssoMixed*EffEtaTrigPr)); | |
758 | //cout<<WeightM<<endl; | |
759 | fMixedProtonKaon[Ptbinbg]->Fill(mixedDelPhi,mixedDelEta,WeightMPr); | |
760 | } | |
761 | } | |
762 | } | |
763 | } | |
764 | } | |
765 | } | |
766 | ||
767 | ||
768 | ||
769 | //Update pool | |
770 | TObjArray* objArray = NULL; | |
771 | objArray = (TObjArray*)AcceptTracksforMixing(fAOD); | |
772 | if(!objArray) return; | |
773 | if(objArray->GetEntriesFast()>0) { | |
774 | pool->UpdatePool(objArray); | |
775 | } | |
776 | ||
777 | ||
778 | ||
779 | PostData(1, fOutputList); | |
780 | } | |
781 | //_______________________________________________________________________________________ | |
782 | ||
783 | Double_t AliAnalysisTaskPIDCORR::PhiRange(Double_t DPhi) | |
784 | ||
785 | { | |
786 | // | |
787 | // Puts the argument in the range [-pi/2,3 pi/2]. | |
788 | // | |
789 | ||
790 | if (DPhi < -TMath::Pi()/2) DPhi += 2*TMath::Pi(); | |
791 | if (DPhi > 3*TMath::Pi()/2) DPhi -= 2*TMath::Pi(); | |
792 | ||
793 | return DPhi; | |
794 | ||
795 | } | |
796 | ||
797 | //________________________________________________________________________ | |
798 | Int_t AliAnalysisTaskPIDCORR:: GetTriggerPtBin(AliAODTrack *track) | |
799 | { | |
800 | Int_t Bin; | |
801 | Double_t Pt_Max=track->Pt(); | |
802 | if(Pt_Max<4.0) Bin=999; | |
803 | if(Pt_Max>=4.0 && Pt_Max<4.5) Bin=0; | |
804 | if(Pt_Max>=4.5 && Pt_Max<5.0) Bin=1; | |
805 | if(Pt_Max>=5.0 && Pt_Max<5.5) Bin=2; | |
806 | if(Pt_Max>=5.5 && Pt_Max<6.0) Bin=3; | |
807 | if(Pt_Max>=6.0 && Pt_Max<6.5) Bin=4; | |
808 | if(Pt_Max>=6.5 && Pt_Max<7.0) Bin=5; | |
809 | if(Pt_Max>=7.0 && Pt_Max<7.5) Bin=6; | |
810 | if(Pt_Max>=7.5 && Pt_Max<8.0) Bin=7; | |
811 | if(Pt_Max>=8.0) Bin=999; | |
812 | return Bin; | |
813 | ||
814 | ||
815 | } | |
816 | ||
817 | //______________________________________________________________________ | |
818 | Bool_t AliAnalysisTaskPIDCORR :: GetTrackStatus(AliAODTrack *track) | |
819 | { | |
820 | if ((track->GetStatus() & AliAODTrack::kTPCin ) == 0) return kFALSE; | |
821 | if ((track->GetStatus() & AliAODTrack::kTPCrefit) == 0) return kFALSE; | |
822 | if ((track->GetStatus() & AliAODTrack::kITSrefit) == 0) return kFALSE; | |
823 | return kTRUE; | |
824 | } | |
825 | //______________________________________________________________________ | |
826 | ||
827 | void AliAnalysisTaskPIDCORR ::DefineEventPool() | |
828 | { | |
829 | const Int_t MaxNofEvents=1000; | |
830 | const Int_t MinNofTracks=50000; | |
831 | const Int_t NofCentBins=3; | |
832 | Double_t CentralityBins[NofCentBins+1]={2,20,50,150}; | |
833 | const Int_t NofVrtxBins=10; | |
834 | Double_t ZvrtxBins[NofVrtxBins+1]={-10,-8,-6,-4,-2,0,2,4,6,8,10}; | |
835 | ||
836 | ||
837 | fPoolMgr = new AliEventPoolManager(MaxNofEvents,MinNofTracks,NofCentBins,CentralityBins,NofVrtxBins,ZvrtxBins); | |
838 | } | |
839 | //_______________________________________________________________________ | |
840 | TObjArray *AliAnalysisTaskPIDCORR::AcceptTracksforMixing(AliAODEvent *inputEvent) | |
841 | { | |
842 | Int_t nTracks = inputEvent->GetNumberOfTracks(); | |
843 | ||
844 | ||
845 | ||
846 | TObjArray* tracksClone = new TObjArray; | |
847 | tracksClone->SetOwner(kTRUE); | |
848 | ||
849 | for (Int_t iTrack=0; iTrack<nTracks; ++iTrack) | |
850 | { | |
f15c1f69 | 851 | AliAODTrack* track = dynamic_cast<AliAODTrack*>(inputEvent->GetTrack(iTrack)); |
852 | if(!track) AliFatal("Not a standard AOD"); | |
7cbcecc6 | 853 | |
854 | Int_t trackclass=ClassifyTrack(track); | |
855 | if (trackclass==1) | |
856 | { | |
857 | //AliAODTrack *globaltrack=GetGlobalTrack(track->GetID()); | |
858 | //Double_t MpT=globaltrack->Pt(); | |
859 | //Double_t MEta=globaltrack->Eta(); | |
860 | //if(MpT>0.2 && TMath::Abs(MEta)<=0.8) | |
861 | tracksClone->Add(new AliPIDCorrParticle(track->Eta(), track->Phi(), track->Pt(),track->Charge())); | |
862 | } | |
863 | } | |
864 | ||
865 | return tracksClone; | |
866 | } | |
867 | //_________________________________________________________________________________________________________________________ | |
868 | ||
869 | ||
870 | Bool_t AliAnalysisTaskPIDCORR::TwoTrackEfficiency(AliAODTrack *trig,AliAODTrack *asso,Float_t ftwoTrackEfficiencyCutValue,Float_t bSign) | |
871 | { | |
872 | if(!trig || !asso) return kFALSE; | |
873 | //if (twoTrackEfficiencyCut) | |
874 | //{ | |
875 | // the variables & cuthave been developed by the HBT group | |
876 | // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700 | |
877 | ||
878 | Float_t phi1 = trig->Phi(); | |
879 | Float_t pt1 = trig->Pt(); | |
880 | Float_t charge1 = trig->Charge(); | |
881 | Float_t eta1=trig->Eta(); | |
882 | ||
883 | Float_t phi2 = asso->Phi(); | |
884 | Float_t pt2 = asso->Pt(); | |
885 | Float_t charge2 = asso->Charge(); | |
886 | Float_t eta2=asso->Eta(); | |
887 | ||
888 | Float_t deta=eta1-eta2; | |
889 | // optimization | |
890 | if (TMath::Abs(deta) < ftwoTrackEfficiencyCutValue * 2.5 * 3) | |
891 | { | |
892 | // check first boundaries to see if is worth to loop and find the minimum | |
893 | Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign); | |
894 | Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign); | |
895 | ||
896 | const Float_t kLimit = ftwoTrackEfficiencyCutValue * 3; | |
897 | ||
898 | Float_t dphistarminabs = 1e5; | |
857be196 | 899 | //Float_t dphistarmin = 1e5; |
7cbcecc6 | 900 | if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0) |
901 | { | |
902 | for (Double_t rad=0.8; rad<2.51; rad+=0.01) | |
903 | { | |
904 | Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign); | |
905 | ||
906 | Float_t dphistarabs = TMath::Abs(dphistar); | |
907 | ||
908 | if (dphistarabs < dphistarminabs) | |
909 | { | |
857be196 | 910 | //dphistarmin = dphistar; |
7cbcecc6 | 911 | dphistarminabs = dphistarabs; |
912 | } | |
913 | } | |
914 | ||
915 | //fTwoTrackDistancePt[0]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2)); | |
916 | ||
917 | if (dphistarminabs < ftwoTrackEfficiencyCutValue && TMath::Abs(deta) < ftwoTrackEfficiencyCutValue) | |
918 | { | |
919 | // Printf("Removed track pair %d %d with %f %f %f %f %f %f %f %f %f", i, j, deta, dphistarminabs, phi1, pt1, charge1, phi2, pt2, charge2, bSign); | |
920 | return kFALSE; | |
921 | } | |
922 | ||
923 | //fTwoTrackDistancePt[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2)); | |
924 | } | |
925 | } | |
926 | //} | |
927 | return kTRUE; | |
928 | } | |
929 | //_________________________________________________________________________________________________________________________________________ | |
930 | ||
931 | Bool_t AliAnalysisTaskPIDCORR::TwoTrackEfficiencyBg(AliAODTrack *trig,AliPIDCorrParticle *asso,Float_t ftwoTrackEfficiencyCutValue,Float_t bSign) | |
932 | { | |
933 | if(!trig || !asso) return kFALSE; | |
934 | //if (twoTrackEfficiencyCut) | |
935 | //{ | |
936 | // the variables & cuthave been developed by the HBT group | |
937 | // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700 | |
938 | ||
939 | Float_t phi1 = trig->Phi(); | |
940 | Float_t pt1 = trig->Pt(); | |
941 | Float_t charge1 = trig->Charge(); | |
942 | Float_t eta1=trig->Eta(); | |
943 | ||
944 | Float_t phi2 = asso->Phi(); | |
945 | Float_t pt2 = asso->Pt(); | |
946 | Float_t charge2 = asso->Charge(); | |
947 | Float_t eta2=asso->Eta(); | |
948 | ||
949 | Float_t deta=eta1-eta2; | |
950 | // optimization | |
951 | if (TMath::Abs(deta) < ftwoTrackEfficiencyCutValue * 2.5 * 3) | |
952 | { | |
953 | // check first boundaries to see if is worth to loop and find the minimum | |
954 | Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign); | |
955 | Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign); | |
956 | ||
957 | const Float_t kLimit = ftwoTrackEfficiencyCutValue * 3; | |
958 | ||
959 | Float_t dphistarminabs = 1e5; | |
857be196 | 960 | //Float_t dphistarmin = 1e5; |
7cbcecc6 | 961 | if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0) |
962 | { | |
963 | for (Double_t rad=0.8; rad<2.51; rad+=0.01) | |
964 | { | |
965 | Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign); | |
966 | ||
967 | Float_t dphistarabs = TMath::Abs(dphistar); | |
968 | ||
969 | if (dphistarabs < dphistarminabs) | |
970 | { | |
857be196 | 971 | //dphistarmin = dphistar; |
7cbcecc6 | 972 | dphistarminabs = dphistarabs; |
973 | } | |
974 | } | |
975 | ||
976 | //fTwoTrackDistancePt[0]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2)); | |
977 | ||
978 | if (dphistarminabs < ftwoTrackEfficiencyCutValue && TMath::Abs(deta) < ftwoTrackEfficiencyCutValue) | |
979 | { | |
980 | // Printf("Removed track pair %d %d with %f %f %f %f %f %f %f %f %f", i, j, deta, dphistarminabs, phi1, pt1, charge1, phi2, pt2, charge2, bSign); | |
981 | return kFALSE; | |
982 | } | |
983 | ||
984 | //fTwoTrackDistancePt[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2)); | |
985 | } | |
986 | } | |
987 | //} | |
988 | return kTRUE; | |
989 | } | |
990 | ||
991 | //__________________________________________________________________________________________________________________________________________ | |
992 | ||
993 | Float_t AliAnalysisTaskPIDCORR::GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign) | |
994 | { | |
995 | // | |
996 | // calculates dphistar | |
997 | // | |
998 | ||
999 | Float_t dphistar = phi1 - phi2 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1) + charge2 * bSign * TMath::ASin(0.075 * radius / pt2); | |
1000 | ||
1001 | static const Double_t kPi = TMath::Pi(); | |
1002 | ||
1003 | // circularity | |
1004 | // if (dphistar > 2 * kPi) | |
1005 | // dphistar -= 2 * kPi; | |
1006 | // if (dphistar < -2 * kPi) | |
1007 | // dphistar += 2 * kPi; | |
1008 | ||
1009 | if (dphistar > kPi) | |
1010 | dphistar = kPi * 2 - dphistar; | |
1011 | if (dphistar < -kPi) | |
1012 | dphistar = -kPi * 2 - dphistar; | |
1013 | if (dphistar > kPi) // might look funny but is needed | |
1014 | dphistar = kPi * 2 - dphistar; | |
1015 | ||
1016 | return dphistar; | |
1017 | } | |
1018 | //_______________________________________________________________________ | |
1019 | Float_t AliAnalysisTaskPIDCORR::GetEtaCorrectionFactorAsso(Double_t Eta) | |
1020 | { | |
1021 | ||
1022 | ||
1023 | Int_t Etabin=(16/1.6)*(-0.8-Eta); | |
1024 | Int_t BIN=TMath::Abs(Etabin); | |
1025 | ||
1026 | Float_t eff[16]={0.773274,0.783099,0.774943,0.769163,0.759582,0.74767,0.732028,0.724823,0.756575,0.780094,0.788648,0.79306,0.796114,0.801123,0.799477,0.779948}; | |
1027 | ||
1028 | return eff[BIN]; | |
1029 | ||
1030 | ||
1031 | ||
1032 | } | |
1033 | //____________________________________________________________________________________ | |
1034 | Float_t AliAnalysisTaskPIDCORR::GetEtaCorrectionFactorTrigAll(Double_t Eta) | |
1035 | { | |
1036 | ||
1037 | ||
1038 | Int_t Etabin=(16/1.6)*(-0.8-Eta); | |
1039 | Int_t BIN=TMath::Abs(Etabin); | |
1040 | ||
1041 | ||
1042 | ||
1043 | Float_t EffAll[16]={0.705833,0.715773,0.72209,0.718895,0.703701,0.691354,0.679242,0.65723,0.698546,0.72464,0.730565,0.732914,0.733499,0.746637,0.738133,0.720495}; | |
1044 | ||
1045 | return EffAll[BIN]; | |
1046 | ||
1047 | } | |
1048 | ||
1049 | //_____________________________________________________________________________________________ | |
1050 | Float_t AliAnalysisTaskPIDCORR::GetEtaCorrectionFactorTrigPion(Double_t Eta) | |
1051 | { | |
1052 | ||
1053 | ||
1054 | Int_t Etabin=(16/1.6)*(-0.8-Eta); | |
1055 | Int_t BIN=TMath::Abs(Etabin); | |
1056 | ||
1057 | ||
1058 | Float_t EffPion[16]={0.36819,0.369563,0.378747,0.378856,0.361426,0.372088,0.355179,0.344626,0.376348,0.387998,0.381553,0.373258,0.397368,0.380326,0.381536,0.369155}; | |
1059 | ||
1060 | return EffPion[BIN]; | |
1061 | ||
1062 | ||
1063 | } | |
1064 | ||
1065 | //______________________________________________________________________________________________________ | |
1066 | Float_t AliAnalysisTaskPIDCORR::GetEtaCorrectionFactorTrigProton(Double_t Eta) | |
1067 | { | |
1068 | ||
1069 | ||
1070 | Int_t Etabin=(16/1.6)*(-0.8-Eta); | |
1071 | Int_t BIN=TMath::Abs(Etabin); | |
1072 | ||
1073 | Float_t EffProton[16]={0.698916,0.708791,0.686047,0.663609,0.621142,0.57571,0.556255,0.518182,0.54031,0.58828,0.62885,0.675739,0.686916,0.707395,0.714397,0.693769}; | |
1074 | return EffProton[BIN]; | |
1075 | ||
1076 | ||
1077 | ||
1078 | ||
1079 | } | |
1080 | //_______________________________________________________________________ | |
1081 | Bool_t AliAnalysisTaskPIDCORR::CheckTOF(AliVTrack * trk) | |
1082 | { | |
1083 | //in addition to KTOFout and kTIME we look at the pt | |
1084 | if(trk->Pt()<0.6)return kFALSE; | |
1085 | ||
1086 | //check if the particle has TOF Matching | |
1087 | UInt_t status; | |
1088 | status=trk->GetStatus(); | |
1089 | if((status&AliVTrack::kTOFout)==0 || (status&AliVTrack::kTIME)==0)return kFALSE; | |
1090 | else return kTRUE; | |
1091 | ||
1092 | ||
1093 | ||
1094 | } | |
1095 | //________________________________________________________________________ | |
1096 | void AliAnalysisTaskPIDCORR::IdentifyAssociated(Double_t Eta_trig,Double_t Phi_trig,Bool_t PION,Bool_t PROTON,AliAODTrack *TRK) | |
1097 | { | |
1098 | Bool_t HasTOFPID=CheckTOF(TRK); | |
1099 | //Bool_t HasTPCPID=GetTrackStatus(TRK); | |
1100 | ||
1101 | if(HasTOFPID) | |
1102 | { | |
1103 | Double_t Eta_asso=TRK->Eta(); | |
1104 | Double_t Phi_asso=TRK->Phi(); | |
1105 | ||
1106 | Int_t Ptype=GetTOFPID(TRK); | |
1107 | if(Ptype>2) return; | |
1108 | ||
1109 | //cout<<"TOFPID"<<HasTOFPID<<" "<<"ParticleType"<<Ptype<<endl; | |
1110 | //Int_t Ptype=GetTPCTOFPID(TRK); | |
1111 | ||
1112 | if(TMath::Abs(Eta_trig-Eta_asso)<=0.5) | |
1113 | { | |
1114 | ||
1115 | if(TMath::Abs(Phi_trig-Phi_asso)<=0.5) | |
1116 | { | |
1117 | fHistNSAll[Ptype]->Fill(TRK->Pt()); | |
1118 | if(PION) | |
1119 | fHistNSPion[Ptype]->Fill(TRK->Pt()); | |
1120 | if(PROTON) | |
1121 | fHistNSProton[Ptype]->Fill(TRK->Pt()); | |
1122 | } | |
1123 | ||
1124 | if((Phi_trig-Phi_asso)>=TMath::Pi()-0.5 && (Phi_trig-Phi_asso)<=TMath::Pi()+0.5) | |
1125 | { | |
1126 | fHistASAll[Ptype]->Fill(TRK->Pt()); | |
1127 | if(PION) | |
1128 | fHistASPion[Ptype]->Fill(TRK->Pt()); | |
1129 | if(PROTON) | |
1130 | fHistASProton[Ptype]->Fill(TRK->Pt()); | |
1131 | } | |
1132 | ||
1133 | if((Phi_trig-Phi_asso)>=0.5*TMath::Pi()-0.4 && (Phi_trig-Phi_asso)<=0.5*TMath::Pi()+0.2) | |
1134 | { | |
1135 | fHistBgAll[Ptype]->Fill(TRK->Pt()); | |
1136 | if(PION) | |
1137 | fHistBgPion[Ptype]->Fill(TRK->Pt()); | |
1138 | if(PROTON) | |
1139 | fHistBgProton[Ptype]->Fill(TRK->Pt()); | |
1140 | } | |
1141 | ||
1142 | ||
1143 | } | |
1144 | ||
1145 | if(TMath::Abs(Eta_trig-Eta_asso)>=1.0) | |
1146 | { | |
1147 | fHistBulkAll[Ptype]->Fill(TRK->Pt()); | |
1148 | if(PION) | |
1149 | fHistBulkPion[Ptype]->Fill(TRK->Pt()); | |
1150 | if(PROTON) | |
1151 | fHistBulkProton[Ptype]->Fill(TRK->Pt()); | |
1152 | } | |
1153 | ||
1154 | ||
1155 | ||
1156 | ||
1157 | ||
1158 | } | |
1159 | ||
1160 | ||
1161 | } | |
1162 | ||
1163 | //_______________________________________________________________________ | |
1164 | Int_t AliAnalysisTaskPIDCORR::GetTOFPID(AliAODTrack *track) | |
1165 | { | |
1166 | ||
1167 | Double_t nsigmaTOFkProton=999.,nsigmaTOFkKaon=999.,nsigmaTOFkPion=999.; | |
1168 | ||
1169 | nsigmaTOFkProton = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kProton); | |
1170 | nsigmaTOFkKaon = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kKaon); | |
1171 | nsigmaTOFkPion = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kPion); | |
1172 | ||
1173 | //cout<<nsigmaTOFkProton<<" "<<nsigmaTOFkKaon<<" "<< nsigmaTOFkPion<<endl; | |
1174 | ||
1175 | if(TMath::Abs(nsigmaTOFkPion)<= 2.0) return 0; | |
1176 | if(TMath::Abs(nsigmaTOFkKaon)<= 2.0) return 1; | |
1177 | if(TMath::Abs(nsigmaTOFkProton)<= 2.0) return 2; | |
1178 | else return 999; | |
1179 | ||
1180 | ||
1181 | } | |
1182 | //_______________________________________________________________________ | |
1183 | Int_t AliAnalysisTaskPIDCORR::GetTPCTOFPID(AliAODTrack *track) | |
1184 | { | |
1185 | ||
1186 | //___TPC | |
1187 | Double_t nsigmaTPCkProton = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kProton); | |
1188 | Double_t nsigmaTPCkKaon = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kKaon); | |
1189 | Double_t nsigmaTPCkPion = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion); | |
1190 | //___TOF | |
1191 | ||
1192 | Double_t nsigmaTOFkProton=999.,nsigmaTOFkKaon=999.,nsigmaTOFkPion=999.; | |
1193 | ||
1194 | nsigmaTOFkProton = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kProton); | |
1195 | nsigmaTOFkKaon = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kKaon); | |
1196 | nsigmaTOFkPion = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kPion); | |
1197 | ||
1198 | //__TPCTOF | |
1199 | ||
1200 | Double_t nsigmaTPCTOFkProton=999.,nsigmaTPCTOFkKaon=999.,nsigmaTPCTOFkPion=999.; | |
1201 | nsigmaTPCTOFkProton = TMath::Sqrt((nsigmaTPCkProton*nsigmaTPCkProton+nsigmaTOFkProton*nsigmaTOFkProton)); | |
1202 | nsigmaTPCTOFkKaon = TMath::Sqrt((nsigmaTPCkKaon*nsigmaTPCkKaon+nsigmaTOFkKaon*nsigmaTOFkKaon)); | |
1203 | nsigmaTPCTOFkPion = TMath::Sqrt((nsigmaTPCkPion*nsigmaTPCkPion+nsigmaTOFkPion*nsigmaTOFkPion)); | |
1204 | ||
1205 | if(TMath::Abs(nsigmaTPCTOFkPion)<= 3.0) return 0; | |
1206 | if(TMath::Abs(nsigmaTPCTOFkKaon)<= 3.0) return 1; | |
1207 | if(TMath::Abs(nsigmaTPCTOFkProton)<= 3.0) return 2; | |
1208 | ||
1209 | return -1; | |
1210 | } | |
1211 | ||
1212 | ||
1213 | ||
1214 | //________________________________________________________________________ | |
1215 | void AliAnalysisTaskPIDCORR::Terminate(Option_t *) | |
1216 | { | |
1217 | // Draw result to screen, or perform fitting, normalizations | |
1218 | // Called once at the end of the query | |
1219 | fOutputList = dynamic_cast<TList*> (GetOutputData(1)); | |
1220 | if(!fOutputList) { Printf("ERROR: could not retrieve TList fOutput"); return; } | |
1221 | ||
1222 | ||
1223 | } | |
1224 | ||
1225 |