]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/STRANGENESS/LambdaK0PbPb/AliAnalysisTaskCTauPbPb.cxx
Fixes for #91044: Problem for reconstructed runs that don't contain AliTOFHeader...
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / LambdaK0PbPb / AliAnalysisTaskCTauPbPb.cxx
CommitLineData
e26966dc 1#include <TCanvas.h>
2#include <TTree.h>
3#include <TFile.h>
4#include <TH1F.h>
5#include <TH2F.h>
6#include <TH3F.h>
7#include <TPDGCode.h>
8#include <TDatabasePDG.h>
9#include <TParticlePDG.h>
10#include <TParticle.h>
11#include <TROOT.h>
12
13#include "AliESDEvent.h"
14#include "AliESDv0.h"
15#include "AliESDcascade.h"
16
17#include "AliCentrality.h"
18
19#include "AliMCEvent.h"
20#include "AliStack.h"
21
22#include "AliPID.h"
23#include "AliPIDResponse.h"
24
25#include "AliInputEventHandler.h"
26#include "AliAnalysisManager.h"
27
28#include "AliAnalysisTaskCTauPbPb.h"
29
30extern TROOT *gROOT;
31
32ClassImp(AliAnalysisTaskCTauPbPb)
33
25aeb948 34static Int_t nbins=100; // number of bins
e26966dc 35static Double_t lMin=0.0, lMax=100.;
36static Double_t pMin=0.0, pMax=10.;
37static Double_t yMax=0.5;
38
39
40//
41// This is a little task for checking the c*tau of the strange particles
42//
43
44AliAnalysisTaskCTauPbPb::AliAnalysisTaskCTauPbPb(const char *name) :
45AliAnalysisTaskSE(name),
46fIsMC(kFALSE),
47fCMin(0.),
48fCMax(90.),
49fOutput(0),
50fMult(0),
51fdEdx(0),
52fdEdxPid(0),
53
54fK0sM(0),
55fK0sSi(0),
56fK0sMC(0),
57fK0sAs(0),
58
59fLambdaM(0),
60fLambdaSi(0),
61fLambdaMC(0),
62fLambdaAs(0),
63
0b384e23 64fLambdaBarM(0),
65fLambdaBarSi(0),
66fLambdaBarMC(0),
67fLambdaBarAs(0),
68
e26966dc 69fCPA(0),
70fDCA(0),
71
72fLambdaEff(0),
73fLambdaPt(0),
74
75fLambdaFromXi(0),
76fXiM(0),
0b384e23 77fXiSiP(0),
78
79fLambdaBarFromXiBar(0),
80fXiBarM(0),
81fXiBarSiP(0)
e26966dc 82{
83 // Constructor. Initialization of pointers
84 DefineOutput(1, TList::Class());
85}
86
87void AliAnalysisTaskCTauPbPb::UserCreateOutputObjects()
88{
89 fOutput = new TList();
90 fOutput->SetOwner();
91
92
93 fMult=new TH1F("fMult","Multiplicity",1100,0.,3300);
94 fMult->GetXaxis()->SetTitle("N tracks");
95 fOutput->Add(fMult);
96
97 fdEdx=new TH2F("fdEdx","dE/dx",50,0.2,3,50,0.,6.);
98 fOutput->Add(fdEdx);
99
100 fdEdxPid=new TH2F("fdEdxPid","dE/dx with PID",50,0.2,3,50,0.,6.);
101 fOutput->Add(fdEdxPid);
102
103 fK0sM =
104 new TH2F("fK0sM", "Mass for K^{0}_{s}", nbins/2, 0.448, 0.548, 10,pMin,pMax);
105 fK0sM->GetXaxis()->SetTitle("Mass [GeV/c]");
106 fOutput->Add(fK0sM);
107
108 fK0sSi =
109 new TH2F("fK0sSi","L_{T} vs p_{T} for K^{0}_{s}, side-band subtracted",
110 nbins,pMin,pMax,nbins,lMin,lMax);
111 fK0sSi->GetXaxis()->SetTitle("p_{T} [GeV/c]");
112 fK0sSi->GetYaxis()->SetTitle("L_{T} [cm]");
113 fOutput->Add(fK0sSi);
114
115 fK0sMC =
116 new TH2F("fK0sMC","L_{T} vs p_{T} for K^{0}_{s}, from MC stack",
117 nbins,pMin,pMax,nbins,lMin,lMax);
118 fK0sMC->GetXaxis()->SetTitle("p_{T} [GeV/c]");
119 fK0sMC->GetYaxis()->SetTitle("L_{T} [cm]");
120 fOutput->Add(fK0sMC);
121
122 fK0sAs =
123 new TH2F("fK0sAs", "L_{T} vs p_{T} for K^{0}_{s}, associated",
124 nbins,pMin,pMax,nbins,lMin,lMax);
125 fK0sAs->GetXaxis()->SetTitle("p_{T} [GeV/c]");
126 fK0sAs->GetYaxis()->SetTitle("L_{T} [cm]");
127 fOutput->Add(fK0sAs);
128
129 //----------------------
130
131 fLambdaM =
132 new TH2F("fLambdaM","Mass for \\Lambda", nbins, 1.065, 1.165,nbins,pMin,pMax);
e26966dc 133 fLambdaM->GetXaxis()->SetTitle("Mass [GeV/c]");
134 fOutput->Add(fLambdaM);
135
136 fLambdaSi =
137 new TH2F("fLambdaSi","L_{T} vs p_{T} for \\Lambda, side-band subtructed",
138 nbins,pMin,pMax,nbins,lMin,lMax);
139 fLambdaSi->GetXaxis()->SetTitle("p_{T} [GeV/c]");
140 fLambdaSi->GetYaxis()->SetTitle("L_{T} [cm]");
141 fOutput->Add(fLambdaSi);
142
143 fLambdaMC =
144 new TH2F("fLambdaMC","c\\tau for \\Lambda, from MC stack",
145 nbins,pMin,pMax,nbins,lMin,lMax);
146 fLambdaMC->GetXaxis()->SetTitle("p_{T} [GeV/c]");
147 fLambdaMC->GetYaxis()->SetTitle("L_{T} [cm]");
148 fOutput->Add(fLambdaMC);
149
150 fLambdaAs =
151 new TH2F("fLambdaAs","c\\tau for \\Lambda, associated",
152 nbins,pMin,pMax,nbins,lMin,lMax);
153 fLambdaAs->GetXaxis()->SetTitle("p_{T} [GeV/c]");
154 fLambdaAs->GetYaxis()->SetTitle("L_{T} [cm]");
155 fOutput->Add(fLambdaAs);
156
0b384e23 157
158 fLambdaBarM =
159 new TH2F("fLambdaBarM","Mass for anti-\\Lambda", nbins, 1.065, 1.165,nbins,pMin,pMax);
160 fLambdaBarM->GetXaxis()->SetTitle("Mass [GeV/c]");
161 fOutput->Add(fLambdaBarM);
162
163 fLambdaBarSi =
164 new TH2F("fLambdaBarSi","L_{T} vs p_{T} for anti-\\Lambda, side-band subtructed",
165 nbins,pMin,pMax,nbins,lMin,lMax);
166 fLambdaBarSi->GetXaxis()->SetTitle("p_{T} [GeV/c]");
167 fLambdaBarSi->GetYaxis()->SetTitle("L_{T} [cm]");
168 fOutput->Add(fLambdaBarSi);
169
170 fLambdaBarMC =
171 new TH2F("fLambdaBarMC","c\\tau for anti-\\Lambda, from MC stack",
172 nbins,pMin,pMax,nbins,lMin,lMax);
173 fLambdaBarMC->GetXaxis()->SetTitle("p_{T} [GeV/c]");
174 fLambdaBarMC->GetYaxis()->SetTitle("L_{T} [cm]");
175 fOutput->Add(fLambdaBarMC);
176
177 fLambdaBarAs =
178 new TH2F("fLambdaBarAs","c\\tau for anti-\\Lambda, associated",
179 nbins,pMin,pMax,nbins,lMin,lMax);
180 fLambdaBarAs->GetXaxis()->SetTitle("p_{T} [GeV/c]");
181 fLambdaBarAs->GetYaxis()->SetTitle("L_{T} [cm]");
182 fOutput->Add(fLambdaBarAs);
183
184
185
e26966dc 186 fCPA=new TH1F("fCPA","Cosine of the pointing angle",30,0.9978,1.);
187 fOutput->Add(fCPA);
188 fDCA=new TH1F("fDCA","DCA between the daughters",30,0.,1.1);
189 fOutput->Add(fDCA);
190
191 fLambdaEff=fLambdaAs->ProjectionX();
192 fLambdaEff->SetName("fLambdaEff");
193 fLambdaEff->SetTitle("Efficiency for #Lambda");
194 fOutput->Add(fLambdaEff);
195
196 fLambdaPt=fLambdaAs->ProjectionX();
197 fLambdaPt->SetName("fLambdaPt");
198 fLambdaPt->SetTitle("Raw #Lambda pT spectrum");
199 fOutput->Add(fLambdaPt);
200
201 //----------------------
202
0b384e23 203 fLambdaFromXi=new TH3F("fLambdaFromXi","L_{T} vs p_{T} vs p_{T} of \\Xi for \\Lambda from \\Xi",
e26966dc 204 nbins,pMin,pMax,nbins,lMin,lMax,33,pMin,pMax+2);
205 fOutput->Add(fLambdaFromXi);
206
207 fXiM =
208 new TH2F("fXiM", "\\Xi mass distribution", 50, 1.271, 1.371,12,pMin,pMax+2);
209 fOutput->Add(fXiM);
210
211 fXiSiP = new TH1F("fXiSiP", "Pt for \\Xi, side-band subracted",
212 33,pMin,pMax+2);
213 fOutput->Add(fXiSiP);
214
215
0b384e23 216 fLambdaBarFromXiBar=new TH3F("fLambdaBarFromXiBar","L_{T} vs p_{T} vs p_{T} of anti-\\Xi for anti-\\Lambda from anti-\\Xi",
217 nbins,pMin,pMax,nbins,lMin,lMax,33,pMin,pMax+2);
218 fOutput->Add(fLambdaBarFromXiBar);
219
220 fXiBarM =
221 new TH2F("fXiBarM", "anti-\\Xi mass distribution", 50, 1.271, 1.371,12,pMin,pMax+2);
222 fOutput->Add(fXiBarM);
223
224 fXiBarSiP = new TH1F("fXiBarSiP", "Pt for anti-\\Xi, side-band subracted",
225 33,pMin,pMax+2);
226 fOutput->Add(fXiBarSiP);
227
228
e26966dc 229 PostData(1, fOutput);
230}
231
232static Bool_t AcceptTrack(const AliESDtrack *t) {
233 if (!t->IsOn(AliESDtrack::kTPCrefit)) return kFALSE;
234 if (t->GetKinkIndex(0)>0) return kFALSE;
235
236 Float_t nCrossedRowsTPC = t->GetTPCClusterInfo(2,1);
237 if (nCrossedRowsTPC < 70) return kFALSE;
238 Int_t findable=t->GetTPCNclsF();
239 if (findable <= 0) return kFALSE;
240 if (nCrossedRowsTPC/findable < 0.8) return kFALSE;
241
ff909752 242 if (TMath::Abs(t->Eta()) > 0.8) return kFALSE;
243
e26966dc 244 return kTRUE;
245}
246
247static Bool_t AcceptV0(const AliESDv0 *v0, const AliESDEvent *esd) {
248
249 if (v0->GetOnFlyStatus()) return kFALSE;
250
251 if (v0->Pt() < pMin) return kFALSE;
252
253 Int_t nidx=TMath::Abs(v0->GetNindex());
254 AliESDtrack *ntrack=esd->GetTrack(nidx);
255 if (!AcceptTrack(ntrack)) return kFALSE;
256
257 Int_t pidx=TMath::Abs(v0->GetPindex());
258 AliESDtrack *ptrack=esd->GetTrack(pidx);
259 if (!AcceptTrack(ptrack)) return kFALSE;
260
261 Float_t xy,z0;
262 ntrack->GetImpactParameters(xy,z0);
263 if (TMath::Abs(xy)<0.1) return kFALSE;
264 ptrack->GetImpactParameters(xy,z0);
265 if (TMath::Abs(xy)<0.1) return kFALSE;
266
267 Double_t dca=v0->GetDcaV0Daughters();
268 if (dca>1.0) return kFALSE;
269 //if (dca>0.7) return kFALSE;
270 //if (dca>0.4) return kFALSE;
271
272 Double_t cpa=v0->GetV0CosineOfPointingAngle();
273 if (cpa<0.998) return kFALSE;
274 //if (cpa<0.99875) return kFALSE;
275 //if (cpa<0.9995) return kFALSE;
276
277 Double_t xx,yy,zz; v0->GetXYZ(xx,yy,zz);
278 Double_t r2=xx*xx + yy*yy;
279 if (r2<0.9*0.9) return kFALSE;
280 if (r2>100*100) return kFALSE;
281
282 return kTRUE;
283}
284
285static Bool_t AcceptCascade(const AliESDcascade *cs, const AliESDEvent *esd) {
286
287 if (cs->Pt() < pMin) return kFALSE;
288
289 Int_t bidx=TMath::Abs(cs->GetBindex());
290 AliESDtrack *btrack=esd->GetTrack(bidx);
291 if (!AcceptTrack(btrack)) return kFALSE;
292
293 Float_t xy,z0;
294 btrack->GetImpactParameters(xy,z0);
295 if (TMath::Abs(xy)<0.03) return kFALSE;
296
297 const AliESDVertex *vtx=esd->GetPrimaryVertexSPD();
298 if (!vtx->GetStatus()) {
299 vtx=esd->GetPrimaryVertexTracks();
300 if (!vtx->GetStatus()) return kFALSE;
301 }
302 Double_t xv=vtx->GetXv(), yv=vtx->GetYv(), zv=vtx->GetZv();
303 if (cs->GetCascadeCosineOfPointingAngle(xv,yv,zv) < 0.999) return kFALSE;
304
305 if (cs->GetDcaXiDaughters() > 0.3) return kFALSE;
306
307 return kTRUE;
308}
309
1c102c9a 310static Bool_t AcceptPID(const AliPIDResponse *pidResponse,
311 const AliESDtrack *ptrack, AliStack *stack) {
312
313 Bool_t isProton=kTRUE;
314
315 if (stack) {
316 // MC PID
317 Int_t ntrk=stack->GetNtrack();
318 Int_t plab=TMath::Abs(ptrack->GetLabel());
319 if (plab>=0)
320 if (plab<ntrk) {
321 TParticle *pp=stack->Particle(plab);
c95561aa 322 if (pp->GetPDG()->Charge() > 0) {
323 if (pp->GetPdgCode() != kProton) isProton=kFALSE;
324 } else {
325 if (pp->GetPdgCode() != kProtonBar) isProton=kFALSE;
326 }
1c102c9a 327 }
328 } else {
329 // Real PID
330 const AliExternalTrackParam *par=ptrack->GetInnerParam();
331 if (par)
332 if (par->GetP()<1.) {
333 Double_t nsig=pidResponse->NumberOfSigmasTPC(ptrack,AliPID::kProton);
334 if (TMath::Abs(nsig) > 3.) isProton=kFALSE;
335 }
336 }
337
338 return isProton;
339}
340
e26966dc 341void AliAnalysisTaskCTauPbPb::UserExec(Option_t *)
342{
343
344 AliESDEvent *esd=(AliESDEvent *)InputEvent();
345
346 if (!esd) {
347 Printf("ERROR: esd not available");
348 return;
349 }
350
0b384e23 351 // Vertex selection
352 const AliESDVertex *vtx=esd->GetPrimaryVertexSPD();
353 if (!vtx->GetStatus()) {
354 vtx=esd->GetPrimaryVertexTracks();
355 if (!vtx->GetStatus()) return;
356 }
357 Double_t xv=vtx->GetXv(), yv=vtx->GetYv(), zv=vtx->GetZv();
358
359 if (TMath::Abs(zv) > 10.) return ;
360
e26966dc 361
362 // Physics selection
363 AliAnalysisManager *mgr= AliAnalysisManager::GetAnalysisManager();
364 AliInputEventHandler *hdr=(AliInputEventHandler*)mgr->GetInputEventHandler();
365 UInt_t maskIsSelected = hdr->IsEventSelected();
366 Bool_t isSelected = (maskIsSelected & AliVEvent::kMB);
367 if (!isSelected) return;
368
0b384e23 369
370 fMult->Fill(-100); //event counter
371
372
e26966dc 373 // Centrality selection
374 AliCentrality *cent=esd->GetCentrality();
375 if (!cent->IsEventInCentralityClass(fCMin,fCMax,"V0M")) return;
376
e26966dc 377 AliPIDResponse *pidResponse = hdr->GetPIDResponse();
378
e26966dc 379
380 //+++++++ MC
381 AliStack *stack = 0x0;
382 Double_t mcXv=0., mcYv=0., mcZv=0.;
383
384 if (fIsMC) {
385 AliMCEvent *mcEvent = MCEvent();
386 stack = mcEvent->Stack();
387 if (!stack) {
388 Printf("ERROR: stack not available");
389 return;
390 }
391
392 const AliVVertex *mcVtx=mcEvent->GetPrimaryVertex();
393
394 mcXv=mcVtx->GetX(); mcYv=mcVtx->GetY(); mcZv=mcVtx->GetZ();
395
396 Int_t ntrk=stack->GetNtrack(), ntrk0=ntrk;
397 while (ntrk--) {
398 TParticle *p0=stack->Particle(ntrk);
399 Int_t code=p0->GetPdgCode();
400 if (code != kK0Short)
0b384e23 401 if (code != kLambda0)
402 if (code != kLambda0Bar) continue;
e26966dc 403
404 Int_t plab=p0->GetFirstDaughter(), nlab=p0->GetLastDaughter();
405 if (nlab==plab) continue;
406 if (nlab<0) continue;
407 if (plab<0) continue;
408 if (nlab>=ntrk0) continue;
409 if (plab>=ntrk0) continue;
410 TParticle *part = stack->Particle(plab);
411 if (!part) continue;
412 TParticlePDG *partPDG = part->GetPDG();
413 if (!partPDG) continue;
414 Double_t charge=partPDG->Charge();
415 if (charge == 0.) continue;
416
417 Double_t pt=p0->Pt();
418 if (pt<pMin) continue;
419 if (TMath::Abs(p0->Y())>yMax) continue;
420
421 Double_t x=p0->Vx(), y=p0->Vy(), z=p0->Vz();
422 Double_t dx=mcXv-x, dy=mcYv-y, dz=mcZv-z;
423 Double_t l=TMath::Sqrt(dx*dx + dy*dy + dz*dz);
424
0b384e23 425 if (l > 0.001) continue; // secondary V0
e26966dc 426
427 x=part->Vx(); y=part->Vy();
428 dx=mcXv-x; dy=mcYv-y;
429 Double_t lt=TMath::Sqrt(dx*dx + dy*dy);
430
431 if (code == kK0Short) {
432 fK0sMC->Fill(pt,lt);
433 }
434 if (code == kLambda0) {
435 fLambdaMC->Fill(pt,lt);
436 }
0b384e23 437 if (code == kLambda0Bar) {
438 fLambdaBarMC->Fill(pt,lt);
439 }
e26966dc 440 }
441 }
0b384e23 442 //+++++++
e26966dc 443
444
076bd7b1 445 Int_t ntrk1=esd->GetNumberOfTracks();
e26966dc 446 Int_t mult=0;
076bd7b1 447 for (Int_t i=0; i<ntrk1; i++) {
e26966dc 448 AliESDtrack *t=esd->GetTrack(i);
449 if (!t->IsOn(AliESDtrack::kTPCrefit)) continue;
450 Float_t xy,z0;
451 t->GetImpactParameters(xy,z0);
452 if (TMath::Abs(xy)>3.) continue;
453 if (TMath::Abs(z0)>3.) continue;
454 Double_t pt=t->Pt(),pz=t->Pz();
455 if (TMath::Abs(pz/pt)>0.8) continue;
456 mult++;
457
458 Double_t p=t->GetInnerParam()->GetP();
459 Double_t dedx=t->GetTPCsignal()/47.;
460 fdEdx->Fill(p,dedx,1);
461
1c102c9a 462 Double_t nsig=pidResponse->NumberOfSigmasTPC(t,AliPID::kProton);
e26966dc 463 if (TMath::Abs(nsig) < 3.) fdEdxPid->Fill(p,dedx,1);
464
465 }
466 fMult->Fill(mult);
467
468
469 Int_t nv0 = esd->GetNumberOfV0s();
470 while (nv0--) {
471 AliESDv0 *v0=esd->GetV0(nv0);
472
473 if (!AcceptV0(v0,esd)) continue;
474
475 Int_t nidx=TMath::Abs(v0->GetNindex());
476 AliESDtrack *ntrack=esd->GetTrack(nidx);
477 Int_t pidx=TMath::Abs(v0->GetPindex());
478 AliESDtrack *ptrack=esd->GetTrack(pidx);
479
480 Double_t x,y,z; v0->GetXYZ(x,y,z);
076bd7b1 481 Double_t dx1=x-xv, dy1=y-yv;
482 Double_t lt=TMath::Sqrt(dx1*dx1 + dy1*dy1);
e26966dc 483
484 Double_t pt=v0->Pt();
485
486 Bool_t ctK=kTRUE; if (0.4977*lt/pt > 3*2.68) ctK=kFALSE;
487 Bool_t ctL=kTRUE; if (1.1157*lt/pt > 3*7.89) ctL=kFALSE;
488
0b384e23 489 Bool_t isProton =AcceptPID(pidResponse, ptrack, stack);
490 Bool_t isProtonBar=AcceptPID(pidResponse, ntrack, stack);
1c102c9a 491
e26966dc 492 //+++++++ MC
493 if (stack) {
494 Int_t ntrk=stack->GetNtrack();
495
496 Int_t nlab=TMath::Abs(ntrack->GetLabel());
e26966dc 497 if (nlab<0) goto noas;
498 if (nlab>=ntrk) goto noas;
1c102c9a 499 TParticle *np=stack->Particle(nlab);
500
501 Int_t plab=TMath::Abs(ptrack->GetLabel());
e26966dc 502 if (plab<0) goto noas;
503 if (plab>=ntrk) goto noas;
e26966dc 504 TParticle *pp=stack->Particle(plab);
1c102c9a 505
e26966dc 506 Int_t i0=pp->GetFirstMother();
507 //if (np->GetFirstMother() != i0) goto noas;
508
509 Int_t in0=np->GetFirstMother();
510 if (in0<0) goto noas;
511 if (in0>=ntrk) goto noas;
512 if (in0 != i0) { // did the negative daughter decay ?
513 TParticle *nnp=stack->Particle(in0);
514 if (nnp->GetFirstMother() != i0) goto noas;
515 }
516
517 if (i0<0) goto noas;
518 if (i0>=ntrk) goto noas;
519 TParticle *p0=stack->Particle(i0);
520
521 Int_t code=p0->GetPdgCode();
522 if (code != kK0Short)
0b384e23 523 if (code != kLambda0)
524 if (code != kLambda0Bar) goto noas;
e26966dc 525
526 if (p0->Pt()<pMin) goto noas;
527 if (TMath::Abs(p0->Y())>yMax ) goto noas;
528
529
530 Double_t dz=mcZv - p0->Vz(), dy=mcYv - p0->Vy(), dx=mcXv - p0->Vx();
531 Double_t l = TMath::Sqrt(dx*dx + dy*dy + dz*dz);
532
533 dx = mcXv - pp->Vx(); dy = mcYv - pp->Vy();
534 Double_t ltAs=TMath::Sqrt(dx*dx + dy*dy);
535 Double_t ptAs=p0->Pt();
536
0b384e23 537 if (l > 0.001) { // Secondary V0
538 if (code != kLambda0)
539 if (code != kLambda0Bar) goto noas;
e26966dc 540 Int_t nx=p0->GetFirstMother();
541 if (nx<0) goto noas;
542 if (nx>=ntrk) goto noas;
543 TParticle *xi=stack->Particle(nx);
544 Int_t xcode=xi->GetPdgCode();
0b384e23 545 if (code == kLambda0) {
546 if ( xcode != kXiMinus )
547 if ( xcode != 3322 ) goto noas;
548 fLambdaFromXi->Fill(ptAs,ltAs,xi->Pt());
549 } else if (code == kLambda0Bar) {
550 if ( xcode != kXiPlusBar )
551 if ( xcode != -3322 ) goto noas;
552 fLambdaBarFromXiBar->Fill(ptAs,ltAs,xi->Pt());
553 }
e26966dc 554 } else {
555 if (code == kLambda0) {
556 if (ctL) fLambdaAs->Fill(ptAs,ltAs);
0b384e23 557 } else if (code == kLambda0Bar) {
558 if (ctL) fLambdaBarAs->Fill(ptAs,ltAs);
e26966dc 559 } else {
560 if (ctK) fK0sAs->Fill(ptAs,ltAs);
561 }
562 }
563
564 }
565 //++++++++
566
567 noas:
568
569 Double_t dca=v0->GetDcaV0Daughters();
570 Double_t cpa=v0->GetV0CosineOfPointingAngle();
571
572 Double_t mass=0., m=0., s=0.;
573 if (ctK)
574 if (TMath::Abs(v0->RapK0Short())<yMax) {
575 v0->ChangeMassHypothesis(kK0Short);
576
577 mass=v0->GetEffMass();
578 fK0sM->Fill(mass,pt);
579
580 m=TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass();
581 s=0.0044 + (0.008-0.0044)/(10-1)*(pt - 1.);
582 if (TMath::Abs(m-mass) < 3*s) {
583 fK0sSi->Fill(pt,lt);
584 }
585 if (TMath::Abs(m-mass + 4.5*s) < 1.5*s) {
586 fK0sSi->Fill(pt,lt,-1);
587 }
588 if (TMath::Abs(m-mass - 4.5*s) < 1.5*s) {
589 fK0sSi->Fill(pt,lt,-1);
590 }
591 }
592
593 if (ctL)
1c102c9a 594 if (isProton)
e26966dc 595 if (TMath::Abs(v0->RapLambda())<yMax) {
e26966dc 596 v0->ChangeMassHypothesis(kLambda0);
597
598 mass=v0->GetEffMass();
599 fLambdaM->Fill(mass,pt);
600
601 m=TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass();
602 //s=0.0027 + (0.004-0.0027)/(10-1)*(pt-1);
603 //s=0.0015 + (0.002-0.0015)/(2.6-1)*(pt-1);
604 s=0.0023 + (0.004-0.0023)/(6-1)*(pt-1);
605 if (TMath::Abs(m-mass) < 3*s) {
606 fLambdaSi->Fill(pt,lt);
607 fCPA->Fill(cpa,1);
608 fDCA->Fill(dca,1);
609 }
610 if (TMath::Abs(m-mass + 4.5*s) < 1.5*s) {
611 fLambdaSi->Fill(pt,lt,-1);
612 fCPA->Fill(cpa,-1);
613 fDCA->Fill(dca,-1);
614 }
615 if (TMath::Abs(m-mass - 4.5*s) < 1.5*s) {
616 fLambdaSi->Fill(pt,lt,-1);
617 fCPA->Fill(cpa,-1);
618 fDCA->Fill(dca,-1);
619 }
620 }
0b384e23 621
622 if (ctL)
623 if (isProtonBar)
624 if (TMath::Abs(v0->RapLambda())<yMax) {
625 v0->ChangeMassHypothesis(kLambda0Bar);
626
627 mass=v0->GetEffMass();
628 fLambdaBarM->Fill(mass,pt);
629
630 m=TDatabasePDG::Instance()->GetParticle(kLambda0Bar)->Mass();
631 //s=0.0027 + (0.004-0.0027)/(10-1)*(pt-1);
632 //s=0.0015 + (0.002-0.0015)/(2.6-1)*(pt-1);
633 s=0.0023 + (0.004-0.0023)/(6-1)*(pt-1);
634 if (TMath::Abs(m-mass) < 3*s) {
635 fLambdaBarSi->Fill(pt,lt);
636 fCPA->Fill(cpa,1);
637 fDCA->Fill(dca,1);
638 }
639 if (TMath::Abs(m-mass + 4.5*s) < 1.5*s) {
640 fLambdaBarSi->Fill(pt,lt,-1);
641 fCPA->Fill(cpa,-1);
642 fDCA->Fill(dca,-1);
643 }
644 if (TMath::Abs(m-mass - 4.5*s) < 1.5*s) {
645 fLambdaBarSi->Fill(pt,lt,-1);
646 fCPA->Fill(cpa,-1);
647 fDCA->Fill(dca,-1);
648 }
649 }
e26966dc 650 }
651
652 Double_t kine0;
653 Int_t ncs=esd->GetNumberOfCascades();
654 for (Int_t i=0; i<ncs; i++) {
655 AliESDcascade *cs=esd->GetCascade(i);
656
657 if (TMath::Abs(cs->RapXi()) > yMax) continue;
658 if (!AcceptCascade(cs,esd)) continue;
659
660 AliESDv0 *v0 = (AliESDv0*)cs;
661 if (TMath::Abs(v0->RapLambda()) > yMax) continue;
662 if (!AcceptV0(v0,esd)) continue;
663
664 Double_t pt=cs->Pt();
665
1c102c9a 666 Int_t pidx=TMath::Abs(v0->GetPindex());
667 AliESDtrack *ptrack=esd->GetTrack(pidx);
0b384e23 668 Bool_t isProton =AcceptPID(pidResponse, ptrack, stack);
1c102c9a 669
0b384e23 670 Int_t nidx=TMath::Abs(v0->GetNindex());
671 AliESDtrack *ntrack=esd->GetTrack(nidx);
672 Bool_t isProtonBar=AcceptPID(pidResponse, ntrack, stack);
1c102c9a 673
e26966dc 674 Int_t charge=cs->Charge();
1c102c9a 675 if (isProton)
e26966dc 676 if (charge < 0) {
e26966dc 677 cs->ChangeMassHypothesis(kine0,kXiMinus);
678 Double_t mass=cs->GetEffMassXi();
679 pt=cs->Pt();
680 fXiM->Fill(mass,pt);
681 Double_t m=TDatabasePDG::Instance()->GetParticle(kXiMinus)->Mass();
682 //Double_t s=0.0037;
683 Double_t s=0.002 + (0.0032-0.002)/(6-1.5)*(pt-1.5);
684 if (TMath::Abs(m-mass) < 3*s) {
685 fXiSiP->Fill(pt);
686 }
687 if (TMath::Abs(m-mass + 4.5*s) < 1.5*s) {
688 fXiSiP->Fill(pt,-1);
689 }
690 if (TMath::Abs(m-mass - 4.5*s) < 1.5*s) {
691 fXiSiP->Fill(pt,-1);
692 }
693 }
0b384e23 694 if (isProtonBar)
695 if (charge > 0) {
696 cs->ChangeMassHypothesis(kine0,kXiPlusBar);
697 Double_t mass=cs->GetEffMassXi();
698 pt=cs->Pt();
699 fXiBarM->Fill(mass,pt);
700 Double_t m=TDatabasePDG::Instance()->GetParticle(kXiPlusBar)->Mass();
701 //Double_t s=0.0037;
702 Double_t s=0.002 + (0.0032-0.002)/(6-1.5)*(pt-1.5);
703 if (TMath::Abs(m-mass) < 3*s) {
704 fXiBarSiP->Fill(pt);
705 }
706 if (TMath::Abs(m-mass + 4.5*s) < 1.5*s) {
707 fXiBarSiP->Fill(pt,-1);
708 }
709 if (TMath::Abs(m-mass - 4.5*s) < 1.5*s) {
710 fXiBarSiP->Fill(pt,-1);
711 }
712 }
e26966dc 713 }
714
715}
716
717void AliAnalysisTaskCTauPbPb::Terminate(Option_t *)
718{
719 // The Terminate() function is the last function to be called during
720 // a query. It always runs on the client, it can be used to present
721 // the results graphically or save the results to file.
722
723 fOutput=(TList*)GetOutputData(1);
724 if (!fOutput) {
725 Printf("ERROR: fOutput not available");
726 return;
727 }
728
729 fMult = dynamic_cast<TH1F*>(fOutput->FindObject("fMult")) ;
730 if (!fMult) {
731 Printf("ERROR: fMult not available");
732 return;
733 }
734
735 fdEdx = dynamic_cast<TH2F*>(fOutput->FindObject("fdEdx")) ;
736 if (!fdEdx) {
737 Printf("ERROR: fdEdx not available");
738 return;
739 }
740
741 fdEdxPid = dynamic_cast<TH2F*>(fOutput->FindObject("fdEdxPid")) ;
742 if (!fdEdxPid) {
743 Printf("ERROR: fdEdxPid not available");
744 return;
745 }
746
747
748 fK0sMC = dynamic_cast<TH2F*>(fOutput->FindObject("fK0sMC")) ;
749 if (!fK0sMC) {
750 Printf("ERROR: fK0sMC not available");
751 return;
752 }
753 TH1D *k0sMcPx=fK0sMC->ProjectionX(); k0sMcPx->Sumw2();
754 fK0sAs = dynamic_cast<TH2F*>(fOutput->FindObject("fK0sAs")) ;
755 if (!fK0sAs) {
756 Printf("ERROR: fK0sAs not available");
757 return;
758 }
759 TH1D *k0sAsPx=fK0sAs->ProjectionX();
760 k0sAsPx->Sumw2(); //k0sAsPx->Scale(0.69);
761
762
763
764 fLambdaFromXi = dynamic_cast<TH3F*>(fOutput->FindObject("fLambdaFromXi")) ;
765 if (!fLambdaFromXi) {
766 Printf("ERROR: fLambdaFromXi not available");
767 return;
768 }
769 TH1D *lambdaFromXiPx=fLambdaFromXi->ProjectionX(); lambdaFromXiPx->Sumw2();
770
771
772 fLambdaMC = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaMC")) ;
773 if (!fLambdaMC) {
774 Printf("ERROR: fLambdaMC not available");
775 return;
776 }
777 TH1D *lambdaMcPx=fLambdaMC->ProjectionX(); lambdaMcPx->Sumw2();
778
779 fLambdaAs = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaAs")) ;
780 if (!fLambdaAs) {
781 Printf("ERROR: fLambdaAs not available");
782 return;
783 }
784 TH1D *lambdaAsPx=fLambdaAs->ProjectionX();
785 lambdaAsPx->Sumw2(); //lambdaAsPx->Scale(0.64);
786
787 fLambdaSi = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaSi")) ;
788 if (!fLambdaSi) {
789 Printf("ERROR: fLambdaSi not available");
790 return;
791 }
792 TH1D *lambdaSiPx=fLambdaSi->ProjectionX();
793 lambdaSiPx->SetName("fLambdaPt");
794 lambdaSiPx->Sumw2();
795
796 fLambdaEff = dynamic_cast<TH1D*>(fOutput->FindObject("fLambdaEff")) ;
797 if (!fLambdaEff) {
798 Printf("ERROR: fLambdaEff not available");
799 return;
800 }
801 fLambdaPt = dynamic_cast<TH1D*>(fOutput->FindObject("fLambdaPt")) ;
802 if (!fLambdaPt) {
803 Printf("ERROR: fLambdaPt not available");
804 return;
805 }
806
807
808 if (!gROOT->IsBatch()) {
809
810 TCanvas *c1 = new TCanvas("c1","Mulitplicity");
811 c1->SetLogy();
812 fMult->DrawCopy() ;
813
814 new TCanvas("c2","dE/dx");
815 fdEdx->DrawCopy() ;
816
817 new TCanvas("c3","dE/dx with PID");
818 fdEdxPid->DrawCopy() ;
819
820 if (fIsMC) {
821 /*
822 TH1D effK(*k0sAsPx); effK.SetTitle("Efficiency for K0s");
823 effK.Divide(k0sAsPx,k0sMcPx,1,1,"b");
824 new TCanvas("c4","Efficiency for K0s");
825 effK.DrawCopy("E") ;
826 */
827
828 fLambdaEff->Divide(lambdaAsPx,lambdaMcPx,1,1,"b");
829 new TCanvas("c5","Efficiency for #Lambda");
830 fLambdaEff->DrawCopy("E") ;
831
832 lambdaSiPx->Add(lambdaFromXiPx,-1);
833 lambdaSiPx->Divide(fLambdaEff);
834
835 new TCanvas("c6","Corrected #Lambda pt");
836 lambdaSiPx->SetTitle("Corrected #Lambda pt");
837 *fLambdaPt = *lambdaSiPx;
838 fLambdaPt->SetLineColor(2);
839 fLambdaPt->DrawCopy("E");
840
841 lambdaMcPx->DrawCopy("same");
842
843 } else {
844 new TCanvas("c6","Raw #Lambda pt");
845 lambdaSiPx->SetTitle("Raw #Lambda pt");
846 *fLambdaPt = *lambdaSiPx;
847 fLambdaPt->SetLineColor(2);
848 fLambdaPt->DrawCopy("E");
849 }
850 }
851}