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 //-------------------------------------------------
8 #define AliAnalysisTaskV0QA_cxx
15 //#include "TLorentzVector.h"
17 #include "AliAnalysisTaskSE.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"
29 #include "AliCentrality.h"
30 #include "AliAnalysisTaskV0QA.h"
32 ClassImp(AliAnalysisTaskV0QA)
33 AliAnalysisTaskV0QA::AliAnalysisTaskV0QA() :AliAnalysisTaskSE(),
46 fgConvGamGeantIndex(0),
47 feNegConvGamGeantIndex(0),
48 fePosConvGamGeantIndex(0),
49 feNegConvGamGeantLength(0),
50 fePosConvGamGeantLength(0),
51 feNegConvGamSingleRecIndex(0),
52 fePosConvGamSingleRecIndex(0),
53 feNegConvGamV0RecIndex(0),
54 fePosConvGamV0RecIndex(0),
55 fConvGamV0RecIndexPos(0),
56 fConvGamV0RecIndexNeg(0),
58 flDecayLGeantIndex(0),
59 fpiNegDecayLGeantIndex(0),
60 fpPosDecayLGeantIndex(0),
61 fpiNegDecayLGeantLength(0),
62 fpPosDecayLGeantLength(0),
63 fpiNegDecayLSingleRecIndex(0),
64 fpPosDecayLSingleRecIndex(0),
65 fpiNegDecayLV0RecIndex(0),
66 fpPosDecayLV0RecIndex(0),
67 fDecayLV0RecIndexPos(0),
68 fDecayLV0RecIndexNeg(0),
70 falDecayALGeantIndex(0),
71 fpiPosDecayALGeantIndex(0),
72 fapNegDecayALGeantIndex(0),
73 fpiPosDecayALGeantLength(0),
74 fapNegDecayALGeantLength(0),
75 fpiPosDecayALSingleRecIndex(0),
76 fapNegDecayALSingleRecIndex(0),
77 fpiPosDecayALV0RecIndex(0),
78 fapNegDecayALV0RecIndex(0),
79 fDecayALV0RecIndexPos(0),
80 fDecayALV0RecIndexNeg(0),
82 fK0DecayK0GeantIndex(0),
83 fpiNegDecayK0GeantIndex(0),
84 fpiPosDecayK0GeantIndex(0),
85 fpiNegDecayK0GeantLength(0),
86 fpiPosDecayK0GeantLength(0),
87 fpiNegDecayK0SingleRecIndex(0),
88 fpiPosDecayK0SingleRecIndex(0),
89 fpiNegDecayK0V0RecIndex(0),
90 fpiPosDecayK0V0RecIndex(0),
91 fDecayK0V0RecIndexPos(0),
92 fDecayK0V0RecIndexNeg(0),
114 // Default Constructor.
115 for(Int_t i=0;i<100000;i++) fLabelsTPC[i] = 0;
118 //________________________________________________________________________
119 AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTaskSE(name),
132 fgConvGamGeantIndex(0),
133 feNegConvGamGeantIndex(0),
134 fePosConvGamGeantIndex(0),
135 feNegConvGamGeantLength(0),
136 fePosConvGamGeantLength(0),
137 feNegConvGamSingleRecIndex(0),
138 fePosConvGamSingleRecIndex(0),
139 feNegConvGamV0RecIndex(0),
140 fePosConvGamV0RecIndex(0),
141 fConvGamV0RecIndexPos(0),
142 fConvGamV0RecIndexNeg(0),
144 flDecayLGeantIndex(0),
145 fpiNegDecayLGeantIndex(0),
146 fpPosDecayLGeantIndex(0),
147 fpiNegDecayLGeantLength(0),
148 fpPosDecayLGeantLength(0),
149 fpiNegDecayLSingleRecIndex(0),
150 fpPosDecayLSingleRecIndex(0),
151 fpiNegDecayLV0RecIndex(0),
152 fpPosDecayLV0RecIndex(0),
153 fDecayLV0RecIndexPos(0),
154 fDecayLV0RecIndexNeg(0),
156 falDecayALGeantIndex(0),
157 fpiPosDecayALGeantIndex(0),
158 fapNegDecayALGeantIndex(0),
159 fpiPosDecayALGeantLength(0),
160 fapNegDecayALGeantLength(0),
161 fpiPosDecayALSingleRecIndex(0),
162 fapNegDecayALSingleRecIndex(0),
163 fpiPosDecayALV0RecIndex(0),
164 fapNegDecayALV0RecIndex(0),
165 fDecayALV0RecIndexPos(0),
166 fDecayALV0RecIndexNeg(0),
168 fK0DecayK0GeantIndex(0),
169 fpiNegDecayK0GeantIndex(0),
170 fpiPosDecayK0GeantIndex(0),
171 fpiNegDecayK0GeantLength(0),
172 fpiPosDecayK0GeantLength(0),
173 fpiNegDecayK0SingleRecIndex(0),
174 fpiPosDecayK0SingleRecIndex(0),
175 fpiNegDecayK0V0RecIndex(0),
176 fpiPosDecayK0V0RecIndex(0),
177 fDecayK0V0RecIndexPos(0),
178 fDecayK0V0RecIndexNeg(0),
204 fValueK0 = new Double_t[fDim];
205 fValueL = new Double_t[fDim];
206 fValueAL = new Double_t[fDim];
207 fValueV0 = new Double_t[fDim];
208 fxminV0 = new Double_t[fDim];
209 fxmaxV0 = new Double_t[fDim];
210 fbinsV0 = new Int_t[fDim];
212 for(Int_t i=0;i<100000;i++) fLabelsTPC[i] = 0;
215 fgConvGamGeantIndex = new Int_t[fgDim];
216 feNegConvGamGeantIndex = new Int_t[fgDim];
217 fePosConvGamGeantIndex = new Int_t[fgDim];
218 feNegConvGamGeantLength = new Float_t[fgDim];
219 fePosConvGamGeantLength = new Float_t[fgDim];
221 feNegConvGamSingleRecIndex = new Int_t[fgDim];
222 fePosConvGamSingleRecIndex = new Int_t[fgDim];
224 feNegConvGamV0RecIndex = new Int_t[fgDim];
225 fePosConvGamV0RecIndex = new Int_t[fgDim];
227 fConvGamV0RecIndexPos = new Int_t[fgDim];
228 fConvGamV0RecIndexNeg = new Int_t[fgDim];
230 // Lambda to proton pi-
231 flDecayLGeantIndex = new Int_t[fgDim];
232 fpiNegDecayLGeantIndex = new Int_t[fgDim];
233 fpPosDecayLGeantIndex = new Int_t[fgDim];
234 fpiNegDecayLGeantLength = new Float_t[fgDim];
235 fpPosDecayLGeantLength = new Float_t[fgDim];
237 fpiNegDecayLSingleRecIndex = new Int_t[fgDim];
238 fpPosDecayLSingleRecIndex = new Int_t[fgDim];
240 fpiNegDecayLV0RecIndex = new Int_t[fgDim];
241 fpPosDecayLV0RecIndex = new Int_t[fgDim];
243 fDecayLV0RecIndexPos = new Int_t[fgDim];
244 fDecayLV0RecIndexNeg = new Int_t[fgDim];
247 fK0DecayK0GeantIndex = new Int_t[fgDim];
248 fpiNegDecayK0GeantIndex = new Int_t[fgDim];
249 fpiPosDecayK0GeantIndex = new Int_t[fgDim];
250 fpiNegDecayK0GeantLength = new Float_t[fgDim];
251 fpiPosDecayK0GeantLength = new Float_t[fgDim];
253 fpiNegDecayK0SingleRecIndex = new Int_t[fgDim];
254 fpiPosDecayK0SingleRecIndex = new Int_t[fgDim];
256 fpiNegDecayK0V0RecIndex = new Int_t[fgDim];
257 fpiPosDecayK0V0RecIndex = new Int_t[fgDim];
259 fDecayK0V0RecIndexPos = new Int_t[fgDim];
260 fDecayK0V0RecIndexNeg = new Int_t[fgDim];
262 //Antilambda to antiproton piplus
263 falDecayALGeantIndex = new Int_t[fgDim];
264 fpiPosDecayALGeantIndex = new Int_t[fgDim];
265 fapNegDecayALGeantIndex = new Int_t[fgDim];
266 fpiPosDecayALGeantLength = new Float_t[fgDim];
267 fapNegDecayALGeantLength = new Float_t[fgDim];
269 fpiPosDecayALSingleRecIndex = new Int_t[fgDim];
270 fapNegDecayALSingleRecIndex = new Int_t[fgDim];
272 fpiPosDecayALV0RecIndex = new Int_t[fgDim];
273 fapNegDecayALV0RecIndex = new Int_t[fgDim];
275 fDecayALV0RecIndexPos = new Int_t[fgDim];
276 fDecayALV0RecIndexNeg = new Int_t[fgDim];
280 fclRefsP = new TClonesArray("AliTrackReference");
281 fclRefsN = new TClonesArray("AliTrackReference");
283 // SetESDtrackCuts();
286 AliLog::SetGlobalLogLevel(AliLog::kError);
288 DefineOutput(1, TList::Class());
291 //_____________________________________________________
292 AliAnalysisTaskV0QA::~AliAnalysisTaskV0QA()
294 // Remove all pointers
309 delete [] fgConvGamGeantIndex;
310 delete [] feNegConvGamGeantIndex;
311 delete [] fePosConvGamGeantIndex;
313 delete [] feNegConvGamSingleRecIndex;
314 delete [] fePosConvGamSingleRecIndex;
316 delete [] feNegConvGamV0RecIndex;
317 delete [] fePosConvGamV0RecIndex;
318 delete [] fConvGamV0RecIndexPos;
319 delete [] fConvGamV0RecIndexNeg;
321 delete [] flDecayLGeantIndex;
322 delete [] fpiNegDecayLGeantIndex;
323 delete [] fpPosDecayLGeantIndex;
325 delete [] fpiNegDecayLGeantLength;
326 delete [] fpPosDecayLGeantLength;
327 delete [] fpiNegDecayLSingleRecIndex;
328 delete [] fpPosDecayLSingleRecIndex;
330 delete [] fpiNegDecayLV0RecIndex;
331 delete [] fpPosDecayLV0RecIndex;
332 delete [] fDecayLV0RecIndexPos;
333 delete [] fDecayLV0RecIndexNeg;
335 delete [] falDecayALGeantIndex;
336 delete [] fpiPosDecayALGeantIndex;
337 delete [] fapNegDecayALGeantIndex;
339 delete [] fpiPosDecayALGeantLength;
340 delete [] fapNegDecayALGeantLength;
341 delete [] fpiPosDecayALSingleRecIndex;
342 delete [] fapNegDecayALSingleRecIndex;
344 delete [] fpiPosDecayALV0RecIndex;
345 delete [] fapNegDecayALV0RecIndex;
346 delete [] fDecayALV0RecIndexPos;
347 delete [] fDecayALV0RecIndexNeg;
350 delete [] fpiNegDecayK0GeantIndex;
351 delete [] fpiPosDecayK0GeantIndex;
353 delete [] fpiNegDecayK0GeantLength;
354 delete [] fpiPosDecayK0GeantLength;
355 delete [] fpiNegDecayK0SingleRecIndex;
356 delete [] fpiPosDecayK0SingleRecIndex;
358 delete [] fpiNegDecayK0V0RecIndex;
359 delete [] fpiPosDecayK0V0RecIndex;
361 delete [] fDecayK0V0RecIndexPos;
362 delete [] fDecayK0V0RecIndexNeg;
367 //________________________________________________________________________
368 void AliAnalysisTaskV0QA::UserCreateOutputObjects() {
369 // Create Ouptut objects
371 for(Int_t d=0;d<fDim;d++){
374 fxminV0[0]= 0; // 1/sqrt(pt) Gamma geant
378 fxminV0[1]=-2.5; // eta Gamma Geant
382 fxminV0[2]=-2*TMath::Pi(); // phi Gamma geant
383 fxmaxV0[2]= TMath::Pi();
386 fxminV0[3]= 0; // r geant
390 fxminV0[4]=-250; // z geant
394 fxminV0[5]= 0; // 1/sqrt(pt) Geant Pos
398 fxminV0[6]=-2.5; // eta geant Pos
402 fxminV0[7]=-2*TMath::Pi(); // phi Geant Pos
403 fxmaxV0[7]= TMath::Pi();
406 fxminV0[8]=0; // Track Length TPC Geant Pos
410 fxminV0[9]= 0; // 1/sqrt(pt) Geant Neg
414 fxminV0[10]=-2.5; // eta Geant Neg
418 fxminV0[11]=-2*TMath::Pi(); // phi Geant Neg
419 fxmaxV0[11]= TMath::Pi();
422 fxminV0[12]=0; // Track Length TPC Geant Neg
427 //-----------Rec single variables
429 fxminV0[13]= -0.5; // (pt-ptGeant)/ptGeant rec Pos
433 fxminV0[14]=-2.5; // eta rec Pos
437 fxminV0[15]=-2*TMath::Pi(); // phi rec Pos
438 fxmaxV0[15]= TMath::Pi();
441 fxminV0[16]= 0; // Impact parameter rec Pos
445 fxminV0[17]= 0; // nsigmas Impact parameter rec Pos
450 fxminV0[18]= -1; // Ncls ITS rec Pos
454 fxminV0[19]= -1; // Ncls TPC rec Pos
458 fxminV0[20]= -2; // Status Single TPC rec Pos
462 fxminV0[21]= -0.5; // (pt-ptGeant)/ptGeant rec Neg
466 fxminV0[22]=-2.5; // eta rec Neg
470 fxminV0[23]=-2*TMath::Pi(); // phi rec Neg
471 fxmaxV0[23]= TMath::Pi();
474 fxminV0[24]= 0; // Impact parameter rec Neg
478 fxminV0[25]= 0; // Sigmas Impact parameter rec Neg
483 fxminV0[26]= -1; // Ncls ITS rec Neg
487 fxminV0[27]= -1; // Ncls TPC rec Neg
491 fxminV0[28]= -2; // Status Single TPC rec Neg
494 // ------------------Rec V0 variables
498 fxminV0[29]= -0.5; // (pt-ptGeant)/ptGeant rec V0 Pos
502 fxminV0[30]=-2.5; // eta rec V0 Pos
506 fxminV0[31]=-2*TMath::Pi(); // phi rec V0 Pos
507 fxmaxV0[31]= TMath::Pi();
510 fxminV0[32]= -2; // Status V0 TPC rec Pos
516 fxminV0[33]= -0.5; // 1/sqrt(pt) rec V0 Neg
520 fxminV0[34]=-2.5; // eta rec V0 Neg
524 fxminV0[35]=-2*TMath::Pi(); // phi rec V0 Neg
525 fxmaxV0[35]= TMath::Pi();
529 fxminV0[36]= -2; // Status V0 TPC rec Neg
532 fxminV0[37]= -1; // Centrality
537 TString axisName[38]={"ptGammaGeant",
545 "TPCTrackLengthEPlusGeant",
549 "TPCTrackLengthEMinusGeant",
550 "ptResEPlusRecSingle",
553 "bXYZEPlusRecSingle",
554 "sigbXYZEPlusRecSingle",
555 "NclsITSEPlusRecSingle",
556 "NclsTPCEPlusRecSingle",
557 "statusRecSinglePos",
558 "ptResEMinusRecSingle",
559 "etaEMinusRecSingle",
560 "phiEMinusRecSingle",
561 "bXYZEMinusRecSingle",
562 "sigbXYZEMinusRecSingle",
563 "NclsITSEMinusRecSingle",
564 "NclsTPCEMinusRecSingle",
565 "statusRecSingleNeg",
577 fSparseV0= new THnSparseF("sparseV0","sparseV0",fDim,fbinsV0,fxminV0,fxmaxV0);
579 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
580 fSparseV0->GetAxis(iaxis)->SetName(axisName[iaxis]);
581 fSparseV0->GetAxis(iaxis)->SetTitle(axisName[iaxis]);
584 TString axisNameK0[38]={"ptK0Geant",
592 "TPCTrackLengthPiPlusGeant",
596 "TPCTrackLengthPiMinusGeant",
597 "ptResPiPlusRecSingle",
598 "etaPiPlusRecSingle",
599 "phiPiPlusRecSingle",
600 "bXYZPiPlusRecSingle",
601 "sigbXYZPiPlusRecSingle",
602 "NclsITSPiPlusRecSingle",
603 "NclsTPCPiPlusRecSingle",
604 "statusRecSinglePos",
605 "ptResPiMinusRecSingle",
606 "etaPiMinusRecSingle",
607 "phiPiMinusRecSingle",
608 "bXYZPiMinusRecSingle",
609 "sigbXYZPiMinusRecSingle",
610 "NclsITSPiMinusRecSingle",
611 "NclsTPCPiMinusRecSingle",
612 "statusRecSingleNeg",
625 fSparseK0= new THnSparseF("sparseK0","sparseK0",fDim,fbinsV0,fxminV0,fxmaxV0);
626 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
627 fSparseK0->GetAxis(iaxis)->SetName(axisNameK0[iaxis]);
628 fSparseK0->GetAxis(iaxis)->SetTitle(axisNameK0[iaxis]);
631 TString axisNameL[38]={"ptLGeant",
639 "TPCTrackLengthPPlusGeant",
643 "TPCTrackLengthPiMinusGeant",
644 "ptResPPlusRecSingle",
647 "bXYZPPlusRecSingle",
648 "sigbXYZPPlusRecSingle",
649 "NclsITSPPlusRecSingle",
650 "NclsTPCPPlusRecSingle",
651 "statusRecSinglePos",
652 "ptResPiMinusRecSingle",
653 "etaPiMinusRecSingle",
654 "phiPiMinusRecSingle",
655 "bXYZPiMinusRecSingle",
656 "sigbXYZPiMinusRecSingle",
657 "NclsITSPiMinusRecSingle",
658 "NclsTPCPiMinusRecSingle",
659 "statusRecSingleNeg",
671 fSparseL= new THnSparseF("sparseL","sparseL",fDim,fbinsV0,fxminV0,fxmaxV0);
672 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
673 fSparseL->GetAxis(iaxis)->SetName(axisNameL[iaxis]);
674 fSparseL->GetAxis(iaxis)->SetTitle(axisNameL[iaxis]);
677 TString axisNameAL[38]={"ptALGeant",
685 "TPCTrackLengthPiPlusGeant",
689 "TPCTrackLengthAPMinusGeant",
690 "ptResPiPlusRecSingle",
691 "etaPiPlusRecSingle",
692 "phiPiPlusRecSingle",
693 "bXYZPiPlusRecSingle",
694 "sigbXYZPiPlusRecSingle",
695 "NclsITSPiPlusRecSingle",
696 "NclsTPCPiPlusRecSingle",
697 "statusRecSinglePos",
698 "ptResAPMinusRecSingle",
699 "etaAPMinusRecSingle",
700 "phiAPMinusRecSingle",
701 "bXYZAPMinusRecSingle",
702 "sigbXYZAPMinusRecSingle",
703 "NclsITSAPMinusRecSingle",
704 "NclsTPCAPMinusRecSingle",
705 "statusRecSingleNeg",
718 fSparseAL= new THnSparseF("sparseAL","sparseAL",fDim,fbinsV0,fxminV0,fxmaxV0);
719 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
720 fSparseAL->GetAxis(iaxis)->SetName(axisNameAL[iaxis]);
721 fSparseAL->GetAxis(iaxis)->SetTitle(axisNameAL[iaxis]);
724 // create output container
726 fOutputContainer = new TList() ;
727 fOutputContainer->SetName(GetName()) ;
730 fOutputContainer->Add(fSparseV0);
731 fOutputContainer->Add(fSparseK0);
732 fOutputContainer->Add(fSparseL);
733 fOutputContainer->Add(fSparseAL);
737 //________________________________________________________________________
738 void AliAnalysisTaskV0QA::UserExec(Option_t *) {
739 // Execution of the Task
741 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
744 //cout<< "not a tree"<< endl;
752 fMCtruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
754 // Double_t vertex[3];
755 Double_t maxVertex=150.;
757 Double_t lineCutZRSlope=tan(2*atan(exp(-maxEta)));
758 Double_t lineCutZValue=7.;
762 Int_t piNegLIndex=-1;
764 Int_t apNegALIndex=-1;
765 Int_t piPosALIndex=-1;
772 for(Int_t i=0; i<fgDim;i++){
773 fgConvGamGeantIndex[i] = -1;
774 feNegConvGamGeantIndex[i] = -1;
775 fePosConvGamGeantIndex[i] = -1;
777 feNegConvGamSingleRecIndex[i] = -1;
778 fePosConvGamSingleRecIndex[i] = -1;
780 feNegConvGamV0RecIndex[i] = -1;
781 fePosConvGamV0RecIndex[i] = -1;
782 fConvGamV0RecIndexPos[i] = -1;
783 fConvGamV0RecIndexNeg[i] = -1;
786 fK0DecayK0GeantIndex[i] = -1;
787 fpiNegDecayK0GeantIndex[i] = -1;
788 fpiPosDecayK0GeantIndex[i] = -1;
790 fpiNegDecayK0SingleRecIndex[i] = -1;
791 fpiPosDecayK0SingleRecIndex[i] = -1;
793 fpiNegDecayK0V0RecIndex[i] = -1;
794 fpiPosDecayK0V0RecIndex[i] = -1;
795 fDecayK0V0RecIndexPos[i] = -1;
796 fDecayK0V0RecIndexNeg[i] = -1;
799 flDecayLGeantIndex[i] = -1;
800 fpiNegDecayLGeantIndex[i] = -1;
801 fpPosDecayLGeantIndex[i] = -1;
803 fpiNegDecayLSingleRecIndex[i] = -1;
804 fpPosDecayLSingleRecIndex[i] = -1;
806 fpiNegDecayLV0RecIndex[i] = -1;
807 fpPosDecayLV0RecIndex[i] = -1;
808 fDecayLV0RecIndexPos[i] = -1;
809 fDecayLV0RecIndexNeg[i] = -1;
812 falDecayALGeantIndex[i] = -1;
813 fpiPosDecayALGeantIndex[i] = -1;
814 fapNegDecayALGeantIndex[i] = -1;
816 fpiPosDecayALSingleRecIndex[i] = -1;
817 fapNegDecayALSingleRecIndex[i] = -1;
819 fpiPosDecayALV0RecIndex[i] = -1;
820 fapNegDecayALV0RecIndex[i] = -1;
821 fDecayALV0RecIndexPos[i] = -1;
822 fDecayALV0RecIndexNeg[i] = -1;
829 AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));
830 fnTracksPrim=primVtx.GetNContributors();
833 if(fMCtruth && fnTracksPrim>0){
835 fStack = fMCtruth->MCEvent()->Stack();
840 for (Int_t iTracks = 0; iTracks < fMCtruth->MCEvent()->GetNumberOfTracks(); iTracks++) {
843 TParticle* particle = fStack->Particle(iTracks);
848 Printf("ERROR: Could not receive particle %d (mc loop)", iTracks);
852 if(particle->Pt()<0.050) continue;
853 if(TMath::Abs(particle->Eta())> maxEta) continue;
856 if (particle->GetPdgCode()== 22){
859 if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
860 continue; // no photon as mothers!
863 if(particle->GetMother(0) >= fStack->GetNprimary()){
864 continue; // the gamma has a mother, and it is not a primary particle
867 TParticle* ePos = NULL;
868 TParticle* eNeg = NULL;
872 if(particle->GetNDaughters() >= 2){
873 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
874 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
875 if(tmpDaughter->GetUniqueID() == 5){
876 if(tmpDaughter->GetPdgCode() == 11){
878 elecGIndex=daughterIndex;
880 else if(tmpDaughter->GetPdgCode() == -11){
882 posiGIndex=daughterIndex;
889 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
893 if(TMath::Abs(ePos->Eta())> maxEta || TMath::Abs(eNeg->Eta())> maxEta){
897 if(ePos->R()> maxVertex ){
898 continue; // cuts on distance from collision point
902 if( (TMath::Abs(ePos->Vz()) * lineCutZRSlope - lineCutZValue) > ePos->R() ){
903 continue; // line cut to exclude regions where we do not reconstruct
907 // Looking at the existance of TPC references
910 fMCtruth->MCEvent()->GetParticleAndTR(posiGIndex,ePosTPC,fclRefsP);
912 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(posiGIndex));
913 if(!mcParticlePos) continue;
916 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
920 int nPointsP = fclRefsP->GetEntries();
922 if (fRefTPC) delete fRefTPC;fRefTPC=NULL;
923 fRefTPC = new TObjArray();
925 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
926 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
927 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
932 for(int i=0; i<fRefTPC->GetEntries(); i++) {
933 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
934 fLabelsTPC[i] = ref->GetTrack();
937 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
938 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
939 if (aRef->GetTrack() != posiGIndex ) break;
947 fMCtruth->MCEvent()->GetParticleAndTR(elecGIndex,eNegTPC,fclRefsN);
949 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(elecGIndex));
950 if(!mcParticleNeg) continue;
953 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
954 int nPointsN = fclRefsN->GetEntries();
956 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
957 fRefTPC = new TObjArray();
959 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
960 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
961 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
966 for(int i=0; i<fRefTPC->GetEntries(); i++) {
967 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
968 fLabelsTPC[i] = ref->GetTrack();
971 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
972 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
973 if (aRef->GetTrack() != elecGIndex ) break;
979 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if e+/e- do not have a TPC ref continue;
980 ////////////////////////////////////////////////////////////////////
984 fgConvGamGeantIndex[fnConvGamGeant]=iTracks;
985 feNegConvGamGeantIndex[fnConvGamGeant] = elecGIndex;
986 fePosConvGamGeantIndex[fnConvGamGeant] = posiGIndex;
988 feNegConvGamGeantLength[fnConvGamGeant] = tpcTrackLengtheNeg;
989 fePosConvGamGeantLength[fnConvGamGeant] = tpcTrackLengthePos;
994 TParticle* piPos = NULL;
995 TParticle* piNeg = NULL;
999 if (particle->GetPdgCode()== 310){ // k0short
1000 if(particle->GetNDaughters() == 2){
1001 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1002 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1003 if(tmpDaughter->GetPdgCode() == 211){
1005 fpiPosK0Index=daughterIndex;
1007 else if(tmpDaughter->GetPdgCode() == -211){
1008 piNeg = tmpDaughter;
1009 fpiNegK0Index=daughterIndex;
1014 if(piPos == NULL || piNeg == NULL){ // means we do not have two daughters from K0short decay
1018 if(TMath::Abs(piPos->Eta())> maxEta || TMath::Abs(piNeg->Eta())> maxEta){
1022 if(piPos->R()> maxVertex ){
1023 continue; // cuts on distance from collision point
1027 if( (TMath::Abs(piPos->Vz()) * lineCutZRSlope - lineCutZValue) > piPos->R() ){
1028 continue; // line cut to exclude regions where we do not reconstruct
1031 // Looking at the existance of TPC references
1034 fMCtruth->MCEvent()->GetParticleAndTR(fpiPosK0Index,ePosTPC,fclRefsP);
1036 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiPosK0Index));
1037 if(!mcParticlePos) continue;
1040 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1043 int nPointsP = fclRefsP->GetEntries();
1044 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1045 fRefTPC = new TObjArray();
1047 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1048 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1049 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1054 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1055 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1056 fLabelsTPC[i] = ref->GetTrack();
1059 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1060 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1061 if (aRef->GetTrack() != fpiPosK0Index ) break;
1069 fMCtruth->MCEvent()->GetParticleAndTR(fpiNegK0Index,eNegTPC,fclRefsN);
1071 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiNegK0Index));
1072 if(!mcParticleNeg) continue;
1075 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1077 int nPointsN = fclRefsN->GetEntries();
1078 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1079 fRefTPC = new TObjArray();
1081 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1082 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1083 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1088 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1089 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1090 fLabelsTPC[i] = ref->GetTrack();
1093 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1094 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1095 if (aRef->GetTrack() != fpiNegK0Index ) break;
1099 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if pi+/pi- do not have a TPC ref continue;
1100 ////////////////////////////////////////////////////////////////////
1104 fK0DecayK0GeantIndex[fnDecayK0Geant]=iTracks;
1105 fpiNegDecayK0GeantIndex[fnDecayK0Geant]=fpiNegK0Index;
1106 fpiPosDecayK0GeantIndex[fnDecayK0Geant]=fpiPosK0Index;
1107 fpiNegDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengtheNeg;
1108 fpiPosDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengthePos;
1113 TParticle* pPos = NULL;
1114 TParticle* piNegL = NULL;
1119 if (particle->GetPdgCode()== 3122){ //lambda
1121 if(particle->GetNDaughters() == 2){
1122 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1123 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1124 if(tmpDaughter->GetPdgCode() == 2212){
1126 pPosLIndex=daughterIndex;
1128 else if(tmpDaughter->GetPdgCode() == -211){
1129 piNegL = tmpDaughter;
1130 piNegLIndex=daughterIndex;
1135 if(pPos == NULL || piNegL == NULL){ // means we do not have two daughters from lambda decay
1139 if(TMath::Abs(pPos->Eta())> maxEta || TMath::Abs(piNegL->Eta())> maxEta){
1143 if(pPos->R()> maxVertex ){
1144 continue; // cuts on distance from collision point
1148 if( (TMath::Abs(pPos->Vz()) * lineCutZRSlope - lineCutZValue) > pPos->R() ){
1149 continue; // line cut to exclude regions where we do not reconstruct
1153 // Looking at the existance of TPC references
1156 fMCtruth->MCEvent()->GetParticleAndTR(pPosLIndex,ePosTPC,fclRefsP);
1158 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(pPosLIndex));
1159 if(!mcParticlePos) continue;
1162 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1165 int nPointsP = fclRefsP->GetEntries();
1166 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1167 fRefTPC = new TObjArray();
1169 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1170 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1171 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1176 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1177 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1178 fLabelsTPC[i] = ref->GetTrack();
1181 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1182 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1183 if (aRef->GetTrack() != pPosLIndex ) break;
1191 fMCtruth->MCEvent()->GetParticleAndTR(piNegLIndex,eNegTPC,fclRefsN);
1193 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piNegLIndex));
1194 if(!mcParticleNeg) continue;
1197 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1199 int nPointsN = fclRefsN->GetEntries();
1200 if (fRefTPC) delete fRefTPC;
1201 fRefTPC = new TObjArray();
1203 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1204 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1205 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1210 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1211 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1212 fLabelsTPC[i] = ref->GetTrack();
1215 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1216 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1217 if (aRef->GetTrack() != piNegLIndex ) break;
1221 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1222 ////////////////////////////////////////////////////////////////////
1226 flDecayLGeantIndex[fnDecayLGeant]=iTracks;
1228 fpiNegDecayLGeantIndex[fnDecayLGeant]=piNegLIndex;
1229 fpPosDecayLGeantIndex[fnDecayLGeant]=pPosLIndex;
1231 fpiNegDecayLGeantLength[fnDecayLGeant]=tpcTrackLengtheNeg;
1232 fpPosDecayLGeantLength[fnDecayLGeant]=tpcTrackLengthePos;
1237 /////////////////////////////////////////////////////
1240 TParticle* apNeg = NULL;
1241 TParticle* piPosAL = NULL;
1246 if (particle->GetPdgCode()== -3122){ //antilambda
1248 if(particle->GetNDaughters() == 2){
1249 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1250 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1251 if(tmpDaughter->GetPdgCode() == -2212){
1253 apNegALIndex=daughterIndex;
1255 else if(tmpDaughter->GetPdgCode() == 211){
1256 piPosAL = tmpDaughter;
1257 piPosALIndex=daughterIndex;
1262 if(apNeg == NULL || piPosAL == NULL){ // means we do not have two daughters from antilambda decay
1266 if(TMath::Abs(apNeg->Eta())> maxEta || TMath::Abs(piPosAL->Eta())> maxEta){
1270 if(apNeg->R()> maxVertex ){
1271 continue; // cuts on distance from collision point
1275 if( (TMath::Abs(apNeg->Vz()) * lineCutZRSlope - lineCutZValue) > apNeg->R() ){
1276 continue; // line cut to exclude regions where we do not reconstruct
1280 // Looking at the existance of TPC references
1283 fMCtruth->MCEvent()->GetParticleAndTR(piPosALIndex,ePosTPC,fclRefsP);
1285 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piPosALIndex));
1286 if(!mcParticlePos) continue;
1289 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1291 int nPointsP = fclRefsP->GetEntries();
1292 if (fRefTPC) delete fRefTPC;
1293 fRefTPC = new TObjArray();
1295 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1296 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1297 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1302 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1303 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1304 fLabelsTPC[i] = ref->GetTrack();
1307 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1308 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1309 if (aRef->GetTrack() != piPosALIndex ) break;
1315 fMCtruth->MCEvent()->GetParticleAndTR(apNegALIndex,eNegTPC,fclRefsN);
1317 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(apNegALIndex));
1318 if(!mcParticleNeg) continue;
1321 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1323 int nPointsN = fclRefsN->GetEntries();
1324 if (fRefTPC) delete fRefTPC;
1325 fRefTPC = new TObjArray();
1327 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1328 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1329 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1334 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1335 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1336 fLabelsTPC[i] = ref->GetTrack();
1339 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1340 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1341 if (aRef->GetTrack() != apNegALIndex ) break;
1347 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1348 ////////////////////////////////////////////////////////////////////
1351 falDecayALGeantIndex[fnDecayALGeant]=iTracks;
1353 fpiPosDecayALGeantIndex[fnDecayALGeant]=piPosALIndex;
1354 fapNegDecayALGeantIndex[fnDecayALGeant]=apNegALIndex;
1356 fpiPosDecayALGeantLength[fnDecayALGeant]=tpcTrackLengthePos;
1357 fapNegDecayALGeantLength[fnDecayALGeant]=tpcTrackLengtheNeg;
1368 AliKFParticle::SetField(fESD->GetMagneticField());
1370 const AliESDVertex *pvertex = fESD->GetPrimaryVertex();
1372 pvertex->GetXYZ(xyzVtx);
1374 AliCentrality *esdCentrality = fESD->GetCentrality();
1375 // Int_t centralityC = -1;
1377 fCentralityC = esdCentrality->GetCentralityClass10("V0M");
1379 if(fnTracksPrim>0) {
1381 InspectListOfChargedParticles();
1385 if(fnConvGamGeant>-1){
1386 FillHnSparseGamma();
1389 if(fnDecayK0Geant>-1){
1393 if(fnDecayLGeant>-1){
1397 if(fnDecayALGeant>-1){
1404 PostData(1, fOutputContainer );
1409 void AliAnalysisTaskV0QA::Terminate(Option_t *) {
1410 // Draw some histogram at the end.
1415 Int_t AliAnalysisTaskV0QA::GetTPCReference(Int_t label) {
1416 // Get TPC References
1418 int start = TMath::BinarySearch(fRefTPC->GetEntries(), fLabelsTPC, label);
1420 while (start >= 0) {
1421 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[start];
1422 if (ref->GetTrack() != label) return start+1;
1433 void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
1434 // Look at the list of particles for the single track reconstruction
1436 for(Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++){
1438 AliESDtrack* curTrack = fESD->GetTrack(iTracks);
1445 // if( !(curTrack->GetStatus() & AliESDtrack::kTPCrefit)){
1450 Int_t labelMC = TMath::Abs(curTrack->GetLabel());
1452 if ( labelMC > fStack->GetNtrack() ) continue;
1455 TParticle* curParticle = fStack->Particle(labelMC);
1456 if(curParticle->GetMother(0)==-1){
1461 if(TMath::Abs(curParticle->GetPdgCode()) == 11){ // e+/e-
1463 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==22 ){ // e+/e- from gamma
1464 if( curParticle->GetUniqueID()!=5 ){ // e+/e- from gamma conversion
1468 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1469 if(curTrack->GetSign()>0){
1470 if (labelMC== fePosConvGamGeantIndex[iGamConv]){
1471 fePosConvGamSingleRecIndex[iGamConv]=iTracks;
1474 if (labelMC== feNegConvGamGeantIndex[iGamConv]){
1475 feNegConvGamSingleRecIndex[iGamConv]=iTracks;
1478 } // loop over geant converted gammas
1481 } // condition to select reconstructed electrons
1485 if(TMath::Abs(curParticle->GetPdgCode()) == 211 || TMath::Abs(curParticle->GetPdgCode())==2212 ){ // pi+/pi-
1487 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==310 ||
1488 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==3122 ||
1489 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==-3122 ){ // pi+/proton/pi- from K0/Lambda
1491 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1492 if(curTrack->GetSign()>0){
1493 if (labelMC== fpiPosDecayK0GeantIndex[iK0Dec]){
1494 fpiPosDecayK0SingleRecIndex[iK0Dec]=iTracks;
1497 if (labelMC== fpiNegDecayK0GeantIndex[iK0Dec]){
1498 fpiNegDecayK0SingleRecIndex[iK0Dec]=iTracks;
1501 } // loop over geant decay K0
1503 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1504 if(curTrack->GetSign()>0){
1505 if (labelMC== fpPosDecayLGeantIndex[iLDec]){
1506 fpPosDecayLSingleRecIndex[iLDec]=iTracks;
1509 if (labelMC== fpiNegDecayLGeantIndex[iLDec]){
1510 fpiNegDecayLSingleRecIndex[iLDec]=iTracks;
1513 } // loop over geant decay Lambda
1515 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1516 if(curTrack->GetSign()<0){
1517 if (labelMC== fapNegDecayALGeantIndex[iALDec]){
1518 fapNegDecayALSingleRecIndex[iALDec]=iTracks;
1521 if (labelMC== fpiPosDecayALGeantIndex[iALDec]){
1522 fpiPosDecayALSingleRecIndex[iALDec]=iTracks;
1525 } // loop over geant decay antiLambda
1527 } // condition to select reconstructed electrons
1528 } // all reconstructed track
1533 void AliAnalysisTaskV0QA::InspectListOfV0s(){
1534 // Look at the list of particles for the V0 reconstruction
1536 AliESDtrack* trackPos= NULL;
1537 AliESDtrack* trackNeg= NULL;
1538 Int_t grandMotherPos=-1;
1539 Int_t grandMotherNeg=-1;
1545 for(Int_t iV0MI = 0; iV0MI < fESD->GetNumberOfV0s(); iV0MI++) {
1547 AliESDv0 * fV0MIs = fESD->GetV0(iV0MI);
1550 if ( !fV0MIs->GetOnFlyStatus() ){ //Onfly V0 finder
1551 // if ( fV0MIs->GetOnFlyStatus() ){ //Offline V0 finder
1554 if(fnTracksPrim<=0) {
1559 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1560 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1563 if ( trackPosTest->GetSign() == trackNegTest->GetSign()){
1569 // if( !(trackPosTest->GetStatus() & AliESDtrack::kTPCrefit)){
1573 // if( !(trackNegTest->GetStatus() & AliESDtrack::kTPCrefit)){
1577 if( trackPosTest->GetSign() ==1){
1578 trackPos =fESD->GetTrack(fV0MIs->GetPindex());
1579 trackNeg =fESD->GetTrack(fV0MIs->GetNindex());
1580 pIndex=fV0MIs->GetPindex();
1581 nIndex=fV0MIs->GetNindex();
1584 if( trackPosTest->GetSign() ==-1){
1585 trackPos =fESD->GetTrack(fV0MIs->GetNindex());
1586 trackNeg =fESD->GetTrack(fV0MIs->GetPindex());
1587 pIndex=fV0MIs->GetNindex();
1588 nIndex=fV0MIs->GetPindex();
1592 if(!trackPos) return;
1593 if(!trackNeg) return;
1595 Int_t labelNeg=TMath::Abs(trackNeg->GetLabel());
1596 if(labelNeg > fStack->GetNtrack() ) continue;
1597 TParticle * particleNeg= fStack->Particle(labelNeg);
1599 Int_t labelPos=TMath::Abs(trackPos->GetLabel());
1600 if(labelPos > fStack->GetNtrack() ) continue;
1601 TParticle * particlePos= fStack->Particle(labelPos);
1604 if(particlePos->GetMother(0)>-1){
1605 grandMotherPos=fStack->Particle(particlePos->GetMother(0))->GetMother(0);
1606 motherPos=particlePos->GetMother(0);
1609 if(particleNeg->GetMother(0)>-1){
1610 grandMotherNeg=fStack->Particle(particleNeg->GetMother(0))->GetMother(0);
1611 motherNeg=particleNeg->GetMother(0);
1614 if(motherPos == motherNeg && motherPos!=-1 ){
1615 if( particlePos->GetPdgCode() ==-11 && particleNeg->GetPdgCode()==11 ){
1616 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1617 if (labelPos== fePosConvGamGeantIndex[iGamConv]){
1618 fePosConvGamV0RecIndex[iGamConv]=pIndex;
1619 fConvGamV0RecIndexPos[iGamConv]=iV0MI;
1621 if (labelNeg== feNegConvGamGeantIndex[iGamConv]){
1622 feNegConvGamV0RecIndex[iGamConv]=nIndex;
1623 fConvGamV0RecIndexNeg[iGamConv]=iV0MI;
1626 } // loop over geant converted gammas
1629 if( particlePos->GetPdgCode()==211 && particleNeg->GetPdgCode()==-211 ){
1630 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1631 if (labelPos== fpiPosDecayK0GeantIndex[iK0Dec]){
1632 fpiPosDecayK0V0RecIndex[iK0Dec]=pIndex;
1633 fDecayK0V0RecIndexPos[iK0Dec]=iV0MI;
1635 if (labelNeg== fpiNegDecayK0GeantIndex[iK0Dec]){
1636 fpiNegDecayK0V0RecIndex[iK0Dec]=nIndex;
1637 fDecayK0V0RecIndexNeg[iK0Dec]=iV0MI;
1640 } // loop over geant K0
1643 if( particlePos->GetPdgCode()==2212 && particleNeg->GetPdgCode()==-211 ){
1644 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1645 if (labelPos== fpPosDecayLGeantIndex[iLDec]){
1646 fpPosDecayLV0RecIndex[iLDec]=pIndex;
1647 fDecayLV0RecIndexPos[iLDec]=iV0MI;
1649 if (labelNeg== fpiNegDecayLGeantIndex[iLDec]){
1650 fpiNegDecayLV0RecIndex[iLDec]=nIndex;
1651 fDecayLV0RecIndexNeg[iLDec]=iV0MI;
1654 } // loop over geant Lambda
1657 if( particleNeg->GetPdgCode()==-2212 && particlePos->GetPdgCode()==211 ){
1658 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1659 if (labelNeg== fapNegDecayALGeantIndex[iALDec]){
1660 fapNegDecayALV0RecIndex[iALDec]=nIndex;
1661 fDecayALV0RecIndexNeg[iALDec]=iV0MI;
1663 if (labelPos== fpiPosDecayALGeantIndex[iALDec]){
1664 fpiPosDecayALV0RecIndex[iALDec]=pIndex;
1665 fDecayALV0RecIndexPos[iALDec]=iV0MI;
1668 } // loop over geant antiLambda
1675 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1676 if ( fConvGamV0RecIndexNeg[iGamConv]!= fConvGamV0RecIndexPos[iGamConv]){
1677 fePosConvGamV0RecIndex[iGamConv]=-1;
1678 feNegConvGamV0RecIndex[iGamConv]=-1;
1679 fConvGamV0RecIndexNeg[iGamConv]=-1;
1680 fConvGamV0RecIndexPos[iGamConv]=-1;
1685 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1686 if(fDecayLV0RecIndexPos[iLDec] != fDecayLV0RecIndexNeg[iLDec]){
1687 fpiNegDecayLV0RecIndex[iLDec]=-1;
1688 fpPosDecayLV0RecIndex[iLDec]=-1;
1689 fDecayLV0RecIndexNeg[iLDec]=-1;
1690 fDecayLV0RecIndexPos[iLDec]=-1;
1694 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1695 if(fDecayALV0RecIndexPos[iALDec] != fDecayALV0RecIndexNeg[iALDec]){
1696 fpiPosDecayALV0RecIndex[iALDec]=-1;
1697 fapNegDecayALV0RecIndex[iALDec]=-1;
1698 fDecayALV0RecIndexNeg[iALDec]=-1;
1699 fDecayALV0RecIndexPos[iALDec]=-1;
1703 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1704 if(fDecayK0V0RecIndexPos[iK0Dec] != fDecayK0V0RecIndexNeg[iK0Dec]){
1705 fpiNegDecayK0V0RecIndex[iK0Dec]=-1;
1706 fpiPosDecayK0V0RecIndex[iK0Dec]=-1;
1707 fDecayK0V0RecIndexNeg[iK0Dec]=-1;
1708 fDecayK0V0RecIndexPos[iK0Dec]=-1;
1714 void AliAnalysisTaskV0QA::FillHnSparseGamma()
1716 // Fill THnSparse Gamma
1718 Double_t massE=0.00051099892;
1730 TLorentzVector posSglTrack;
1731 TLorentzVector negSglTrack;
1732 Double_t posPt,posEta,posPhi;
1733 Double_t negPt,negEta,negPhi;
1735 TLorentzVector posV0Track;
1736 TLorentzVector negV0Track;
1737 Double_t posV0Pt,posV0Eta,posV0Phi;
1738 Double_t negV0Pt,negV0Eta,negV0Phi;
1740 Float_t nClsITSPos=-1;
1741 Float_t nClsITSNeg=-1;
1743 Float_t nClsTPCPos=-1;
1744 Float_t nClsTPCNeg=-1;
1746 Int_t statusSingPos=-1;
1747 Int_t statusSingNeg=-1;
1749 Int_t statusV0Pos=-1;
1750 Int_t statusV0Neg=-1;
1753 for(Int_t i=0;i<fnConvGamGeant+1;i++){
1754 TParticle* gamPart = fStack->Particle(fgConvGamGeantIndex[i]);
1755 TParticle* ePosPart = fStack->Particle(fePosConvGamGeantIndex[i]);
1756 TParticle* eNegPart = fStack->Particle(feNegConvGamGeantIndex[i]);
1757 if (fePosConvGamSingleRecIndex[i]!=-1){
1758 AliESDtrack * ePosSglTrack = fESD->GetTrack(fePosConvGamSingleRecIndex[i]);
1759 ePosSglTrack->GetPxPyPz(ppSgl);
1760 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massE);
1761 posPt = posSglTrack.Pt();
1762 posEta = posSglTrack.Eta();
1763 posPhi = posSglTrack.Phi();
1764 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1765 nClsITSPos=ePosSglTrack->GetNcls(0);
1766 nClsTPCPos=ePosSglTrack->GetNcls(1);
1771 posPhi = -2*TMath::Pi();
1781 if (feNegConvGamSingleRecIndex[i]!=-1){
1782 AliESDtrack * eNegSglTrack = fESD->GetTrack(feNegConvGamSingleRecIndex[i]);
1783 eNegSglTrack->GetPxPyPz(pmSgl);
1784 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massE);
1785 negPt = negSglTrack.Pt();
1786 negEta = negSglTrack.Eta();
1787 negPhi = negSglTrack.Phi();
1788 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
1789 nClsITSNeg=eNegSglTrack->GetNcls(0);
1790 nClsTPCNeg=eNegSglTrack->GetNcls(1);
1795 negPhi = -2*TMath::Pi();
1807 posV0Phi = -2*TMath::Pi();
1810 negV0Phi = -2*TMath::Pi();
1812 if(fConvGamV0RecIndexPos[i]!=-1){
1813 AliESDv0 * fV0MIs = fESD->GetV0(fConvGamV0RecIndexPos[i]);
1814 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1815 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1817 if (fePosConvGamV0RecIndex[i]!=-1 ){
1818 // AliESDtrack * ePosV0Track = fESD->GetTrack(ePosConvGamV0RecIndex[i]);
1819 if ( trackPosTest->GetSign()==1 ) {
1820 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1822 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1824 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massE);
1826 posV0Pt = posV0Track.Pt();
1827 posV0Eta = posV0Track.Eta();
1828 posV0Phi = posV0Track.Phi();
1833 posV0Phi = -2*TMath::Pi();
1837 if (feNegConvGamV0RecIndex[i]!=-1 ){
1838 // AliESDtrack * eNegV0Track = fESD->GetTrack(eNegConvGamV0RecIndex[i]);
1839 if ( trackNegTest->GetSign()==-1 ) {
1840 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1842 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1844 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massE);
1846 negV0Pt = negV0Track.Pt();
1847 negV0Eta = negV0Track.Eta();
1848 negV0Phi = negV0Track.Phi();
1853 negV0Phi = -2*TMath::Pi();
1858 xrG[0] = ePosPart->Vx();
1859 xrG[1] = ePosPart->Vy();
1860 xrG[2] = ePosPart->Vz();
1862 //--------- Geant variables ----------------------
1863 fValueV0[0] = 1./TMath::Sqrt(gamPart->Pt());
1864 fValueV0[1] = gamPart->Eta();
1866 Double_t tmpGPhi=gamPart->Phi();
1867 if( gamPart->Phi()>TMath::Pi()){
1868 tmpGPhi=gamPart->Phi()-2*TMath::Pi();
1870 fValueV0[2] = tmpGPhi;
1872 fValueV0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
1873 fValueV0[4] = xrG[2];
1876 fValueV0[5] = 1./TMath::Sqrt(ePosPart->Pt());
1877 fValueV0[6] = ePosPart->Eta();
1879 Double_t tmpPPhi=ePosPart->Phi();
1880 if( ePosPart->Phi()>TMath::Pi()){
1881 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
1883 fValueV0[7] = tmpPPhi;
1884 fValueV0[8] = fePosConvGamGeantLength[i];
1886 fValueV0[9] = 1./TMath::Sqrt(eNegPart->Pt());
1887 fValueV0[10] = eNegPart->Eta();
1889 Double_t tmpNPhi=eNegPart->Phi();
1890 if( eNegPart->Phi()>TMath::Pi()){
1891 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
1893 fValueV0[11] = tmpNPhi;
1894 fValueV0[12] = feNegConvGamGeantLength[i];
1896 //---- Single track variables----------------------
1898 fValueV0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
1899 fValueV0[14] = posEta;
1900 fValueV0[15] = posPhi;
1901 fValueV0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
1902 fValueV0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
1903 fValueV0[18] = nClsITSPos;
1904 fValueV0[19] = nClsTPCPos;
1905 fValueV0[20] = statusSingPos;
1908 fValueV0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
1909 fValueV0[22] = negEta;
1910 fValueV0[23] = negPhi;
1911 fValueV0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
1912 fValueV0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
1914 fValueV0[26] = nClsITSNeg;
1915 fValueV0[27] = nClsTPCNeg;
1916 fValueV0[28] = statusSingNeg;
1919 //---- V0 track variables----------------------
1921 fValueV0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
1922 fValueV0[30] = posV0Eta;
1923 fValueV0[31] = posV0Phi;
1924 fValueV0[32] = statusV0Pos;
1926 fValueV0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
1927 fValueV0[34] = negV0Eta;
1928 fValueV0[35] = negV0Phi;
1929 fValueV0[36] = statusV0Neg;
1930 fValueV0[37] = fCentralityC;
1931 fSparseV0->Fill(fValueV0);
1937 void AliAnalysisTaskV0QA::FillHnSparseK0()
1939 // Fill THnSparse K0
1941 Double_t massPi=0.13957018;
1953 TLorentzVector posSglTrack;
1954 TLorentzVector negSglTrack;
1955 Double_t posPt,posEta,posPhi;
1956 Double_t negPt,negEta,negPhi;
1958 TLorentzVector posV0Track;
1959 TLorentzVector negV0Track;
1960 Double_t posV0Pt,posV0Eta,posV0Phi;
1961 Double_t negV0Pt,negV0Eta,negV0Phi;
1963 Float_t nClsITSPos=-1;
1964 Float_t nClsITSNeg=-1;
1966 Float_t nClsTPCPos=-1;
1967 Float_t nClsTPCNeg=-1;
1969 Int_t statusSingPos=-1;
1970 Int_t statusSingNeg=-1;
1972 Int_t statusV0Pos=-1;
1973 Int_t statusV0Neg=-1;
1975 for(Int_t i=0;i<fnDecayK0Geant+1;i++){
1976 TParticle* k0Part = fStack->Particle(fK0DecayK0GeantIndex[i]);
1977 TParticle* ePosPart = fStack->Particle(fpiPosDecayK0GeantIndex[i]);
1978 TParticle* eNegPart = fStack->Particle(fpiNegDecayK0GeantIndex[i]);
1979 if (fpiPosDecayK0SingleRecIndex[i]!=-1){
1980 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayK0SingleRecIndex[i]);
1981 ePosSglTrack->GetPxPyPz(ppSgl);
1982 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
1983 posPt = posSglTrack.Pt();
1984 posEta = posSglTrack.Eta();
1985 posPhi = posSglTrack.Phi();
1986 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1987 nClsITSPos=ePosSglTrack->GetNcls(0);
1988 nClsTPCPos=ePosSglTrack->GetNcls(1);
1993 posPhi = -2*TMath::Pi();
2004 if (fpiNegDecayK0SingleRecIndex[i]!=-1){
2005 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayK0SingleRecIndex[i]);
2006 eNegSglTrack->GetPxPyPz(pmSgl);
2007 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
2008 negPt = negSglTrack.Pt();
2009 negEta = negSglTrack.Eta();
2010 negPhi = negSglTrack.Phi();
2011 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2012 nClsITSNeg=eNegSglTrack->GetNcls(0);
2013 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2018 negPhi = -2*TMath::Pi();
2030 posV0Phi = -2*TMath::Pi();
2033 negV0Phi = -2*TMath::Pi();
2035 if(fDecayK0V0RecIndexPos[i]!=-1){
2036 AliESDv0 * fV0MIs = fESD->GetV0(fDecayK0V0RecIndexPos[i]);
2037 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2038 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2040 if (fpiPosDecayK0V0RecIndex[i]!=-1 ){
2041 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayK0V0RecIndex[i]);
2042 if ( trackPosTest->GetSign()==1 ) {
2043 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2045 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2047 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2049 posV0Pt = posV0Track.Pt();
2050 posV0Eta = posV0Track.Eta();
2051 posV0Phi = posV0Track.Phi();
2056 posV0Phi = -2*TMath::Pi();
2060 if (fpiNegDecayK0V0RecIndex[i]!=-1 ){
2061 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayK0V0RecIndex[i]);
2062 if ( trackNegTest->GetSign()==-1 ) {
2063 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2065 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2067 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2069 negV0Pt = negV0Track.Pt();
2070 negV0Eta = negV0Track.Eta();
2071 negV0Phi = negV0Track.Phi();
2076 negV0Phi = -2*TMath::Pi();
2081 xrG[0] = ePosPart->Vx();
2082 xrG[1] = ePosPart->Vy();
2083 xrG[2] = ePosPart->Vz();
2086 //--------- Geant variables ----------------------
2087 fValueK0[0] = 1./TMath::Sqrt(k0Part->Pt());
2088 fValueK0[1] = k0Part->Eta();
2090 Double_t tmpGPhi=k0Part->Phi();
2091 if( k0Part->Phi()>TMath::Pi()){
2092 tmpGPhi=k0Part->Phi()-2*TMath::Pi();
2094 fValueK0[2] = tmpGPhi;
2096 fValueK0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2097 fValueK0[4] = xrG[2];
2100 fValueK0[5] = 1./TMath::Sqrt(ePosPart->Pt());
2101 fValueK0[6] = ePosPart->Eta();
2103 Double_t tmpPPhi=ePosPart->Phi();
2104 if( ePosPart->Phi()>TMath::Pi()){
2105 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2107 fValueK0[7] = tmpPPhi;
2108 fValueK0[8] = fpiPosDecayK0GeantLength[i];
2110 fValueK0[9] = 1./TMath::Sqrt(eNegPart->Pt());
2111 fValueK0[10] = eNegPart->Eta();
2113 Double_t tmpNPhi=eNegPart->Phi();
2114 if( eNegPart->Phi()>TMath::Pi()){
2115 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2117 fValueK0[11] = tmpNPhi;
2118 fValueK0[12] = fpiNegDecayK0GeantLength[i];
2119 //---- Single track variables----------------------
2121 fValueK0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt() ;
2122 fValueK0[14] = posEta;
2123 fValueK0[15] = posPhi;
2124 fValueK0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
2125 fValueK0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2127 fValueK0[18] = nClsITSPos;
2128 fValueK0[19] = nClsTPCPos;
2129 fValueK0[20] = statusSingPos;
2131 fValueK0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
2132 fValueK0[22] = negEta;
2133 fValueK0[23] = negPhi;
2134 fValueK0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] );
2135 fValueK0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2136 fValueK0[26] = nClsITSNeg;
2137 fValueK0[27] = nClsTPCNeg;
2138 fValueK0[28] = statusSingNeg;
2141 //---- V0 track variables----------------------
2143 fValueK0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2144 fValueK0[30] = posV0Eta;
2145 fValueK0[31] = posV0Phi;
2146 fValueK0[32] = statusV0Pos;
2148 fValueK0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2149 fValueK0[34] = negV0Eta;
2150 fValueK0[35] = negV0Phi;
2151 fValueK0[36] = statusV0Neg;
2152 fValueK0[37] = fCentralityC;
2154 fSparseK0->Fill(fValueK0);
2159 void AliAnalysisTaskV0QA::FillHnSparseL()
2161 // Fill THnSparse Lambda
2163 Double_t massPi=0.13957018;
2164 Double_t massP=0.93827203;
2178 TLorentzVector posSglTrack;
2179 TLorentzVector negSglTrack;
2180 Double_t posPt,posEta,posPhi;
2181 Double_t negPt,negEta,negPhi;
2183 TLorentzVector posV0Track;
2184 TLorentzVector negV0Track;
2185 Double_t posV0Pt,posV0Eta,posV0Phi;
2186 Double_t negV0Pt,negV0Eta,negV0Phi;
2188 Float_t nClsITSPos=-1;
2189 Float_t nClsITSNeg=-1;
2191 Float_t nClsTPCPos=-1;
2192 Float_t nClsTPCNeg=-1;
2194 Int_t statusSingPos=-1;
2195 Int_t statusSingNeg=-1;
2197 Int_t statusV0Pos=-1;
2198 Int_t statusV0Neg=-1;
2200 for(Int_t i=0;i<fnDecayLGeant+1;i++){
2201 TParticle* lPart = fStack->Particle(flDecayLGeantIndex[i]);
2202 TParticle* ePosPart = fStack->Particle(fpPosDecayLGeantIndex[i]);
2203 TParticle* eNegPart = fStack->Particle(fpiNegDecayLGeantIndex[i]);
2204 if (fpPosDecayLSingleRecIndex[i]!=-1){
2205 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpPosDecayLSingleRecIndex[i]);
2206 ePosSglTrack->GetPxPyPz(ppSgl);
2207 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massP);
2208 posPt = posSglTrack.Pt();
2209 posEta = posSglTrack.Eta();
2210 posPhi = posSglTrack.Phi();
2211 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2212 nClsITSPos=ePosSglTrack->GetNcls(0);
2213 nClsTPCPos=ePosSglTrack->GetNcls(1);
2218 posPhi = -2*TMath::Pi();
2228 if (fpiNegDecayLSingleRecIndex[i]!=-1){
2229 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayLSingleRecIndex[i]);
2230 eNegSglTrack->GetPxPyPz(pmSgl);
2231 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
2232 negPt = negSglTrack.Pt();
2233 negEta = negSglTrack.Eta();
2234 negPhi = negSglTrack.Phi();
2235 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2236 nClsITSNeg=eNegSglTrack->GetNcls(0);
2237 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2242 negPhi = -2*TMath::Pi();
2254 posV0Phi = -2*TMath::Pi();
2257 negV0Phi = -2*TMath::Pi();
2259 if(fDecayLV0RecIndexPos[i]!=-1){
2260 AliESDv0 * fV0MIs = fESD->GetV0(fDecayLV0RecIndexPos[i]);
2261 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2262 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2264 if (fpPosDecayLV0RecIndex[i]!=-1 ){
2265 // AliESDtrack * ePosV0Track = fESD->GetTrack(pPosDecayLV0RecIndex[i]);
2266 if ( trackPosTest->GetSign()==1 ) {
2267 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2269 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2271 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massP);
2273 posV0Pt = posV0Track.Pt();
2274 posV0Eta = posV0Track.Eta();
2275 posV0Phi = posV0Track.Phi();
2280 posV0Phi = -2*TMath::Pi();
2284 if (fpiNegDecayLV0RecIndex[i]!=-1 ){
2285 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayLV0RecIndex[i]);
2286 if ( trackNegTest->GetSign()==-1 ) {
2287 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2289 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2291 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2293 negV0Pt = negV0Track.Pt();
2294 negV0Eta = negV0Track.Eta();
2295 negV0Phi = negV0Track.Phi();
2300 negV0Phi = -2*TMath::Pi();
2305 xrG[0] = ePosPart->Vx();
2306 xrG[1] = ePosPart->Vy();
2307 xrG[2] = ePosPart->Vz();
2309 //--------- Geant variables ----------------------
2310 fValueL[0] = 1./TMath::Sqrt(lPart->Pt());
2311 fValueL[1] = lPart->Eta();
2313 Double_t tmpGPhi=lPart->Phi();
2314 if( lPart->Phi()>TMath::Pi()){
2315 tmpGPhi=lPart->Phi()-2*TMath::Pi();
2317 fValueL[2] = tmpGPhi;
2319 fValueL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2320 fValueL[4] = xrG[2];
2323 fValueL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2324 fValueL[6] = ePosPart->Eta();
2326 Double_t tmpPPhi=ePosPart->Phi();
2327 if( ePosPart->Phi()>TMath::Pi()){
2328 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2330 fValueL[7] = tmpPPhi;
2331 fValueL[8] = fpPosDecayLGeantLength[i];
2333 fValueL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2334 fValueL[10] = eNegPart->Eta();
2336 Double_t tmpNPhi=eNegPart->Phi();
2337 if( eNegPart->Phi()>TMath::Pi()){
2338 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2340 fValueL[11] = tmpNPhi;
2341 fValueL[12] = fpiNegDecayLGeantLength[i];
2342 //---- Single track variables----------------------
2344 fValueL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2345 fValueL[14] = posEta;
2346 fValueL[15] = posPhi;
2347 fValueL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2348 fValueL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2349 fValueL[18] = nClsITSPos;
2350 fValueL[19] = nClsTPCPos;
2351 fValueL[20] = statusSingPos;
2353 fValueL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2354 fValueL[22] = negEta;
2355 fValueL[23] = negPhi;
2356 fValueL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2357 fValueL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2358 fValueL[26] = nClsITSNeg;
2359 fValueL[27] = nClsTPCNeg;
2360 fValueL[28] = statusSingNeg;
2364 //---- V0 track variables----------------------
2366 fValueL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2367 fValueL[30] = posV0Eta;
2368 fValueL[31] = posV0Phi;
2369 fValueL[32] = statusV0Pos;
2372 fValueL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2373 fValueL[34] = negV0Eta;
2374 fValueL[35] = negV0Phi;
2375 fValueL[36] = statusV0Neg;
2376 fValueL[37] = fCentralityC;
2378 fSparseL->Fill(fValueL);
2384 void AliAnalysisTaskV0QA::FillHnSparseAL()
2386 // Fill THnSparse Antilambda
2388 Double_t massPi=0.13957018;
2389 Double_t massP=0.93827203;
2403 TLorentzVector posSglTrack;
2404 TLorentzVector negSglTrack;
2405 Double_t posPt,posEta,posPhi;
2406 Double_t negPt,negEta,negPhi;
2408 TLorentzVector posV0Track;
2409 TLorentzVector negV0Track;
2410 Double_t posV0Pt,posV0Eta,posV0Phi;
2411 Double_t negV0Pt,negV0Eta,negV0Phi;
2413 Float_t nClsITSPos=-1;
2414 Float_t nClsITSNeg=-1;
2416 Float_t nClsTPCPos=-1;
2417 Float_t nClsTPCNeg=-1;
2419 Int_t statusSingPos=-1;
2420 Int_t statusSingNeg=-1;
2422 Int_t statusV0Pos=-1;
2423 Int_t statusV0Neg=-1;
2426 for(Int_t i=0;i<fnDecayALGeant+1;i++){
2427 TParticle* alPart = fStack->Particle(falDecayALGeantIndex[i]);
2428 TParticle* eNegPart = fStack->Particle(fapNegDecayALGeantIndex[i]);
2429 TParticle* ePosPart = fStack->Particle(fpiPosDecayALGeantIndex[i]);
2430 if (fpiPosDecayALSingleRecIndex[i]!=-1){
2431 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayALSingleRecIndex[i]);
2432 ePosSglTrack->GetPxPyPz(ppSgl);
2433 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
2434 posPt = posSglTrack.Pt();
2435 posEta = posSglTrack.Eta();
2436 posPhi = posSglTrack.Phi();
2437 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2438 nClsITSPos=ePosSglTrack->GetNcls(0);
2439 nClsTPCPos=ePosSglTrack->GetNcls(1);
2444 posPhi = -2*TMath::Pi();
2454 if (fapNegDecayALSingleRecIndex[i]!=-1){
2455 AliESDtrack * eNegSglTrack = fESD->GetTrack(fapNegDecayALSingleRecIndex[i]);
2456 eNegSglTrack->GetPxPyPz(pmSgl);
2457 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massP);
2458 negPt = negSglTrack.Pt();
2459 negEta = negSglTrack.Eta();
2460 negPhi = negSglTrack.Phi();
2461 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2462 nClsITSNeg=eNegSglTrack->GetNcls(0);
2463 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2468 negPhi = -2*TMath::Pi();
2480 posV0Phi = -2*TMath::Pi();
2483 negV0Phi = -2*TMath::Pi();
2485 if(fDecayALV0RecIndexPos[i]!=-1){
2486 AliESDv0 * fV0MIs = fESD->GetV0(fDecayALV0RecIndexPos[i]);
2487 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2488 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2490 if (fpiPosDecayALV0RecIndex[i]!=-1 ){
2491 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayALV0RecIndex[i]);
2492 if ( trackPosTest->GetSign()==1 ) {
2493 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2495 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2497 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2499 posV0Pt = posV0Track.Pt();
2500 posV0Eta = posV0Track.Eta();
2501 posV0Phi = posV0Track.Phi();
2506 posV0Phi = -2*TMath::Pi();
2510 if (fapNegDecayALV0RecIndex[i]!=-1 ){
2511 // AliESDtrack * eNegV0Track = fESD->GetTrack(apNegDecayALV0RecIndex[i]);
2512 if ( trackNegTest->GetSign()==-1 ) {
2513 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2515 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2517 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massP);
2519 negV0Pt = negV0Track.Pt();
2520 negV0Eta = negV0Track.Eta();
2521 negV0Phi = negV0Track.Phi();
2526 negV0Phi = -2*TMath::Pi();
2531 xrG[0] = ePosPart->Vx();
2532 xrG[1] = ePosPart->Vy();
2533 xrG[2] = ePosPart->Vz();
2535 //--------- Geant variables ----------------------
2536 fValueAL[0] = 1./TMath::Sqrt(alPart->Pt());
2537 fValueAL[1] = alPart->Eta();
2539 Double_t tmpGPhi=alPart->Phi();
2540 if( alPart->Phi()>TMath::Pi()){
2541 tmpGPhi=alPart->Phi()-2*TMath::Pi();
2543 fValueAL[2] = tmpGPhi;
2545 fValueAL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2546 fValueAL[4] = xrG[2];
2549 fValueAL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2550 fValueAL[6] = ePosPart->Eta();
2552 Double_t tmpPPhi=ePosPart->Phi();
2553 if( ePosPart->Phi()>TMath::Pi()){
2554 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2556 fValueAL[7] = tmpPPhi;
2557 fValueAL[8] = fpiPosDecayALGeantLength[i];
2559 fValueAL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2560 fValueAL[10] = eNegPart->Eta();
2562 Double_t tmpNPhi=eNegPart->Phi();
2563 if( eNegPart->Phi()>TMath::Pi()){
2564 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2566 fValueAL[11] = tmpNPhi;
2567 fValueAL[12] = fapNegDecayALGeantLength[i];
2568 //---- Single track variables----------------------
2570 fValueAL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2571 fValueAL[14] = posEta;
2572 fValueAL[15] = posPhi;
2573 fValueAL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2574 fValueAL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2575 fValueAL[18] = nClsITSPos;
2576 fValueAL[19] = nClsTPCPos;
2577 fValueAL[20] = statusSingPos;
2579 fValueAL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2580 fValueAL[22] = negEta;
2581 fValueAL[23] = negPhi;
2582 fValueAL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2583 fValueAL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2584 fValueAL[26] = nClsITSNeg;
2585 fValueAL[27] = nClsTPCNeg;
2586 fValueAL[28] = statusSingNeg;
2590 //---- V0 track variables----------------------
2592 fValueAL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2593 fValueAL[30] = posV0Eta;
2594 fValueAL[31] = posV0Phi;
2595 fValueAL[32] = statusV0Pos;
2598 fValueAL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2599 fValueAL[34] = negV0Eta;
2600 fValueAL[35] = negV0Phi;
2601 fValueAL[36] = statusV0Neg;
2602 fValueAL[37] = fCentralityC;
2604 fSparseAL->Fill(fValueAL);
2609 // void AliAnalysisTaskV0QA::SetESDtrackCuts()
2612 // fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
2614 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
2615 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);