]>
Commit | Line | Data |
---|---|---|
a8ad4709 | 1 | #include "AliAnalysisTaskLambdaBayes.h" |
2 | ||
3 | // ROOT includes | |
4 | #include <TMath.h> | |
5 | ||
6 | // AliRoot includes | |
7 | #include "AliInputEventHandler.h" | |
8 | #include "AliAODEvent.h" | |
9 | #include "AliAODVertex.h" | |
10 | #include "AliAODTrack.h" | |
11 | #include "AliESDtrack.h" | |
12 | #include "AliCentrality.h" | |
13 | #include "AliVHeader.h" | |
14 | #include "AliAODVZERO.h" | |
15 | #include "TFile.h" | |
16 | #include "AliOADBContainer.h" | |
17 | #include "TH2F.h" | |
18 | #include "TF1.h" | |
19 | #include "AliGenHijingEventHeader.h" | |
20 | #include "AliMCEvent.h" | |
21 | #include "AliAODMCHeader.h" | |
22 | #include "AliAODMCParticle.h" | |
23 | #include "TChain.h" | |
24 | #include "AliESDtrackCuts.h" | |
25 | #include "AliESDVertex.h" | |
26 | #include "AliEventplane.h" | |
27 | #include "AliAnalysisManager.h" | |
28 | #include "TRandom.h" | |
29 | ||
30 | ||
31 | Float_t AliAnalysisTaskLambdaBayes::fPtLambdaMin[AliAnalysisTaskLambdaBayes::nPtBin] = {0.,0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4.,5.,6.};// ptmin bin | |
32 | Float_t AliAnalysisTaskLambdaBayes::fPtLambdaMax[AliAnalysisTaskLambdaBayes::nPtBin] = {0.25,0.5,0.75,1,1.5,2,2.5,3,3.5,4.,5.,6.,10.};// ptmax bin | |
33 | ||
34 | // STL includes | |
35 | //#include <iostream> | |
36 | //using namespace std; | |
37 | ||
38 | ClassImp(AliAnalysisTaskLambdaBayes) | |
39 | //_____________________________________________________________________________ | |
40 | AliAnalysisTaskLambdaBayes::AliAnalysisTaskLambdaBayes(): | |
41 | AliAnalysisTaskSE(), | |
42 | fVtxCut(10.0), // cut on |vertex| < fVtxCut | |
43 | fEtaCut(0.8), // cut on |eta| < fEtaCut | |
44 | fMinPt(0.15), // cut on pt > fMinPt | |
45 | fIsMC(kFALSE), | |
46 | fQAsw(kFALSE), | |
47 | fNcluster(70), | |
48 | fFilterBit(1), | |
49 | fList(new TList()), | |
50 | fList2(new TList()), | |
51 | fList3(new TList()), | |
52 | fCentrality(-1), | |
53 | fPsi(0), | |
54 | fPtLambdaC(0.), | |
55 | fPhiLambdaC(0.), | |
56 | fEtaLambda(0.), | |
57 | fMassV0(0.), | |
58 | fPtKp(0.), | |
59 | fPhiKp(0.), | |
60 | fEtaKp(0.), | |
61 | fPtKn(0.), | |
62 | fPhiKn(0.), | |
63 | fEtaKn(0.), | |
64 | fPidKp(0), | |
65 | fPidKn(0), | |
66 | fTOFTPCsignal(0), | |
67 | fCombsignal(0), | |
68 | fCutsDaughter(NULL), | |
69 | fPIDCombined(NULL), | |
70 | fContPid(NULL), | |
71 | fContPid2(NULL), | |
72 | fNLambda(0), | |
73 | fNpPos(0), | |
74 | fNpNeg(0), | |
75 | fHmismTOF(0), | |
9c668341 | 76 | fHchannelTOFdistr(0), |
77 | fTypeCol(2) | |
a8ad4709 | 78 | { |
79 | // Default constructor (should not be used) | |
80 | fList->SetName("contLambdaBayes1"); | |
81 | fList2->SetName("contLambdaBayes2"); | |
82 | fList3->SetName("contLambdaBayes3"); | |
83 | ||
84 | fList->SetOwner(kTRUE); | |
85 | fList2->SetOwner(kTRUE); | |
86 | fList3->SetOwner(kTRUE); | |
87 | ||
88 | TFile *fmism = new TFile("$ALICE_ROOT/TOF/data/TOFmismatchDistr.root"); | |
89 | fHmismTOF = (TH1F *) fmism->Get("TOFmismDistr"); | |
90 | ||
91 | TFile *fchDist = new TFile("$ALICE_ROOT/TOF/data/TOFchannelDist.root"); | |
92 | fHchannelTOFdistr = (TH1D *) fchDist->Get("hTOFchanDist"); | |
f4c4ac9e | 93 | |
94 | for(Int_t i=0;i < nCentrBin;i++){ | |
95 | fElTOF[i] = NULL; | |
96 | fElTPC[i] = NULL; | |
97 | fPiTOF[i] = NULL; | |
98 | fPiTPC[i] = NULL; | |
99 | fKaTOF[i] = NULL; | |
100 | fKaTPC[i] = NULL; | |
101 | fPrTOF[i] = NULL; | |
102 | fPrTPC[i] = NULL; | |
103 | } | |
104 | for(Int_t i=0;i < 4;i++){ | |
105 | hMatching[i] = NULL; | |
106 | hTracking[i] = NULL; | |
107 | } | |
108 | ||
109 | for(Int_t i=0;i < 1000;i++){ | |
110 | fPhiLambda[i] = 0.0; | |
111 | fPtLambda[i] = 0.0; | |
112 | fIPPos[i] = 0; | |
113 | fIPNeg[i] = 0; | |
114 | fIpP[i] = 0; | |
115 | fIpN[i] = 0; | |
116 | fMassLambda[i] = 0.0; | |
117 | } | |
a8ad4709 | 118 | } |
119 | ||
120 | //______________________________________________________________________________ | |
121 | AliAnalysisTaskLambdaBayes::AliAnalysisTaskLambdaBayes(const char *name): | |
122 | AliAnalysisTaskSE(name), | |
123 | fVtxCut(10.0), // cut on |vertex| < fVtxCut | |
124 | fEtaCut(0.8), // cut on |eta| < fEtaCut | |
125 | fMinPt(0.15), // cut on pt > fMinPt | |
126 | fIsMC(kFALSE), | |
127 | fQAsw(kFALSE), | |
128 | fNcluster(70), | |
129 | fFilterBit(1), | |
130 | fList(new TList()), | |
131 | fList2(new TList()), | |
132 | fList3(new TList()), | |
133 | fCentrality(-1), | |
134 | fPsi(0), | |
135 | fPtLambdaC(0.), | |
136 | fPhiLambdaC(0.), | |
137 | fEtaLambda(0.), | |
138 | fMassV0(0.), | |
139 | fPtKp(0.), | |
140 | fPhiKp(0.), | |
141 | fEtaKp(0.), | |
142 | fPtKn(0.), | |
143 | fPhiKn(0.), | |
144 | fEtaKn(0.), | |
145 | fPidKp(0), | |
146 | fPidKn(0), | |
147 | fTOFTPCsignal(0), | |
148 | fCombsignal(0), | |
149 | fCutsDaughter(NULL), | |
150 | fPIDCombined(NULL), | |
151 | fContPid(NULL), | |
152 | fContPid2(NULL), | |
153 | fNLambda(0), | |
154 | fNpPos(0), | |
155 | fNpNeg(0), | |
156 | fHmismTOF(0), | |
9c668341 | 157 | fHchannelTOFdistr(0), |
158 | fTypeCol(2) | |
a8ad4709 | 159 | { |
160 | ||
161 | DefineOutput(1, TList::Class()); | |
162 | DefineOutput(2, TList::Class()); | |
163 | DefineOutput(3, TList::Class()); | |
164 | DefineOutput(4, TList::Class()); | |
165 | ||
166 | // Output slot #1 writes into a TTree | |
167 | fList->SetName("contLambdaBayes1"); | |
168 | fList2->SetName("contLambdaBayes2"); | |
169 | fList3->SetName("contLambdaBayes3"); | |
170 | ||
171 | fList->SetOwner(kTRUE); | |
172 | fList2->SetOwner(kTRUE); | |
173 | fList3->SetOwner(kTRUE); | |
174 | ||
175 | TFile *fmism = new TFile("$ALICE_ROOT/TOF/data/TOFmismatchDistr.root"); | |
176 | fHmismTOF = (TH1F *) fmism->Get("TOFmismDistr"); | |
177 | ||
178 | TFile *fchDist = new TFile("$ALICE_ROOT/TOF/data/TOFchannelDist.root"); | |
179 | fHchannelTOFdistr = (TH1D *) fchDist->Get("hTOFchanDist"); | |
f4c4ac9e | 180 | |
181 | for(Int_t i=0;i < nCentrBin;i++){ | |
182 | fElTOF[i] = NULL; | |
183 | fElTPC[i] = NULL; | |
184 | fPiTOF[i] = NULL; | |
185 | fPiTPC[i] = NULL; | |
186 | fKaTOF[i] = NULL; | |
187 | fKaTPC[i] = NULL; | |
188 | fPrTOF[i] = NULL; | |
189 | fPrTPC[i] = NULL; | |
190 | } | |
191 | for(Int_t i=0;i < 4;i++){ | |
192 | hMatching[i] = NULL; | |
193 | hTracking[i] = NULL; | |
194 | } | |
195 | ||
196 | for(Int_t i=0;i < 1000;i++){ | |
197 | fPhiLambda[i] = 0.0; | |
198 | fPtLambda[i] = 0.0; | |
199 | fIPPos[i] = 0; | |
200 | fIPNeg[i] = 0; | |
201 | fIpP[i] = 0; | |
202 | fIpN[i] = 0; | |
203 | fMassLambda[i] = 0.0; | |
204 | } | |
a8ad4709 | 205 | } |
206 | //_____________________________________________________________________________ | |
207 | AliAnalysisTaskLambdaBayes::~AliAnalysisTaskLambdaBayes() | |
208 | { | |
209 | ||
210 | } | |
211 | ||
212 | //______________________________________________________________________________ | |
213 | void AliAnalysisTaskLambdaBayes::UserCreateOutputObjects() | |
214 | { | |
215 | ||
216 | fPIDCombined=new AliPIDCombined; | |
217 | fPIDCombined->SetDefaultTPCPriors(); | |
218 | fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTOF); | |
219 | ||
220 | Float_t invMmin = 1.115-0.005*8; | |
221 | Float_t invMmax = 1.115+0.005*8; | |
222 | ||
223 | const Int_t nBinPid = 14; | |
224 | ||
225 | Int_t binPid[nBinPid] = {1/*ptLambda*/,8/*EtaPP*/,20/*pt+*/,1/*pt-*/,5/*P+*/,1/*P-*/,2/*TOFmatch+*/,1/*TOFmatch-*/,2/*istrue*/,4/*Nsigma+*/,1/*Nsigma-*/,1/*DeltaPhi+*/,1/*DeltaPhi-*/,1/*Psi*/}; | |
226 | ||
227 | Int_t binPid2[nBinPid] = {1/*ptLambda*/,8/*EtaPN*/,1/*pt+*/,20/*pt-*/,1/*P+*/,5/*P-*/,1/*TOFmatch+*/,2/*TOFmatch-*/,2/*istrue*/,1/*Nsigma+*/,4/*Nsigma-*/,1/*DeltaPhi+*/,1/*DeltaPhi-*/,1/*Psi*/}; | |
228 | ||
229 | fContPid = new AliPIDperfContainer("contPID",nBinPid,binPid); | |
230 | fContPid->SetTitleX("M_{#Lambda}"); | |
231 | fContPid->SetTitleY("centrality (%)"); | |
232 | fContPid->SetVarName(0,"p_{T}^{#Lambda}"); | |
233 | fContPid->SetVarRange(0,0,10); | |
234 | fContPid->SetVarName(1,"#eta^{#Lambda}"); | |
235 | fContPid->SetVarRange(1,-0.8,0.8); | |
236 | fContPid->SetVarName(2,"p_{T}^{Kp}"); | |
237 | fContPid->SetVarRange(2,0.3,4.3); | |
238 | fContPid->SetVarName(3,"p_{T}^{Kn}"); | |
239 | fContPid->SetVarRange(3,0.3,4.3); | |
240 | fContPid->SetVarName(4,"BayesProb^{Kp}"); | |
241 | fContPid->SetVarRange(4,0,1.); | |
242 | fContPid->SetVarName(5,"BayesProb^{Kn}"); | |
243 | fContPid->SetVarRange(5,0,1.); | |
244 | fContPid->SetVarName(6,"isTOFmatch^{Kp}"); | |
245 | fContPid->SetVarRange(6,-0.5,1.5); | |
246 | fContPid->SetVarName(7,"isTOFmatch^{Kn}"); | |
247 | fContPid->SetVarRange(7,-0.5,1.5); | |
248 | fContPid->SetVarName(8,"isLambdaTrue^{Kn}"); | |
249 | fContPid->SetVarRange(8,-0.5,1.5); | |
250 | fContPid->SetVarName(9,"N#sigma^{Kp}"); | |
251 | fContPid->SetVarRange(9,1.25,6.25); | |
252 | fContPid->SetVarName(10,"N#sigma^{Kn}"); | |
253 | fContPid->SetVarRange(10,1.25,6.25); | |
254 | fContPid->SetVarName(11,"#Delta#phi^{Kp}"); | |
255 | fContPid->SetVarRange(11,-TMath::Pi(),TMath::Pi()); | |
256 | fContPid->SetVarName(12,"#Delta#phi^{Kn}"); | |
257 | fContPid->SetVarRange(12,-TMath::Pi(),TMath::Pi()); | |
258 | fContPid->SetVarName(13,"#Psi"); | |
259 | fContPid->SetVarRange(13,-TMath::Pi()/2,TMath::Pi()/2); | |
260 | ||
261 | fContPid2 = new AliPIDperfContainer("contPID2",nBinPid,binPid2); | |
262 | fContPid2->SetTitleX("M_{#Lambda}"); | |
263 | fContPid2->SetTitleY("centrality (%)"); | |
264 | fContPid2->SetVarName(0,"p_{T}^{#Lambda}"); | |
265 | fContPid2->SetVarRange(0,0,10); | |
266 | fContPid2->SetVarName(1,"#eta^{#Lambda}"); | |
267 | fContPid2->SetVarRange(1,-0.8,0.8); | |
268 | fContPid2->SetVarName(2,"p_{T}^{Kp}"); | |
269 | fContPid2->SetVarRange(2,0.3,4.3); | |
270 | fContPid2->SetVarName(3,"p_{T}^{Kn}"); | |
271 | fContPid2->SetVarRange(3,0.3,4.3); | |
272 | fContPid2->SetVarName(4,"BayesProb^{Kp}"); | |
273 | fContPid2->SetVarRange(4,0,1.); | |
274 | fContPid2->SetVarName(5,"BayesProb^{Kn}"); | |
275 | fContPid2->SetVarRange(5,0,1.); | |
276 | fContPid2->SetVarName(6,"isTOFmatch^{Kp}"); | |
277 | fContPid2->SetVarRange(6,-0.5,1.5); | |
278 | fContPid2->SetVarName(7,"isTOFmatch^{Kn}"); | |
279 | fContPid2->SetVarRange(7,-0.5,1.5); | |
280 | fContPid2->SetVarName(8,"isLambdaTrue^{Kn}"); | |
281 | fContPid2->SetVarRange(8,-0.5,1.5); | |
282 | fContPid2->SetVarName(9,"N#sigma^{Kp}"); | |
283 | fContPid2->SetVarRange(9,1.25,6.25); | |
284 | fContPid2->SetVarName(10,"N#sigma^{Kn}"); | |
285 | fContPid2->SetVarRange(10,1.25,6.25); | |
286 | fContPid2->SetVarName(11,"#Delta#phi^{Kp}"); | |
287 | fContPid2->SetVarRange(11,-TMath::Pi(),TMath::Pi()); | |
288 | fContPid2->SetVarName(12,"#Delta#phi^{Kn}"); | |
289 | fContPid2->SetVarRange(12,-TMath::Pi(),TMath::Pi()); | |
290 | fContPid2->SetVarName(13,"#Psi"); | |
291 | fContPid2->SetVarRange(13,-TMath::Pi()/2,TMath::Pi()/2); | |
292 | ||
293 | ||
294 | ||
295 | const Int_t nDETsignal = 100; // mass | |
296 | Double_t binDETsignal[nDETsignal+1]; | |
297 | for(Int_t i=0;i<nDETsignal+1;i++){ | |
298 | binDETsignal[i] = invMmin + i*(invMmax - invMmin) / nDETsignal; | |
299 | } | |
300 | const Int_t nDETsignal2 = 10; // centrality | |
301 | Double_t binDETsignal2[nDETsignal2+1]; | |
302 | for(Int_t i=0;i<nDETsignal2+1;i++){ | |
303 | binDETsignal2[i] = i*100./ nDETsignal2; | |
304 | } | |
305 | fContPid->AddSpecies("Lambda",nDETsignal,binDETsignal,nDETsignal2,binDETsignal2); | |
306 | fContPid2->AddSpecies("Lambda2",nDETsignal,binDETsignal,nDETsignal2,binDETsignal2); | |
307 | ||
308 | fList->Add(fContPid); | |
309 | fList->Add(fContPid2); | |
310 | ||
311 | hMatching[0] = new TH2F("hMatchAll","TOF matched (all);p_{T} (GeV/#it{c});centrality (%)",50,0,10,nDETsignal2,0,100); | |
312 | hMatching[1] = new TH2F("hMatchPi","TOF matched (#pi);p_{T} (GeV/#it{c});centrality (%)",50,0,10,nDETsignal2,0,100); | |
313 | hMatching[2] = new TH2F("hMatchKa","TOF matched (K);p_{T} (GeV/#it{c});centrality (%)",50,0,10,nDETsignal2,0,100); | |
314 | hMatching[3] = new TH2F("hMatchPr","TOF matched (p);p_{T} (GeV/#it{c});centrality (%)",50,0,10,nDETsignal2,0,100); | |
315 | ||
316 | hTracking[0] = new TH2F("hTrackingAll","TPC tracks (all);p_{T} (GeV/#it{c});centrality (%)",50,0,10,nDETsignal2,0,100); | |
317 | hTracking[1] = new TH2F("hTrackingPi","TPC tracks (#pi);p_{T} (GeV/#it{c});centrality (%)",50,0,10,nDETsignal2,0,100); | |
318 | hTracking[2] = new TH2F("hTrackingKa","TPC tracks (K);p_{T} (GeV/#it{c});centrality (%)",50,0,10,nDETsignal2,0,100); | |
319 | hTracking[3] = new TH2F("hTrackingPr","TPC tracks (p);p_{T} (GeV/#it{c});centrality (%)",50,0,10,nDETsignal2,0,100); | |
320 | ||
321 | fList2->Add(hMatching[0]); | |
322 | fList2->Add(hMatching[1]); | |
323 | fList2->Add(hMatching[2]); | |
324 | fList2->Add(hMatching[3]); | |
325 | fList2->Add(hTracking[0]); | |
326 | fList2->Add(hTracking[1]); | |
327 | fList2->Add(hTracking[2]); | |
328 | fList2->Add(hTracking[3]); | |
329 | ||
330 | fTOFTPCsignal = new TH2F("hTOFTPCsignal","TOF-TPC signal for protons (1.2 < p_{T} < 1.3 GeV/#it{c}, cent. = 0-20);N#sigma_{TOF};N#sigma_{TPC}",100,-5,5,100,-5,5); | |
331 | fList2->Add(fTOFTPCsignal); | |
332 | fCombsignal = new TH1F("hCombsignal","Combined signal for protons (1.2 < p_{T} < 1.3 GeV/#it{c}, cent. = 0-20);N#sigma",100,0,5); | |
333 | fList2->Add(fCombsignal); | |
334 | ||
335 | // QA plots | |
336 | char name[100],title[400]; | |
337 | for(Int_t i=0;i < nCentrBin;i++){ | |
338 | snprintf(name,100,"hPiTPCQA_%i",i); | |
339 | snprintf(title,400,"TPC signal for #pi cent=%i-%i%c;p_{T} (GeV/#it{c});N#sigma",i*10,(i+1)*10,'%'); | |
340 | fPiTPC[i] = new TH2F(name,title,50,0,4,200,-10,10); | |
341 | fList3->Add(fPiTPC[i]); | |
342 | ||
343 | snprintf(name,100,"hKaTPCQA_%i",i); | |
344 | snprintf(title,400,"TPC signal for K cent=%i-%i%c;p_{T} (GeV/#it{c});N#sigma",i*10,(i+1)*10,'%'); | |
345 | fKaTPC[i] = new TH2F(name,title,50,0,4,200,-10,10); | |
346 | fList3->Add(fKaTPC[i]); | |
347 | ||
348 | snprintf(name,100,"hPrTPCQA_%i",i); | |
349 | snprintf(title,400,"TPC signal for p cent=%i-%i%c;p_{T} (GeV/#it{c});N#sigma",i*10,(i+1)*10,'%'); | |
350 | fPrTPC[i] = new TH2F(name,title,50,0,4,200,-10,10); | |
351 | fList3->Add(fPrTPC[i]); | |
352 | ||
353 | snprintf(name,100,"hElTPCQA_%i",i); | |
354 | snprintf(title,400,"TPC signal for e cent=%i-%i%c;p_{T} (GeV/#it{c});N#sigma",i*10,(i+1)*10,'%'); | |
355 | fElTPC[i] = new TH2F(name,title,50,0,4,200,-10,10); | |
356 | fList3->Add(fElTPC[i]); | |
357 | ||
358 | snprintf(name,100,"hPiTOFQA_%i",i); | |
359 | snprintf(title,400,"TOF signal for #pi cent=%i-%i%c;p_{T} (GeV/#it{c});N#sigma",i*10,(i+1)*10,'%'); | |
360 | fPiTOF[i] = new TH2F(name,title,50,0,4,200,-10,10); | |
361 | fList3->Add(fPiTOF[i]); | |
362 | ||
363 | snprintf(name,100,"hKaTOFQA_%i",i); | |
364 | snprintf(title,400,"TOF signal for K cent=%i-%i%c;p_{T} (GeV/#it{c});N#sigma",i*10,(i+1)*10,'%'); | |
365 | fKaTOF[i] = new TH2F(name,title,50,0,4,200,-10,10); | |
366 | fList3->Add(fKaTOF[i]); | |
367 | ||
368 | snprintf(name,100,"hPrTOFQA_%i",i); | |
369 | snprintf(title,400,"TOF signal for p cent=%i-%i%c;p_{T} (GeV/#it{c});N#sigma",i*10,(i+1)*10,'%'); | |
370 | fPrTOF[i] = new TH2F(name,title,50,0,4,200,-10,10); | |
371 | fList3->Add(fPrTOF[i]); | |
372 | ||
373 | snprintf(name,100,"hElTOFQA_%i",i); | |
374 | snprintf(title,400,"TOF signal for e cent=%i-%i%c;p_{T} (GeV/#it{c});N#sigma",i*10,(i+1)*10,'%'); | |
375 | fElTOF[i] = new TH2F(name,title,50,0,4,200,-10,10); | |
376 | fList3->Add(fElTOF[i]); | |
377 | ||
378 | } | |
379 | ||
380 | // Post output data. | |
381 | PostData(1, fList); | |
382 | PostData(2, fList2); | |
383 | PostData(3, fList3); | |
384 | } | |
385 | ||
386 | //______________________________________________________________________________ | |
387 | void AliAnalysisTaskLambdaBayes::UserExec(Option_t *) | |
388 | { | |
389 | // Main loop | |
390 | // Called for each event | |
391 | ||
392 | fOutputAOD = dynamic_cast<AliAODEvent*>(InputEvent()); | |
393 | if(!fOutputAOD){ | |
394 | Printf("%s:%d AODEvent not found in Input Manager",(char*)__FILE__,__LINE__); | |
395 | this->Dump(); | |
396 | return; | |
397 | } | |
398 | ||
399 | Float_t zvtx = GetVertex(fOutputAOD); | |
400 | ||
401 | ||
402 | ||
403 | //Get the MC object | |
404 | if(fIsMC){ | |
405 | AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(fOutputAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName())); | |
406 | if (!mcHeader) { | |
407 | AliError("Could not find MC Header in AOD"); | |
408 | return; | |
409 | } | |
410 | } | |
411 | ||
412 | if (TMath::Abs(zvtx) < fVtxCut) { | |
413 | ||
414 | SelectLambda(); | |
415 | ||
416 | //Centrality | |
417 | Float_t v0Centr = -10.; | |
418 | Float_t trkCentr = -10.; | |
419 | AliCentrality *centrality = fOutputAOD->GetCentrality(); | |
420 | if (centrality){ | |
421 | trkCentr = centrality->GetCentralityPercentile("V0M"); | |
422 | v0Centr = centrality->GetCentralityPercentile("TRK"); | |
423 | } | |
424 | ||
9c668341 | 425 | if((TMath::Abs(v0Centr - trkCentr) < 5.0 || (fTypeCol!=2)) && v0Centr>0){ // consistency cut on centrality selection |
a8ad4709 | 426 | fCentrality = v0Centr; |
427 | Analyze(fOutputAOD); // Do analysis!!!! | |
428 | ||
429 | } | |
430 | } | |
431 | ||
432 | } | |
433 | ||
434 | //________________________________________________________________________ | |
435 | void AliAnalysisTaskLambdaBayes::Analyze(AliAODEvent* aodEvent) | |
436 | { | |
437 | ||
438 | Int_t ntrack = aodEvent->GetNumberOfTracks(); | |
439 | ||
440 | fPtKp=0.,fPhiKp=0.,fEtaKp=0.; | |
441 | fPtKn=0.,fPhiKn=0.,fEtaKn=0.; | |
442 | fPidKp=0,fPidKn=0; | |
443 | fMassV0=-1; | |
444 | ||
445 | TLorentzVector ksV; | |
446 | ||
447 | Double_t px,py,pz,E; | |
448 | ||
449 | Float_t invMmin = 1.115-0.005*8; | |
450 | Float_t invMmax = 1.115+0.005*8; | |
451 | ||
452 | Int_t icentr = 8; | |
453 | if(fCentrality < 0) icentr = 8; | |
454 | else if(fCentrality < 10) icentr = 0; | |
455 | else if(fCentrality < 20) icentr = 1; | |
456 | else if(fCentrality < 30) icentr = 2; | |
457 | else if(fCentrality < 40) icentr = 3; | |
458 | else if(fCentrality < 50) icentr = 4; | |
459 | else if(fCentrality < 60) icentr = 5; | |
460 | else if(fCentrality < 70) icentr = 6; | |
461 | else if(fCentrality < 80) icentr = 7; | |
462 | ||
463 | Float_t addMismatchForMC = 0.005; | |
464 | if(fCentrality < 50) addMismatchForMC += 0.01; | |
465 | if(fCentrality < 20) addMismatchForMC += 0.02; | |
466 | ||
9c668341 | 467 | if(fTypeCol == 0) addMismatchForMC = 0.005; |
468 | else if(fTypeCol == 1) addMismatchForMC *= 0.5; | |
469 | ||
a8ad4709 | 470 | fPsi = 0; |
471 | /* Compute TPC EP */ | |
472 | Double_t Qx2 = 0, Qy2 = 0; | |
473 | Double_t Qx3 = 0, Qy3 = 0; | |
474 | for(Int_t iT = 0; iT < ntrack; iT++) { | |
475 | AliAODTrack* aodTrack = aodEvent->GetTrack(iT); | |
476 | ||
477 | if (!aodTrack){ | |
478 | continue; | |
479 | } | |
480 | ||
481 | Bool_t trkFlag = aodTrack->TestFilterBit(fFilterBit); | |
482 | ||
483 | if ((TMath::Abs(aodTrack->Eta()) > 0.8) || (aodTrack->Pt() < 0.2) || (aodTrack->GetTPCNcls() < fNcluster) || !trkFlag) | |
484 | continue; | |
485 | ||
486 | Double_t b[2] = {-99., -99.}; | |
487 | Double_t bCov[3] = {-99., -99., -99.}; | |
488 | if (!aodTrack->PropagateToDCA(aodEvent->GetPrimaryVertex(), aodEvent->GetMagneticField(), 100., b, bCov)) | |
489 | continue; | |
490 | ||
491 | if ((TMath::Abs(b[0]) > 3.0) || (TMath::Abs(b[1]) > 2.4)) | |
492 | continue; | |
493 | ||
494 | Qx2 += TMath::Cos(2*aodTrack->Phi()); | |
495 | Qy2 += TMath::Sin(2*aodTrack->Phi()); | |
496 | Qx3 += TMath::Cos(3*aodTrack->Phi()); | |
497 | Qy3 += TMath::Sin(3*aodTrack->Phi()); | |
498 | ||
499 | } | |
500 | ||
501 | fPsi = TMath::ATan2(Qy2, Qx2)/2.; | |
502 | ||
503 | AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager(); | |
504 | AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler()); | |
505 | AliPIDResponse *PIDResponse=inputHandler->GetPIDResponse(); | |
506 | ||
507 | PIDResponse->GetTOFResponse().SetTrackParameter(0,0.); | |
508 | PIDResponse->GetTOFResponse().SetTrackParameter(1,0.); | |
509 | PIDResponse->GetTOFResponse().SetTrackParameter(2,0.018); | |
510 | PIDResponse->GetTOFResponse().SetTrackParameter(3,50.0); | |
511 | ||
512 | fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF); | |
513 | ||
f4c4ac9e | 514 | |
515 | Double_t probP[10] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
516 | Double_t probN[10] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
a8ad4709 | 517 | Double_t nSigmaTPC,nSigmaTOF=6,nSigmaTPC2,nSigmaTOF2=6,nSigmaComb,nSigmaComb2; |
518 | ||
519 | ||
520 | AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(aodEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName())); | |
521 | TClonesArray *mcArray = NULL; | |
522 | if (mcHeader) | |
523 | mcArray = (TClonesArray*)aodEvent->GetList()->FindObject(AliAODMCParticle::StdBranchName()); | |
524 | ||
525 | Int_t nmc = 0; | |
526 | if(mcArray) | |
527 | nmc = mcArray->GetEntries(); | |
528 | ||
529 | for(Int_t i=0;i < ntrack;i++){ // loop on tracks | |
530 | AliAODTrack* track = aodEvent->GetTrack(i); | |
531 | ||
532 | AliAODMCParticle *mcp = NULL; | |
533 | Int_t pdg = 0; | |
534 | ||
535 | if (!track){ | |
536 | continue; | |
537 | } | |
538 | ||
539 | Int_t tofMatch = (track->GetStatus() & AliVTrack::kTOFout) && (track->GetStatus() & AliVTrack::kTIME); | |
540 | ||
541 | Int_t label = -1; | |
542 | if(mcArray){ | |
543 | label = track->GetLabel(); | |
544 | if(label != -1 && label < nmc){ | |
545 | label = TMath::Abs(label); | |
546 | mcp = (AliAODMCParticle*)mcArray->At(label); | |
547 | pdg = TMath::Abs(mcp->GetPdgCode()); | |
548 | } | |
549 | else | |
550 | label = -1; | |
551 | } | |
552 | else{ | |
553 | /*UInt_t detUsed =*/ fPIDCombined->ComputeProbabilities(track, PIDResponse, probP); | |
554 | } | |
555 | ||
556 | if(track->TestFilterBit(fFilterBit) && TMath::Abs(track->Eta()) < 0.8 && track->Charge() > 0){ | |
557 | hTracking[0]->Fill(track->Pt(),fCentrality); | |
558 | if(pdg == 211) | |
559 | hTracking[1]->Fill(track->Pt(),fCentrality); | |
560 | else if(pdg == 321) | |
561 | hTracking[2]->Fill(track->Pt(),fCentrality); | |
562 | else if(pdg == 2212) | |
563 | hTracking[3]->Fill(track->Pt(),fCentrality); | |
564 | else if(! mcp){ // Fill matching histo with the prob | |
565 | hTracking[1]->Fill(track->Pt(),fCentrality,probP[2]); | |
566 | hTracking[2]->Fill(track->Pt(),fCentrality,probP[3]); | |
567 | hTracking[3]->Fill(track->Pt(),fCentrality,probP[4]); | |
568 | } | |
569 | } | |
570 | ||
571 | if(!tofMatch) continue; | |
572 | ||
573 | if(track->TestFilterBit(fFilterBit) && TMath::Abs(track->Eta()) < 0.8 && track->Charge() > 0){ | |
574 | hMatching[0]->Fill(track->Pt(),fCentrality); | |
575 | if(pdg == 211) | |
576 | hMatching[1]->Fill(track->Pt(),fCentrality); | |
577 | else if(pdg == 321) | |
578 | hMatching[2]->Fill(track->Pt(),fCentrality); | |
579 | else if(pdg == 2212) | |
580 | hMatching[3]->Fill(track->Pt(),fCentrality); | |
581 | else if(! mcp){ // Fill matching histo with the prob | |
582 | hMatching[1]->Fill(track->Pt(),fCentrality,probP[2]); | |
583 | hMatching[2]->Fill(track->Pt(),fCentrality,probP[3]); | |
584 | hMatching[3]->Fill(track->Pt(),fCentrality,probP[4]); | |
585 | } | |
586 | } | |
587 | } | |
588 | ||
007df888 | 589 | // Int_t pdg1 = -1; |
590 | // Int_t pdg2 = -1; | |
a8ad4709 | 591 | |
592 | ||
593 | // start analysis Lambda | |
594 | for(Int_t i=0;i < ntrack;i++){ // loop on proton candidate tracks | |
595 | AliAODTrack* KpTrack = aodEvent->GetTrack(i); | |
596 | ||
597 | if (!KpTrack){ | |
598 | continue; | |
599 | } | |
600 | ||
601 | if(!(KpTrack->Pt() > 0.3 && TMath::Abs(KpTrack->Eta()) < 0.8)) continue; | |
602 | ||
603 | Bool_t isLambda = (KpTrack->Charge() > 0); | |
604 | ||
605 | nSigmaComb=5; | |
e34b28fe | 606 | nSigmaTOF=5; |
a8ad4709 | 607 | fPtKp=KpTrack->Pt(),fPhiKp=KpTrack->Phi(),fEtaKp=KpTrack->Eta(); |
608 | fPidKp=0; | |
609 | ||
610 | UInt_t detUsedP = fPIDCombined->ComputeProbabilities(KpTrack, PIDResponse, probP); | |
611 | ||
612 | Double_t oldpP[10]; | |
613 | fPIDCombined->GetPriors(KpTrack, oldpP, PIDResponse, detUsedP); | |
614 | ||
615 | ||
616 | nSigmaTPC = PIDResponse->NumberOfSigmasTPC(KpTrack,AliPID::kKaon); | |
617 | if(isLambda)fKaTPC[icentr]->Fill(fPtKp,nSigmaTPC); | |
618 | nSigmaTPC = PIDResponse->NumberOfSigmasTPC(KpTrack,AliPID::kElectron); | |
619 | if(isLambda) fElTPC[icentr]->Fill(fPtKp,nSigmaTPC); | |
620 | nSigmaTPC = PIDResponse->NumberOfSigmasTPC(KpTrack,AliPID::kPion); | |
621 | if(isLambda)fPiTPC[icentr]->Fill(fPtKp,nSigmaTPC); | |
622 | nSigmaTPC = PIDResponse->NumberOfSigmasTPC(KpTrack,AliPID::kProton); | |
623 | if(isLambda) fPrTPC[icentr]->Fill(fPtKp,nSigmaTPC); | |
624 | ||
625 | if(! (TMath::Abs(nSigmaTPC) < 5)) continue; | |
626 | ||
627 | Int_t tofMatch1 = (KpTrack->GetStatus() & AliVTrack::kTOFout) && (KpTrack->GetStatus() & AliVTrack::kTIME); | |
9c668341 | 628 | /* |
a8ad4709 | 629 | if(mcArray){ |
630 | Int_t labelK = TMath::Abs(KpTrack->GetLabel()); | |
631 | AliAODMCParticle *mcp1 = (AliAODMCParticle*)mcArray->At(labelK); | |
9c668341 | 632 | pdg1 = TMath::Abs(mcp1->GetPdgCode()); |
a8ad4709 | 633 | } |
9c668341 | 634 | */ |
a8ad4709 | 635 | |
636 | fPidKp = Int_t(probP[4]*100); | |
637 | ||
638 | if(tofMatch1){ | |
639 | if(!IsChannelValid(TMath::Abs(KpTrack->Eta()))){ | |
640 | // remove this tof hit | |
641 | fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC); | |
642 | detUsedP = fPIDCombined->ComputeProbabilities(KpTrack, PIDResponse, probP); | |
643 | fPIDCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF); | |
644 | fPidKp = Int_t(probP[4]*100); | |
645 | tofMatch1=0; | |
646 | } | |
647 | else{ | |
648 | if(probP[4] > probP[3] && probP[4] > probP[2] && probP[4] > probP[0]) fPidKp += 128; // max prob | |
649 | ||
650 | nSigmaTOF = PIDResponse->NumberOfSigmasTOF(KpTrack,AliPID::kElectron); | |
651 | if(isLambda) fElTOF[icentr]->Fill(fPtKp,nSigmaTOF); | |
652 | nSigmaTOF = PIDResponse->NumberOfSigmasTOF(KpTrack,AliPID::kKaon); | |
653 | if(isLambda) fKaTOF[icentr]->Fill(fPtKp,nSigmaTOF); | |
654 | nSigmaTOF = PIDResponse->NumberOfSigmasTOF(KpTrack,AliPID::kPion); | |
655 | if(isLambda) fPiTOF[icentr]->Fill(fPtKp,nSigmaTOF); | |
656 | nSigmaTOF = PIDResponse->NumberOfSigmasTOF(KpTrack,AliPID::kProton); | |
657 | if(isLambda) fPrTOF[icentr]->Fill(fPtKp,nSigmaTOF); | |
658 | ||
a8ad4709 | 659 | if(fIsMC){ |
660 | Float_t mismAdd = addMismatchForMC; | |
661 | if(KpTrack->Pt() < 1) mismAdd = addMismatchForMC/KpTrack->Pt(); | |
662 | ||
663 | if(gRandom->Rndm() < mismAdd){ | |
664 | Float_t etaAbs = TMath::Abs(KpTrack->Eta()); | |
665 | Int_t channel = Int_t(4334.09 - 4758.36 * etaAbs -1989.71 * etaAbs*etaAbs + 1957.62*etaAbs*etaAbs*etaAbs); | |
666 | channel = channel % 8736; | |
667 | Float_t distIP = fHchannelTOFdistr->GetBinContent(channel); | |
668 | ||
669 | // generate random time | |
670 | Float_t timeRandom = fHmismTOF->GetRandom() + distIP*3.35655419905265973e+00; | |
671 | Double_t times[10]; | |
672 | KpTrack->GetIntegratedTimes(times); | |
673 | nSigmaTOF = TMath::Abs(timeRandom - times[4])/PIDResponse->GetTOFResponse().GetExpectedSigma(KpTrack->P(), times[3], AliPID::kProton); | |
674 | } | |
675 | } | |
676 | ||
677 | if(fCentrality < 20 && KpTrack->Pt() < 1.3 && KpTrack->Pt() > 1.2)fTOFTPCsignal->Fill(nSigmaTOF,nSigmaTPC); | |
63d1d548 | 678 | nSigmaTOF = TMath::Abs(nSigmaTOF); |
a8ad4709 | 679 | |
680 | if(nSigmaTOF < 2) fPidKp += 256; | |
681 | else if(nSigmaTOF < 3) fPidKp += 512; | |
682 | } | |
683 | } | |
684 | ||
685 | if(tofMatch1){ | |
686 | nSigmaComb = TMath::Sqrt(nSigmaTOF*nSigmaTOF + nSigmaTPC*nSigmaTPC); | |
687 | if(nSigmaTOF < 5 && fCentrality < 20 && KpTrack->Pt() < 1.3 && KpTrack->Pt() > 1.2){ | |
688 | fCombsignal->Fill(nSigmaComb); | |
689 | } | |
690 | } else { | |
691 | nSigmaComb = TMath::Abs(nSigmaTPC); | |
692 | } | |
693 | ||
694 | // use sigmaTOF instead of sigmaComb | |
e34b28fe | 695 | if(tofMatch1) nSigmaComb = nSigmaTOF; |
a8ad4709 | 696 | |
697 | if(nSigmaComb < 2) nSigmaComb = 2; | |
698 | else if(nSigmaComb < 3) nSigmaComb = 3; | |
699 | else if(nSigmaComb < 5) nSigmaComb = 4.99; | |
700 | else nSigmaComb = 6; | |
701 | ||
702 | Int_t iks=-1; | |
703 | for(Int_t k=0;k < fNLambda;k++){ // find the Lambda which contains the positive track | |
704 | if(i == fIpP[k]) iks = k; | |
705 | } | |
706 | ||
707 | if(fPtKp > 4.299) fPtKp = 4.299; | |
708 | ||
709 | if(iks > -1 && fIpN[iks] > -1){ | |
710 | //for(Int_t j=0;j < ntrack;j++){ // loop on negative tracks | |
711 | Int_t j = fIpN[iks]; | |
712 | AliAODTrack* KnTrack = aodEvent->GetTrack(j); | |
713 | ||
714 | if (!KnTrack){ | |
715 | continue; | |
716 | } | |
717 | ||
e34b28fe | 718 | nSigmaComb2 = 5; |
719 | nSigmaTOF2 = 5; | |
720 | ||
a8ad4709 | 721 | if(!(KnTrack->Pt() > 0.3 && TMath::Abs(KnTrack->Eta()) < 0.8)) continue; |
722 | ||
723 | fPtKn=KnTrack->Pt(),fPhiKn=KnTrack->Phi(),fEtaKn=KnTrack->Eta(); | |
724 | fPidKn=0; | |
725 | ||
726 | UInt_t detUsedN = fPIDCombined->ComputeProbabilities(KnTrack, PIDResponse, probN); | |
727 | Double_t oldpN[10]; | |
728 | fPIDCombined->GetPriors(KnTrack, oldpN, PIDResponse, detUsedN); | |
729 | ||
730 | nSigmaTPC2 = PIDResponse->NumberOfSigmasTPC(KnTrack,AliPID::kPion); | |
731 | ||
732 | if(! (TMath::Abs(nSigmaTPC2) < 5)) continue; | |
733 | ||
a8ad4709 | 734 | Int_t tofMatch2 = (KnTrack->GetStatus() & AliVTrack::kTOFout) && (KnTrack->GetStatus() & AliVTrack::kTIME); |
9c668341 | 735 | /* |
a8ad4709 | 736 | if(mcArray){ |
737 | Int_t labelK = TMath::Abs(KnTrack->GetLabel()); | |
738 | AliAODMCParticle *mcp2 = (AliAODMCParticle*)mcArray->At(labelK); | |
9c668341 | 739 | pdg2 = TMath::Abs(mcp2->GetPdgCode()); |
740 | } | |
741 | */ | |
a8ad4709 | 742 | |
743 | fPidKn = Int_t(probN[2]*100); | |
744 | ||
745 | if(tofMatch2){ | |
746 | if(probN[2] > probN[3] && probN[2] > probN[4] && probN[2] > probN[0]) fPidKn += 128; // max prob | |
747 | ||
748 | nSigmaTOF2 = PIDResponse->NumberOfSigmasTOF(KnTrack,AliPID::kPion); | |
749 | ||
750 | nSigmaTOF2 = TMath::Abs(nSigmaTOF2); | |
751 | ||
752 | if(nSigmaTOF2 < 2) fPidKn += 256; | |
753 | else if(nSigmaTOF2 < 3) fPidKn += 512; | |
754 | } | |
755 | ||
756 | px = KpTrack->Px() + KnTrack->Px(); | |
757 | py = KpTrack->Py() + KnTrack->Py(); | |
758 | pz = KpTrack->Pz() + KnTrack->Pz(); | |
759 | E = TMath::Sqrt(KpTrack->P()*KpTrack->P() + 0.938e-01*0.938e-01); | |
760 | E += TMath::Sqrt(KnTrack->P()*KnTrack->P()+ 1.39e-01*1.39e-01); | |
761 | ||
762 | ksV.SetPxPyPzE(px,py,pz,E); | |
763 | fMassV0 = fMassLambda[iks]; | |
764 | ||
765 | if(fMassV0 < invMmin || fMassV0 > invMmax) continue; | |
766 | ||
767 | ||
768 | fPtLambdaC = ksV.Pt(); | |
769 | fEtaLambda = ksV.Eta(); | |
770 | fPhiLambdaC = ksV.Phi(); | |
771 | ||
772 | if(tofMatch2){ | |
773 | nSigmaComb2 = TMath::Sqrt(nSigmaTOF2*nSigmaTOF2+ nSigmaTPC2*nSigmaTPC2); | |
774 | } else { | |
775 | nSigmaComb2 = TMath::Abs(nSigmaTPC2); | |
776 | } | |
777 | ||
778 | // use sigmaTOF instead of sigmaComb | |
e34b28fe | 779 | if(tofMatch2) nSigmaComb2 = nSigmaTOF2; |
a8ad4709 | 780 | |
781 | if(nSigmaComb2 < 2) nSigmaComb2 = 2; | |
782 | else if(nSigmaComb2 < 3) nSigmaComb2 = 3; | |
783 | else if(nSigmaComb2 < 5) nSigmaComb2 = 4.99; | |
784 | else nSigmaComb2 = 6; | |
785 | ||
786 | Bool_t isTrue = kFALSE; | |
787 | ||
788 | if(mcArray){ | |
789 | Int_t labelP = TMath::Abs(KpTrack->GetLabel()); | |
790 | Int_t labelN = TMath::Abs(KnTrack->GetLabel()); | |
791 | ||
792 | if(labelP > -1 && labelN > -1){ | |
793 | AliAODMCParticle *partP = (AliAODMCParticle*)mcArray->At(labelP); | |
794 | AliAODMCParticle *partN = (AliAODMCParticle*)mcArray->At(labelN); | |
795 | ||
796 | Int_t mP = partP->GetMother(); | |
797 | Int_t mN = partN->GetMother(); | |
798 | if(mP == mN && mP > -1){ | |
799 | AliAODMCParticle *partM = (AliAODMCParticle*)mcArray->At(mP); | |
800 | Int_t pdgM = partM->GetPdgCode(); | |
801 | if(TMath::Abs(pdgM) == 3122) isTrue = kTRUE; | |
802 | } | |
803 | } | |
804 | ||
805 | } | |
806 | ||
807 | Double_t deltaphi1 = KpTrack->Phi() - fPsi; | |
808 | Double_t deltaphi2 = KnTrack->Phi() - fPsi; | |
809 | ||
810 | while(deltaphi1 > TMath::Pi()) deltaphi1 -= TMath::Pi()*2; | |
811 | while(deltaphi1 < -TMath::Pi()) deltaphi1 += TMath::Pi()*2; | |
812 | while(deltaphi2 > TMath::Pi()) deltaphi2 -= TMath::Pi()*2; | |
813 | while(deltaphi2 < -TMath::Pi()) deltaphi2 += TMath::Pi()*2; | |
814 | ||
815 | if(fPtKn > 4.299) fPtKn = 4.299; | |
816 | ||
817 | Float_t xTOfill[] = {fPtLambdaC,KpTrack->Eta(),fPtKp,fPtKn,(fPidKp%128)*0.01,(fPidKn%128)*0.01,tofMatch1,tofMatch2,isTrue,nSigmaComb,nSigmaComb2,deltaphi1,deltaphi2,fPsi}; | |
818 | Float_t xTOfill2[] = {fPtLambdaC,KpTrack->Eta(),fPtKn,fPtKp,(fPidKn%128)*0.01,(fPidKp%128)*0.01,tofMatch2,tofMatch1,isTrue,nSigmaComb2,nSigmaComb,deltaphi2,deltaphi1,fPsi}; | |
819 | ||
820 | ||
821 | Int_t ipt = 0; | |
822 | while(fPtLambdaMin[ipt] < fPtLambdaC && ipt < nPtBin){ | |
823 | ipt++; | |
824 | } | |
825 | ipt--; | |
826 | if(ipt < 0) ipt = 0; // just to be sure | |
827 | ||
828 | if(TMath::Abs(fEtaLambda) < 0.8 && fPtKp > 0.3 && fPtKn > 0.3){ | |
829 | if(isLambda) fContPid->Fill(0,fMassV0,fCentrality,xTOfill); | |
830 | else fContPid2->Fill(0,fMassV0,fCentrality,xTOfill2); | |
831 | } | |
832 | ||
833 | ||
834 | } | |
835 | } // end analysi Lambda | |
836 | } | |
837 | ||
838 | //_____________________________________________________________________________ | |
839 | Float_t AliAnalysisTaskLambdaBayes::GetVertex(AliAODEvent* aod) const | |
840 | { | |
841 | ||
842 | Float_t zvtx = -999; | |
843 | ||
844 | const AliAODVertex* vtxAOD = aod->GetPrimaryVertex(); | |
845 | if (!vtxAOD) | |
846 | return zvtx; | |
847 | if(vtxAOD->GetNContributors()>0) | |
848 | zvtx = vtxAOD->GetZ(); | |
849 | ||
850 | return zvtx; | |
851 | } | |
852 | //_____________________________________________________________________________ | |
853 | void AliAnalysisTaskLambdaBayes::Terminate(Option_t *) | |
854 | { | |
855 | // Terminate loop | |
856 | Printf("Terminate()"); | |
857 | } | |
858 | //======================================================================= | |
859 | void AliAnalysisTaskLambdaBayes::SelectLambda(){ | |
860 | fNLambda=0; | |
861 | fNpPos=0; | |
862 | fNpNeg=0; | |
863 | ||
864 | Int_t nV0s = fOutputAOD->GetNumberOfV0s(); | |
865 | AliAODv0 *myV0; | |
866 | Double_t dMASS=0.0; | |
867 | for (Int_t i=0; i!=nV0s; ++i) { | |
868 | myV0 = (AliAODv0*) fOutputAOD->GetV0(i); | |
869 | if(!myV0) continue; | |
870 | if(myV0->Pt()<0.1 || TMath::Abs(myV0->Eta()) > 0.8) continue; // skipping low momentum | |
871 | Int_t pass = PassesAODCuts(myV0,fOutputAOD,1); // check for Lambda | |
872 | if(pass) { | |
873 | if(pass==1) dMASS = myV0->MassLambda(); | |
874 | else dMASS = myV0->MassAntiLambda(); | |
875 | ||
f4c4ac9e | 876 | Float_t massKs = myV0->MassK0Short(); |
877 | ||
878 | if(TMath::Abs(dMASS-1.115)/0.005 < 8 && TMath::Abs(massKs - 0.497)/0.005 > 8){ | |
a8ad4709 | 879 | AliAODTrack *iT=(AliAODTrack*) myV0->GetDaughter(0); // positive |
880 | AliAODTrack *jT=(AliAODTrack*) myV0->GetDaughter(1); // negative | |
881 | if(iT->Charge()<0){ | |
882 | iT=(AliAODTrack*) myV0->GetDaughter(1); // positive | |
883 | jT=(AliAODTrack*) myV0->GetDaughter(0); // negative | |
884 | } | |
885 | fPhiLambda[fNLambda] = myV0->Phi(); | |
886 | fPtLambda[fNLambda] = myV0->Pt(); | |
887 | fIpP[fNLambda] = FindDaugheterIndex(iT); | |
888 | fIpN[fNLambda] = FindDaugheterIndex(jT); | |
889 | ||
890 | if(pass==2){ | |
891 | Int_t itemp = fIpP[fNLambda]; | |
892 | fIpP[fNLambda] = fIpN[fNLambda]; | |
893 | fIpN[fNLambda] = itemp; | |
894 | } | |
895 | ||
896 | fMassLambda[fNLambda] = dMASS; | |
897 | if(fIpP[fNLambda] > -1 && fIpN[fNLambda] > -1){ | |
898 | fNLambda++; | |
899 | } | |
900 | ||
901 | } | |
902 | } | |
903 | } | |
904 | } | |
905 | ||
906 | //======================================================================= | |
907 | Int_t AliAnalysisTaskLambdaBayes::PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAOD,Int_t specie) | |
908 | { | |
909 | if (myV0->GetOnFlyStatus() ) return 0; | |
910 | ||
911 | //the following is needed in order to evualuate track-quality | |
912 | AliAODTrack *iT, *jT; | |
913 | AliAODVertex *vV0s = myV0->GetSecondaryVtx(); | |
914 | Double_t pos[3],cov[6]; | |
915 | vV0s->GetXYZ(pos); | |
916 | vV0s->GetCovarianceMatrix(cov); | |
917 | const AliESDVertex vESD(pos,cov,100.,100); | |
918 | ||
919 | // TESTING CHARGE | |
920 | int iPos, iNeg; | |
921 | iT=(AliAODTrack*) myV0->GetDaughter(0); | |
922 | if(iT->Charge()>0) { | |
923 | iPos = 0; iNeg = 1; | |
924 | } else { | |
925 | iPos = 1; iNeg = 0; | |
926 | } | |
927 | // END OF TEST | |
928 | ||
929 | iT=(AliAODTrack*) myV0->GetDaughter(iPos); // positive | |
930 | ||
931 | jT=(AliAODTrack*) myV0->GetDaughter(iNeg); // negative | |
932 | ||
933 | Bool_t trkFlag = iT->TestFilterBit(fFilterBit); | |
934 | if(!trkFlag) return 0; | |
935 | Bool_t trkFlag2 = jT->TestFilterBit(fFilterBit); | |
936 | if(!trkFlag2) return 0; | |
937 | ||
938 | Double_t pvertex[3]; | |
939 | pvertex[0]=tAOD->GetPrimaryVertex()->GetX(); | |
940 | pvertex[1]=tAOD->GetPrimaryVertex()->GetY(); | |
941 | pvertex[2]=tAOD->GetPrimaryVertex()->GetZ(); | |
942 | ||
943 | Double_t dDL=myV0->DecayLengthV0( pvertex ); | |
944 | if(dDL < 0.5 || dDL > 25) return 0; | |
945 | ||
946 | Double_t dDCA=myV0->DcaV0Daughters(); | |
947 | if(dDCA >0.5) return 0; | |
948 | ||
949 | Double_t dCTP=myV0->CosPointingAngle( pvertex ); | |
950 | if(dCTP < -1) return 0; | |
951 | ||
952 | // AliESDtrack ieT( iT ); | |
953 | // Double_t dD0P=ieT.GetD(pvertex[0],pvertex[1],tAOD->GetMagneticField()); | |
954 | // if(TMath::Abs(dD0P) < 0]) return 0; | |
955 | ||
956 | // AliESDtrack jeT( jT ); | |
957 | // Double_t dD0M=jeT.GetD(pvertex[0],pvertex[1],tAOD->GetMagneticField()); | |
958 | // if(TMath::Abs(dD0M) < 0) return 0; | |
959 | ||
960 | // Double_t dD0D0=dD0P*dD0M; | |
961 | // if(dD0D0>0) return 0; | |
962 | ||
963 | // Double_t dETA=myV0->Eta(); | |
964 | // if(dETA <-0.8) return 0; | |
965 | // if(dETA >0.8) return 0; | |
966 | ||
967 | // Double_t dQT=myV0->PtArmV0(); | |
968 | // if(specie==0) if(dQT<???) return 0; | |
969 | ||
970 | Double_t dALPHA=myV0->AlphaV0(); // AlphaV0 -> AODRecoDecat::Alpha -> return 1.-2./(1.+QlProng(0)/QlProng(1)); | |
971 | if(myV0->ChargeProng(iPos)<0) dALPHA = -dALPHA; // protects for a change in convention | |
972 | ||
973 | if(specie==1 && dALPHA<0) return 2; // antilambda | |
974 | return 1; // Ks or lambda | |
975 | } | |
976 | //------------------------------------------------------------------------- | |
977 | Int_t AliAnalysisTaskLambdaBayes::FindDaugheterIndex(AliAODTrack *trk){ | |
978 | Int_t ntrack = fOutputAOD->GetNumberOfTracks(); | |
979 | ||
980 | for(Int_t i=0;i < ntrack;i++){ // loop on tracks | |
981 | AliAODTrack* track = fOutputAOD->GetTrack(i); | |
982 | if(track == trk) return i; | |
983 | } | |
984 | ||
985 | printf("Daughter for %p not found\n",trk); | |
986 | return -1; | |
987 | } | |
988 | //------------------------------------------------------------------------- | |
989 | Int_t AliAnalysisTaskLambdaBayes::IsChannelValid(Float_t etaAbs){ | |
990 | if(!fIsMC) return 1; // used only on MC | |
991 | ||
9c668341 | 992 | if( fTypeCol==2){ // LHC10h or LHC11h because of TOF matching window at 3 cm |
a8ad4709 | 993 | Int_t channel = Int_t(4334.09 - 4758.36 * etaAbs -1989.71 * etaAbs*etaAbs + 1957.62*etaAbs*etaAbs*etaAbs); |
994 | ||
995 | if(!(channel%20)) return 0; // 5% additional loss in MC | |
996 | } | |
997 | ||
998 | return 1; | |
999 | } |