]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/STRANGENESS/LambdaK0PbPb/AliV0CutVariations.C
An effective FD corretion
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / LambdaK0PbPb / AliV0CutVariations.C
CommitLineData
dc9b43d9 1#define AliV0CutVariations_cxx
2// The class definition in AliV0CutVariations.h has been generated automatically
3// by the ROOT utility TTree::MakeSelector(). This class is derived
4// from the ROOT class TSelector. For more information on the TSelector
5// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
6
7// The following methods are defined in this file:
8// Begin(): called every time a loop on the tree starts,
9// a convenient place to create your histograms.
10// SlaveBegin(): called after Begin(), when on PROOF called only on the
11// slave servers.
12// Process(): called for each event, in this function you decide what
13// to read and fill your histograms.
14// SlaveTerminate: called at the end of the loop on the tree, when on PROOF
15// called only on the slave servers.
16// Terminate(): called at the end of the loop on the tree,
17// a convenient place to draw/fit your histograms.
18//
19// To use this file, try the following session on your Tree T:
20//
21// Root > T->Process("AliV0CutVariations.C")
22// Root > T->Process("AliV0CutVariations.C","some options")
23// Root > T->Process("AliV0CutVariations.C+")
24//
25
26#include "AliV0CutVariations.h"
27
28#include "Riostream.h"
29#include "TCanvas.h"
30#include "TPDGCode.h"
31#include <TDatabasePDG.h>
32#include <TH2.h>
33#include <TStyle.h>
34#include <TH1F.h>
35#include <TH2F.h>
36#include <TH3F.h>
37
38AliV0CutVariations::AliV0CutVariations(TTree * /*tree*/ ) :
39fChain(0),
40fIsMC(kFALSE),
fe424a32 41fSelectNonInjected(kFALSE),
dc9b43d9 42fCMin(0.),
43fCMax(90.),
44fCPA(0.9975),
45fDCA(1.0),
46fTPCcr(70.),
47fTPCcrfd(0.8),
48fDCApv(0.1),
49fMult(0),
50fdEdx(0),
51fdEdxPid(0),
52fCosPA(0),
53fDtrDCA(0),
54fTPCrows(0),
55fTPCratio(0),
56fPrimDCA(0),
57
58fK0sM(0),
59fK0sSi(0),
60fK0sMC(0),
61fK0sAs(0),
62
63fLambdaM(0),
64fLambdaSi(0),
65fLambdaMC(0),
66fLambdaAs(0),
67
68fLambdaEff(0),
69fLambdaPt(0),
70
71fLambdaBarM(0),
72fLambdaBarSi(0),
73fLambdaBarMC(0),
74fLambdaBarAs(0),
75
76fLambdaBarEff(0),
77fLambdaBarPt(0),
78
79fLambdaFromXi(0),
80fXiM(0),
81fXiSiP(0),
82
83fLambdaBarFromXiBar(0),
84fXiBarM(0),
85fXiBarSiP(0)
86{ }
87
88void AliV0CutVariations::Begin(TTree * /*tree*/)
89{
90 // The Begin() function is called at the start of the query.
91 // When running with PROOF Begin() is only called on the client.
92 // The tree argument is deprecated (on PROOF 0 is passed).
93
94 TString option = GetOption();
95
96}
97
98void AliV0CutVariations::SlaveBegin(TTree * tree)
99{
100 // The SlaveBegin() function is called after the Begin() function.
101 // When running with PROOF SlaveBegin() is called on each slave server.
102 // The tree argument is deprecated (on PROOF 0 is passed).
103
104 Init(tree);
105
a0820959 106 //cout<<tree->GetEntries()<<endl;
dc9b43d9 107
a0820959 108 TString option = GetOption();
dc9b43d9 109
110 Int_t lbins=100; // number of bins in lt
111 Int_t kbins=33; // number of bins in pt of Xi
112 Double_t ltMax=100.;
113 Double_t ptMax=12.;
114
115 const Double_t xBins[]={
116 0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,
117 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,
118 2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,
119 4.5,5.0,5.5,6.5,8.0,10.0,12.0
120 };
121 const Int_t nBins=sizeof(xBins)/sizeof(Double_t) - 1;
122
123 Double_t yBins[lbins+1];
124 for (Int_t i=0; i<=(lbins+1); i++) yBins[i]=i*ltMax/lbins;
125 Double_t zBins[kbins+1];
126 for (Int_t i=0; i<=(kbins+1); i++) zBins[i]=i*(ptMax+2)/kbins;
127
128
129 //fMult=new TH1F("fMult","Multiplicity",1100,0.,3300);
130 //fMult->GetXaxis()->SetTitle("N tracks");
131 fMult=new TH1F("fMult","Centrality",100,0.,100);
132 fMult->GetXaxis()->SetTitle("Centrality (%)");
133 fOutput->Add(fMult);
134
135
136 fCosPA=new TH1F("fCosPA","Cos(PA) distribution",50,0.9975,1.0005);
137 fCosPA->GetXaxis()->SetTitle("Cos(PA)");
138 fOutput->Add(fCosPA);
139
140 fDtrDCA=new TH1F("fDtrDCA","DCA between V0 daughters",50,0.0,1.5);
141 fDtrDCA->GetXaxis()->SetTitle("DCA (rel. u.)");
142 fOutput->Add(fDtrDCA);
143
144 fTPCrows=new TH1F("fTPCrows","TPC crossed pad rows",180,0.,180.);
145 fTPCrows->GetXaxis()->SetTitle("TPC crossed pad rows");
146 fOutput->Add(fTPCrows);
147
148 fTPCratio=new TH1F("fTPCratio","TPC crossed/findable pad rows",50,0.0,1.5);
149 fTPCratio->GetXaxis()->SetTitle("TPC crossed/findable pad rows");
150 fOutput->Add(fTPCratio);
151
152 fPrimDCA=new TH1F("fPrimDCA","DCA wrt the primary vertex",50,0.0,1.5);
153 fPrimDCA->GetXaxis()->SetTitle("DCA wrt the PV (cm)");
154 fOutput->Add(fPrimDCA);
155
156
157 fdEdx=new TH2F("fdEdx","dE/dx",50,0.2,3,50,0.,6.);
158 fOutput->Add(fdEdx);
159
160 fdEdxPid=new TH2F("fdEdxPid","dE/dx with PID",50,0.2,3,50,0.,6.);
161 fOutput->Add(fdEdxPid);
162
163 fK0sM =
164 new TH2F("fK0sM", "Mass for K^{0}_{s}", 50,0.448,0.548,nBins,xBins);
165 fK0sM->GetXaxis()->SetTitle("Mass (GeV/c)");
166 fOutput->Add(fK0sM);
167
168 fK0sSi =
169 new TH2F("fK0sSi","L_{T} vs p_{T} for K^{0}_{s}, side-band subtracted",
170 nBins,xBins,lbins,0.,ltMax);
171 fK0sSi->GetXaxis()->SetTitle("p_{T} (GeV/c)");
172 fK0sSi->GetYaxis()->SetTitle("L_{T} (cm)");
173 fOutput->Add(fK0sSi);
174
175 fK0sMC =
176 new TH2F("fK0sMC","L_{T} vs p_{T} for K^{0}_{s}, from MC stack",
177 nBins,xBins,lbins,0.,ltMax);
178 fK0sMC->GetXaxis()->SetTitle("p_{T} (GeV/c)");
179 fK0sMC->GetYaxis()->SetTitle("L_{T} (cm)");
180 fOutput->Add(fK0sMC);
181
182 fK0sAs =
183 new TH2F("fK0sAs", "L_{T} vs p_{T} for K^{0}_{s}, associated",
184 nBins,xBins,lbins,0.,ltMax);
185 fK0sAs->GetXaxis()->SetTitle("p_{T} (GeV/c)");
186 fK0sAs->GetYaxis()->SetTitle("L_{T} (cm)");
187 fOutput->Add(fK0sAs);
188
189 //----------------------
190
191 fLambdaM =
192 new TH2F("fLambdaM","Mass for \\Lambda", 100, 1.065, 1.165,nBins,xBins);
193 fLambdaM->GetXaxis()->SetTitle("Mass (GeV/c)");
194 fOutput->Add(fLambdaM);
195
196 fLambdaSi =
197 new TH2F("fLambdaSi","L_{T} vs p_{T} for \\Lambda, side-band subtructed",
198 nBins,xBins,lbins,0.,ltMax);
199 fLambdaSi->GetXaxis()->SetTitle("p_{T} (GeV/c)");
200 fLambdaSi->GetYaxis()->SetTitle("L_{T} (cm)");
201 fOutput->Add(fLambdaSi);
202
203 fLambdaMC =
204 new TH2F("fLambdaMC","L_{T} vs p_{T} for \\Lambda, from MC stack",
205 nBins,xBins,lbins,0.,ltMax);
206 fLambdaMC->GetXaxis()->SetTitle("p_{T} (GeV/c)");
207 fLambdaMC->GetYaxis()->SetTitle("L_{T} (cm)");
208 fOutput->Add(fLambdaMC);
209
210 fLambdaAs =
211 new TH2F("fLambdaAs","L_{T} vs p_{T} for \\Lambda, associated",
212 nBins,xBins,lbins,0.,ltMax);
213 fLambdaAs->GetXaxis()->SetTitle("p_{T} (GeV/c)");
214 fLambdaAs->GetYaxis()->SetTitle("L_{T} (cm)");
215 fOutput->Add(fLambdaAs);
216
217 //----------------------
218
219 fLambdaEff=fLambdaAs->ProjectionX();
220 fLambdaEff->SetName("fLambdaEff");
221 fLambdaEff->SetTitle("Efficiency for #Lambda");
222 fOutput->Add(fLambdaEff);
223
224 fLambdaPt=fLambdaAs->ProjectionX();
225 fLambdaPt->SetName("fLambdaPt");
226 fLambdaPt->SetTitle("Raw #Lambda pT spectrum");
227 fOutput->Add(fLambdaPt);
228 //----------------------
229
230 fLambdaBarM =
231 new TH2F("fLambdaBarM","Mass for anti-\\Lambda",100,1.065,1.165,nBins,xBins);
232 fLambdaBarM->GetXaxis()->SetTitle("Mass (GeV/c)");
233 fOutput->Add(fLambdaBarM);
234
235 fLambdaBarSi =
236 new TH2F("fLambdaBarSi","L_{T} vs p_{T} for anti-\\Lambda, side-band subtructed",
237 nBins,xBins,lbins,0.,ltMax);
238 fLambdaBarSi->GetXaxis()->SetTitle("p_{T} (GeV/c)");
239 fLambdaBarSi->GetYaxis()->SetTitle("L_{T} (cm)");
240 fOutput->Add(fLambdaBarSi);
241
242 fLambdaBarMC =
243 new TH2F("fLambdaBarMC","L_{T} vs p_{T} for anti-\\Lambda, from MC stack",
244 nBins,xBins,lbins,0.,ltMax);
245 fLambdaBarMC->GetXaxis()->SetTitle("p_{T} (GeV/c)");
246 fLambdaBarMC->GetYaxis()->SetTitle("L_{T} (cm)");
247 fOutput->Add(fLambdaBarMC);
248
249 fLambdaBarAs =
250 new TH2F("fLambdaBarAs","L_{T} vs p_{T} for anti-\\Lambda, associated",
251 nBins,xBins,lbins,0.,ltMax);
252 fLambdaBarAs->GetXaxis()->SetTitle("p_{T} (GeV/c)");
253 fLambdaBarAs->GetYaxis()->SetTitle("L_{T} (cm)");
254 fOutput->Add(fLambdaBarAs);
255
256
257 //----------------------
258
259 fLambdaBarEff=fLambdaBarAs->ProjectionX();
260 fLambdaBarEff->SetName("fLambdaBarEff");
261 fLambdaBarEff->SetTitle("Efficiency for anti-#Lambda");
262 fOutput->Add(fLambdaBarEff);
263
264 fLambdaBarPt=fLambdaBarAs->ProjectionX();
265 fLambdaBarPt->SetName("fLambdaBarPt");
266 fLambdaBarPt->SetTitle("Raw anti-#Lambda pT spectrum");
267 fOutput->Add(fLambdaBarPt);
268
269 //----------------------
270 fLambdaFromXi=new TH3F("fLambdaFromXi","L_{T} vs p_{T} vs p_{T} of \\Xi for \\Lambda from \\Xi",
271 nBins,xBins,lbins,yBins,kbins,zBins);
272 fOutput->Add(fLambdaFromXi);
273
274 fXiM =
275 new TH2F("fXiM", "\\Xi mass distribution", 50, 1.271, 1.371,33,0.,ptMax+2);
276 fOutput->Add(fXiM);
277
278 fXiSiP = new TH1F("fXiSiP", "Pt for \\Xi, side-band subracted",
279 33,0.,ptMax+2);
280 fOutput->Add(fXiSiP);
281
282
283 fLambdaBarFromXiBar=new TH3F("fLambdaBarFromXiBar","L_{T} vs p_{T} vs p_{T} of anti-\\Xi for anti-\\Lambda from anti-\\Xi",
284 nBins,xBins,lbins,yBins,kbins,zBins);
285 fOutput->Add(fLambdaBarFromXiBar);
286
287 fXiBarM =
288 new TH2F("fXiBarM", "anti-\\Xi mass distribution", 50, 1.271, 1.371,33,0.,ptMax+2);
289 fOutput->Add(fXiBarM);
290
291 fXiBarSiP = new TH1F("fXiBarSiP", "Pt for anti-\\Xi, side-band subracted",
292 33,0.,ptMax+2);
293 fOutput->Add(fXiBarSiP);
294
295}
296
297Bool_t AliV0CutVariations::AcceptTracks() {
298 //if (!t->IsOn(AliAODTrack::kTPCrefit)) return kFALSE;
299 //if (t->GetKinkIndex(0)>0) return kFALSE;
300
3d800a19 301 /*
dc9b43d9 302 if (fTreeVariableLeastNbrCrossedRows < fTPCcr) return kFALSE;
303 if (fTreeVariableLeastRatioCrossedRowsOverFindable < fTPCcrfd) return kFALSE;
3d800a19 304 */
dc9b43d9 305 if (TMath::Abs(fTreeVariableNegEta) > 0.8) return kFALSE;
306 if (TMath::Abs(fTreeVariablePosEta) > 0.8) return kFALSE;
307
308 fTPCrows->Fill(fTreeVariableLeastNbrCrossedRows);
309 fTPCratio->Fill(fTreeVariableLeastRatioCrossedRowsOverFindable);
310
311 return kTRUE;
312}
313
314Bool_t AliV0CutVariations::AcceptV0()
315{
316 //if (v0->GetOnFlyStatus()) return kFALSE;
317
318 if (fTreeVariableV0CosineOfPointingAngle < fCPA) return kFALSE;
319 if (fTreeVariableDcaV0Daughters > fDCA) return kFALSE;
320
321 if (!AcceptTracks()) return kFALSE;
322
323 if (TMath::Abs(fTreeVariableDcaNegToPrimVertex) < fDCApv) return kFALSE;
324 if (TMath::Abs(fTreeVariableDcaPosToPrimVertex) < fDCApv) return kFALSE;
325
326 if (fTreeVariableV0Radius < 0.9) return kFALSE;
327 if (fTreeVariableV0Radius > 100) return kFALSE;
328
329 fCosPA->Fill(fTreeVariableV0CosineOfPointingAngle);
330 fDtrDCA->Fill(fTreeVariableDcaV0Daughters);
331 fPrimDCA->Fill(fTreeVariableDcaNegToPrimVertex);
332 fPrimDCA->Fill(fTreeVariableDcaPosToPrimVertex);
333
334 return kTRUE;
335}
336
337Bool_t AliV0CutVariations::AcceptPID(Int_t code)
338{
339 //const AliAODPid *pid=ptrack->GetDetPid();
340 //if (!pid) return kTRUE;
341 if (code > 0) {
342 if (fTreeVariablePosTransvMomentum > 1.) return kTRUE;
343 } else {
344 if (fTreeVariableNegTransvMomentum > 1.) return kTRUE;
345 }
346
347
348 if (fIsMC) {
349 // MC PID
fe424a32 350
351 if (fSelectNonInjected && (!fTreeVariableIsNonInjected)) return kFALSE;
352
dc9b43d9 353 if (code > 0) {
354 if (fTreeVariablePIDPositive == code) return kTRUE;
355 } else {
356 if (fTreeVariablePIDNegative == code) return kTRUE;
357 }
358 } else {
359 // Real PID
360 if (code > 0) {
361 if (TMath::Abs(fTreeVariableNSigmasPosProton) < 3.) return kTRUE;
362 } else {
363 if (TMath::Abs(fTreeVariableNSigmasNegProton) < 3.) return kTRUE;
364 }
365 }
366
367 return kFALSE;
368}
369
370
371Bool_t AliV0CutVariations::Process(Long64_t entry)
372{
373 // The Process() function is called for each entry in the tree (or possibly
374 // keyed object in the case of PROOF) to be processed. The entry argument
375 // specifies which entry in the currently loaded tree is to be processed.
376 // It can be passed to either AliV0CutVariations::GetEntry() or TBranch::GetEntry()
377 // to read either all or the required parts of the data. When processing
378 // keyed objects with PROOF, the object is already loaded and is available
379 // via the fObject pointer.
380 //
381 // This function should contain the "body" of the analysis. It can contain
382 // simple or elaborate selection criteria, run algorithms on the data
383 // of the event and typically fill histograms.
384 //
385 // The processing can be stopped by calling Abort().
386 //
387 // Use fStatus to set the return value of TTree::Process().
388 //
389 // The return value is currently not used.
390
391 const Double_t yMax=0.5;
392 const Double_t pMin=0.0;
393 //const Double_t lMax=0.001;
394
395 fChain->GetTree()->GetEntry(entry);
396
a0820959 397 //cout<<entry<<'\r';
dc9b43d9 398
399 if (fTreeVariableMultiplicity<fCMin) return kFALSE;
400 if (fTreeVariableMultiplicity>fCMax) return kFALSE;
401
402 fMult->Fill(fTreeVariableMultiplicity);
403
404 Double_t pt=0;
405 Double_t lt=0;
406 //+++++++ MC
407 if (fIsMC) {
fe424a32 408 if (fSelectNonInjected && (!fTreeVariableIsNonInjected)) goto real;
409
dc9b43d9 410 Int_t code=fTreeVariablePID;
411
412 if (code != kK0Short)
413 if (code != kLambda0)
414 if (code != kLambda0Bar) goto real;
415
416 pt=fTreeVariablePtMC;
417 if (pt < pMin) goto real;
418
419 if (TMath::Abs(fTreeVariableRapMC) > yMax) goto real;
420
421 //if (TMath::Abs(fTreeVariableV0CreationRadius) > lMax) goto real;
422 if (fTreeVariablePrimaryStatus != 1) goto real;
423
424 lt=fTreeVariableV0Radius;
425 switch (code) {
426 case kK0Short:
427 fK0sMC->Fill(pt,lt);
428 break;
429 case kLambda0:
430 fLambdaMC->Fill(pt,lt);
431 break;
432 case kLambda0Bar:
433 fLambdaBarMC->Fill(pt,lt);
434 break;
435 default: break;
436 }
437
438 }
439 //+++++++
440
441 real:
442
443 pt=fTreeVariablePt;
444 if (pt < pMin) return kFALSE;
445
446 if (!AcceptV0()) return kFALSE;
447
448 lt=fTreeVariableV0Radius;
449 if (lt/pt > 3*7.89/1.1157) return kFALSE;
450
451 //--- V0 switches
452 Bool_t isK0s=kTRUE;
453 Bool_t isLambda=kTRUE;
454 Bool_t isLambdaBar=kTRUE;
455
456 if (0.4977*lt/pt > 3*2.68) isK0s=kFALSE;
457 if (1.1157*lt/pt > 3*7.89) isLambdaBar=isLambda=kFALSE;
458
fd1daeb6 459 if (fTreeVariablePtArmV0<0.2*TMath::Abs(fTreeVariableAlphaV0)) isK0s=kFALSE;
460
dc9b43d9 461 if (!AcceptPID(kProton)) isLambda=kFALSE;
462 if (!AcceptPID(kProtonBar)) isLambdaBar=kFALSE;
463
52cf7b68 464 Double_t yK0s=TMath::Abs(fTreeVariableRapK0Short);
465 Double_t yLam=TMath::Abs(fTreeVariableRapLambda);
dc9b43d9 466 if (yK0s > yMax) isK0s=kFALSE;
467 if (yLam > yMax) isLambda=isLambdaBar=kFALSE;
468 //---
469
470 Double_t mass=0., m=0., s=0.;
85de5777 471 Double_t peakWidth=0;
dc9b43d9 472 if (isK0s) {
473 mass=fTreeVariableInvMassK0s;
474 fK0sM->Fill(mass,pt);
475
476 m=TDatabasePDG::Instance()->GetParticle(kK0Short)->Mass();
85de5777 477 //s=0.0029 + 0.00077*pt;
478 s=0.0041 + 0.00056*pt;
479 peakWidth=5*s;
480 if (TMath::Abs(m-mass) < peakWidth) {
dc9b43d9 481 fK0sSi->Fill(pt,lt);
482 } else {
483 isK0s=kFALSE;
484 }
85de5777 485 if (TMath::Abs(m-mass + 1.5*peakWidth) < 0.5*peakWidth) {
dc9b43d9 486 fK0sSi->Fill(pt,lt,-1);
487 }
85de5777 488 if (TMath::Abs(m-mass - 1.5*peakWidth) < 0.5*peakWidth) {
dc9b43d9 489 fK0sSi->Fill(pt,lt,-1);
490 }
491 }
492
493 if (isLambda) {
494 mass=fTreeVariableInvMassLambda;
495 fLambdaM->Fill(mass,pt);
496
497 m=TDatabasePDG::Instance()->GetParticle(kLambda0)->Mass();
85de5777 498 //s=0.0021 + 0.00022*pt;
499 s=0.0018 + 0.00030*pt;
500 peakWidth = 3*s + 0.002;
501 if (TMath::Abs(m-mass) < peakWidth) {
dc9b43d9 502 fLambdaSi->Fill(pt,lt);
503 } else {
504 isLambda=kFALSE;
505 }
85de5777 506 if (TMath::Abs(m-mass + 1.5*peakWidth) < 0.5*peakWidth) {
dc9b43d9 507 fLambdaSi->Fill(pt,lt,-1);
508 }
85de5777 509 if (TMath::Abs(m-mass - 1.5*peakWidth) < 0.5*peakWidth) {
dc9b43d9 510 fLambdaSi->Fill(pt,lt,-1);
511 }
512 }
513
514 if (isLambdaBar) {
515 mass=fTreeVariableInvMassAntiLambda;
516 fLambdaBarM->Fill(mass,pt);
517
518 m=TDatabasePDG::Instance()->GetParticle(kLambda0Bar)->Mass();
85de5777 519 //s=0.0021 + 0.00022*pt;
520 s=0.0018 + 0.00035*pt;
521 peakWidth = 3*s + 0.002;
522 if (TMath::Abs(m-mass) < peakWidth) {
dc9b43d9 523 fLambdaBarSi->Fill(pt,lt);
524 } else {
525 isLambdaBar=kFALSE;
526 }
85de5777 527 if (TMath::Abs(m-mass + 1.5*peakWidth) < 0.5*peakWidth) {
dc9b43d9 528 fLambdaBarSi->Fill(pt,lt,-1);
529 }
85de5777 530 if (TMath::Abs(m-mass - 1.5*peakWidth) < 0.5*peakWidth) {
dc9b43d9 531 fLambdaBarSi->Fill(pt,lt,-1);
532 }
533 }
534
535 if (!fIsMC) return kFALSE;
fe424a32 536 if (fSelectNonInjected && (!fTreeVariableIsNonInjected)) return kFALSE;
537
dc9b43d9 538
539 //++++++ MC
540 if (!isK0s)
541 if (!isLambda)
542 if (!isLambdaBar) return kFALSE;//check MC only for the accepted V0s
543
544 Int_t code=fTreeVariablePID;
545 if (code != kK0Short)
546 if (code != kLambda0)
547 if (code != kLambda0Bar) return kFALSE;
548
549 Double_t ptAs=fTreeVariablePtMC;
550 if (ptAs < pMin) return kFALSE;
551
552 Double_t yAs=fTreeVariableRapMC;
553 if (TMath::Abs(yAs) > yMax) return kFALSE;
554
555 Double_t ltAs=fTreeVariableV0Radius;
556 if (fTreeVariablePrimaryStatus == 1) {
557 switch (code) {
558 case kK0Short:
559 if (isK0s) fK0sAs->Fill(ptAs,ltAs);
560 break;
561 case kLambda0:
562 if (isLambda) fLambdaAs->Fill(ptAs,ltAs);
563 break;
564 case kLambda0Bar:
565 if (isLambdaBar) fLambdaBarAs->Fill(ptAs,ltAs);
566 break;
567 default: break;
568 }
569 } else {
570 if (code==kK0Short) return kTRUE;
571
572 Int_t xcode=fTreeVariablePIDMother;
573 Double_t xpt=fTreeVariablePtXiMother;
574
575 switch (code) {
576 case kLambda0:
577 if (isLambda)
578 if ((xcode==kXiMinus) || (xcode==3322))
579 fLambdaFromXi->Fill(ptAs,ltAs,xpt);
580 break;
581 case kLambda0Bar:
582 if (isLambdaBar)
583 if ((xcode==kXiPlusBar)||(xcode==-3322))
584 fLambdaBarFromXiBar->Fill(ptAs,ltAs,xpt);
585 break;
586 default: break;
587 }
588 }
589
590 return kTRUE;
591}
592
593void AliV0CutVariations::SlaveTerminate()
594{
595 // The SlaveTerminate() function is called after all entries or objects
596 // have been processed. When running with PROOF SlaveTerminate() is called
597 // on each slave server.
598
599}
600
601void AliV0CutVariations::Terminate()
602{
603 // The Terminate() function is the last function to be called during
604 // a query. It always runs on the client, it can be used to present
605 // the results graphically or save the results to file.
606
607 cout<<endl;
608
609 if (!fOutput) {
610 Printf("ERROR: fOutput not available");
611 return;
612 }
613
614 fMult = dynamic_cast<TH1F*>(fOutput->FindObject("fMult")) ;
615 if (!fMult) {
616 Printf("ERROR: fMult not available");
617 return;
618 }
619
620 fdEdx = dynamic_cast<TH2F*>(fOutput->FindObject("fdEdx")) ;
621 if (!fdEdx) {
622 Printf("ERROR: fdEdx not available");
623 return;
624 }
625
626 fdEdxPid = dynamic_cast<TH2F*>(fOutput->FindObject("fdEdxPid")) ;
627 if (!fdEdxPid) {
628 Printf("ERROR: fdEdxPid not available");
629 return;
630 }
631
632
633 fK0sMC = dynamic_cast<TH2F*>(fOutput->FindObject("fK0sMC")) ;
634 if (!fK0sMC) {
635 Printf("ERROR: fK0sMC not available");
636 return;
637 }
638 TH1D *k0sMcPx=fK0sMC->ProjectionX(); k0sMcPx->Sumw2();
639 fK0sAs = dynamic_cast<TH2F*>(fOutput->FindObject("fK0sAs")) ;
640 if (!fK0sAs) {
641 Printf("ERROR: fK0sAs not available");
642 return;
643 }
644 TH1D *k0sAsPx=fK0sAs->ProjectionX();
645 k0sAsPx->Sumw2(); //k0sAsPx->Scale(0.69);
646
647
648
649 // Lambda histograms
650 fLambdaFromXi = dynamic_cast<TH3F*>(fOutput->FindObject("fLambdaFromXi")) ;
651 if (!fLambdaFromXi) {
652 Printf("ERROR: fLambdaFromXi not available");
653 return;
654 }
655 TH1D *lambdaFromXiPx=fLambdaFromXi->ProjectionX(); lambdaFromXiPx->Sumw2();
656
657 fLambdaMC = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaMC")) ;
658 if (!fLambdaMC) {
659 Printf("ERROR: fLambdaMC not available");
660 return;
661 }
662 TH1D *lambdaMcPx=fLambdaMC->ProjectionX(); lambdaMcPx->Sumw2();
663
664 fLambdaAs = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaAs")) ;
665 if (!fLambdaAs) {
666 Printf("ERROR: fLambdaAs not available");
667 return;
668 }
669 TH1D *lambdaAsPx=fLambdaAs->ProjectionX();
670 lambdaAsPx->Sumw2(); //lambdaAsPx->Scale(0.64);
671
672 fLambdaSi = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaSi")) ;
673 if (!fLambdaSi) {
674 Printf("ERROR: fLambdaSi not available");
675 return;
676 }
677 TH1D *lambdaSiPx=fLambdaSi->ProjectionX();
678 lambdaSiPx->SetName("fLambdaPt");
679 lambdaSiPx->Sumw2();
680
681 fLambdaEff = dynamic_cast<TH1D*>(fOutput->FindObject("fLambdaEff")) ;
682 if (!fLambdaEff) {
683 Printf("ERROR: fLambdaEff not available");
684 return;
685 }
686 fLambdaPt = dynamic_cast<TH1D*>(fOutput->FindObject("fLambdaPt")) ;
687 if (!fLambdaPt) {
688 Printf("ERROR: fLambdaPt not available");
689 return;
690 }
691
692
693 // anti-Lambda histograms
694 fLambdaBarFromXiBar =
695 dynamic_cast<TH3F*>(fOutput->FindObject("fLambdaBarFromXiBar")) ;
696 if (!fLambdaBarFromXiBar) {
697 Printf("ERROR: fLambdaBarFromXiBar not available");
698 return;
699 }
700 TH1D *lambdaBarFromXiBarPx=
701 fLambdaBarFromXiBar->ProjectionX("Bar"); lambdaBarFromXiBarPx->Sumw2();
702
703 fLambdaBarMC = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaBarMC")) ;
704 if (!fLambdaBarMC) {
705 Printf("ERROR: fLambdaBarMC not available");
706 return;
707 }
708 TH1D *lambdaBarMcPx=fLambdaBarMC->ProjectionX(); lambdaBarMcPx->Sumw2();
709
710 fLambdaBarAs = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaBarAs")) ;
711 if (!fLambdaBarAs) {
712 Printf("ERROR: fLambdaBarAs not available");
713 return;
714 }
715 TH1D *lambdaBarAsPx=fLambdaBarAs->ProjectionX();
716 lambdaBarAsPx->Sumw2(); //lambdaBarAsPx->Scale(0.64);
717
718 fLambdaBarSi = dynamic_cast<TH2F*>(fOutput->FindObject("fLambdaBarSi")) ;
719 if (!fLambdaBarSi) {
720 Printf("ERROR: fLambdaBarSi not available");
721 return;
722 }
723 TH1D *lambdaBarSiPx=fLambdaBarSi->ProjectionX();
724 lambdaBarSiPx->SetName("fLambdaBarPt");
725 lambdaBarSiPx->Sumw2();
726
727 fLambdaBarEff = dynamic_cast<TH1D*>(fOutput->FindObject("fLambdaBarEff")) ;
728 if (!fLambdaBarEff) {
729 Printf("ERROR: fLambdaBarEff not available");
730 return;
731 }
732 fLambdaBarPt = dynamic_cast<TH1D*>(fOutput->FindObject("fLambdaBarPt")) ;
733 if (!fLambdaBarPt) {
734 Printf("ERROR: fLambdaBarPt not available");
735 return;
736 }
737
738
739 if (!gROOT->IsBatch()) {
740
741 TCanvas *c1 = new TCanvas("c1","Mulitplicity");
742 c1->SetLogy();
743 fMult->DrawCopy() ;
744
745 new TCanvas("c2","dE/dx");
746 fdEdx->DrawCopy() ;
747
748 new TCanvas("c3","dE/dx with PID");
749 fdEdxPid->DrawCopy() ;
750
751 if (fIsMC) {
752 /*
753 TH1D effK(*k0sAsPx); effK.SetTitle("Efficiency for K0s");
754 effK.Divide(k0sAsPx,k0sMcPx,1,1,"b");
755 new TCanvas("c4","Efficiency for K0s");
756 effK.DrawCopy("E") ;
757 */
758
759 //+++ Lambdas
760 fLambdaEff->Divide(lambdaAsPx,lambdaMcPx,1,1,"b");
761 new TCanvas("c5","Efficiency for #Lambda");
762 fLambdaEff->DrawCopy("E") ;
763
764 lambdaSiPx->Add(lambdaFromXiPx,-1);
765 lambdaSiPx->Divide(fLambdaEff);
766
767 new TCanvas("c6","Corrected #Lambda pt");
768 lambdaSiPx->SetTitle("Corrected #Lambda pt");
769 *fLambdaPt = *lambdaSiPx;
770 fLambdaPt->SetLineColor(2);
771 fLambdaPt->DrawCopy("E");
772
773 lambdaMcPx->DrawCopy("same");
774
775
776 //+++ anti-Lambdas
777 fLambdaBarEff->Divide(lambdaBarAsPx,lambdaBarMcPx,1,1,"b");
778 new TCanvas("c7","Efficiency for anti-#Lambda");
779 fLambdaBarEff->DrawCopy("E") ;
780
781 lambdaBarSiPx->Add(lambdaBarFromXiBarPx,-1);
782 lambdaBarSiPx->Divide(fLambdaBarEff);
783
784 new TCanvas("c8","Corrected anti-#Lambda pt");
785 lambdaBarSiPx->SetTitle("Corrected anti-#Lambda pt");
786 *fLambdaBarPt = *lambdaBarSiPx;
787 fLambdaBarPt->SetLineColor(2);
788 fLambdaBarPt->DrawCopy("E");
789
790 lambdaBarMcPx->DrawCopy("same");
791 } else {
792 new TCanvas("c6","Raw #Lambda pt");
793 lambdaSiPx->SetTitle("Raw #Lambda pt");
794 *fLambdaPt = *lambdaSiPx;
795 fLambdaPt->SetLineColor(2);
796 fLambdaPt->DrawCopy("E");
797
798
799 new TCanvas("c7","Raw anti-#Lambda pt");
800 lambdaBarSiPx->SetTitle("Raw anti-#Lambda pt");
801 *fLambdaBarPt = *lambdaBarSiPx;
802 fLambdaBarPt->SetLineColor(2);
803 fLambdaBarPt->DrawCopy("E");
804 }
805 }
806
807 TFile *file = 0;
808 if (fIsMC)
3d800a19 809 if (fSelectNonInjected)
810 file=TFile::Open("AliV0CutVariationsMC_nonInj.root", "RECREATE");
811 else
812 file=TFile::Open("AliV0CutVariationsMC.root", "RECREATE");
dc9b43d9 813 else
814 file=TFile::Open("AliV0CutVariations.root", "RECREATE");
815
816 fOutput->Write() ;
817 file->Close() ;
818 delete file ;
819
820}