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