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