]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/AliAnalysisTaskV0QA.cxx
- new class for TPC laser warmupt tracks rejection
[u/mrichter/AliRoot.git] / PWG1 / AliAnalysisTaskV0QA.cxx
CommitLineData
7f11ea62 1//------------------------------------------------
2// Implementation of AliAnalysisTaskV0QA class.
3// Calculates the "on the fly" V0 method efficiency
4// for Gamma, K0s, lambda, antilambda
5// Needs MC information
6// Author: A. Marin Revision 18/10/09
7//-------------------------------------------------
88a746d6 8#define AliAnalysisTaskV0QA_cxx
7f11ea62 9
88a746d6 10#include "TChain.h"
11#include "TH1.h"
12#include "TH2.h"
13
7f11ea62 14
15//#include "TLorentzVector.h"
88a746d6 16
47dce8bb 17#include "AliAnalysisTaskSE.h"
88a746d6 18#include "AliTrackReference.h"
19#include "AliKFParticle.h"
20#include "AliKFVertex.h"
21#include "AliVertexerTracks.h"
22#include "AliESDEvent.h"
23#include "AliESDInputHandler.h"
24#include "AliMCEvent.h"
25#include "AliMCEventHandler.h"
26#include "AliStack.h"
27#include "AliESD.h"
28#include "AliLog.h"
29
30#include "AliAnalysisTaskV0QA.h"
31
32ClassImp(AliAnalysisTaskV0QA)
47dce8bb 33AliAnalysisTaskV0QA::AliAnalysisTaskV0QA() :AliAnalysisTaskSE(),
34fESD(0),
35fStack(0),
36fMCtruth(0),
37fChain(0),
38fOutputContainer(0),
39fSparseV0(0),
40fSparseK0(0),
41fSparseL(0),
42fSparseAL(0),
43fnEv(0),
44fgDim(50),
45fnConvGamGeant(-1),
46fgConvGamGeantIndex(0),
47feNegConvGamGeantIndex(0),
48fePosConvGamGeantIndex(0),
49feNegConvGamGeantLength(0),
50fePosConvGamGeantLength(0),
51feNegConvGamSingleRecIndex(0),
52fePosConvGamSingleRecIndex(0),
53feNegConvGamV0RecIndex(0),
54fePosConvGamV0RecIndex(0),
55fConvGamV0RecIndexPos(0),
56fConvGamV0RecIndexNeg(0),
57fnDecayLGeant(-1),
58flDecayLGeantIndex(0),
59fpiNegDecayLGeantIndex(0),
60fpPosDecayLGeantIndex(0),
61fpiNegDecayLGeantLength(0),
62fpPosDecayLGeantLength(0),
63fpiNegDecayLSingleRecIndex(0),
64fpPosDecayLSingleRecIndex(0),
65fpiNegDecayLV0RecIndex(0),
66fpPosDecayLV0RecIndex(0),
67fDecayLV0RecIndexPos(0),
68fDecayLV0RecIndexNeg(0),
69fnDecayALGeant(-1),
70falDecayALGeantIndex(0),
71fpiPosDecayALGeantIndex(0),
72fapNegDecayALGeantIndex(0),
73fpiPosDecayALGeantLength(0),
74fapNegDecayALGeantLength(0),
75fpiPosDecayALSingleRecIndex(0),
76fapNegDecayALSingleRecIndex(0),
77fpiPosDecayALV0RecIndex(0),
78fapNegDecayALV0RecIndex(0),
79fDecayALV0RecIndexPos(0),
80fDecayALV0RecIndexNeg(0),
81fnDecayK0Geant(-1),
82fK0DecayK0GeantIndex(0),
83fpiNegDecayK0GeantIndex(0),
84fpiPosDecayK0GeantIndex(0),
85fpiNegDecayK0GeantLength(0),
86fpiPosDecayK0GeantLength(0),
87fpiNegDecayK0SingleRecIndex(0),
88fpiPosDecayK0SingleRecIndex(0),
89fpiNegDecayK0V0RecIndex(0),
90fpiPosDecayK0V0RecIndex(0),
91fDecayK0V0RecIndexPos(0),
92fDecayK0V0RecIndexNeg(0),
93fpiPosK0Index(-1),
94fpiNegK0Index(-1),
95fnTracksPrim(-1),
96ftpcRefit(0),
97fitsRefit(0),
98ftrdRefit(0),
99ftrdOut(0),
100fDim(37),
101fValueL(0),
102fValueAL(0),
103fValueK0(0),
104fValueV0(0),
105fxminV0(0),
106fxmaxV0(0),
107fbinsV0(0),
108fRefTPC(0),
109fclRefsN(0),
110fclRefsP(0)
111
112 {
113 // Default Constructor.
b77c8724 114 for (Int_t i = 0; i < AliPID::kSPECIES; i++) {
115 fprobabilityPos[i] = 0.;
116 fprobabilityNeg[i] = 0.;
117 }
118 for (Int_t i = 0; i < 100000; i++) {
119 fLabelsTPC[i] = 0;
120 }
47dce8bb 121 }
88a746d6 122
123//________________________________________________________________________
47dce8bb 124AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTaskSE(name),
88a746d6 125fESD(0),
7f11ea62 126fStack(0),
127fMCtruth(0),
88a746d6 128fChain(0),
129fOutputContainer(0),
130fSparseV0(0),
131fSparseK0(0),
132fSparseL(0),
133fSparseAL(0),
7f11ea62 134fnEv(0),
ec835029 135fgDim(50),
7f11ea62 136fnConvGamGeant(-1),
137fgConvGamGeantIndex(0),
138feNegConvGamGeantIndex(0),
139fePosConvGamGeantIndex(0),
140feNegConvGamGeantLength(0),
141fePosConvGamGeantLength(0),
142feNegConvGamSingleRecIndex(0),
143fePosConvGamSingleRecIndex(0),
144feNegConvGamV0RecIndex(0),
145fePosConvGamV0RecIndex(0),
146fConvGamV0RecIndexPos(0),
147fConvGamV0RecIndexNeg(0),
7f11ea62 148fnDecayLGeant(-1),
149flDecayLGeantIndex(0),
150fpiNegDecayLGeantIndex(0),
151fpPosDecayLGeantIndex(0),
152fpiNegDecayLGeantLength(0),
153fpPosDecayLGeantLength(0),
154fpiNegDecayLSingleRecIndex(0),
155fpPosDecayLSingleRecIndex(0),
156fpiNegDecayLV0RecIndex(0),
157fpPosDecayLV0RecIndex(0),
158fDecayLV0RecIndexPos(0),
159fDecayLV0RecIndexNeg(0),
160fnDecayALGeant(-1),
161falDecayALGeantIndex(0),
162fpiPosDecayALGeantIndex(0),
163fapNegDecayALGeantIndex(0),
164fpiPosDecayALGeantLength(0),
165fapNegDecayALGeantLength(0),
166fpiPosDecayALSingleRecIndex(0),
167fapNegDecayALSingleRecIndex(0),
168fpiPosDecayALV0RecIndex(0),
169fapNegDecayALV0RecIndex(0),
170fDecayALV0RecIndexPos(0),
171fDecayALV0RecIndexNeg(0),
172fnDecayK0Geant(-1),
173fK0DecayK0GeantIndex(0),
174fpiNegDecayK0GeantIndex(0),
175fpiPosDecayK0GeantIndex(0),
176fpiNegDecayK0GeantLength(0),
177fpiPosDecayK0GeantLength(0),
178fpiNegDecayK0SingleRecIndex(0),
179fpiPosDecayK0SingleRecIndex(0),
180fpiNegDecayK0V0RecIndex(0),
181fpiPosDecayK0V0RecIndex(0),
182fDecayK0V0RecIndexPos(0),
183fDecayK0V0RecIndexNeg(0),
184fpiPosK0Index(-1),
185fpiNegK0Index(-1),
186fnTracksPrim(-1),
187ftpcRefit(0),
188fitsRefit(0),
189ftrdRefit(0),
190ftrdOut(0),
ec835029 191fDim(37),
88a746d6 192fValueL(0),
193fValueAL(0),
194fValueK0(0),
195fValueV0(0),
7f11ea62 196fxminV0(0),
197fxmaxV0(0),
198fbinsV0(0),
88a746d6 199fRefTPC(0),
7f11ea62 200fclRefsN(0),
201fclRefsP(0)
88a746d6 202
203 {
b77c8724 204 for (Int_t i = 0; i < AliPID::kSPECIES; i++) {
205 fprobabilityPos[i] = 0.;
206 fprobabilityNeg[i] = 0.;
207 }
208 for (Int_t i = 0; i < 100000; i++) {
209 fLabelsTPC[i] = 0;
210 }
88a746d6 211
ec835029 212 fnEv=0;
213 fDim=37;
214
215 fValueK0 = new Double_t[fDim];
216 fValueL = new Double_t[fDim];
217 fValueAL = new Double_t[fDim];
218 fValueV0 = new Double_t[fDim];
219 fxminV0 = new Double_t[fDim];
220 fxmaxV0 = new Double_t[fDim];
221 fbinsV0 = new Int_t[fDim];
88a746d6 222
223
7f11ea62 224 fgDim=50;
225 fgConvGamGeantIndex = new Int_t[fgDim];
226 feNegConvGamGeantIndex = new Int_t[fgDim];
227 fePosConvGamGeantIndex = new Int_t[fgDim];
228 feNegConvGamGeantLength = new Float_t[fgDim];
229 fePosConvGamGeantLength = new Float_t[fgDim];
88a746d6 230
7f11ea62 231 feNegConvGamSingleRecIndex = new Int_t[fgDim];
232 fePosConvGamSingleRecIndex = new Int_t[fgDim];
88a746d6 233
7f11ea62 234 feNegConvGamV0RecIndex = new Int_t[fgDim];
235 fePosConvGamV0RecIndex = new Int_t[fgDim];
88a746d6 236
7f11ea62 237 fConvGamV0RecIndexPos = new Int_t[fgDim];
238 fConvGamV0RecIndexNeg = new Int_t[fgDim];
88a746d6 239
240 // Lambda to proton pi-
7f11ea62 241 flDecayLGeantIndex = new Int_t[fgDim];
242 fpiNegDecayLGeantIndex = new Int_t[fgDim];
243 fpPosDecayLGeantIndex = new Int_t[fgDim];
244 fpiNegDecayLGeantLength = new Float_t[fgDim];
245 fpPosDecayLGeantLength = new Float_t[fgDim];
88a746d6 246
7f11ea62 247 fpiNegDecayLSingleRecIndex = new Int_t[fgDim];
248 fpPosDecayLSingleRecIndex = new Int_t[fgDim];
88a746d6 249
7f11ea62 250 fpiNegDecayLV0RecIndex = new Int_t[fgDim];
251 fpPosDecayLV0RecIndex = new Int_t[fgDim];
88a746d6 252
7f11ea62 253 fDecayLV0RecIndexPos = new Int_t[fgDim];
254 fDecayLV0RecIndexNeg = new Int_t[fgDim];
88a746d6 255
256 //K0S to pi+ pi-
7f11ea62 257 fK0DecayK0GeantIndex = new Int_t[fgDim];
258 fpiNegDecayK0GeantIndex = new Int_t[fgDim];
259 fpiPosDecayK0GeantIndex = new Int_t[fgDim];
260 fpiNegDecayK0GeantLength = new Float_t[fgDim];
261 fpiPosDecayK0GeantLength = new Float_t[fgDim];
88a746d6 262
7f11ea62 263 fpiNegDecayK0SingleRecIndex = new Int_t[fgDim];
264 fpiPosDecayK0SingleRecIndex = new Int_t[fgDim];
88a746d6 265
7f11ea62 266 fpiNegDecayK0V0RecIndex = new Int_t[fgDim];
267 fpiPosDecayK0V0RecIndex = new Int_t[fgDim];
88a746d6 268
7f11ea62 269 fDecayK0V0RecIndexPos = new Int_t[fgDim];
270 fDecayK0V0RecIndexNeg = new Int_t[fgDim];
88a746d6 271
272 //Antilambda to antiproton piplus
7f11ea62 273 falDecayALGeantIndex = new Int_t[fgDim];
274 fpiPosDecayALGeantIndex = new Int_t[fgDim];
275 fapNegDecayALGeantIndex = new Int_t[fgDim];
276 fpiPosDecayALGeantLength = new Float_t[fgDim];
277 fapNegDecayALGeantLength = new Float_t[fgDim];
88a746d6 278
7f11ea62 279 fpiPosDecayALSingleRecIndex = new Int_t[fgDim];
280 fapNegDecayALSingleRecIndex = new Int_t[fgDim];
88a746d6 281
7f11ea62 282 fpiPosDecayALV0RecIndex = new Int_t[fgDim];
283 fapNegDecayALV0RecIndex = new Int_t[fgDim];
88a746d6 284
7f11ea62 285 fDecayALV0RecIndexPos = new Int_t[fgDim];
286 fDecayALV0RecIndexNeg = new Int_t[fgDim];
88a746d6 287
288
7f11ea62 289
290 fclRefsP = new TClonesArray("AliTrackReference");
291 fclRefsN = new TClonesArray("AliTrackReference");
88a746d6 292
293 // SetESDtrackCuts();
294
295
296 AliLog::SetGlobalLogLevel(AliLog::kError);
47dce8bb 297//
298 DefineOutput(1, TList::Class());
88a746d6 299}
300
301//_____________________________________________________
302AliAnalysisTaskV0QA::~AliAnalysisTaskV0QA()
303{
304 // Remove all pointers
305
306
7f11ea62 307 delete [] fclRefsP;
308 delete [] fclRefsN;
88a746d6 309
310
311 delete [] fValueK0;
312 delete [] fValueL;
313 delete [] fValueAL;
314 delete [] fValueV0;
7f11ea62 315 delete [] fbinsV0;
316 delete [] fxminV0;
317 delete [] fxmaxV0;
88a746d6 318
7f11ea62 319 delete [] fgConvGamGeantIndex;
320 delete [] feNegConvGamGeantIndex;
321 delete [] fePosConvGamGeantIndex;
88a746d6 322
7f11ea62 323 delete [] feNegConvGamSingleRecIndex;
324 delete [] fePosConvGamSingleRecIndex;
88a746d6 325
7f11ea62 326 delete [] feNegConvGamV0RecIndex;
327 delete [] fePosConvGamV0RecIndex;
328 delete [] fConvGamV0RecIndexPos;
329 delete [] fConvGamV0RecIndexNeg;
88a746d6 330
7f11ea62 331 delete [] flDecayLGeantIndex;
332 delete [] fpiNegDecayLGeantIndex;
333 delete [] fpPosDecayLGeantIndex;
88a746d6 334
7f11ea62 335 delete [] fpiNegDecayLGeantLength;
336 delete [] fpPosDecayLGeantLength;
337 delete [] fpiNegDecayLSingleRecIndex;
338 delete [] fpPosDecayLSingleRecIndex;
88a746d6 339
7f11ea62 340 delete [] fpiNegDecayLV0RecIndex;
341 delete [] fpPosDecayLV0RecIndex;
342 delete [] fDecayLV0RecIndexPos;
343 delete [] fDecayLV0RecIndexNeg;
88a746d6 344
7f11ea62 345 delete [] falDecayALGeantIndex;
346 delete [] fpiPosDecayALGeantIndex;
347 delete [] fapNegDecayALGeantIndex;
88a746d6 348
7f11ea62 349 delete [] fpiPosDecayALGeantLength;
350 delete [] fapNegDecayALGeantLength;
351 delete [] fpiPosDecayALSingleRecIndex;
352 delete [] fapNegDecayALSingleRecIndex;
88a746d6 353
7f11ea62 354 delete [] fpiPosDecayALV0RecIndex;
355 delete [] fapNegDecayALV0RecIndex;
356 delete [] fDecayALV0RecIndexPos;
357 delete [] fDecayALV0RecIndexNeg;
88a746d6 358
359
7f11ea62 360 delete [] fpiNegDecayK0GeantIndex;
361 delete [] fpiPosDecayK0GeantIndex;
88a746d6 362
7f11ea62 363 delete [] fpiNegDecayK0GeantLength;
364 delete [] fpiPosDecayK0GeantLength;
365 delete [] fpiNegDecayK0SingleRecIndex;
366 delete [] fpiPosDecayK0SingleRecIndex;
88a746d6 367
7f11ea62 368 delete [] fpiNegDecayK0V0RecIndex;
369 delete [] fpiPosDecayK0V0RecIndex;
88a746d6 370
7f11ea62 371 delete [] fDecayK0V0RecIndexPos;
372 delete [] fDecayK0V0RecIndexNeg;
88a746d6 373
374}
375
376
377//________________________________________________________________________
47dce8bb 378void AliAnalysisTaskV0QA::UserCreateOutputObjects() {
7f11ea62 379 // Create Ouptut objects
88a746d6 380
381 for(Int_t d=0;d<fDim;d++){
7f11ea62 382 fbinsV0[d]=70;
88a746d6 383 }
7f11ea62 384 fxminV0[0]= 0; // 1/sqrt(pt) Gamma geant
385 fxmaxV0[0]= 8;
88a746d6 386
387
7f11ea62 388 fxminV0[1]=-2.5; // eta Gamma Geant
389 fxmaxV0[1]= 1.5;
88a746d6 390
391
7f11ea62 392 fxminV0[2]=-2*TMath::Pi(); // phi Gamma geant
393 fxmaxV0[2]= TMath::Pi();
88a746d6 394
395
7f11ea62 396 fxminV0[3]= 0; // r geant
397 fxmaxV0[3]= 200;
88a746d6 398
399
7f11ea62 400 fxminV0[4]=-250; // z geant
401 fxmaxV0[4]= 250;
88a746d6 402
403
7f11ea62 404 fxminV0[5]= 0; // 1/sqrt(pt) Geant Pos
405 fxmaxV0[5]= 8;
88a746d6 406
407
7f11ea62 408 fxminV0[6]=-2.5; // eta geant Pos
409 fxmaxV0[6]= 1.5;
88a746d6 410
411
7f11ea62 412 fxminV0[7]=-2*TMath::Pi(); // phi Geant Pos
413 fxmaxV0[7]= TMath::Pi();
88a746d6 414
415
7f11ea62 416 fxminV0[8]=0; // Track Length TPC Geant Pos
417 fxmaxV0[8]= 200;
88a746d6 418
419
7f11ea62 420 fxminV0[9]= 0; // 1/sqrt(pt) Geant Neg
421 fxmaxV0[9]= 8;
88a746d6 422
423
7f11ea62 424 fxminV0[10]=-2.5; // eta Geant Neg
425 fxmaxV0[10]= 1.5;
88a746d6 426
427
7f11ea62 428 fxminV0[11]=-2*TMath::Pi(); // phi Geant Neg
429 fxmaxV0[11]= TMath::Pi();
88a746d6 430
431
7f11ea62 432 fxminV0[12]=0; // Track Length TPC Geant Neg
433 fxmaxV0[12]= 200;
88a746d6 434
435
436
437 //-----------Rec single variables
438
7f11ea62 439 fxminV0[13]= -0.5; // (pt-ptGeant)/ptGeant rec Pos
440 fxmaxV0[13]= 0.5;
88a746d6 441
442
7f11ea62 443 fxminV0[14]=-2.5; // eta rec Pos
444 fxmaxV0[14]= 1.5;
88a746d6 445
446
7f11ea62 447 fxminV0[15]=-2*TMath::Pi(); // phi rec Pos
448 fxmaxV0[15]= TMath::Pi();
88a746d6 449
450
7f11ea62 451 fxminV0[16]= 0; // Impact parameter rec Pos
452 fxmaxV0[16]= 100;
88a746d6 453
454
7f11ea62 455 fxminV0[17]= 0; // nsigmas Impact parameter rec Pos
456 fxmaxV0[17]= 100;
88a746d6 457
458
459
7f11ea62 460 fxminV0[18]= -1; // Ncls ITS rec Pos
461 fxmaxV0[18]= 6;
88a746d6 462
463
7f11ea62 464 fxminV0[19]= -1; // Ncls TPC rec Pos
465 fxmaxV0[19]= 180;
88a746d6 466
467
7f11ea62 468 fxminV0[20]= -2; // Status Single TPC rec Pos
469 fxmaxV0[20]= 2;
88a746d6 470
471
7f11ea62 472 fxminV0[21]= -0.5; // (pt-ptGeant)/ptGeant rec Neg
473 fxmaxV0[21]= 0.5;
88a746d6 474
475
7f11ea62 476 fxminV0[22]=-2.5; // eta rec Neg
477 fxmaxV0[22]= 1.5;
88a746d6 478
479
7f11ea62 480 fxminV0[23]=-2*TMath::Pi(); // phi rec Neg
481 fxmaxV0[23]= TMath::Pi();
88a746d6 482
483
7f11ea62 484 fxminV0[24]= 0; // Impact parameter rec Neg
485 fxmaxV0[24]= 100;
88a746d6 486
487
7f11ea62 488 fxminV0[25]= 0; // Sigmas Impact parameter rec Neg
489 fxmaxV0[25]= 100;
88a746d6 490
491
492
7f11ea62 493 fxminV0[26]= -1; // Ncls ITS rec Neg
494 fxmaxV0[26]= 6;
88a746d6 495
496
7f11ea62 497 fxminV0[27]= -1; // Ncls TPC rec Neg
498 fxmaxV0[27]= 180;
88a746d6 499
500
7f11ea62 501 fxminV0[28]= -2; // Status Single TPC rec Neg
502 fxmaxV0[28]= 2;
88a746d6 503
504 // ------------------Rec V0 variables
505
506
507
7f11ea62 508 fxminV0[29]= -0.5; // (pt-ptGeant)/ptGeant rec V0 Pos
509 fxmaxV0[29]= 0.5;
88a746d6 510
511
7f11ea62 512 fxminV0[30]=-2.5; // eta rec V0 Pos
513 fxmaxV0[30]= 1.5;
88a746d6 514
515
7f11ea62 516 fxminV0[31]=-2*TMath::Pi(); // phi rec V0 Pos
517 fxmaxV0[31]= TMath::Pi();
88a746d6 518
519
7f11ea62 520 fxminV0[32]= -2; // Status V0 TPC rec Pos
521 fxmaxV0[32]= 2;
88a746d6 522
523
524
525
7f11ea62 526 fxminV0[33]= -0.5; // 1/sqrt(pt) rec V0 Neg
527 fxmaxV0[33]= 0.5;
88a746d6 528
529
7f11ea62 530 fxminV0[34]=-2.5; // eta rec V0 Neg
531 fxmaxV0[34]= 1.5;
88a746d6 532
533
7f11ea62 534 fxminV0[35]=-2*TMath::Pi(); // phi rec V0 Neg
535 fxmaxV0[35]= TMath::Pi();
88a746d6 536
537
538
7f11ea62 539 fxminV0[36]= -2; // Status V0 TPC rec Neg
540 fxmaxV0[36]= 2;
88a746d6 541
542
543
544 TString axisName[37]={"ptGammaGeant",
545 "etaGammaGeant",
546 "phiGammaGeant",
547 "rGeant",
548 "zGeant",
549 "ptEPlusGeant",
550 "etaEPlusGeant",
551 "phiEPlusGeant",
552 "TPCTrackLengthEPlusGeant",
553 "ptEMinusGeant",
554 "etaEMinusGeant",
555 "phiEMinusGeant",
556 "TPCTrackLengthEMinusGeant",
557 "ptResEPlusRecSingle",
558 "etaEPlusRecSingle",
559 "phiEPlusRecSingle",
560 "bXYZEPlusRecSingle",
561 "sigbXYZEPlusRecSingle",
562 "NclsITSEPlusRecSingle",
563 "NclsTPCEPlusRecSingle",
564 "statusRecSinglePos",
565 "ptResEMinusRecSingle",
566 "etaEMinusRecSingle",
567 "phiEMinusRecSingle",
568 "bXYZEMinusRecSingle",
569 "sigbXYZEMinusRecSingle",
570 "NclsITSEMinusRecSingle",
571 "NclsTPCEMinusRecSingle",
572 "statusRecSingleNeg",
573 "ptResEPlusRecV0",
574 "etaEPlusRecV0",
575 "phiEPlusRecV0",
576 "statusV0SinglePos",
577 "ptResEMinusRecV0",
578 "etaEMinusRecV0",
579 "phiEMinusRecV0",
580 "statusV0SingleNeg"};
581
582
7f11ea62 583 fSparseV0= new THnSparseF("sparseV0","sparseV0",fDim,fbinsV0,fxminV0,fxmaxV0);
88a746d6 584
585 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
586 fSparseV0->GetAxis(iaxis)->SetName(axisName[iaxis]);
587 fSparseV0->GetAxis(iaxis)->SetTitle(axisName[iaxis]);
588 }
589
590 TString axisNameK0[37]={"ptK0Geant",
591 "etaK0Geant",
592 "phiK0Geant",
593 "rGeant",
594 "zGeant",
595 "ptPiPlusGeant",
596 "etaPiPlusGeant",
597 "phiPiPlusGeant",
598 "TPCTrackLengthPiPlusGeant",
599 "ptPiMinusGeant",
600 "etaPiMinusGeant",
601 "phiPiMinusGeant",
602 "TPCTrackLengthPiMinusGeant",
603 "ptResPiPlusRecSingle",
604 "etaPiPlusRecSingle",
605 "phiPiPlusRecSingle",
606 "bXYZPiPlusRecSingle",
607 "sigbXYZPiPlusRecSingle",
608 "NclsITSPiPlusRecSingle",
609 "NclsTPCPiPlusRecSingle",
610 "statusRecSinglePos",
611 "ptResPiMinusRecSingle",
612 "etaPiMinusRecSingle",
613 "phiPiMinusRecSingle",
614 "bXYZPiMinusRecSingle",
615 "sigbXYZPiMinusRecSingle",
616 "NclsITSPiMinusRecSingle",
617 "NclsTPCPiMinusRecSingle",
618 "statusRecSingleNeg",
619 "ptResPiPlusRecV0",
620 "etaPiPlusRecV0",
621 "phiPiPlusRecV0",
622 "statusRecV0Pos",
623 "ptResPiMinusRecV0",
624 "etaPiMinusRecV0",
625 "phiPiMinusRecV0",
626 "statusRecV0Neg"};
627
628
629
7f11ea62 630 fSparseK0= new THnSparseF("sparseK0","sparseK0",fDim,fbinsV0,fxminV0,fxmaxV0);
88a746d6 631 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
632 fSparseK0->GetAxis(iaxis)->SetName(axisNameK0[iaxis]);
633 fSparseK0->GetAxis(iaxis)->SetTitle(axisNameK0[iaxis]);
634 }
635
636 TString axisNameL[37]={"ptLGeant",
637 "etaLGeant",
638 "phiLGeant",
639 "rGeant",
640 "zGeant",
641 "ptPPlusGeant",
642 "etaPPlusGeant",
643 "phiPPlusGeant",
644 "TPCTrackLengthPPlusGeant",
645 "ptPiMinusGeant",
646 "etaPiMinusGeant",
647 "phiPiMinusGeant",
648 "TPCTrackLengthPiMinusGeant",
649 "ptResPPlusRecSingle",
650 "etaPPlusRecSingle",
651 "phiPPlusRecSingle",
652 "bXYZPPlusRecSingle",
653 "sigbXYZPPlusRecSingle",
654 "NclsITSPPlusRecSingle",
655 "NclsTPCPPlusRecSingle",
656 "statusRecSinglePos",
657 "ptResPiMinusRecSingle",
658 "etaPiMinusRecSingle",
659 "phiPiMinusRecSingle",
660 "bXYZPiMinusRecSingle",
661 "sigbXYZPiMinusRecSingle",
662 "NclsITSPiMinusRecSingle",
663 "NclsTPCPiMinusRecSingle",
664 "statusRecSingleNeg",
665 "ptResPPlusRecV0",
666 "etaPPlusRecV0",
667 "phiPPlusRecV0",
668 "statusRecV0Pos",
669 "ptResPiMinusRecV0",
670 "etaPiMinusRecV0",
671 "phiPiMinusRecV0",
672 "statusRecV0Neg"};
673
674
7f11ea62 675 fSparseL= new THnSparseF("sparseL","sparseL",fDim,fbinsV0,fxminV0,fxmaxV0);
88a746d6 676 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
677 fSparseL->GetAxis(iaxis)->SetName(axisNameL[iaxis]);
678 fSparseL->GetAxis(iaxis)->SetTitle(axisNameL[iaxis]);
679 }
680
681 TString axisNameAL[37]={"ptALGeant",
682 "etaALGeant",
683 "phiALGeant",
684 "rGeant",
685 "zGeant",
686 "ptPiPluusGeant",
687 "etaPiPlusGeant",
688 "phiPiPlusGeant",
689 "TPCTrackLengthPiPlusGeant",
690 "ptAPMinusGeant",
691 "etaAPMinusGeant",
692 "phiAPMinusGeant",
693 "TPCTrackLengthAPMinusGeant",
694 "ptResPiPlusRecSingle",
695 "etaPiPlusRecSingle",
696 "phiPiPlusRecSingle",
697 "bXYZPiPlusRecSingle",
698 "sigbXYZPiPlusRecSingle",
699 "NclsITSPiPlusRecSingle",
700 "NclsTPCPiPlusRecSingle",
701 "statusRecSinglePos",
702 "ptResAPMinusRecSingle",
703 "etaAPMinusRecSingle",
704 "phiAPMinusRecSingle",
705 "bXYZAPMinusRecSingle",
706 "sigbXYZAPMinusRecSingle",
707 "NclsITSAPMinusRecSingle",
708 "NclsTPCAPMinusRecSingle",
709 "statusRecSingleNeg",
710 "ptResPiPlusRecV0",
711 "etaPiPlusRecV0",
712 "phiPiPlusRecV0",
713 "statusRecV0Pos",
714 "ptResAPMinusRecV0",
715 "etaAPMinusRecV0",
716 "phiAPMinusRecV0",
717 "statusRecV0Neg"};
718
719
7f11ea62 720 fSparseAL= new THnSparseF("sparseAL","sparseAL",fDim,fbinsV0,fxminV0,fxmaxV0);
88a746d6 721 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
722 fSparseAL->GetAxis(iaxis)->SetName(axisNameAL[iaxis]);
723 fSparseAL->GetAxis(iaxis)->SetTitle(axisNameAL[iaxis]);
724 }
725
726 // create output container
727
728 fOutputContainer = new TList() ;
729 fOutputContainer->SetName(GetName()) ;
730
731
732 fOutputContainer->Add(fSparseV0);
733 fOutputContainer->Add(fSparseK0);
734 fOutputContainer->Add(fSparseL);
735 fOutputContainer->Add(fSparseAL);
736
737}
738
739//________________________________________________________________________
47dce8bb 740void AliAnalysisTaskV0QA::UserExec(Option_t *) {
7f11ea62 741 // Execution of the Task
88a746d6 742
47dce8bb 743 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
744
88a746d6 745 if (!fESD) {
ec835029 746 //cout<< "not a tree"<< endl;
88a746d6 747 return;
748 }
749
7f11ea62 750 fnEv++;
88a746d6 751
752
753 //Get MC data
7f11ea62 754 fMCtruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
88a746d6 755
756 // Double_t vertex[3];
7f11ea62 757 Double_t maxVertex=150.;
758 Double_t maxEta=1.2;
759 Double_t lineCutZRSlope=0.662486;
760 Double_t lineCutZValue=7.;
88a746d6 761 Int_t elecGIndex=-1;
762 Int_t posiGIndex=-1;
763 Int_t pPosLIndex=-1;
764 Int_t piNegLIndex=-1;
765
766 Int_t apNegALIndex=-1;
767 Int_t piPosALIndex=-1;
768
7f11ea62 769 fnConvGamGeant=-1;
770 fnDecayK0Geant=-1;
771 fnDecayLGeant=-1;
772 fnDecayALGeant=-1;
88a746d6 773
7f11ea62 774 for(Int_t i=0; i<fgDim;i++){
775 fgConvGamGeantIndex[i] = -1;
776 feNegConvGamGeantIndex[i] = -1;
777 fePosConvGamGeantIndex[i] = -1;
88a746d6 778
7f11ea62 779 feNegConvGamSingleRecIndex[i] = -1;
780 fePosConvGamSingleRecIndex[i] = -1;
88a746d6 781
7f11ea62 782 feNegConvGamV0RecIndex[i] = -1;
783 fePosConvGamV0RecIndex[i] = -1;
784 fConvGamV0RecIndexPos[i] = -1;
785 fConvGamV0RecIndexNeg[i] = -1;
88a746d6 786
787
7f11ea62 788 fK0DecayK0GeantIndex[i] = -1;
789 fpiNegDecayK0GeantIndex[i] = -1;
790 fpiPosDecayK0GeantIndex[i] = -1;
88a746d6 791
7f11ea62 792 fpiNegDecayK0SingleRecIndex[i] = -1;
793 fpiPosDecayK0SingleRecIndex[i] = -1;
88a746d6 794
7f11ea62 795 fpiNegDecayK0V0RecIndex[i] = -1;
796 fpiPosDecayK0V0RecIndex[i] = -1;
797 fDecayK0V0RecIndexPos[i] = -1;
798 fDecayK0V0RecIndexNeg[i] = -1;
88a746d6 799
800
7f11ea62 801 flDecayLGeantIndex[i] = -1;
802 fpiNegDecayLGeantIndex[i] = -1;
803 fpPosDecayLGeantIndex[i] = -1;
88a746d6 804
7f11ea62 805 fpiNegDecayLSingleRecIndex[i] = -1;
806 fpPosDecayLSingleRecIndex[i] = -1;
88a746d6 807
7f11ea62 808 fpiNegDecayLV0RecIndex[i] = -1;
809 fpPosDecayLV0RecIndex[i] = -1;
810 fDecayLV0RecIndexPos[i] = -1;
811 fDecayLV0RecIndexNeg[i] = -1;
88a746d6 812
813 // Antilambda
7f11ea62 814 falDecayALGeantIndex[i] = -1;
815 fpiPosDecayALGeantIndex[i] = -1;
816 fapNegDecayALGeantIndex[i] = -1;
88a746d6 817
7f11ea62 818 fpiPosDecayALSingleRecIndex[i] = -1;
819 fapNegDecayALSingleRecIndex[i] = -1;
88a746d6 820
7f11ea62 821 fpiPosDecayALV0RecIndex[i] = -1;
822 fapNegDecayALV0RecIndex[i] = -1;
823 fDecayALV0RecIndexPos[i] = -1;
824 fDecayALV0RecIndexNeg[i] = -1;
88a746d6 825
826
827 }
828
829 Int_t doMC=1;
830
831 AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));
7f11ea62 832 fnTracksPrim=primVtx.GetNContributors();
88a746d6 833
834
7f11ea62 835 if(fMCtruth && fnTracksPrim>0){
88a746d6 836
7f11ea62 837 fStack = fMCtruth->MCEvent()->Stack();
88a746d6 838
839
840 if ( doMC){
841
7f11ea62 842 for (Int_t iTracks = 0; iTracks < fMCtruth->MCEvent()->GetNumberOfTracks(); iTracks++) {
88a746d6 843
844
7f11ea62 845 TParticle* particle = fStack->Particle(iTracks);
88a746d6 846
847
848
849 if (!particle) {
850 Printf("ERROR: Could not receive particle %d (mc loop)", iTracks);
851 continue;
852 }
853
854 if(particle->Pt()<0.050) continue;
855 if(TMath::Abs(particle->Eta())> 1.2) continue;
856
857
858 if (particle->GetPdgCode()== 22){
859
860
7f11ea62 861 if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
88a746d6 862 continue; // no photon as mothers!
863 }
864
7f11ea62 865 if(particle->GetMother(0) >= fStack->GetNprimary()){
88a746d6 866 continue; // the gamma has a mother, and it is not a primary particle
867 }
868
869 TParticle* ePos = NULL;
870 TParticle* eNeg = NULL;
871 elecGIndex=-1;
872 posiGIndex=-1;
873
874 if(particle->GetNDaughters() >= 2){
875 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
7f11ea62 876 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
88a746d6 877 if(tmpDaughter->GetUniqueID() == 5){
878 if(tmpDaughter->GetPdgCode() == 11){
879 eNeg = tmpDaughter;
880 elecGIndex=daughterIndex;
881 }
882 else if(tmpDaughter->GetPdgCode() == -11){
883 ePos = tmpDaughter;
884 posiGIndex=daughterIndex;
885 }
886 }
887 }
888 }
889
890
891 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
892 continue;
893 }
894
7f11ea62 895 if(TMath::Abs(ePos->Eta())> maxEta || TMath::Abs(eNeg->Eta())> maxEta){
88a746d6 896 continue;
897 }
898
7f11ea62 899 if(ePos->R()> maxVertex ){
88a746d6 900 continue; // cuts on distance from collision point
901 }
902
903
7f11ea62 904 if( (TMath::Abs(ePos->Vz()) * lineCutZRSlope - lineCutZValue) > ePos->R() ){
88a746d6 905 continue; // line cut to exclude regions where we do not reconstruct
906 }
907
908
909 // Looking at the existance of TPC references
910
911 TParticle* ePosTPC;
7f11ea62 912 fMCtruth->MCEvent()->GetParticleAndTR(posiGIndex,ePosTPC,fclRefsP);
88a746d6 913
7f11ea62 914 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(posiGIndex));
88a746d6 915 if(!mcParticlePos) continue;
916
917 Int_t counter;
918 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
919
920
921
7f11ea62 922 int nPointsP = fclRefsP->GetEntries();
88a746d6 923
ec835029 924 if (fRefTPC) delete fRefTPC;fRefTPC=NULL;
88a746d6 925 fRefTPC = new TObjArray();
926
927 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
7f11ea62 928 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
88a746d6 929 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
930 }
931
932 fRefTPC->Sort();
933
934 for(int i=0; i<fRefTPC->GetEntries(); i++) {
935 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
936 fLabelsTPC[i] = ref->GetTrack();
937 }
938 int labelPosRefs=0;
939 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
940 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
941 if (aRef->GetTrack() != posiGIndex ) break;
942 ++labelPosRefs;
943 }
944
945
946
947
948 TParticle* eNegTPC;
7f11ea62 949 fMCtruth->MCEvent()->GetParticleAndTR(elecGIndex,eNegTPC,fclRefsN);
88a746d6 950
7f11ea62 951 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(elecGIndex));
88a746d6 952 if(!mcParticleNeg) continue;
953
954 Int_t counterN;
955 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
7f11ea62 956 int nPointsN = fclRefsN->GetEntries();
88a746d6 957
ec835029 958 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
88a746d6 959 fRefTPC = new TObjArray();
960
961 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
7f11ea62 962 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
88a746d6 963 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
964 }
965
966 fRefTPC->Sort();
967
968 for(int i=0; i<fRefTPC->GetEntries(); i++) {
969 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
970 fLabelsTPC[i] = ref->GetTrack();
971 }
972 int labelNegRefs=0;
973 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
974 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
975 if (aRef->GetTrack() != elecGIndex ) break;
976 ++labelNegRefs;
977 }
978
979
980
981 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if e+/e- do not have a TPC ref continue;
982 ////////////////////////////////////////////////////////////////////
983
984
7f11ea62 985 fnConvGamGeant++;
986 fgConvGamGeantIndex[fnConvGamGeant]=iTracks;
987 feNegConvGamGeantIndex[fnConvGamGeant] = elecGIndex;
988 fePosConvGamGeantIndex[fnConvGamGeant] = posiGIndex;
88a746d6 989
7f11ea62 990 feNegConvGamGeantLength[fnConvGamGeant] = tpcTrackLengtheNeg;
991 fePosConvGamGeantLength[fnConvGamGeant] = tpcTrackLengthePos;
88a746d6 992
993 }
994
995
996 TParticle* piPos = NULL;
997 TParticle* piNeg = NULL;
7f11ea62 998 fpiPosK0Index=-1;
999 fpiNegK0Index=-1;
88a746d6 1000
1001 if (particle->GetPdgCode()== 310){ // k0short
1002 if(particle->GetNDaughters() == 2){
1003 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
7f11ea62 1004 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
88a746d6 1005 if(tmpDaughter->GetPdgCode() == 211){
1006 piPos= tmpDaughter;
7f11ea62 1007 fpiPosK0Index=daughterIndex;
88a746d6 1008 }
1009 else if(tmpDaughter->GetPdgCode() == -211){
1010 piNeg = tmpDaughter;
7f11ea62 1011 fpiNegK0Index=daughterIndex;
88a746d6 1012 }
1013 }
1014 }
1015
1016 if(piPos == NULL || piNeg == NULL){ // means we do not have two daughters from K0short decay
1017 continue;
1018 }
1019
7f11ea62 1020 if(TMath::Abs(piPos->Eta())> maxEta || TMath::Abs(piNeg->Eta())> maxEta){
88a746d6 1021 continue;
1022 }
1023
7f11ea62 1024 if(piPos->R()> maxVertex ){
88a746d6 1025 continue; // cuts on distance from collision point
1026 }
1027
1028
7f11ea62 1029 if( (TMath::Abs(piPos->Vz()) * lineCutZRSlope - lineCutZValue) > piPos->R() ){
88a746d6 1030 continue; // line cut to exclude regions where we do not reconstruct
1031 }
1032
1033 // Looking at the existance of TPC references
1034
1035 TParticle* ePosTPC;
7f11ea62 1036 fMCtruth->MCEvent()->GetParticleAndTR(fpiPosK0Index,ePosTPC,fclRefsP);
88a746d6 1037
7f11ea62 1038 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiPosK0Index));
88a746d6 1039 if(!mcParticlePos) continue;
1040
1041 Int_t counter;
1042 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1043
1044
7f11ea62 1045 int nPointsP = fclRefsP->GetEntries();
ec835029 1046 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
88a746d6 1047 fRefTPC = new TObjArray();
1048
1049 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
7f11ea62 1050 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
88a746d6 1051 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1052 }
1053
1054 fRefTPC->Sort();
1055
1056 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1057 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1058 fLabelsTPC[i] = ref->GetTrack();
1059 }
1060 int labelPosRefs=0;
1061 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1062 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
7f11ea62 1063 if (aRef->GetTrack() != fpiPosK0Index ) break;
88a746d6 1064 ++labelPosRefs;
1065 }
1066
1067
1068
1069
1070 TParticle* eNegTPC;
7f11ea62 1071 fMCtruth->MCEvent()->GetParticleAndTR(fpiNegK0Index,eNegTPC,fclRefsN);
88a746d6 1072
7f11ea62 1073 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiNegK0Index));
88a746d6 1074 if(!mcParticleNeg) continue;
1075
1076 Int_t counterN;
1077 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1078
7f11ea62 1079 int nPointsN = fclRefsN->GetEntries();
ec835029 1080 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
88a746d6 1081 fRefTPC = new TObjArray();
1082
1083 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
7f11ea62 1084 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
88a746d6 1085 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1086 }
1087
1088 fRefTPC->Sort();
1089
1090 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1091 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1092 fLabelsTPC[i] = ref->GetTrack();
1093 }
1094 int labelNegRefs=0;
1095 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1096 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
7f11ea62 1097 if (aRef->GetTrack() != fpiNegK0Index ) break;
88a746d6 1098 ++labelNegRefs;
1099 }
1100
1101 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if pi+/pi- do not have a TPC ref continue;
1102 ////////////////////////////////////////////////////////////////////
1103
7f11ea62 1104 fnDecayK0Geant++;
88a746d6 1105
7f11ea62 1106 fK0DecayK0GeantIndex[fnDecayK0Geant]=iTracks;
1107 fpiNegDecayK0GeantIndex[fnDecayK0Geant]=fpiNegK0Index;
1108 fpiPosDecayK0GeantIndex[fnDecayK0Geant]=fpiPosK0Index;
1109 fpiNegDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengtheNeg;
1110 fpiPosDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengthePos;
88a746d6 1111
1112 }
1113
1114
1115 TParticle* pPos = NULL;
1116 TParticle* piNegL = NULL;
1117 pPosLIndex=-1;
1118 piNegLIndex=-1;
1119
1120
1121 if (particle->GetPdgCode()== 3122){ //lambda
1122
1123 if(particle->GetNDaughters() == 2){
1124 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
7f11ea62 1125 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
88a746d6 1126 if(tmpDaughter->GetPdgCode() == 2212){
1127 pPos= tmpDaughter;
1128 pPosLIndex=daughterIndex;
1129 }
1130 else if(tmpDaughter->GetPdgCode() == -211){
1131 piNegL = tmpDaughter;
1132 piNegLIndex=daughterIndex;
1133 }
1134 }
1135 }
1136
1137 if(pPos == NULL || piNegL == NULL){ // means we do not have two daughters from lambda decay
1138 continue;
1139 }
1140
7f11ea62 1141 if(TMath::Abs(pPos->Eta())> maxEta || TMath::Abs(piNegL->Eta())> maxEta){
88a746d6 1142 continue;
1143 }
1144
7f11ea62 1145 if(pPos->R()> maxVertex ){
88a746d6 1146 continue; // cuts on distance from collision point
1147 }
1148
1149
7f11ea62 1150 if( (TMath::Abs(pPos->Vz()) * lineCutZRSlope - lineCutZValue) > pPos->R() ){
88a746d6 1151 continue; // line cut to exclude regions where we do not reconstruct
1152 }
1153
1154
1155 // Looking at the existance of TPC references
1156
1157 TParticle* ePosTPC;
7f11ea62 1158 fMCtruth->MCEvent()->GetParticleAndTR(pPosLIndex,ePosTPC,fclRefsP);
88a746d6 1159
7f11ea62 1160 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(pPosLIndex));
88a746d6 1161 if(!mcParticlePos) continue;
1162
1163 Int_t counter;
1164 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1165
1166
7f11ea62 1167 int nPointsP = fclRefsP->GetEntries();
ec835029 1168 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
88a746d6 1169 fRefTPC = new TObjArray();
1170
1171 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
7f11ea62 1172 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
88a746d6 1173 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1174 }
1175
1176 fRefTPC->Sort();
1177
1178 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1179 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1180 fLabelsTPC[i] = ref->GetTrack();
1181 }
1182 int labelPosRefs=0;
1183 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1184 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1185 if (aRef->GetTrack() != pPosLIndex ) break;
1186 ++labelPosRefs;
1187 }
1188
1189
1190
1191
1192 TParticle* eNegTPC;
7f11ea62 1193 fMCtruth->MCEvent()->GetParticleAndTR(piNegLIndex,eNegTPC,fclRefsN);
88a746d6 1194
7f11ea62 1195 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piNegLIndex));
88a746d6 1196 if(!mcParticleNeg) continue;
1197
1198 Int_t counterN;
1199 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1200
7f11ea62 1201 int nPointsN = fclRefsN->GetEntries();
88a746d6 1202 if (fRefTPC) delete fRefTPC;
1203 fRefTPC = new TObjArray();
1204
1205 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
7f11ea62 1206 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
88a746d6 1207 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1208 }
1209
1210 fRefTPC->Sort();
1211
1212 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1213 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1214 fLabelsTPC[i] = ref->GetTrack();
1215 }
1216 int labelNegRefs=0;
1217 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1218 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1219 if (aRef->GetTrack() != piNegLIndex ) break;
1220 ++labelNegRefs;
1221 }
1222
1223 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1224 ////////////////////////////////////////////////////////////////////
1225
7f11ea62 1226 fnDecayLGeant++;
88a746d6 1227
7f11ea62 1228 flDecayLGeantIndex[fnDecayLGeant]=iTracks;
88a746d6 1229
7f11ea62 1230 fpiNegDecayLGeantIndex[fnDecayLGeant]=piNegLIndex;
1231 fpPosDecayLGeantIndex[fnDecayLGeant]=pPosLIndex;
88a746d6 1232
7f11ea62 1233 fpiNegDecayLGeantLength[fnDecayLGeant]=tpcTrackLengtheNeg;
1234 fpPosDecayLGeantLength[fnDecayLGeant]=tpcTrackLengthePos;
88a746d6 1235
1236
1237 }
1238
1239 /////////////////////////////////////////////////////
1240
1241 // AntiLambda
1242 TParticle* apNeg = NULL;
1243 TParticle* piPosAL = NULL;
1244 apNegALIndex=-1;
1245 piPosALIndex=-1;
1246
1247
1248 if (particle->GetPdgCode()== -3122){ //antilambda
1249
1250 if(particle->GetNDaughters() == 2){
1251 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
7f11ea62 1252 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
88a746d6 1253 if(tmpDaughter->GetPdgCode() == -2212){
1254 apNeg= tmpDaughter;
1255 apNegALIndex=daughterIndex;
1256 }
1257 else if(tmpDaughter->GetPdgCode() == 211){
1258 piPosAL = tmpDaughter;
1259 piPosALIndex=daughterIndex;
1260 }
1261 }
1262 }
1263
1264 if(apNeg == NULL || piPosAL == NULL){ // means we do not have two daughters from antilambda decay
1265 continue;
1266 }
1267
7f11ea62 1268 if(TMath::Abs(apNeg->Eta())> maxEta || TMath::Abs(piPosAL->Eta())> maxEta){
88a746d6 1269 continue;
1270 }
1271
7f11ea62 1272 if(apNeg->R()> maxVertex ){
88a746d6 1273 continue; // cuts on distance from collision point
1274 }
1275
1276
7f11ea62 1277 if( (TMath::Abs(apNeg->Vz()) * lineCutZRSlope - lineCutZValue) > apNeg->R() ){
88a746d6 1278 continue; // line cut to exclude regions where we do not reconstruct
1279 }
1280
1281
1282 // Looking at the existance of TPC references
1283
1284 TParticle* ePosTPC;
7f11ea62 1285 fMCtruth->MCEvent()->GetParticleAndTR(piPosALIndex,ePosTPC,fclRefsP);
88a746d6 1286
7f11ea62 1287 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piPosALIndex));
88a746d6 1288 if(!mcParticlePos) continue;
1289
1290 Int_t counter;
1291 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1292
7f11ea62 1293 int nPointsP = fclRefsP->GetEntries();
88a746d6 1294 if (fRefTPC) delete fRefTPC;
1295 fRefTPC = new TObjArray();
1296
1297 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
7f11ea62 1298 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
88a746d6 1299 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1300 }
1301
1302 fRefTPC->Sort();
1303
1304 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1305 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1306 fLabelsTPC[i] = ref->GetTrack();
1307 }
1308 int labelPosRefs=0;
1309 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1310 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1311 if (aRef->GetTrack() != piPosALIndex ) break;
1312 ++labelPosRefs;
1313 }
1314
1315
1316 TParticle* eNegTPC;
7f11ea62 1317 fMCtruth->MCEvent()->GetParticleAndTR(apNegALIndex,eNegTPC,fclRefsN);
88a746d6 1318
7f11ea62 1319 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(apNegALIndex));
88a746d6 1320 if(!mcParticleNeg) continue;
1321
1322 Int_t counterN;
1323 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1324
7f11ea62 1325 int nPointsN = fclRefsN->GetEntries();
88a746d6 1326 if (fRefTPC) delete fRefTPC;
1327 fRefTPC = new TObjArray();
1328
1329 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
7f11ea62 1330 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
88a746d6 1331 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1332 }
1333
1334 fRefTPC->Sort();
1335
1336 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1337 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1338 fLabelsTPC[i] = ref->GetTrack();
1339 }
1340 int labelNegRefs=0;
1341 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1342 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1343 if (aRef->GetTrack() != apNegALIndex ) break;
1344 ++labelNegRefs;
1345 }
1346
1347
1348
1349 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1350 ////////////////////////////////////////////////////////////////////
1351
7f11ea62 1352 fnDecayALGeant++;
1353 falDecayALGeantIndex[fnDecayALGeant]=iTracks;
88a746d6 1354
7f11ea62 1355 fpiPosDecayALGeantIndex[fnDecayALGeant]=piPosALIndex;
1356 fapNegDecayALGeantIndex[fnDecayALGeant]=apNegALIndex;
88a746d6 1357
7f11ea62 1358 fpiPosDecayALGeantLength[fnDecayALGeant]=tpcTrackLengthePos;
1359 fapNegDecayALGeantLength[fnDecayALGeant]=tpcTrackLengtheNeg;
88a746d6 1360
1361
1362 } // AntiLambda
1363
1364 } //track loop
1365 }
1366
1367 }
1368
1369
1370 AliKFParticle::SetField(fESD->GetMagneticField());
1371
1372 const AliESDVertex *pvertex = fESD->GetPrimaryVertex();
1373 Double_t xyzVtx[3];
1374 pvertex->GetXYZ(xyzVtx);
1375
7f11ea62 1376 if(fnTracksPrim>0) {
88a746d6 1377
1378 InspectListOfChargedParticles();
1379 InspectListOfV0s();
1380
1381
7f11ea62 1382 if(fnConvGamGeant>-1){
88a746d6 1383 FillHnSparseGamma();
1384 }
1385
7f11ea62 1386 if(fnDecayK0Geant>-1){
88a746d6 1387 FillHnSparseK0();
1388 }
1389
7f11ea62 1390 if(fnDecayLGeant>-1){
88a746d6 1391 FillHnSparseL();
1392 }
1393
7f11ea62 1394 if(fnDecayALGeant>-1){
88a746d6 1395 FillHnSparseAL();
1396 }
1397
1398 }
1399
1400
47dce8bb 1401 PostData(1, fOutputContainer );
88a746d6 1402
1403
1404}
1405
1406void AliAnalysisTaskV0QA::Terminate(Option_t *) {
1407 // Draw some histogram at the end.
1408
1409}
1410
1411
1412Int_t AliAnalysisTaskV0QA::GetTPCReference(Int_t label) {
7f11ea62 1413 // Get TPC References
88a746d6 1414
1415 int start = TMath::BinarySearch(fRefTPC->GetEntries(), fLabelsTPC, label);
1416
1417 while (start >= 0) {
1418 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[start];
1419 if (ref->GetTrack() != label) return start+1;
1420 start--;
1421 }
1422
1423 return 0;
1424}
1425
1426
1427
1428
1429
1430void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
7f11ea62 1431 // Look at the list of particles for the single track reconstruction
88a746d6 1432
1433 for(Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++){
1434
1435 AliESDtrack* curTrack = fESD->GetTrack(iTracks);
1436
1437 if(!curTrack){
1438 continue;
1439 }
1440
1441
1442// if( !(curTrack->GetStatus() & AliESDtrack::kTPCrefit)){
1443// continue;
1444// }
1445
1446
1447 Int_t labelMC = TMath::Abs(curTrack->GetLabel());
1448
7f11ea62 1449 if ( labelMC > fStack->GetNtrack() ) continue;
88a746d6 1450
1451
7f11ea62 1452 TParticle* curParticle = fStack->Particle(labelMC);
88a746d6 1453 if(curParticle->GetMother(0)==-1){
1454 continue;
1455 }
1456
1457
1458 if(TMath::Abs(curParticle->GetPdgCode()) == 11){ // e+/e-
1459
7f11ea62 1460 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==22 ){ // e+/e- from gamma
88a746d6 1461 if( curParticle->GetUniqueID()!=5 ){ // e+/e- from gamma conversion
1462 continue;
1463 }
1464
7f11ea62 1465 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
88a746d6 1466 if(curTrack->GetSign()>0){
7f11ea62 1467 if (labelMC== fePosConvGamGeantIndex[iGamConv]){
1468 fePosConvGamSingleRecIndex[iGamConv]=iTracks;
88a746d6 1469 }
1470 }else{
7f11ea62 1471 if (labelMC== feNegConvGamGeantIndex[iGamConv]){
1472 feNegConvGamSingleRecIndex[iGamConv]=iTracks;
88a746d6 1473 }
1474 }
1475 } // loop over geant converted gammas
1476
1477 }
1478 } // condition to select reconstructed electrons
1479
1480
1481
1482 if(TMath::Abs(curParticle->GetPdgCode()) == 211 || TMath::Abs(curParticle->GetPdgCode())==2212 ){ // pi+/pi-
1483
7f11ea62 1484 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==310 ||
1485 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==3122 ||
1486 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==-3122 ){ // pi+/proton/pi- from K0/Lambda
88a746d6 1487
7f11ea62 1488 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
88a746d6 1489 if(curTrack->GetSign()>0){
7f11ea62 1490 if (labelMC== fpiPosDecayK0GeantIndex[iK0Dec]){
1491 fpiPosDecayK0SingleRecIndex[iK0Dec]=iTracks;
88a746d6 1492 }
1493 }else{
7f11ea62 1494 if (labelMC== fpiNegDecayK0GeantIndex[iK0Dec]){
1495 fpiNegDecayK0SingleRecIndex[iK0Dec]=iTracks;
88a746d6 1496 }
1497 }
1498 } // loop over geant decay K0
1499
7f11ea62 1500 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
88a746d6 1501 if(curTrack->GetSign()>0){
7f11ea62 1502 if (labelMC== fpPosDecayLGeantIndex[iLDec]){
1503 fpPosDecayLSingleRecIndex[iLDec]=iTracks;
88a746d6 1504 }
1505 }else{
7f11ea62 1506 if (labelMC== fpiNegDecayLGeantIndex[iLDec]){
1507 fpiNegDecayLSingleRecIndex[iLDec]=iTracks;
88a746d6 1508 }
1509 }
1510 } // loop over geant decay Lambda
1511
7f11ea62 1512 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
88a746d6 1513 if(curTrack->GetSign()<0){
7f11ea62 1514 if (labelMC== fapNegDecayALGeantIndex[iALDec]){
1515 fapNegDecayALSingleRecIndex[iALDec]=iTracks;
88a746d6 1516 }
1517 }else{
7f11ea62 1518 if (labelMC== fpiPosDecayALGeantIndex[iALDec]){
1519 fpiPosDecayALSingleRecIndex[iALDec]=iTracks;
88a746d6 1520 }
1521 }
1522 } // loop over geant decay antiLambda
1523 }
1524 } // condition to select reconstructed electrons
1525 } // all reconstructed track
1526
1527
1528}
1529
1530void AliAnalysisTaskV0QA::InspectListOfV0s(){
7f11ea62 1531 // Look at the list of particles for the V0 reconstruction
88a746d6 1532
1533 AliESDtrack* trackPos= NULL;
1534 AliESDtrack* trackNeg= NULL;
1535 Int_t grandMotherPos=-1;
1536 Int_t grandMotherNeg=-1;
1537 Int_t motherPos=-1;
1538 Int_t motherNeg=-1;
1539 Int_t pIndex=-1;
1540 Int_t nIndex=-1;
1541
1542 for(Int_t iV0MI = 0; iV0MI < fESD->GetNumberOfV0s(); iV0MI++) {
1543
1544 AliESDv0 * fV0MIs = fESD->GetV0(iV0MI);
1545
1546
1547 if ( !fV0MIs->GetOnFlyStatus() ){
1548 continue;
1549 }
7f11ea62 1550 if(fnTracksPrim<=0) {
88a746d6 1551 continue;
1552 }
1553
1554
1555 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1556 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1557
1558
1559 if ( trackPosTest->GetSign() == trackNegTest->GetSign()){
1560 continue;
1561 }
1562
1563 //To avoid ghosts
1564
1565// if( !(trackPosTest->GetStatus() & AliESDtrack::kTPCrefit)){
1566// continue;
1567// }
1568
1569// if( !(trackNegTest->GetStatus() & AliESDtrack::kTPCrefit)){
1570// continue;
1571// }
1572
1573 if( trackPosTest->GetSign() ==1){
1574 trackPos =fESD->GetTrack(fV0MIs->GetPindex());
1575 trackNeg =fESD->GetTrack(fV0MIs->GetNindex());
1576 pIndex=fV0MIs->GetPindex();
1577 nIndex=fV0MIs->GetNindex();
1578 }
1579
1580 if( trackPosTest->GetSign() ==-1){
1581 trackPos =fESD->GetTrack(fV0MIs->GetNindex());
1582 trackNeg =fESD->GetTrack(fV0MIs->GetPindex());
1583 pIndex=fV0MIs->GetNindex();
1584 nIndex=fV0MIs->GetPindex();
1585
1586 }
1587
1588 Int_t labelNeg=TMath::Abs(trackNeg->GetLabel());
7f11ea62 1589 if(labelNeg > fStack->GetNtrack() ) continue;
1590 TParticle * particleNeg= fStack->Particle(labelNeg);
88a746d6 1591
1592 Int_t labelPos=TMath::Abs(trackPos->GetLabel());
7f11ea62 1593 if(labelPos > fStack->GetNtrack() ) continue;
1594 TParticle * particlePos= fStack->Particle(labelPos);
88a746d6 1595
1596
1597 if(particlePos->GetMother(0)>-1){
7f11ea62 1598 grandMotherPos=fStack->Particle(particlePos->GetMother(0))->GetMother(0);
88a746d6 1599 motherPos=particlePos->GetMother(0);
1600 }
1601
1602 if(particleNeg->GetMother(0)>-1){
7f11ea62 1603 grandMotherNeg=fStack->Particle(particleNeg->GetMother(0))->GetMother(0);
88a746d6 1604 motherNeg=particleNeg->GetMother(0);
1605 }
1606
1607 if(motherPos == motherNeg && motherPos!=-1 ){
1608 if( particlePos->GetPdgCode() ==-11 && particleNeg->GetPdgCode()==11 ){
7f11ea62 1609 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1610 if (labelPos== fePosConvGamGeantIndex[iGamConv]){
1611 fePosConvGamV0RecIndex[iGamConv]=pIndex;
1612 fConvGamV0RecIndexPos[iGamConv]=iV0MI;
88a746d6 1613 }
7f11ea62 1614 if (labelNeg== feNegConvGamGeantIndex[iGamConv]){
1615 feNegConvGamV0RecIndex[iGamConv]=nIndex;
1616 fConvGamV0RecIndexNeg[iGamConv]=iV0MI;
88a746d6 1617 }
1618
1619 } // loop over geant converted gammas
1620 }
1621
1622 if( particlePos->GetPdgCode()==211 && particleNeg->GetPdgCode()==-211 ){
7f11ea62 1623 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1624 if (labelPos== fpiPosDecayK0GeantIndex[iK0Dec]){
1625 fpiPosDecayK0V0RecIndex[iK0Dec]=pIndex;
1626 fDecayK0V0RecIndexPos[iK0Dec]=iV0MI;
88a746d6 1627 }
7f11ea62 1628 if (labelNeg== fpiNegDecayK0GeantIndex[iK0Dec]){
1629 fpiNegDecayK0V0RecIndex[iK0Dec]=nIndex;
1630 fDecayK0V0RecIndexNeg[iK0Dec]=iV0MI;
88a746d6 1631 }
1632
1633 } // loop over geant K0
1634 }
1635
1636 if( particlePos->GetPdgCode()==2212 && particleNeg->GetPdgCode()==-211 ){
7f11ea62 1637 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1638 if (labelPos== fpPosDecayLGeantIndex[iLDec]){
1639 fpPosDecayLV0RecIndex[iLDec]=pIndex;
1640 fDecayLV0RecIndexPos[iLDec]=iV0MI;
88a746d6 1641 }
7f11ea62 1642 if (labelNeg== fpiNegDecayLGeantIndex[iLDec]){
1643 fpiNegDecayLV0RecIndex[iLDec]=nIndex;
1644 fDecayLV0RecIndexNeg[iLDec]=iV0MI;
88a746d6 1645 }
1646
1647 } // loop over geant Lambda
1648 }
1649
1650 if( particleNeg->GetPdgCode()==-2212 && particlePos->GetPdgCode()==211 ){
7f11ea62 1651 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1652 if (labelNeg== fapNegDecayALGeantIndex[iALDec]){
1653 fapNegDecayALV0RecIndex[iALDec]=nIndex;
1654 fDecayALV0RecIndexNeg[iALDec]=iV0MI;
88a746d6 1655 }
7f11ea62 1656 if (labelPos== fpiPosDecayALGeantIndex[iALDec]){
1657 fpiPosDecayALV0RecIndex[iALDec]=pIndex;
1658 fDecayALV0RecIndexPos[iALDec]=iV0MI;
88a746d6 1659 }
1660
1661 } // loop over geant antiLambda
1662 }
1663
1664
1665 }
1666
1667 }
7f11ea62 1668 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1669 if ( fConvGamV0RecIndexNeg[iGamConv]!= fConvGamV0RecIndexPos[iGamConv]){
1670 fePosConvGamV0RecIndex[iGamConv]=-1;
1671 feNegConvGamV0RecIndex[iGamConv]=-1;
1672 fConvGamV0RecIndexNeg[iGamConv]=-1;
1673 fConvGamV0RecIndexPos[iGamConv]=-1;
88a746d6 1674
1675 }
1676 }
1677
7f11ea62 1678 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1679 if(fDecayLV0RecIndexPos[iLDec] != fDecayLV0RecIndexNeg[iLDec]){
1680 fpiNegDecayLV0RecIndex[iLDec]=-1;
1681 fpPosDecayLV0RecIndex[iLDec]=-1;
1682 fDecayLV0RecIndexNeg[iLDec]=-1;
1683 fDecayLV0RecIndexPos[iLDec]=-1;
88a746d6 1684 }
1685 }
1686
7f11ea62 1687 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1688 if(fDecayALV0RecIndexPos[iALDec] != fDecayALV0RecIndexNeg[iALDec]){
1689 fpiPosDecayALV0RecIndex[iALDec]=-1;
1690 fapNegDecayALV0RecIndex[iALDec]=-1;
1691 fDecayALV0RecIndexNeg[iALDec]=-1;
1692 fDecayALV0RecIndexPos[iALDec]=-1;
88a746d6 1693 }
1694 }
1695
7f11ea62 1696 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1697 if(fDecayK0V0RecIndexPos[iK0Dec] != fDecayK0V0RecIndexNeg[iK0Dec]){
1698 fpiNegDecayK0V0RecIndex[iK0Dec]=-1;
1699 fpiPosDecayK0V0RecIndex[iK0Dec]=-1;
1700 fDecayK0V0RecIndexNeg[iK0Dec]=-1;
1701 fDecayK0V0RecIndexPos[iK0Dec]=-1;
88a746d6 1702 }
1703 }
1704
1705
1706}
1707void AliAnalysisTaskV0QA::FillHnSparseGamma()
1708{
7f11ea62 1709 // Fill THnSparse Gamma
1710
88a746d6 1711 Double_t massE=0.00051099892;
1712 Double_t ppSgl[3];
1713 Double_t pmSgl[3];
1714 Float_t bPosSgl[2];
1715 Float_t bNegSgl[2];
1716 Float_t bPosCov[3];
1717 Float_t bNegCov[3];
1718
1719 Double_t ppV0[3];
1720 Double_t pmV0[3];
1721 Double_t xrG[3];
1722
1723 TLorentzVector posSglTrack;
1724 TLorentzVector negSglTrack;
1725 Double_t posPt,posEta,posPhi;
1726 Double_t negPt,negEta,negPhi;
1727
1728 TLorentzVector posV0Track;
1729 TLorentzVector negV0Track;
1730 Double_t posV0Pt,posV0Eta,posV0Phi;
1731 Double_t negV0Pt,negV0Eta,negV0Phi;
1732
1733 Float_t nClsITSPos=-1;
1734 Float_t nClsITSNeg=-1;
1735
1736 Float_t nClsTPCPos=-1;
1737 Float_t nClsTPCNeg=-1;
1738
1739 Int_t statusSingPos=-1;
1740 Int_t statusSingNeg=-1;
1741
1742 Int_t statusV0Pos=-1;
1743 Int_t statusV0Neg=-1;
1744
1745
7f11ea62 1746 for(Int_t i=0;i<fnConvGamGeant+1;i++){
1747 TParticle* gamPart = fStack->Particle(fgConvGamGeantIndex[i]);
1748 TParticle* ePosPart = fStack->Particle(fePosConvGamGeantIndex[i]);
1749 TParticle* eNegPart = fStack->Particle(feNegConvGamGeantIndex[i]);
1750 if (fePosConvGamSingleRecIndex[i]!=-1){
1751 AliESDtrack * ePosSglTrack = fESD->GetTrack(fePosConvGamSingleRecIndex[i]);
88a746d6 1752 ePosSglTrack->GetPxPyPz(ppSgl);
1753 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massE);
1754 posPt = posSglTrack.Pt();
1755 posEta = posSglTrack.Eta();
1756 posPhi = posSglTrack.Phi();
1757 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1758 nClsITSPos=ePosSglTrack->GetNcls(0);
1759 nClsTPCPos=ePosSglTrack->GetNcls(1);
1760 statusSingPos=1;
1761 }else{
1762 posPt = 1000000;
1763 posEta = -2.;
1764 posPhi = -2*TMath::Pi();
1765 bPosSgl[0]=-100.;
1766 bPosSgl[1]=-100.;
1767 bPosCov[0]=-100;
1768 bPosCov[2]=-100;
1769 nClsITSPos=-1;
1770 nClsTPCPos=-1;
1771 statusSingPos=-1;
1772 }
1773
7f11ea62 1774 if (feNegConvGamSingleRecIndex[i]!=-1){
1775 AliESDtrack * eNegSglTrack = fESD->GetTrack(feNegConvGamSingleRecIndex[i]);
88a746d6 1776 eNegSglTrack->GetPxPyPz(pmSgl);
1777 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massE);
1778 negPt = negSglTrack.Pt();
1779 negEta = negSglTrack.Eta();
1780 negPhi = negSglTrack.Phi();
1781 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
1782 nClsITSNeg=eNegSglTrack->GetNcls(0);
1783 nClsTPCNeg=eNegSglTrack->GetNcls(1);
1784 statusSingNeg=1;
1785 }else{
1786 negPt = 1000000;
1787 negEta = -2.;
1788 negPhi = -2*TMath::Pi();
1789 bNegSgl[0]=-100.;
1790 bNegSgl[1]=-100.;
1791 bNegCov[0]=-100;
1792 bNegCov[2]=-100;
1793 nClsITSNeg=-1;
1794 nClsTPCNeg=-1;
1795 statusSingNeg=-1;
1796 }
1797
1798 posV0Pt = 1000000;
1799 posV0Eta = -2.;
1800 posV0Phi = -2*TMath::Pi();
1801 negV0Pt = 1000000;
1802 negV0Eta = -2.;
1803 negV0Phi = -2*TMath::Pi();
1804
7f11ea62 1805 if(fConvGamV0RecIndexPos[i]!=-1){
1806 AliESDv0 * fV0MIs = fESD->GetV0(fConvGamV0RecIndexPos[i]);
88a746d6 1807 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1808 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1809
7f11ea62 1810 if (fePosConvGamV0RecIndex[i]!=-1 ){
88a746d6 1811 // AliESDtrack * ePosV0Track = fESD->GetTrack(ePosConvGamV0RecIndex[i]);
1812 if ( trackPosTest->GetSign()==1 ) {
1813 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1814 }else{
1815 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1816 }
1817 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massE);
1818
1819 posV0Pt = posV0Track.Pt();
1820 posV0Eta = posV0Track.Eta();
1821 posV0Phi = posV0Track.Phi();
1822 statusV0Pos=1;
1823 }else{
1824 posV0Pt = 1000000;
1825 posV0Eta = -2.;
1826 posV0Phi = -2*TMath::Pi();
1827 statusV0Pos=-1;
1828 }
1829
7f11ea62 1830 if (feNegConvGamV0RecIndex[i]!=-1 ){
88a746d6 1831 // AliESDtrack * eNegV0Track = fESD->GetTrack(eNegConvGamV0RecIndex[i]);
1832 if ( trackNegTest->GetSign()==-1 ) {
1833 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1834 }else{
1835 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1836 }
1837 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massE);
1838
1839 negV0Pt = negV0Track.Pt();
1840 negV0Eta = negV0Track.Eta();
1841 negV0Phi = negV0Track.Phi();
1842 statusV0Neg=1;
1843 }else{
1844 negV0Pt = 1000000;
1845 negV0Eta = -2.;
1846 negV0Phi = -2*TMath::Pi();
1847 statusV0Neg=-1;
1848 }
1849 }
1850
1851 xrG[0] = ePosPart->Vx();
1852 xrG[1] = ePosPart->Vy();
1853 xrG[2] = ePosPart->Vz();
1854
1855 //--------- Geant variables ----------------------
1856 fValueV0[0] = 1./TMath::Sqrt(gamPart->Pt());
1857 fValueV0[1] = gamPart->Eta();
1858
1859 Double_t tmpGPhi=gamPart->Phi();
1860 if( gamPart->Phi()>TMath::Pi()){
1861 tmpGPhi=gamPart->Phi()-2*TMath::Pi();
1862 }
1863 fValueV0[2] = tmpGPhi;
1864
1865 fValueV0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
1866 fValueV0[4] = xrG[2];
1867
1868
1869 fValueV0[5] = 1./TMath::Sqrt(ePosPart->Pt());
1870 fValueV0[6] = ePosPart->Eta();
1871
1872 Double_t tmpPPhi=ePosPart->Phi();
1873 if( ePosPart->Phi()>TMath::Pi()){
1874 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
1875 }
1876 fValueV0[7] = tmpPPhi;
7f11ea62 1877 fValueV0[8] = fePosConvGamGeantLength[i];
88a746d6 1878
1879 fValueV0[9] = 1./TMath::Sqrt(eNegPart->Pt());
1880 fValueV0[10] = eNegPart->Eta();
1881
1882 Double_t tmpNPhi=eNegPart->Phi();
1883 if( eNegPart->Phi()>TMath::Pi()){
1884 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
1885 }
1886 fValueV0[11] = tmpNPhi;
7f11ea62 1887 fValueV0[12] = feNegConvGamGeantLength[i];
88a746d6 1888
1889 //---- Single track variables----------------------
1890
1891 fValueV0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
1892 fValueV0[14] = posEta;
1893 fValueV0[15] = posPhi;
1894 fValueV0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
1895 fValueV0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
1896 fValueV0[18] = nClsITSPos;
1897 fValueV0[19] = nClsTPCPos;
1898 fValueV0[20] = statusSingPos;
1899
1900
1901 fValueV0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
1902 fValueV0[22] = negEta;
1903 fValueV0[23] = negPhi;
1904 fValueV0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
1905 fValueV0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
1906
1907 fValueV0[26] = nClsITSNeg;
1908 fValueV0[27] = nClsTPCNeg;
1909 fValueV0[28] = statusSingNeg;
1910
1911
1912 //---- V0 track variables----------------------
1913
1914 fValueV0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
1915 fValueV0[30] = posV0Eta;
1916 fValueV0[31] = posV0Phi;
1917 fValueV0[32] = statusV0Pos;
1918
1919 fValueV0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
1920 fValueV0[34] = negV0Eta;
1921 fValueV0[35] = negV0Phi;
1922 fValueV0[36] = statusV0Neg;
1923
1924 fSparseV0->Fill(fValueV0);
1925 }
1926
1927
1928}
1929
1930void AliAnalysisTaskV0QA::FillHnSparseK0()
1931{
7f11ea62 1932 // Fill THnSparse K0
88a746d6 1933
1934 Double_t massPi=0.13957018;
1935 Double_t ppSgl[3];
1936 Double_t pmSgl[3];
1937 Float_t bPosSgl[2];
1938 Float_t bNegSgl[2];
1939 Float_t bPosCov[3];
1940 Float_t bNegCov[3];
1941
1942 Double_t ppV0[3];
1943 Double_t pmV0[3];
1944 Double_t xrG[3];
1945
1946 TLorentzVector posSglTrack;
1947 TLorentzVector negSglTrack;
1948 Double_t posPt,posEta,posPhi;
1949 Double_t negPt,negEta,negPhi;
1950
1951 TLorentzVector posV0Track;
1952 TLorentzVector negV0Track;
1953 Double_t posV0Pt,posV0Eta,posV0Phi;
1954 Double_t negV0Pt,negV0Eta,negV0Phi;
1955
1956 Float_t nClsITSPos=-1;
1957 Float_t nClsITSNeg=-1;
1958
1959 Float_t nClsTPCPos=-1;
1960 Float_t nClsTPCNeg=-1;
1961
1962 Int_t statusSingPos=-1;
1963 Int_t statusSingNeg=-1;
1964
1965 Int_t statusV0Pos=-1;
1966 Int_t statusV0Neg=-1;
1967
7f11ea62 1968 for(Int_t i=0;i<fnDecayK0Geant+1;i++){
1969 TParticle* k0Part = fStack->Particle(fK0DecayK0GeantIndex[i]);
1970 TParticle* ePosPart = fStack->Particle(fpiPosDecayK0GeantIndex[i]);
1971 TParticle* eNegPart = fStack->Particle(fpiNegDecayK0GeantIndex[i]);
1972 if (fpiPosDecayK0SingleRecIndex[i]!=-1){
1973 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayK0SingleRecIndex[i]);
88a746d6 1974 ePosSglTrack->GetPxPyPz(ppSgl);
1975 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
1976 posPt = posSglTrack.Pt();
1977 posEta = posSglTrack.Eta();
1978 posPhi = posSglTrack.Phi();
1979 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1980 nClsITSPos=ePosSglTrack->GetNcls(0);
1981 nClsTPCPos=ePosSglTrack->GetNcls(1);
1982 statusSingPos=1;
1983 }else{
1984 posPt = 1000000;
1985 posEta = -2.;
1986 posPhi = -2*TMath::Pi();
1987 bPosSgl[0]=-100.;
1988 bPosSgl[1]=-100.;
1989 bPosCov[0]=-100;
1990 bPosCov[2]=-100;
1991
1992 nClsITSPos=-1;
1993 nClsTPCPos=-1;
1994 statusSingPos=-1;
1995 }
1996
7f11ea62 1997 if (fpiNegDecayK0SingleRecIndex[i]!=-1){
1998 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayK0SingleRecIndex[i]);
88a746d6 1999 eNegSglTrack->GetPxPyPz(pmSgl);
2000 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
2001 negPt = negSglTrack.Pt();
2002 negEta = negSglTrack.Eta();
2003 negPhi = negSglTrack.Phi();
2004 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2005 nClsITSNeg=eNegSglTrack->GetNcls(0);
2006 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2007 statusSingNeg=1;
2008 }else{
2009 negPt = 1000000;
2010 negEta = -2.;
2011 negPhi = -2*TMath::Pi();
2012 bNegSgl[0]=-100.;
2013 bNegSgl[1]=-100.;
2014 bNegCov[0]=-100;
2015 bNegCov[2]=-100;
2016 nClsITSNeg=-1;
2017 nClsTPCNeg=-1;
2018 statusSingNeg=-1;
2019 }
2020
2021 posV0Pt = 1000000;
2022 posV0Eta = -2.;
2023 posV0Phi = -2*TMath::Pi();
2024 negV0Pt = 1000000;
2025 negV0Eta = -2.;
2026 negV0Phi = -2*TMath::Pi();
2027
7f11ea62 2028 if(fDecayK0V0RecIndexPos[i]!=-1){
2029 AliESDv0 * fV0MIs = fESD->GetV0(fDecayK0V0RecIndexPos[i]);
88a746d6 2030 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2031 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2032
7f11ea62 2033 if (fpiPosDecayK0V0RecIndex[i]!=-1 ){
88a746d6 2034 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayK0V0RecIndex[i]);
2035 if ( trackPosTest->GetSign()==1 ) {
2036 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2037 }else{
2038 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2039 }
2040 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2041
2042 posV0Pt = posV0Track.Pt();
2043 posV0Eta = posV0Track.Eta();
2044 posV0Phi = posV0Track.Phi();
2045 statusV0Pos=1;
2046 }else{
2047 posV0Pt = 1000000;
2048 posV0Eta = -2.;
2049 posV0Phi = -2*TMath::Pi();
2050 statusV0Pos=-1;
2051 }
2052
7f11ea62 2053 if (fpiNegDecayK0V0RecIndex[i]!=-1 ){
88a746d6 2054 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayK0V0RecIndex[i]);
2055 if ( trackNegTest->GetSign()==-1 ) {
2056 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2057 }else{
2058 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2059 }
2060 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2061
2062 negV0Pt = negV0Track.Pt();
2063 negV0Eta = negV0Track.Eta();
2064 negV0Phi = negV0Track.Phi();
2065 statusV0Neg=1;
2066 }else{
2067 negV0Pt = 1000000;
2068 negV0Eta = -2.;
2069 negV0Phi = -2*TMath::Pi();
2070 statusV0Neg=-1;
2071 }
2072 }
2073
2074 xrG[0] = ePosPart->Vx();
2075 xrG[1] = ePosPart->Vy();
2076 xrG[2] = ePosPart->Vz();
2077
2078
2079 //--------- Geant variables ----------------------
7f11ea62 2080 fValueK0[0] = 1./TMath::Sqrt(k0Part->Pt());
2081 fValueK0[1] = k0Part->Eta();
88a746d6 2082
7f11ea62 2083 Double_t tmpGPhi=k0Part->Phi();
2084 if( k0Part->Phi()>TMath::Pi()){
2085 tmpGPhi=k0Part->Phi()-2*TMath::Pi();
88a746d6 2086 }
2087 fValueK0[2] = tmpGPhi;
2088
2089 fValueK0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2090 fValueK0[4] = xrG[2];
2091
2092
2093 fValueK0[5] = 1./TMath::Sqrt(ePosPart->Pt());
2094 fValueK0[6] = ePosPart->Eta();
2095
2096 Double_t tmpPPhi=ePosPart->Phi();
2097 if( ePosPart->Phi()>TMath::Pi()){
2098 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2099 }
2100 fValueK0[7] = tmpPPhi;
7f11ea62 2101 fValueK0[8] = fpiPosDecayK0GeantLength[i];
88a746d6 2102
2103 fValueK0[9] = 1./TMath::Sqrt(eNegPart->Pt());
2104 fValueK0[10] = eNegPart->Eta();
2105
2106 Double_t tmpNPhi=eNegPart->Phi();
2107 if( eNegPart->Phi()>TMath::Pi()){
2108 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2109 }
2110 fValueK0[11] = tmpNPhi;
7f11ea62 2111 fValueK0[12] = fpiNegDecayK0GeantLength[i];
88a746d6 2112 //---- Single track variables----------------------
2113
2114 fValueK0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt() ;
2115 fValueK0[14] = posEta;
2116 fValueK0[15] = posPhi;
2117 fValueK0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
2118 fValueK0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2119
2120 fValueK0[18] = nClsITSPos;
2121 fValueK0[19] = nClsTPCPos;
2122 fValueK0[20] = statusSingPos;
2123
2124 fValueK0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
2125 fValueK0[22] = negEta;
2126 fValueK0[23] = negPhi;
2127 fValueK0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] );
2128 fValueK0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2129 fValueK0[26] = nClsITSNeg;
2130 fValueK0[27] = nClsTPCNeg;
2131 fValueK0[28] = statusSingNeg;
2132
2133
2134 //---- V0 track variables----------------------
2135
2136 fValueK0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2137 fValueK0[30] = posV0Eta;
2138 fValueK0[31] = posV0Phi;
2139 fValueK0[32] = statusV0Pos;
2140
2141 fValueK0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2142 fValueK0[34] = negV0Eta;
2143 fValueK0[35] = negV0Phi;
2144 fValueK0[36] = statusV0Neg;
2145
2146 fSparseK0->Fill(fValueK0);
2147 }
2148
2149
2150}
2151void AliAnalysisTaskV0QA::FillHnSparseL()
2152{
7f11ea62 2153 // Fill THnSparse Lambda
88a746d6 2154
2155 Double_t massPi=0.13957018;
2156 Double_t massP=0.93827203;
2157
2158
2159 Double_t ppSgl[3];
2160 Double_t pmSgl[3];
2161 Float_t bPosSgl[2];
2162 Float_t bNegSgl[2];
2163 Float_t bPosCov[3];
2164 Float_t bNegCov[3];
2165
2166 Double_t ppV0[3];
2167 Double_t pmV0[3];
2168 Double_t xrG[3];
2169
2170 TLorentzVector posSglTrack;
2171 TLorentzVector negSglTrack;
2172 Double_t posPt,posEta,posPhi;
2173 Double_t negPt,negEta,negPhi;
2174
2175 TLorentzVector posV0Track;
2176 TLorentzVector negV0Track;
2177 Double_t posV0Pt,posV0Eta,posV0Phi;
2178 Double_t negV0Pt,negV0Eta,negV0Phi;
2179
2180 Float_t nClsITSPos=-1;
2181 Float_t nClsITSNeg=-1;
2182
2183 Float_t nClsTPCPos=-1;
2184 Float_t nClsTPCNeg=-1;
2185
2186 Int_t statusSingPos=-1;
2187 Int_t statusSingNeg=-1;
2188
2189 Int_t statusV0Pos=-1;
2190 Int_t statusV0Neg=-1;
2191
7f11ea62 2192 for(Int_t i=0;i<fnDecayLGeant+1;i++){
2193 TParticle* lPart = fStack->Particle(flDecayLGeantIndex[i]);
2194 TParticle* ePosPart = fStack->Particle(fpPosDecayLGeantIndex[i]);
2195 TParticle* eNegPart = fStack->Particle(fpiNegDecayLGeantIndex[i]);
2196 if (fpPosDecayLSingleRecIndex[i]!=-1){
2197 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpPosDecayLSingleRecIndex[i]);
88a746d6 2198 ePosSglTrack->GetPxPyPz(ppSgl);
2199 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massP);
2200 posPt = posSglTrack.Pt();
2201 posEta = posSglTrack.Eta();
2202 posPhi = posSglTrack.Phi();
2203 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2204 nClsITSPos=ePosSglTrack->GetNcls(0);
2205 nClsTPCPos=ePosSglTrack->GetNcls(1);
2206 statusSingPos=1;
2207 }else{
2208 posPt = 1000000;
2209 posEta = -2.;
2210 posPhi = -2*TMath::Pi();
2211 bPosSgl[0]=-100.;
2212 bPosSgl[1]=-100.;
2213 bPosCov[0]=-100;
2214 bPosCov[2]=-100;
2215 nClsITSPos=-1;
2216 nClsTPCPos=-1;
2217 statusSingPos=-1;
2218 }
2219
7f11ea62 2220 if (fpiNegDecayLSingleRecIndex[i]!=-1){
2221 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayLSingleRecIndex[i]);
88a746d6 2222 eNegSglTrack->GetPxPyPz(pmSgl);
2223 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
2224 negPt = negSglTrack.Pt();
2225 negEta = negSglTrack.Eta();
2226 negPhi = negSglTrack.Phi();
2227 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2228 nClsITSNeg=eNegSglTrack->GetNcls(0);
2229 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2230 statusSingNeg=1;
2231 }else{
2232 negPt = 1000000;
2233 negEta = -2.;
2234 negPhi = -2*TMath::Pi();
2235 bNegSgl[0]=-100.;
2236 bNegSgl[1]=-100.;
2237 bNegCov[0]=-100;
2238 bNegCov[2]=-100;
2239 nClsITSNeg=-1;
2240 nClsTPCNeg=-1;
2241 statusSingNeg=-1;
2242 }
2243
2244 posV0Pt = 1000000;
2245 posV0Eta = -2.;
2246 posV0Phi = -2*TMath::Pi();
2247 negV0Pt = 1000000;
2248 negV0Eta = -2.;
2249 negV0Phi = -2*TMath::Pi();
2250
7f11ea62 2251 if(fDecayLV0RecIndexPos[i]!=-1){
2252 AliESDv0 * fV0MIs = fESD->GetV0(fDecayLV0RecIndexPos[i]);
88a746d6 2253 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2254 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2255
7f11ea62 2256 if (fpPosDecayLV0RecIndex[i]!=-1 ){
88a746d6 2257 // AliESDtrack * ePosV0Track = fESD->GetTrack(pPosDecayLV0RecIndex[i]);
2258 if ( trackPosTest->GetSign()==1 ) {
2259 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2260 }else{
2261 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2262 }
2263 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massP);
2264
2265 posV0Pt = posV0Track.Pt();
2266 posV0Eta = posV0Track.Eta();
2267 posV0Phi = posV0Track.Phi();
2268 statusV0Pos=1;
2269 }else{
2270 posV0Pt = 1000000;
2271 posV0Eta = -2.;
2272 posV0Phi = -2*TMath::Pi();
2273 statusV0Pos=-1;
2274 }
2275
7f11ea62 2276 if (fpiNegDecayLV0RecIndex[i]!=-1 ){
88a746d6 2277 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayLV0RecIndex[i]);
2278 if ( trackNegTest->GetSign()==-1 ) {
2279 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2280 }else{
2281 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2282 }
2283 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2284
2285 negV0Pt = negV0Track.Pt();
2286 negV0Eta = negV0Track.Eta();
2287 negV0Phi = negV0Track.Phi();
2288 statusV0Neg=1;
2289 }else{
2290 negV0Pt = 1000000;
2291 negV0Eta = -2.;
2292 negV0Phi = -2*TMath::Pi();
2293 statusV0Neg=-1;
2294 }
2295 }
2296
2297 xrG[0] = ePosPart->Vx();
2298 xrG[1] = ePosPart->Vy();
2299 xrG[2] = ePosPart->Vz();
2300
2301 //--------- Geant variables ----------------------
2302 fValueL[0] = 1./TMath::Sqrt(lPart->Pt());
2303 fValueL[1] = lPart->Eta();
2304
2305 Double_t tmpGPhi=lPart->Phi();
2306 if( lPart->Phi()>TMath::Pi()){
2307 tmpGPhi=lPart->Phi()-2*TMath::Pi();
2308 }
2309 fValueL[2] = tmpGPhi;
2310
2311 fValueL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2312 fValueL[4] = xrG[2];
2313
2314
2315 fValueL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2316 fValueL[6] = ePosPart->Eta();
2317
2318 Double_t tmpPPhi=ePosPart->Phi();
2319 if( ePosPart->Phi()>TMath::Pi()){
2320 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2321 }
2322 fValueL[7] = tmpPPhi;
7f11ea62 2323 fValueL[8] = fpPosDecayLGeantLength[i];
88a746d6 2324
2325 fValueL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2326 fValueL[10] = eNegPart->Eta();
2327
2328 Double_t tmpNPhi=eNegPart->Phi();
2329 if( eNegPart->Phi()>TMath::Pi()){
2330 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2331 }
2332 fValueL[11] = tmpNPhi;
7f11ea62 2333 fValueL[12] = fpiNegDecayLGeantLength[i];
88a746d6 2334 //---- Single track variables----------------------
2335
2336 fValueL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2337 fValueL[14] = posEta;
2338 fValueL[15] = posPhi;
2339 fValueL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2340 fValueL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2341 fValueL[18] = nClsITSPos;
2342 fValueL[19] = nClsTPCPos;
2343 fValueL[20] = statusSingPos;
2344
2345 fValueL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2346 fValueL[22] = negEta;
2347 fValueL[23] = negPhi;
2348 fValueL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2349 fValueL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2350 fValueL[26] = nClsITSNeg;
2351 fValueL[27] = nClsTPCNeg;
2352 fValueL[28] = statusSingNeg;
2353
2354
2355
2356 //---- V0 track variables----------------------
2357
2358 fValueL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2359 fValueL[30] = posV0Eta;
2360 fValueL[31] = posV0Phi;
2361 fValueL[32] = statusV0Pos;
2362
2363
2364 fValueL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2365 fValueL[34] = negV0Eta;
2366 fValueL[35] = negV0Phi;
2367 fValueL[36] = statusV0Neg;
2368
2369 fSparseL->Fill(fValueL);
2370 }
2371
2372
2373}
2374
2375void AliAnalysisTaskV0QA::FillHnSparseAL()
2376{
7f11ea62 2377 // Fill THnSparse Antilambda
88a746d6 2378
2379 Double_t massPi=0.13957018;
2380 Double_t massP=0.93827203;
2381
2382
2383 Double_t ppSgl[3];
2384 Double_t pmSgl[3];
2385 Float_t bPosSgl[2];
2386 Float_t bNegSgl[2];
2387 Float_t bPosCov[3];
2388 Float_t bNegCov[3];
2389
2390 Double_t ppV0[3];
2391 Double_t pmV0[3];
2392 Double_t xrG[3];
2393
2394 TLorentzVector posSglTrack;
2395 TLorentzVector negSglTrack;
2396 Double_t posPt,posEta,posPhi;
2397 Double_t negPt,negEta,negPhi;
2398
2399 TLorentzVector posV0Track;
2400 TLorentzVector negV0Track;
2401 Double_t posV0Pt,posV0Eta,posV0Phi;
2402 Double_t negV0Pt,negV0Eta,negV0Phi;
2403
2404 Float_t nClsITSPos=-1;
2405 Float_t nClsITSNeg=-1;
2406
2407 Float_t nClsTPCPos=-1;
2408 Float_t nClsTPCNeg=-1;
2409
2410 Int_t statusSingPos=-1;
2411 Int_t statusSingNeg=-1;
2412
2413 Int_t statusV0Pos=-1;
2414 Int_t statusV0Neg=-1;
2415
2416
7f11ea62 2417 for(Int_t i=0;i<fnDecayALGeant+1;i++){
2418 TParticle* alPart = fStack->Particle(falDecayALGeantIndex[i]);
2419 TParticle* eNegPart = fStack->Particle(fapNegDecayALGeantIndex[i]);
2420 TParticle* ePosPart = fStack->Particle(fpiPosDecayALGeantIndex[i]);
2421 if (fpiPosDecayALSingleRecIndex[i]!=-1){
2422 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayALSingleRecIndex[i]);
88a746d6 2423 ePosSglTrack->GetPxPyPz(ppSgl);
2424 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
2425 posPt = posSglTrack.Pt();
2426 posEta = posSglTrack.Eta();
2427 posPhi = posSglTrack.Phi();
2428 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2429 nClsITSPos=ePosSglTrack->GetNcls(0);
2430 nClsTPCPos=ePosSglTrack->GetNcls(1);
2431 statusSingPos=1;
2432 }else{
2433 posPt = 1000000;
2434 posEta = -2.;
2435 posPhi = -2*TMath::Pi();
2436 bPosSgl[0]=-100.;
2437 bPosSgl[1]=-100.;
2438 bPosCov[0]=-100;
2439 bPosCov[2]=-100;
2440 nClsITSPos=-1;
2441 nClsTPCPos=-1;
2442 statusSingPos=-1;
2443 }
2444
7f11ea62 2445 if (fapNegDecayALSingleRecIndex[i]!=-1){
2446 AliESDtrack * eNegSglTrack = fESD->GetTrack(fapNegDecayALSingleRecIndex[i]);
88a746d6 2447 eNegSglTrack->GetPxPyPz(pmSgl);
2448 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massP);
2449 negPt = negSglTrack.Pt();
2450 negEta = negSglTrack.Eta();
2451 negPhi = negSglTrack.Phi();
2452 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2453 nClsITSNeg=eNegSglTrack->GetNcls(0);
2454 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2455 statusSingNeg=1;
2456 }else{
2457 negPt = 1000000;
2458 negEta = -2.;
2459 negPhi = -2*TMath::Pi();
2460 bNegSgl[0]=-100.;
2461 bNegSgl[1]=-100.;
2462 bNegCov[0]=-100;
2463 bNegCov[2]=-100;
2464 nClsITSNeg=-1;
2465 nClsTPCNeg=-1;
2466 statusSingNeg=-1;
2467 }
2468
2469 posV0Pt = 1000000;
2470 posV0Eta = -2.;
2471 posV0Phi = -2*TMath::Pi();
2472 negV0Pt = 1000000;
2473 negV0Eta = -2.;
2474 negV0Phi = -2*TMath::Pi();
2475
7f11ea62 2476 if(fDecayALV0RecIndexPos[i]!=-1){
2477 AliESDv0 * fV0MIs = fESD->GetV0(fDecayALV0RecIndexPos[i]);
88a746d6 2478 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2479 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2480
7f11ea62 2481 if (fpiPosDecayALV0RecIndex[i]!=-1 ){
88a746d6 2482 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayALV0RecIndex[i]);
2483 if ( trackPosTest->GetSign()==1 ) {
2484 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2485 }else{
2486 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2487 }
2488 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2489
2490 posV0Pt = posV0Track.Pt();
2491 posV0Eta = posV0Track.Eta();
2492 posV0Phi = posV0Track.Phi();
2493 statusV0Pos=1;
2494 }else{
2495 posV0Pt = 1000000;
2496 posV0Eta = -2.;
2497 posV0Phi = -2*TMath::Pi();
2498 statusV0Pos=-1;
2499 }
2500
7f11ea62 2501 if (fapNegDecayALV0RecIndex[i]!=-1 ){
88a746d6 2502 // AliESDtrack * eNegV0Track = fESD->GetTrack(apNegDecayALV0RecIndex[i]);
2503 if ( trackNegTest->GetSign()==-1 ) {
2504 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2505 }else{
2506 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2507 }
2508 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massP);
2509
2510 negV0Pt = negV0Track.Pt();
2511 negV0Eta = negV0Track.Eta();
2512 negV0Phi = negV0Track.Phi();
2513 statusV0Neg=1;
2514 }else{
2515 negV0Pt = 1000000;
2516 negV0Eta = -2.;
2517 negV0Phi = -2*TMath::Pi();
2518 statusV0Neg=-1;
2519 }
2520 }
2521
2522 xrG[0] = ePosPart->Vx();
2523 xrG[1] = ePosPart->Vy();
2524 xrG[2] = ePosPart->Vz();
2525
2526 //--------- Geant variables ----------------------
2527 fValueAL[0] = 1./TMath::Sqrt(alPart->Pt());
2528 fValueAL[1] = alPart->Eta();
2529
2530 Double_t tmpGPhi=alPart->Phi();
2531 if( alPart->Phi()>TMath::Pi()){
2532 tmpGPhi=alPart->Phi()-2*TMath::Pi();
2533 }
2534 fValueAL[2] = tmpGPhi;
2535
2536 fValueAL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2537 fValueAL[4] = xrG[2];
2538
2539
2540 fValueAL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2541 fValueAL[6] = ePosPart->Eta();
2542
2543 Double_t tmpPPhi=ePosPart->Phi();
2544 if( ePosPart->Phi()>TMath::Pi()){
2545 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2546 }
2547 fValueAL[7] = tmpPPhi;
7f11ea62 2548 fValueAL[8] = fpiPosDecayALGeantLength[i];
88a746d6 2549
2550 fValueAL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2551 fValueAL[10] = eNegPart->Eta();
2552
2553 Double_t tmpNPhi=eNegPart->Phi();
2554 if( eNegPart->Phi()>TMath::Pi()){
2555 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2556 }
2557 fValueAL[11] = tmpNPhi;
7f11ea62 2558 fValueAL[12] = fapNegDecayALGeantLength[i];
88a746d6 2559 //---- Single track variables----------------------
2560
2561 fValueAL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2562 fValueAL[14] = posEta;
2563 fValueAL[15] = posPhi;
2564 fValueAL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2565 fValueAL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2566 fValueAL[18] = nClsITSPos;
2567 fValueAL[19] = nClsTPCPos;
2568 fValueAL[20] = statusSingPos;
2569
2570 fValueAL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2571 fValueAL[22] = negEta;
2572 fValueAL[23] = negPhi;
2573 fValueAL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2574 fValueAL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2575 fValueAL[26] = nClsITSNeg;
2576 fValueAL[27] = nClsTPCNeg;
2577 fValueAL[28] = statusSingNeg;
2578
2579
2580
2581 //---- V0 track variables----------------------
2582
2583 fValueAL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2584 fValueAL[30] = posV0Eta;
2585 fValueAL[31] = posV0Phi;
2586 fValueAL[32] = statusV0Pos;
2587
2588
2589 fValueAL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2590 fValueAL[34] = negV0Eta;
2591 fValueAL[35] = negV0Phi;
2592 fValueAL[36] = statusV0Neg;
2593
2594 fSparseAL->Fill(fValueAL);
2595 }
2596}
2597
2598
2599// void AliAnalysisTaskV0QA::SetESDtrackCuts()
2600// {
2601
2602// fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
2603
2604// fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
2605// fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
2606
2607
2608
2609// }