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