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"
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),
113 // Default Constructor.
114 for (Int_t i = 0; i < AliPID::kSPECIES; i++) {
115 fprobabilityPos[i] = 0.;
116 fprobabilityNeg[i] = 0.;
118 for (Int_t i = 0; i < 100000; i++) {
123 //________________________________________________________________________
124 AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTaskSE(name),
137 fgConvGamGeantIndex(0),
138 feNegConvGamGeantIndex(0),
139 fePosConvGamGeantIndex(0),
140 feNegConvGamGeantLength(0),
141 fePosConvGamGeantLength(0),
142 feNegConvGamSingleRecIndex(0),
143 fePosConvGamSingleRecIndex(0),
144 feNegConvGamV0RecIndex(0),
145 fePosConvGamV0RecIndex(0),
146 fConvGamV0RecIndexPos(0),
147 fConvGamV0RecIndexNeg(0),
149 flDecayLGeantIndex(0),
150 fpiNegDecayLGeantIndex(0),
151 fpPosDecayLGeantIndex(0),
152 fpiNegDecayLGeantLength(0),
153 fpPosDecayLGeantLength(0),
154 fpiNegDecayLSingleRecIndex(0),
155 fpPosDecayLSingleRecIndex(0),
156 fpiNegDecayLV0RecIndex(0),
157 fpPosDecayLV0RecIndex(0),
158 fDecayLV0RecIndexPos(0),
159 fDecayLV0RecIndexNeg(0),
161 falDecayALGeantIndex(0),
162 fpiPosDecayALGeantIndex(0),
163 fapNegDecayALGeantIndex(0),
164 fpiPosDecayALGeantLength(0),
165 fapNegDecayALGeantLength(0),
166 fpiPosDecayALSingleRecIndex(0),
167 fapNegDecayALSingleRecIndex(0),
168 fpiPosDecayALV0RecIndex(0),
169 fapNegDecayALV0RecIndex(0),
170 fDecayALV0RecIndexPos(0),
171 fDecayALV0RecIndexNeg(0),
173 fK0DecayK0GeantIndex(0),
174 fpiNegDecayK0GeantIndex(0),
175 fpiPosDecayK0GeantIndex(0),
176 fpiNegDecayK0GeantLength(0),
177 fpiPosDecayK0GeantLength(0),
178 fpiNegDecayK0SingleRecIndex(0),
179 fpiPosDecayK0SingleRecIndex(0),
180 fpiNegDecayK0V0RecIndex(0),
181 fpiPosDecayK0V0RecIndex(0),
182 fDecayK0V0RecIndexPos(0),
183 fDecayK0V0RecIndexNeg(0),
204 for (Int_t i = 0; i < AliPID::kSPECIES; i++) {
205 fprobabilityPos[i] = 0.;
206 fprobabilityNeg[i] = 0.;
208 for (Int_t i = 0; i < 100000; i++) {
215 fValueK0 = new Double_t[fDim];
216 fValueL = new Double_t[fDim];
217 fValueAL = new Double_t[fDim];
218 fValueV0 = new Double_t[fDim];
219 fxminV0 = new Double_t[fDim];
220 fxmaxV0 = new Double_t[fDim];
221 fbinsV0 = new Int_t[fDim];
225 fgConvGamGeantIndex = new Int_t[fgDim];
226 feNegConvGamGeantIndex = new Int_t[fgDim];
227 fePosConvGamGeantIndex = new Int_t[fgDim];
228 feNegConvGamGeantLength = new Float_t[fgDim];
229 fePosConvGamGeantLength = new Float_t[fgDim];
231 feNegConvGamSingleRecIndex = new Int_t[fgDim];
232 fePosConvGamSingleRecIndex = new Int_t[fgDim];
234 feNegConvGamV0RecIndex = new Int_t[fgDim];
235 fePosConvGamV0RecIndex = new Int_t[fgDim];
237 fConvGamV0RecIndexPos = new Int_t[fgDim];
238 fConvGamV0RecIndexNeg = new Int_t[fgDim];
240 // Lambda to proton pi-
241 flDecayLGeantIndex = new Int_t[fgDim];
242 fpiNegDecayLGeantIndex = new Int_t[fgDim];
243 fpPosDecayLGeantIndex = new Int_t[fgDim];
244 fpiNegDecayLGeantLength = new Float_t[fgDim];
245 fpPosDecayLGeantLength = new Float_t[fgDim];
247 fpiNegDecayLSingleRecIndex = new Int_t[fgDim];
248 fpPosDecayLSingleRecIndex = new Int_t[fgDim];
250 fpiNegDecayLV0RecIndex = new Int_t[fgDim];
251 fpPosDecayLV0RecIndex = new Int_t[fgDim];
253 fDecayLV0RecIndexPos = new Int_t[fgDim];
254 fDecayLV0RecIndexNeg = new Int_t[fgDim];
257 fK0DecayK0GeantIndex = new Int_t[fgDim];
258 fpiNegDecayK0GeantIndex = new Int_t[fgDim];
259 fpiPosDecayK0GeantIndex = new Int_t[fgDim];
260 fpiNegDecayK0GeantLength = new Float_t[fgDim];
261 fpiPosDecayK0GeantLength = new Float_t[fgDim];
263 fpiNegDecayK0SingleRecIndex = new Int_t[fgDim];
264 fpiPosDecayK0SingleRecIndex = new Int_t[fgDim];
266 fpiNegDecayK0V0RecIndex = new Int_t[fgDim];
267 fpiPosDecayK0V0RecIndex = new Int_t[fgDim];
269 fDecayK0V0RecIndexPos = new Int_t[fgDim];
270 fDecayK0V0RecIndexNeg = new Int_t[fgDim];
272 //Antilambda to antiproton piplus
273 falDecayALGeantIndex = new Int_t[fgDim];
274 fpiPosDecayALGeantIndex = new Int_t[fgDim];
275 fapNegDecayALGeantIndex = new Int_t[fgDim];
276 fpiPosDecayALGeantLength = new Float_t[fgDim];
277 fapNegDecayALGeantLength = new Float_t[fgDim];
279 fpiPosDecayALSingleRecIndex = new Int_t[fgDim];
280 fapNegDecayALSingleRecIndex = new Int_t[fgDim];
282 fpiPosDecayALV0RecIndex = new Int_t[fgDim];
283 fapNegDecayALV0RecIndex = new Int_t[fgDim];
285 fDecayALV0RecIndexPos = new Int_t[fgDim];
286 fDecayALV0RecIndexNeg = new Int_t[fgDim];
290 fclRefsP = new TClonesArray("AliTrackReference");
291 fclRefsN = new TClonesArray("AliTrackReference");
293 // SetESDtrackCuts();
296 AliLog::SetGlobalLogLevel(AliLog::kError);
298 DefineOutput(1, TList::Class());
301 //_____________________________________________________
302 AliAnalysisTaskV0QA::~AliAnalysisTaskV0QA()
304 // Remove all pointers
319 delete [] fgConvGamGeantIndex;
320 delete [] feNegConvGamGeantIndex;
321 delete [] fePosConvGamGeantIndex;
323 delete [] feNegConvGamSingleRecIndex;
324 delete [] fePosConvGamSingleRecIndex;
326 delete [] feNegConvGamV0RecIndex;
327 delete [] fePosConvGamV0RecIndex;
328 delete [] fConvGamV0RecIndexPos;
329 delete [] fConvGamV0RecIndexNeg;
331 delete [] flDecayLGeantIndex;
332 delete [] fpiNegDecayLGeantIndex;
333 delete [] fpPosDecayLGeantIndex;
335 delete [] fpiNegDecayLGeantLength;
336 delete [] fpPosDecayLGeantLength;
337 delete [] fpiNegDecayLSingleRecIndex;
338 delete [] fpPosDecayLSingleRecIndex;
340 delete [] fpiNegDecayLV0RecIndex;
341 delete [] fpPosDecayLV0RecIndex;
342 delete [] fDecayLV0RecIndexPos;
343 delete [] fDecayLV0RecIndexNeg;
345 delete [] falDecayALGeantIndex;
346 delete [] fpiPosDecayALGeantIndex;
347 delete [] fapNegDecayALGeantIndex;
349 delete [] fpiPosDecayALGeantLength;
350 delete [] fapNegDecayALGeantLength;
351 delete [] fpiPosDecayALSingleRecIndex;
352 delete [] fapNegDecayALSingleRecIndex;
354 delete [] fpiPosDecayALV0RecIndex;
355 delete [] fapNegDecayALV0RecIndex;
356 delete [] fDecayALV0RecIndexPos;
357 delete [] fDecayALV0RecIndexNeg;
360 delete [] fpiNegDecayK0GeantIndex;
361 delete [] fpiPosDecayK0GeantIndex;
363 delete [] fpiNegDecayK0GeantLength;
364 delete [] fpiPosDecayK0GeantLength;
365 delete [] fpiNegDecayK0SingleRecIndex;
366 delete [] fpiPosDecayK0SingleRecIndex;
368 delete [] fpiNegDecayK0V0RecIndex;
369 delete [] fpiPosDecayK0V0RecIndex;
371 delete [] fDecayK0V0RecIndexPos;
372 delete [] fDecayK0V0RecIndexNeg;
377 //________________________________________________________________________
378 void AliAnalysisTaskV0QA::UserCreateOutputObjects() {
379 // Create Ouptut objects
381 for(Int_t d=0;d<fDim;d++){
384 fxminV0[0]= 0; // 1/sqrt(pt) Gamma geant
388 fxminV0[1]=-2.5; // eta Gamma Geant
392 fxminV0[2]=-2*TMath::Pi(); // phi Gamma geant
393 fxmaxV0[2]= TMath::Pi();
396 fxminV0[3]= 0; // r geant
400 fxminV0[4]=-250; // z geant
404 fxminV0[5]= 0; // 1/sqrt(pt) Geant Pos
408 fxminV0[6]=-2.5; // eta geant Pos
412 fxminV0[7]=-2*TMath::Pi(); // phi Geant Pos
413 fxmaxV0[7]= TMath::Pi();
416 fxminV0[8]=0; // Track Length TPC Geant Pos
420 fxminV0[9]= 0; // 1/sqrt(pt) Geant Neg
424 fxminV0[10]=-2.5; // eta Geant Neg
428 fxminV0[11]=-2*TMath::Pi(); // phi Geant Neg
429 fxmaxV0[11]= TMath::Pi();
432 fxminV0[12]=0; // Track Length TPC Geant Neg
437 //-----------Rec single variables
439 fxminV0[13]= -0.5; // (pt-ptGeant)/ptGeant rec Pos
443 fxminV0[14]=-2.5; // eta rec Pos
447 fxminV0[15]=-2*TMath::Pi(); // phi rec Pos
448 fxmaxV0[15]= TMath::Pi();
451 fxminV0[16]= 0; // Impact parameter rec Pos
455 fxminV0[17]= 0; // nsigmas Impact parameter rec Pos
460 fxminV0[18]= -1; // Ncls ITS rec Pos
464 fxminV0[19]= -1; // Ncls TPC rec Pos
468 fxminV0[20]= -2; // Status Single TPC rec Pos
472 fxminV0[21]= -0.5; // (pt-ptGeant)/ptGeant rec Neg
476 fxminV0[22]=-2.5; // eta rec Neg
480 fxminV0[23]=-2*TMath::Pi(); // phi rec Neg
481 fxmaxV0[23]= TMath::Pi();
484 fxminV0[24]= 0; // Impact parameter rec Neg
488 fxminV0[25]= 0; // Sigmas Impact parameter rec Neg
493 fxminV0[26]= -1; // Ncls ITS rec Neg
497 fxminV0[27]= -1; // Ncls TPC rec Neg
501 fxminV0[28]= -2; // Status Single TPC rec Neg
504 // ------------------Rec V0 variables
508 fxminV0[29]= -0.5; // (pt-ptGeant)/ptGeant rec V0 Pos
512 fxminV0[30]=-2.5; // eta rec V0 Pos
516 fxminV0[31]=-2*TMath::Pi(); // phi rec V0 Pos
517 fxmaxV0[31]= TMath::Pi();
520 fxminV0[32]= -2; // Status V0 TPC rec Pos
526 fxminV0[33]= -0.5; // 1/sqrt(pt) rec V0 Neg
530 fxminV0[34]=-2.5; // eta rec V0 Neg
534 fxminV0[35]=-2*TMath::Pi(); // phi rec V0 Neg
535 fxmaxV0[35]= TMath::Pi();
539 fxminV0[36]= -2; // Status V0 TPC rec Neg
544 TString axisName[37]={"ptGammaGeant",
552 "TPCTrackLengthEPlusGeant",
556 "TPCTrackLengthEMinusGeant",
557 "ptResEPlusRecSingle",
560 "bXYZEPlusRecSingle",
561 "sigbXYZEPlusRecSingle",
562 "NclsITSEPlusRecSingle",
563 "NclsTPCEPlusRecSingle",
564 "statusRecSinglePos",
565 "ptResEMinusRecSingle",
566 "etaEMinusRecSingle",
567 "phiEMinusRecSingle",
568 "bXYZEMinusRecSingle",
569 "sigbXYZEMinusRecSingle",
570 "NclsITSEMinusRecSingle",
571 "NclsTPCEMinusRecSingle",
572 "statusRecSingleNeg",
580 "statusV0SingleNeg"};
583 fSparseV0= new THnSparseF("sparseV0","sparseV0",fDim,fbinsV0,fxminV0,fxmaxV0);
585 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
586 fSparseV0->GetAxis(iaxis)->SetName(axisName[iaxis]);
587 fSparseV0->GetAxis(iaxis)->SetTitle(axisName[iaxis]);
590 TString axisNameK0[37]={"ptK0Geant",
598 "TPCTrackLengthPiPlusGeant",
602 "TPCTrackLengthPiMinusGeant",
603 "ptResPiPlusRecSingle",
604 "etaPiPlusRecSingle",
605 "phiPiPlusRecSingle",
606 "bXYZPiPlusRecSingle",
607 "sigbXYZPiPlusRecSingle",
608 "NclsITSPiPlusRecSingle",
609 "NclsTPCPiPlusRecSingle",
610 "statusRecSinglePos",
611 "ptResPiMinusRecSingle",
612 "etaPiMinusRecSingle",
613 "phiPiMinusRecSingle",
614 "bXYZPiMinusRecSingle",
615 "sigbXYZPiMinusRecSingle",
616 "NclsITSPiMinusRecSingle",
617 "NclsTPCPiMinusRecSingle",
618 "statusRecSingleNeg",
630 fSparseK0= new THnSparseF("sparseK0","sparseK0",fDim,fbinsV0,fxminV0,fxmaxV0);
631 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
632 fSparseK0->GetAxis(iaxis)->SetName(axisNameK0[iaxis]);
633 fSparseK0->GetAxis(iaxis)->SetTitle(axisNameK0[iaxis]);
636 TString axisNameL[37]={"ptLGeant",
644 "TPCTrackLengthPPlusGeant",
648 "TPCTrackLengthPiMinusGeant",
649 "ptResPPlusRecSingle",
652 "bXYZPPlusRecSingle",
653 "sigbXYZPPlusRecSingle",
654 "NclsITSPPlusRecSingle",
655 "NclsTPCPPlusRecSingle",
656 "statusRecSinglePos",
657 "ptResPiMinusRecSingle",
658 "etaPiMinusRecSingle",
659 "phiPiMinusRecSingle",
660 "bXYZPiMinusRecSingle",
661 "sigbXYZPiMinusRecSingle",
662 "NclsITSPiMinusRecSingle",
663 "NclsTPCPiMinusRecSingle",
664 "statusRecSingleNeg",
675 fSparseL= new THnSparseF("sparseL","sparseL",fDim,fbinsV0,fxminV0,fxmaxV0);
676 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
677 fSparseL->GetAxis(iaxis)->SetName(axisNameL[iaxis]);
678 fSparseL->GetAxis(iaxis)->SetTitle(axisNameL[iaxis]);
681 TString axisNameAL[37]={"ptALGeant",
689 "TPCTrackLengthPiPlusGeant",
693 "TPCTrackLengthAPMinusGeant",
694 "ptResPiPlusRecSingle",
695 "etaPiPlusRecSingle",
696 "phiPiPlusRecSingle",
697 "bXYZPiPlusRecSingle",
698 "sigbXYZPiPlusRecSingle",
699 "NclsITSPiPlusRecSingle",
700 "NclsTPCPiPlusRecSingle",
701 "statusRecSinglePos",
702 "ptResAPMinusRecSingle",
703 "etaAPMinusRecSingle",
704 "phiAPMinusRecSingle",
705 "bXYZAPMinusRecSingle",
706 "sigbXYZAPMinusRecSingle",
707 "NclsITSAPMinusRecSingle",
708 "NclsTPCAPMinusRecSingle",
709 "statusRecSingleNeg",
720 fSparseAL= new THnSparseF("sparseAL","sparseAL",fDim,fbinsV0,fxminV0,fxmaxV0);
721 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
722 fSparseAL->GetAxis(iaxis)->SetName(axisNameAL[iaxis]);
723 fSparseAL->GetAxis(iaxis)->SetTitle(axisNameAL[iaxis]);
726 // create output container
728 fOutputContainer = new TList() ;
729 fOutputContainer->SetName(GetName()) ;
732 fOutputContainer->Add(fSparseV0);
733 fOutputContainer->Add(fSparseK0);
734 fOutputContainer->Add(fSparseL);
735 fOutputContainer->Add(fSparseAL);
739 //________________________________________________________________________
740 void AliAnalysisTaskV0QA::UserExec(Option_t *) {
741 // Execution of the Task
743 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
746 //cout<< "not a tree"<< endl;
754 fMCtruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
756 // Double_t vertex[3];
757 Double_t maxVertex=150.;
759 Double_t lineCutZRSlope=0.662486;
760 Double_t lineCutZValue=7.;
764 Int_t piNegLIndex=-1;
766 Int_t apNegALIndex=-1;
767 Int_t piPosALIndex=-1;
774 for(Int_t i=0; i<fgDim;i++){
775 fgConvGamGeantIndex[i] = -1;
776 feNegConvGamGeantIndex[i] = -1;
777 fePosConvGamGeantIndex[i] = -1;
779 feNegConvGamSingleRecIndex[i] = -1;
780 fePosConvGamSingleRecIndex[i] = -1;
782 feNegConvGamV0RecIndex[i] = -1;
783 fePosConvGamV0RecIndex[i] = -1;
784 fConvGamV0RecIndexPos[i] = -1;
785 fConvGamV0RecIndexNeg[i] = -1;
788 fK0DecayK0GeantIndex[i] = -1;
789 fpiNegDecayK0GeantIndex[i] = -1;
790 fpiPosDecayK0GeantIndex[i] = -1;
792 fpiNegDecayK0SingleRecIndex[i] = -1;
793 fpiPosDecayK0SingleRecIndex[i] = -1;
795 fpiNegDecayK0V0RecIndex[i] = -1;
796 fpiPosDecayK0V0RecIndex[i] = -1;
797 fDecayK0V0RecIndexPos[i] = -1;
798 fDecayK0V0RecIndexNeg[i] = -1;
801 flDecayLGeantIndex[i] = -1;
802 fpiNegDecayLGeantIndex[i] = -1;
803 fpPosDecayLGeantIndex[i] = -1;
805 fpiNegDecayLSingleRecIndex[i] = -1;
806 fpPosDecayLSingleRecIndex[i] = -1;
808 fpiNegDecayLV0RecIndex[i] = -1;
809 fpPosDecayLV0RecIndex[i] = -1;
810 fDecayLV0RecIndexPos[i] = -1;
811 fDecayLV0RecIndexNeg[i] = -1;
814 falDecayALGeantIndex[i] = -1;
815 fpiPosDecayALGeantIndex[i] = -1;
816 fapNegDecayALGeantIndex[i] = -1;
818 fpiPosDecayALSingleRecIndex[i] = -1;
819 fapNegDecayALSingleRecIndex[i] = -1;
821 fpiPosDecayALV0RecIndex[i] = -1;
822 fapNegDecayALV0RecIndex[i] = -1;
823 fDecayALV0RecIndexPos[i] = -1;
824 fDecayALV0RecIndexNeg[i] = -1;
831 AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));
832 fnTracksPrim=primVtx.GetNContributors();
835 if(fMCtruth && fnTracksPrim>0){
837 fStack = fMCtruth->MCEvent()->Stack();
842 for (Int_t iTracks = 0; iTracks < fMCtruth->MCEvent()->GetNumberOfTracks(); iTracks++) {
845 TParticle* particle = fStack->Particle(iTracks);
850 Printf("ERROR: Could not receive particle %d (mc loop)", iTracks);
854 if(particle->Pt()<0.050) continue;
855 if(TMath::Abs(particle->Eta())> 1.2) continue;
858 if (particle->GetPdgCode()== 22){
861 if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
862 continue; // no photon as mothers!
865 if(particle->GetMother(0) >= fStack->GetNprimary()){
866 continue; // the gamma has a mother, and it is not a primary particle
869 TParticle* ePos = NULL;
870 TParticle* eNeg = NULL;
874 if(particle->GetNDaughters() >= 2){
875 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
876 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
877 if(tmpDaughter->GetUniqueID() == 5){
878 if(tmpDaughter->GetPdgCode() == 11){
880 elecGIndex=daughterIndex;
882 else if(tmpDaughter->GetPdgCode() == -11){
884 posiGIndex=daughterIndex;
891 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
895 if(TMath::Abs(ePos->Eta())> maxEta || TMath::Abs(eNeg->Eta())> maxEta){
899 if(ePos->R()> maxVertex ){
900 continue; // cuts on distance from collision point
904 if( (TMath::Abs(ePos->Vz()) * lineCutZRSlope - lineCutZValue) > ePos->R() ){
905 continue; // line cut to exclude regions where we do not reconstruct
909 // Looking at the existance of TPC references
912 fMCtruth->MCEvent()->GetParticleAndTR(posiGIndex,ePosTPC,fclRefsP);
914 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(posiGIndex));
915 if(!mcParticlePos) continue;
918 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
922 int nPointsP = fclRefsP->GetEntries();
924 if (fRefTPC) delete fRefTPC;fRefTPC=NULL;
925 fRefTPC = new TObjArray();
927 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
928 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
929 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
934 for(int i=0; i<fRefTPC->GetEntries(); i++) {
935 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
936 fLabelsTPC[i] = ref->GetTrack();
939 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
940 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
941 if (aRef->GetTrack() != posiGIndex ) break;
949 fMCtruth->MCEvent()->GetParticleAndTR(elecGIndex,eNegTPC,fclRefsN);
951 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(elecGIndex));
952 if(!mcParticleNeg) continue;
955 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
956 int nPointsN = fclRefsN->GetEntries();
958 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
959 fRefTPC = new TObjArray();
961 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
962 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
963 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
968 for(int i=0; i<fRefTPC->GetEntries(); i++) {
969 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
970 fLabelsTPC[i] = ref->GetTrack();
973 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
974 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
975 if (aRef->GetTrack() != elecGIndex ) break;
981 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if e+/e- do not have a TPC ref continue;
982 ////////////////////////////////////////////////////////////////////
986 fgConvGamGeantIndex[fnConvGamGeant]=iTracks;
987 feNegConvGamGeantIndex[fnConvGamGeant] = elecGIndex;
988 fePosConvGamGeantIndex[fnConvGamGeant] = posiGIndex;
990 feNegConvGamGeantLength[fnConvGamGeant] = tpcTrackLengtheNeg;
991 fePosConvGamGeantLength[fnConvGamGeant] = tpcTrackLengthePos;
996 TParticle* piPos = NULL;
997 TParticle* piNeg = NULL;
1001 if (particle->GetPdgCode()== 310){ // k0short
1002 if(particle->GetNDaughters() == 2){
1003 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1004 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1005 if(tmpDaughter->GetPdgCode() == 211){
1007 fpiPosK0Index=daughterIndex;
1009 else if(tmpDaughter->GetPdgCode() == -211){
1010 piNeg = tmpDaughter;
1011 fpiNegK0Index=daughterIndex;
1016 if(piPos == NULL || piNeg == NULL){ // means we do not have two daughters from K0short decay
1020 if(TMath::Abs(piPos->Eta())> maxEta || TMath::Abs(piNeg->Eta())> maxEta){
1024 if(piPos->R()> maxVertex ){
1025 continue; // cuts on distance from collision point
1029 if( (TMath::Abs(piPos->Vz()) * lineCutZRSlope - lineCutZValue) > piPos->R() ){
1030 continue; // line cut to exclude regions where we do not reconstruct
1033 // Looking at the existance of TPC references
1036 fMCtruth->MCEvent()->GetParticleAndTR(fpiPosK0Index,ePosTPC,fclRefsP);
1038 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiPosK0Index));
1039 if(!mcParticlePos) continue;
1042 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1045 int nPointsP = fclRefsP->GetEntries();
1046 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1047 fRefTPC = new TObjArray();
1049 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1050 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1051 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1056 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1057 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1058 fLabelsTPC[i] = ref->GetTrack();
1061 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1062 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1063 if (aRef->GetTrack() != fpiPosK0Index ) break;
1071 fMCtruth->MCEvent()->GetParticleAndTR(fpiNegK0Index,eNegTPC,fclRefsN);
1073 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiNegK0Index));
1074 if(!mcParticleNeg) continue;
1077 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1079 int nPointsN = fclRefsN->GetEntries();
1080 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1081 fRefTPC = new TObjArray();
1083 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1084 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1085 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1090 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1091 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1092 fLabelsTPC[i] = ref->GetTrack();
1095 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1096 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1097 if (aRef->GetTrack() != fpiNegK0Index ) break;
1101 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if pi+/pi- do not have a TPC ref continue;
1102 ////////////////////////////////////////////////////////////////////
1106 fK0DecayK0GeantIndex[fnDecayK0Geant]=iTracks;
1107 fpiNegDecayK0GeantIndex[fnDecayK0Geant]=fpiNegK0Index;
1108 fpiPosDecayK0GeantIndex[fnDecayK0Geant]=fpiPosK0Index;
1109 fpiNegDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengtheNeg;
1110 fpiPosDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengthePos;
1115 TParticle* pPos = NULL;
1116 TParticle* piNegL = NULL;
1121 if (particle->GetPdgCode()== 3122){ //lambda
1123 if(particle->GetNDaughters() == 2){
1124 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1125 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1126 if(tmpDaughter->GetPdgCode() == 2212){
1128 pPosLIndex=daughterIndex;
1130 else if(tmpDaughter->GetPdgCode() == -211){
1131 piNegL = tmpDaughter;
1132 piNegLIndex=daughterIndex;
1137 if(pPos == NULL || piNegL == NULL){ // means we do not have two daughters from lambda decay
1141 if(TMath::Abs(pPos->Eta())> maxEta || TMath::Abs(piNegL->Eta())> maxEta){
1145 if(pPos->R()> maxVertex ){
1146 continue; // cuts on distance from collision point
1150 if( (TMath::Abs(pPos->Vz()) * lineCutZRSlope - lineCutZValue) > pPos->R() ){
1151 continue; // line cut to exclude regions where we do not reconstruct
1155 // Looking at the existance of TPC references
1158 fMCtruth->MCEvent()->GetParticleAndTR(pPosLIndex,ePosTPC,fclRefsP);
1160 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(pPosLIndex));
1161 if(!mcParticlePos) continue;
1164 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1167 int nPointsP = fclRefsP->GetEntries();
1168 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1169 fRefTPC = new TObjArray();
1171 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1172 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1173 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1178 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1179 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1180 fLabelsTPC[i] = ref->GetTrack();
1183 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1184 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1185 if (aRef->GetTrack() != pPosLIndex ) break;
1193 fMCtruth->MCEvent()->GetParticleAndTR(piNegLIndex,eNegTPC,fclRefsN);
1195 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piNegLIndex));
1196 if(!mcParticleNeg) continue;
1199 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1201 int nPointsN = fclRefsN->GetEntries();
1202 if (fRefTPC) delete fRefTPC;
1203 fRefTPC = new TObjArray();
1205 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1206 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1207 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1212 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1213 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1214 fLabelsTPC[i] = ref->GetTrack();
1217 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1218 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1219 if (aRef->GetTrack() != piNegLIndex ) break;
1223 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1224 ////////////////////////////////////////////////////////////////////
1228 flDecayLGeantIndex[fnDecayLGeant]=iTracks;
1230 fpiNegDecayLGeantIndex[fnDecayLGeant]=piNegLIndex;
1231 fpPosDecayLGeantIndex[fnDecayLGeant]=pPosLIndex;
1233 fpiNegDecayLGeantLength[fnDecayLGeant]=tpcTrackLengtheNeg;
1234 fpPosDecayLGeantLength[fnDecayLGeant]=tpcTrackLengthePos;
1239 /////////////////////////////////////////////////////
1242 TParticle* apNeg = NULL;
1243 TParticle* piPosAL = NULL;
1248 if (particle->GetPdgCode()== -3122){ //antilambda
1250 if(particle->GetNDaughters() == 2){
1251 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1252 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1253 if(tmpDaughter->GetPdgCode() == -2212){
1255 apNegALIndex=daughterIndex;
1257 else if(tmpDaughter->GetPdgCode() == 211){
1258 piPosAL = tmpDaughter;
1259 piPosALIndex=daughterIndex;
1264 if(apNeg == NULL || piPosAL == NULL){ // means we do not have two daughters from antilambda decay
1268 if(TMath::Abs(apNeg->Eta())> maxEta || TMath::Abs(piPosAL->Eta())> maxEta){
1272 if(apNeg->R()> maxVertex ){
1273 continue; // cuts on distance from collision point
1277 if( (TMath::Abs(apNeg->Vz()) * lineCutZRSlope - lineCutZValue) > apNeg->R() ){
1278 continue; // line cut to exclude regions where we do not reconstruct
1282 // Looking at the existance of TPC references
1285 fMCtruth->MCEvent()->GetParticleAndTR(piPosALIndex,ePosTPC,fclRefsP);
1287 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piPosALIndex));
1288 if(!mcParticlePos) continue;
1291 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1293 int nPointsP = fclRefsP->GetEntries();
1294 if (fRefTPC) delete fRefTPC;
1295 fRefTPC = new TObjArray();
1297 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1298 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1299 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1304 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1305 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1306 fLabelsTPC[i] = ref->GetTrack();
1309 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1310 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1311 if (aRef->GetTrack() != piPosALIndex ) break;
1317 fMCtruth->MCEvent()->GetParticleAndTR(apNegALIndex,eNegTPC,fclRefsN);
1319 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(apNegALIndex));
1320 if(!mcParticleNeg) continue;
1323 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1325 int nPointsN = fclRefsN->GetEntries();
1326 if (fRefTPC) delete fRefTPC;
1327 fRefTPC = new TObjArray();
1329 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1330 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1331 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1336 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1337 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1338 fLabelsTPC[i] = ref->GetTrack();
1341 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1342 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1343 if (aRef->GetTrack() != apNegALIndex ) break;
1349 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1350 ////////////////////////////////////////////////////////////////////
1353 falDecayALGeantIndex[fnDecayALGeant]=iTracks;
1355 fpiPosDecayALGeantIndex[fnDecayALGeant]=piPosALIndex;
1356 fapNegDecayALGeantIndex[fnDecayALGeant]=apNegALIndex;
1358 fpiPosDecayALGeantLength[fnDecayALGeant]=tpcTrackLengthePos;
1359 fapNegDecayALGeantLength[fnDecayALGeant]=tpcTrackLengtheNeg;
1370 AliKFParticle::SetField(fESD->GetMagneticField());
1372 const AliESDVertex *pvertex = fESD->GetPrimaryVertex();
1374 pvertex->GetXYZ(xyzVtx);
1376 if(fnTracksPrim>0) {
1378 InspectListOfChargedParticles();
1382 if(fnConvGamGeant>-1){
1383 FillHnSparseGamma();
1386 if(fnDecayK0Geant>-1){
1390 if(fnDecayLGeant>-1){
1394 if(fnDecayALGeant>-1){
1401 PostData(1, fOutputContainer );
1406 void AliAnalysisTaskV0QA::Terminate(Option_t *) {
1407 // Draw some histogram at the end.
1412 Int_t AliAnalysisTaskV0QA::GetTPCReference(Int_t label) {
1413 // Get TPC References
1415 int start = TMath::BinarySearch(fRefTPC->GetEntries(), fLabelsTPC, label);
1417 while (start >= 0) {
1418 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[start];
1419 if (ref->GetTrack() != label) return start+1;
1430 void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
1431 // Look at the list of particles for the single track reconstruction
1433 for(Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++){
1435 AliESDtrack* curTrack = fESD->GetTrack(iTracks);
1442 // if( !(curTrack->GetStatus() & AliESDtrack::kTPCrefit)){
1447 Int_t labelMC = TMath::Abs(curTrack->GetLabel());
1449 if ( labelMC > fStack->GetNtrack() ) continue;
1452 TParticle* curParticle = fStack->Particle(labelMC);
1453 if(curParticle->GetMother(0)==-1){
1458 if(TMath::Abs(curParticle->GetPdgCode()) == 11){ // e+/e-
1460 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==22 ){ // e+/e- from gamma
1461 if( curParticle->GetUniqueID()!=5 ){ // e+/e- from gamma conversion
1465 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1466 if(curTrack->GetSign()>0){
1467 if (labelMC== fePosConvGamGeantIndex[iGamConv]){
1468 fePosConvGamSingleRecIndex[iGamConv]=iTracks;
1471 if (labelMC== feNegConvGamGeantIndex[iGamConv]){
1472 feNegConvGamSingleRecIndex[iGamConv]=iTracks;
1475 } // loop over geant converted gammas
1478 } // condition to select reconstructed electrons
1482 if(TMath::Abs(curParticle->GetPdgCode()) == 211 || TMath::Abs(curParticle->GetPdgCode())==2212 ){ // pi+/pi-
1484 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==310 ||
1485 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==3122 ||
1486 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==-3122 ){ // pi+/proton/pi- from K0/Lambda
1488 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1489 if(curTrack->GetSign()>0){
1490 if (labelMC== fpiPosDecayK0GeantIndex[iK0Dec]){
1491 fpiPosDecayK0SingleRecIndex[iK0Dec]=iTracks;
1494 if (labelMC== fpiNegDecayK0GeantIndex[iK0Dec]){
1495 fpiNegDecayK0SingleRecIndex[iK0Dec]=iTracks;
1498 } // loop over geant decay K0
1500 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1501 if(curTrack->GetSign()>0){
1502 if (labelMC== fpPosDecayLGeantIndex[iLDec]){
1503 fpPosDecayLSingleRecIndex[iLDec]=iTracks;
1506 if (labelMC== fpiNegDecayLGeantIndex[iLDec]){
1507 fpiNegDecayLSingleRecIndex[iLDec]=iTracks;
1510 } // loop over geant decay Lambda
1512 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1513 if(curTrack->GetSign()<0){
1514 if (labelMC== fapNegDecayALGeantIndex[iALDec]){
1515 fapNegDecayALSingleRecIndex[iALDec]=iTracks;
1518 if (labelMC== fpiPosDecayALGeantIndex[iALDec]){
1519 fpiPosDecayALSingleRecIndex[iALDec]=iTracks;
1522 } // loop over geant decay antiLambda
1524 } // condition to select reconstructed electrons
1525 } // all reconstructed track
1530 void AliAnalysisTaskV0QA::InspectListOfV0s(){
1531 // Look at the list of particles for the V0 reconstruction
1533 AliESDtrack* trackPos= NULL;
1534 AliESDtrack* trackNeg= NULL;
1535 Int_t grandMotherPos=-1;
1536 Int_t grandMotherNeg=-1;
1542 for(Int_t iV0MI = 0; iV0MI < fESD->GetNumberOfV0s(); iV0MI++) {
1544 AliESDv0 * fV0MIs = fESD->GetV0(iV0MI);
1547 if ( !fV0MIs->GetOnFlyStatus() ){
1550 if(fnTracksPrim<=0) {
1555 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1556 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1559 if ( trackPosTest->GetSign() == trackNegTest->GetSign()){
1565 // if( !(trackPosTest->GetStatus() & AliESDtrack::kTPCrefit)){
1569 // if( !(trackNegTest->GetStatus() & AliESDtrack::kTPCrefit)){
1573 if( trackPosTest->GetSign() ==1){
1574 trackPos =fESD->GetTrack(fV0MIs->GetPindex());
1575 trackNeg =fESD->GetTrack(fV0MIs->GetNindex());
1576 pIndex=fV0MIs->GetPindex();
1577 nIndex=fV0MIs->GetNindex();
1580 if( trackPosTest->GetSign() ==-1){
1581 trackPos =fESD->GetTrack(fV0MIs->GetNindex());
1582 trackNeg =fESD->GetTrack(fV0MIs->GetPindex());
1583 pIndex=fV0MIs->GetNindex();
1584 nIndex=fV0MIs->GetPindex();
1588 Int_t labelNeg=TMath::Abs(trackNeg->GetLabel());
1589 if(labelNeg > fStack->GetNtrack() ) continue;
1590 TParticle * particleNeg= fStack->Particle(labelNeg);
1592 Int_t labelPos=TMath::Abs(trackPos->GetLabel());
1593 if(labelPos > fStack->GetNtrack() ) continue;
1594 TParticle * particlePos= fStack->Particle(labelPos);
1597 if(particlePos->GetMother(0)>-1){
1598 grandMotherPos=fStack->Particle(particlePos->GetMother(0))->GetMother(0);
1599 motherPos=particlePos->GetMother(0);
1602 if(particleNeg->GetMother(0)>-1){
1603 grandMotherNeg=fStack->Particle(particleNeg->GetMother(0))->GetMother(0);
1604 motherNeg=particleNeg->GetMother(0);
1607 if(motherPos == motherNeg && motherPos!=-1 ){
1608 if( particlePos->GetPdgCode() ==-11 && particleNeg->GetPdgCode()==11 ){
1609 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1610 if (labelPos== fePosConvGamGeantIndex[iGamConv]){
1611 fePosConvGamV0RecIndex[iGamConv]=pIndex;
1612 fConvGamV0RecIndexPos[iGamConv]=iV0MI;
1614 if (labelNeg== feNegConvGamGeantIndex[iGamConv]){
1615 feNegConvGamV0RecIndex[iGamConv]=nIndex;
1616 fConvGamV0RecIndexNeg[iGamConv]=iV0MI;
1619 } // loop over geant converted gammas
1622 if( particlePos->GetPdgCode()==211 && particleNeg->GetPdgCode()==-211 ){
1623 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1624 if (labelPos== fpiPosDecayK0GeantIndex[iK0Dec]){
1625 fpiPosDecayK0V0RecIndex[iK0Dec]=pIndex;
1626 fDecayK0V0RecIndexPos[iK0Dec]=iV0MI;
1628 if (labelNeg== fpiNegDecayK0GeantIndex[iK0Dec]){
1629 fpiNegDecayK0V0RecIndex[iK0Dec]=nIndex;
1630 fDecayK0V0RecIndexNeg[iK0Dec]=iV0MI;
1633 } // loop over geant K0
1636 if( particlePos->GetPdgCode()==2212 && particleNeg->GetPdgCode()==-211 ){
1637 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1638 if (labelPos== fpPosDecayLGeantIndex[iLDec]){
1639 fpPosDecayLV0RecIndex[iLDec]=pIndex;
1640 fDecayLV0RecIndexPos[iLDec]=iV0MI;
1642 if (labelNeg== fpiNegDecayLGeantIndex[iLDec]){
1643 fpiNegDecayLV0RecIndex[iLDec]=nIndex;
1644 fDecayLV0RecIndexNeg[iLDec]=iV0MI;
1647 } // loop over geant Lambda
1650 if( particleNeg->GetPdgCode()==-2212 && particlePos->GetPdgCode()==211 ){
1651 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1652 if (labelNeg== fapNegDecayALGeantIndex[iALDec]){
1653 fapNegDecayALV0RecIndex[iALDec]=nIndex;
1654 fDecayALV0RecIndexNeg[iALDec]=iV0MI;
1656 if (labelPos== fpiPosDecayALGeantIndex[iALDec]){
1657 fpiPosDecayALV0RecIndex[iALDec]=pIndex;
1658 fDecayALV0RecIndexPos[iALDec]=iV0MI;
1661 } // loop over geant antiLambda
1668 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1669 if ( fConvGamV0RecIndexNeg[iGamConv]!= fConvGamV0RecIndexPos[iGamConv]){
1670 fePosConvGamV0RecIndex[iGamConv]=-1;
1671 feNegConvGamV0RecIndex[iGamConv]=-1;
1672 fConvGamV0RecIndexNeg[iGamConv]=-1;
1673 fConvGamV0RecIndexPos[iGamConv]=-1;
1678 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1679 if(fDecayLV0RecIndexPos[iLDec] != fDecayLV0RecIndexNeg[iLDec]){
1680 fpiNegDecayLV0RecIndex[iLDec]=-1;
1681 fpPosDecayLV0RecIndex[iLDec]=-1;
1682 fDecayLV0RecIndexNeg[iLDec]=-1;
1683 fDecayLV0RecIndexPos[iLDec]=-1;
1687 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1688 if(fDecayALV0RecIndexPos[iALDec] != fDecayALV0RecIndexNeg[iALDec]){
1689 fpiPosDecayALV0RecIndex[iALDec]=-1;
1690 fapNegDecayALV0RecIndex[iALDec]=-1;
1691 fDecayALV0RecIndexNeg[iALDec]=-1;
1692 fDecayALV0RecIndexPos[iALDec]=-1;
1696 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1697 if(fDecayK0V0RecIndexPos[iK0Dec] != fDecayK0V0RecIndexNeg[iK0Dec]){
1698 fpiNegDecayK0V0RecIndex[iK0Dec]=-1;
1699 fpiPosDecayK0V0RecIndex[iK0Dec]=-1;
1700 fDecayK0V0RecIndexNeg[iK0Dec]=-1;
1701 fDecayK0V0RecIndexPos[iK0Dec]=-1;
1707 void AliAnalysisTaskV0QA::FillHnSparseGamma()
1709 // Fill THnSparse Gamma
1711 Double_t massE=0.00051099892;
1723 TLorentzVector posSglTrack;
1724 TLorentzVector negSglTrack;
1725 Double_t posPt,posEta,posPhi;
1726 Double_t negPt,negEta,negPhi;
1728 TLorentzVector posV0Track;
1729 TLorentzVector negV0Track;
1730 Double_t posV0Pt,posV0Eta,posV0Phi;
1731 Double_t negV0Pt,negV0Eta,negV0Phi;
1733 Float_t nClsITSPos=-1;
1734 Float_t nClsITSNeg=-1;
1736 Float_t nClsTPCPos=-1;
1737 Float_t nClsTPCNeg=-1;
1739 Int_t statusSingPos=-1;
1740 Int_t statusSingNeg=-1;
1742 Int_t statusV0Pos=-1;
1743 Int_t statusV0Neg=-1;
1746 for(Int_t i=0;i<fnConvGamGeant+1;i++){
1747 TParticle* gamPart = fStack->Particle(fgConvGamGeantIndex[i]);
1748 TParticle* ePosPart = fStack->Particle(fePosConvGamGeantIndex[i]);
1749 TParticle* eNegPart = fStack->Particle(feNegConvGamGeantIndex[i]);
1750 if (fePosConvGamSingleRecIndex[i]!=-1){
1751 AliESDtrack * ePosSglTrack = fESD->GetTrack(fePosConvGamSingleRecIndex[i]);
1752 ePosSglTrack->GetPxPyPz(ppSgl);
1753 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massE);
1754 posPt = posSglTrack.Pt();
1755 posEta = posSglTrack.Eta();
1756 posPhi = posSglTrack.Phi();
1757 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1758 nClsITSPos=ePosSglTrack->GetNcls(0);
1759 nClsTPCPos=ePosSglTrack->GetNcls(1);
1764 posPhi = -2*TMath::Pi();
1774 if (feNegConvGamSingleRecIndex[i]!=-1){
1775 AliESDtrack * eNegSglTrack = fESD->GetTrack(feNegConvGamSingleRecIndex[i]);
1776 eNegSglTrack->GetPxPyPz(pmSgl);
1777 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massE);
1778 negPt = negSglTrack.Pt();
1779 negEta = negSglTrack.Eta();
1780 negPhi = negSglTrack.Phi();
1781 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
1782 nClsITSNeg=eNegSglTrack->GetNcls(0);
1783 nClsTPCNeg=eNegSglTrack->GetNcls(1);
1788 negPhi = -2*TMath::Pi();
1800 posV0Phi = -2*TMath::Pi();
1803 negV0Phi = -2*TMath::Pi();
1805 if(fConvGamV0RecIndexPos[i]!=-1){
1806 AliESDv0 * fV0MIs = fESD->GetV0(fConvGamV0RecIndexPos[i]);
1807 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1808 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1810 if (fePosConvGamV0RecIndex[i]!=-1 ){
1811 // AliESDtrack * ePosV0Track = fESD->GetTrack(ePosConvGamV0RecIndex[i]);
1812 if ( trackPosTest->GetSign()==1 ) {
1813 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1815 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1817 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massE);
1819 posV0Pt = posV0Track.Pt();
1820 posV0Eta = posV0Track.Eta();
1821 posV0Phi = posV0Track.Phi();
1826 posV0Phi = -2*TMath::Pi();
1830 if (feNegConvGamV0RecIndex[i]!=-1 ){
1831 // AliESDtrack * eNegV0Track = fESD->GetTrack(eNegConvGamV0RecIndex[i]);
1832 if ( trackNegTest->GetSign()==-1 ) {
1833 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1835 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1837 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massE);
1839 negV0Pt = negV0Track.Pt();
1840 negV0Eta = negV0Track.Eta();
1841 negV0Phi = negV0Track.Phi();
1846 negV0Phi = -2*TMath::Pi();
1851 xrG[0] = ePosPart->Vx();
1852 xrG[1] = ePosPart->Vy();
1853 xrG[2] = ePosPart->Vz();
1855 //--------- Geant variables ----------------------
1856 fValueV0[0] = 1./TMath::Sqrt(gamPart->Pt());
1857 fValueV0[1] = gamPart->Eta();
1859 Double_t tmpGPhi=gamPart->Phi();
1860 if( gamPart->Phi()>TMath::Pi()){
1861 tmpGPhi=gamPart->Phi()-2*TMath::Pi();
1863 fValueV0[2] = tmpGPhi;
1865 fValueV0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
1866 fValueV0[4] = xrG[2];
1869 fValueV0[5] = 1./TMath::Sqrt(ePosPart->Pt());
1870 fValueV0[6] = ePosPart->Eta();
1872 Double_t tmpPPhi=ePosPart->Phi();
1873 if( ePosPart->Phi()>TMath::Pi()){
1874 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
1876 fValueV0[7] = tmpPPhi;
1877 fValueV0[8] = fePosConvGamGeantLength[i];
1879 fValueV0[9] = 1./TMath::Sqrt(eNegPart->Pt());
1880 fValueV0[10] = eNegPart->Eta();
1882 Double_t tmpNPhi=eNegPart->Phi();
1883 if( eNegPart->Phi()>TMath::Pi()){
1884 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
1886 fValueV0[11] = tmpNPhi;
1887 fValueV0[12] = feNegConvGamGeantLength[i];
1889 //---- Single track variables----------------------
1891 fValueV0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
1892 fValueV0[14] = posEta;
1893 fValueV0[15] = posPhi;
1894 fValueV0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
1895 fValueV0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
1896 fValueV0[18] = nClsITSPos;
1897 fValueV0[19] = nClsTPCPos;
1898 fValueV0[20] = statusSingPos;
1901 fValueV0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
1902 fValueV0[22] = negEta;
1903 fValueV0[23] = negPhi;
1904 fValueV0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
1905 fValueV0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
1907 fValueV0[26] = nClsITSNeg;
1908 fValueV0[27] = nClsTPCNeg;
1909 fValueV0[28] = statusSingNeg;
1912 //---- V0 track variables----------------------
1914 fValueV0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
1915 fValueV0[30] = posV0Eta;
1916 fValueV0[31] = posV0Phi;
1917 fValueV0[32] = statusV0Pos;
1919 fValueV0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
1920 fValueV0[34] = negV0Eta;
1921 fValueV0[35] = negV0Phi;
1922 fValueV0[36] = statusV0Neg;
1924 fSparseV0->Fill(fValueV0);
1930 void AliAnalysisTaskV0QA::FillHnSparseK0()
1932 // Fill THnSparse K0
1934 Double_t massPi=0.13957018;
1946 TLorentzVector posSglTrack;
1947 TLorentzVector negSglTrack;
1948 Double_t posPt,posEta,posPhi;
1949 Double_t negPt,negEta,negPhi;
1951 TLorentzVector posV0Track;
1952 TLorentzVector negV0Track;
1953 Double_t posV0Pt,posV0Eta,posV0Phi;
1954 Double_t negV0Pt,negV0Eta,negV0Phi;
1956 Float_t nClsITSPos=-1;
1957 Float_t nClsITSNeg=-1;
1959 Float_t nClsTPCPos=-1;
1960 Float_t nClsTPCNeg=-1;
1962 Int_t statusSingPos=-1;
1963 Int_t statusSingNeg=-1;
1965 Int_t statusV0Pos=-1;
1966 Int_t statusV0Neg=-1;
1968 for(Int_t i=0;i<fnDecayK0Geant+1;i++){
1969 TParticle* k0Part = fStack->Particle(fK0DecayK0GeantIndex[i]);
1970 TParticle* ePosPart = fStack->Particle(fpiPosDecayK0GeantIndex[i]);
1971 TParticle* eNegPart = fStack->Particle(fpiNegDecayK0GeantIndex[i]);
1972 if (fpiPosDecayK0SingleRecIndex[i]!=-1){
1973 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayK0SingleRecIndex[i]);
1974 ePosSglTrack->GetPxPyPz(ppSgl);
1975 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
1976 posPt = posSglTrack.Pt();
1977 posEta = posSglTrack.Eta();
1978 posPhi = posSglTrack.Phi();
1979 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1980 nClsITSPos=ePosSglTrack->GetNcls(0);
1981 nClsTPCPos=ePosSglTrack->GetNcls(1);
1986 posPhi = -2*TMath::Pi();
1997 if (fpiNegDecayK0SingleRecIndex[i]!=-1){
1998 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayK0SingleRecIndex[i]);
1999 eNegSglTrack->GetPxPyPz(pmSgl);
2000 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
2001 negPt = negSglTrack.Pt();
2002 negEta = negSglTrack.Eta();
2003 negPhi = negSglTrack.Phi();
2004 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2005 nClsITSNeg=eNegSglTrack->GetNcls(0);
2006 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2011 negPhi = -2*TMath::Pi();
2023 posV0Phi = -2*TMath::Pi();
2026 negV0Phi = -2*TMath::Pi();
2028 if(fDecayK0V0RecIndexPos[i]!=-1){
2029 AliESDv0 * fV0MIs = fESD->GetV0(fDecayK0V0RecIndexPos[i]);
2030 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2031 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2033 if (fpiPosDecayK0V0RecIndex[i]!=-1 ){
2034 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayK0V0RecIndex[i]);
2035 if ( trackPosTest->GetSign()==1 ) {
2036 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2038 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2040 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2042 posV0Pt = posV0Track.Pt();
2043 posV0Eta = posV0Track.Eta();
2044 posV0Phi = posV0Track.Phi();
2049 posV0Phi = -2*TMath::Pi();
2053 if (fpiNegDecayK0V0RecIndex[i]!=-1 ){
2054 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayK0V0RecIndex[i]);
2055 if ( trackNegTest->GetSign()==-1 ) {
2056 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2058 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2060 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2062 negV0Pt = negV0Track.Pt();
2063 negV0Eta = negV0Track.Eta();
2064 negV0Phi = negV0Track.Phi();
2069 negV0Phi = -2*TMath::Pi();
2074 xrG[0] = ePosPart->Vx();
2075 xrG[1] = ePosPart->Vy();
2076 xrG[2] = ePosPart->Vz();
2079 //--------- Geant variables ----------------------
2080 fValueK0[0] = 1./TMath::Sqrt(k0Part->Pt());
2081 fValueK0[1] = k0Part->Eta();
2083 Double_t tmpGPhi=k0Part->Phi();
2084 if( k0Part->Phi()>TMath::Pi()){
2085 tmpGPhi=k0Part->Phi()-2*TMath::Pi();
2087 fValueK0[2] = tmpGPhi;
2089 fValueK0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2090 fValueK0[4] = xrG[2];
2093 fValueK0[5] = 1./TMath::Sqrt(ePosPart->Pt());
2094 fValueK0[6] = ePosPart->Eta();
2096 Double_t tmpPPhi=ePosPart->Phi();
2097 if( ePosPart->Phi()>TMath::Pi()){
2098 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2100 fValueK0[7] = tmpPPhi;
2101 fValueK0[8] = fpiPosDecayK0GeantLength[i];
2103 fValueK0[9] = 1./TMath::Sqrt(eNegPart->Pt());
2104 fValueK0[10] = eNegPart->Eta();
2106 Double_t tmpNPhi=eNegPart->Phi();
2107 if( eNegPart->Phi()>TMath::Pi()){
2108 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2110 fValueK0[11] = tmpNPhi;
2111 fValueK0[12] = fpiNegDecayK0GeantLength[i];
2112 //---- Single track variables----------------------
2114 fValueK0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt() ;
2115 fValueK0[14] = posEta;
2116 fValueK0[15] = posPhi;
2117 fValueK0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
2118 fValueK0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2120 fValueK0[18] = nClsITSPos;
2121 fValueK0[19] = nClsTPCPos;
2122 fValueK0[20] = statusSingPos;
2124 fValueK0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
2125 fValueK0[22] = negEta;
2126 fValueK0[23] = negPhi;
2127 fValueK0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] );
2128 fValueK0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2129 fValueK0[26] = nClsITSNeg;
2130 fValueK0[27] = nClsTPCNeg;
2131 fValueK0[28] = statusSingNeg;
2134 //---- V0 track variables----------------------
2136 fValueK0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2137 fValueK0[30] = posV0Eta;
2138 fValueK0[31] = posV0Phi;
2139 fValueK0[32] = statusV0Pos;
2141 fValueK0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2142 fValueK0[34] = negV0Eta;
2143 fValueK0[35] = negV0Phi;
2144 fValueK0[36] = statusV0Neg;
2146 fSparseK0->Fill(fValueK0);
2151 void AliAnalysisTaskV0QA::FillHnSparseL()
2153 // Fill THnSparse Lambda
2155 Double_t massPi=0.13957018;
2156 Double_t massP=0.93827203;
2170 TLorentzVector posSglTrack;
2171 TLorentzVector negSglTrack;
2172 Double_t posPt,posEta,posPhi;
2173 Double_t negPt,negEta,negPhi;
2175 TLorentzVector posV0Track;
2176 TLorentzVector negV0Track;
2177 Double_t posV0Pt,posV0Eta,posV0Phi;
2178 Double_t negV0Pt,negV0Eta,negV0Phi;
2180 Float_t nClsITSPos=-1;
2181 Float_t nClsITSNeg=-1;
2183 Float_t nClsTPCPos=-1;
2184 Float_t nClsTPCNeg=-1;
2186 Int_t statusSingPos=-1;
2187 Int_t statusSingNeg=-1;
2189 Int_t statusV0Pos=-1;
2190 Int_t statusV0Neg=-1;
2192 for(Int_t i=0;i<fnDecayLGeant+1;i++){
2193 TParticle* lPart = fStack->Particle(flDecayLGeantIndex[i]);
2194 TParticle* ePosPart = fStack->Particle(fpPosDecayLGeantIndex[i]);
2195 TParticle* eNegPart = fStack->Particle(fpiNegDecayLGeantIndex[i]);
2196 if (fpPosDecayLSingleRecIndex[i]!=-1){
2197 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpPosDecayLSingleRecIndex[i]);
2198 ePosSglTrack->GetPxPyPz(ppSgl);
2199 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massP);
2200 posPt = posSglTrack.Pt();
2201 posEta = posSglTrack.Eta();
2202 posPhi = posSglTrack.Phi();
2203 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2204 nClsITSPos=ePosSglTrack->GetNcls(0);
2205 nClsTPCPos=ePosSglTrack->GetNcls(1);
2210 posPhi = -2*TMath::Pi();
2220 if (fpiNegDecayLSingleRecIndex[i]!=-1){
2221 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayLSingleRecIndex[i]);
2222 eNegSglTrack->GetPxPyPz(pmSgl);
2223 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
2224 negPt = negSglTrack.Pt();
2225 negEta = negSglTrack.Eta();
2226 negPhi = negSglTrack.Phi();
2227 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2228 nClsITSNeg=eNegSglTrack->GetNcls(0);
2229 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2234 negPhi = -2*TMath::Pi();
2246 posV0Phi = -2*TMath::Pi();
2249 negV0Phi = -2*TMath::Pi();
2251 if(fDecayLV0RecIndexPos[i]!=-1){
2252 AliESDv0 * fV0MIs = fESD->GetV0(fDecayLV0RecIndexPos[i]);
2253 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2254 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2256 if (fpPosDecayLV0RecIndex[i]!=-1 ){
2257 // AliESDtrack * ePosV0Track = fESD->GetTrack(pPosDecayLV0RecIndex[i]);
2258 if ( trackPosTest->GetSign()==1 ) {
2259 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2261 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2263 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massP);
2265 posV0Pt = posV0Track.Pt();
2266 posV0Eta = posV0Track.Eta();
2267 posV0Phi = posV0Track.Phi();
2272 posV0Phi = -2*TMath::Pi();
2276 if (fpiNegDecayLV0RecIndex[i]!=-1 ){
2277 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayLV0RecIndex[i]);
2278 if ( trackNegTest->GetSign()==-1 ) {
2279 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2281 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2283 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2285 negV0Pt = negV0Track.Pt();
2286 negV0Eta = negV0Track.Eta();
2287 negV0Phi = negV0Track.Phi();
2292 negV0Phi = -2*TMath::Pi();
2297 xrG[0] = ePosPart->Vx();
2298 xrG[1] = ePosPart->Vy();
2299 xrG[2] = ePosPart->Vz();
2301 //--------- Geant variables ----------------------
2302 fValueL[0] = 1./TMath::Sqrt(lPart->Pt());
2303 fValueL[1] = lPart->Eta();
2305 Double_t tmpGPhi=lPart->Phi();
2306 if( lPart->Phi()>TMath::Pi()){
2307 tmpGPhi=lPart->Phi()-2*TMath::Pi();
2309 fValueL[2] = tmpGPhi;
2311 fValueL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2312 fValueL[4] = xrG[2];
2315 fValueL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2316 fValueL[6] = ePosPart->Eta();
2318 Double_t tmpPPhi=ePosPart->Phi();
2319 if( ePosPart->Phi()>TMath::Pi()){
2320 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2322 fValueL[7] = tmpPPhi;
2323 fValueL[8] = fpPosDecayLGeantLength[i];
2325 fValueL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2326 fValueL[10] = eNegPart->Eta();
2328 Double_t tmpNPhi=eNegPart->Phi();
2329 if( eNegPart->Phi()>TMath::Pi()){
2330 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2332 fValueL[11] = tmpNPhi;
2333 fValueL[12] = fpiNegDecayLGeantLength[i];
2334 //---- Single track variables----------------------
2336 fValueL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2337 fValueL[14] = posEta;
2338 fValueL[15] = posPhi;
2339 fValueL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2340 fValueL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2341 fValueL[18] = nClsITSPos;
2342 fValueL[19] = nClsTPCPos;
2343 fValueL[20] = statusSingPos;
2345 fValueL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2346 fValueL[22] = negEta;
2347 fValueL[23] = negPhi;
2348 fValueL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2349 fValueL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2350 fValueL[26] = nClsITSNeg;
2351 fValueL[27] = nClsTPCNeg;
2352 fValueL[28] = statusSingNeg;
2356 //---- V0 track variables----------------------
2358 fValueL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2359 fValueL[30] = posV0Eta;
2360 fValueL[31] = posV0Phi;
2361 fValueL[32] = statusV0Pos;
2364 fValueL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2365 fValueL[34] = negV0Eta;
2366 fValueL[35] = negV0Phi;
2367 fValueL[36] = statusV0Neg;
2369 fSparseL->Fill(fValueL);
2375 void AliAnalysisTaskV0QA::FillHnSparseAL()
2377 // Fill THnSparse Antilambda
2379 Double_t massPi=0.13957018;
2380 Double_t massP=0.93827203;
2394 TLorentzVector posSglTrack;
2395 TLorentzVector negSglTrack;
2396 Double_t posPt,posEta,posPhi;
2397 Double_t negPt,negEta,negPhi;
2399 TLorentzVector posV0Track;
2400 TLorentzVector negV0Track;
2401 Double_t posV0Pt,posV0Eta,posV0Phi;
2402 Double_t negV0Pt,negV0Eta,negV0Phi;
2404 Float_t nClsITSPos=-1;
2405 Float_t nClsITSNeg=-1;
2407 Float_t nClsTPCPos=-1;
2408 Float_t nClsTPCNeg=-1;
2410 Int_t statusSingPos=-1;
2411 Int_t statusSingNeg=-1;
2413 Int_t statusV0Pos=-1;
2414 Int_t statusV0Neg=-1;
2417 for(Int_t i=0;i<fnDecayALGeant+1;i++){
2418 TParticle* alPart = fStack->Particle(falDecayALGeantIndex[i]);
2419 TParticle* eNegPart = fStack->Particle(fapNegDecayALGeantIndex[i]);
2420 TParticle* ePosPart = fStack->Particle(fpiPosDecayALGeantIndex[i]);
2421 if (fpiPosDecayALSingleRecIndex[i]!=-1){
2422 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayALSingleRecIndex[i]);
2423 ePosSglTrack->GetPxPyPz(ppSgl);
2424 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
2425 posPt = posSglTrack.Pt();
2426 posEta = posSglTrack.Eta();
2427 posPhi = posSglTrack.Phi();
2428 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2429 nClsITSPos=ePosSglTrack->GetNcls(0);
2430 nClsTPCPos=ePosSglTrack->GetNcls(1);
2435 posPhi = -2*TMath::Pi();
2445 if (fapNegDecayALSingleRecIndex[i]!=-1){
2446 AliESDtrack * eNegSglTrack = fESD->GetTrack(fapNegDecayALSingleRecIndex[i]);
2447 eNegSglTrack->GetPxPyPz(pmSgl);
2448 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massP);
2449 negPt = negSglTrack.Pt();
2450 negEta = negSglTrack.Eta();
2451 negPhi = negSglTrack.Phi();
2452 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2453 nClsITSNeg=eNegSglTrack->GetNcls(0);
2454 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2459 negPhi = -2*TMath::Pi();
2471 posV0Phi = -2*TMath::Pi();
2474 negV0Phi = -2*TMath::Pi();
2476 if(fDecayALV0RecIndexPos[i]!=-1){
2477 AliESDv0 * fV0MIs = fESD->GetV0(fDecayALV0RecIndexPos[i]);
2478 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2479 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2481 if (fpiPosDecayALV0RecIndex[i]!=-1 ){
2482 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayALV0RecIndex[i]);
2483 if ( trackPosTest->GetSign()==1 ) {
2484 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2486 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2488 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2490 posV0Pt = posV0Track.Pt();
2491 posV0Eta = posV0Track.Eta();
2492 posV0Phi = posV0Track.Phi();
2497 posV0Phi = -2*TMath::Pi();
2501 if (fapNegDecayALV0RecIndex[i]!=-1 ){
2502 // AliESDtrack * eNegV0Track = fESD->GetTrack(apNegDecayALV0RecIndex[i]);
2503 if ( trackNegTest->GetSign()==-1 ) {
2504 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2506 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2508 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massP);
2510 negV0Pt = negV0Track.Pt();
2511 negV0Eta = negV0Track.Eta();
2512 negV0Phi = negV0Track.Phi();
2517 negV0Phi = -2*TMath::Pi();
2522 xrG[0] = ePosPart->Vx();
2523 xrG[1] = ePosPart->Vy();
2524 xrG[2] = ePosPart->Vz();
2526 //--------- Geant variables ----------------------
2527 fValueAL[0] = 1./TMath::Sqrt(alPart->Pt());
2528 fValueAL[1] = alPart->Eta();
2530 Double_t tmpGPhi=alPart->Phi();
2531 if( alPart->Phi()>TMath::Pi()){
2532 tmpGPhi=alPart->Phi()-2*TMath::Pi();
2534 fValueAL[2] = tmpGPhi;
2536 fValueAL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2537 fValueAL[4] = xrG[2];
2540 fValueAL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2541 fValueAL[6] = ePosPart->Eta();
2543 Double_t tmpPPhi=ePosPart->Phi();
2544 if( ePosPart->Phi()>TMath::Pi()){
2545 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2547 fValueAL[7] = tmpPPhi;
2548 fValueAL[8] = fpiPosDecayALGeantLength[i];
2550 fValueAL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2551 fValueAL[10] = eNegPart->Eta();
2553 Double_t tmpNPhi=eNegPart->Phi();
2554 if( eNegPart->Phi()>TMath::Pi()){
2555 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2557 fValueAL[11] = tmpNPhi;
2558 fValueAL[12] = fapNegDecayALGeantLength[i];
2559 //---- Single track variables----------------------
2561 fValueAL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2562 fValueAL[14] = posEta;
2563 fValueAL[15] = posPhi;
2564 fValueAL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2565 fValueAL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2566 fValueAL[18] = nClsITSPos;
2567 fValueAL[19] = nClsTPCPos;
2568 fValueAL[20] = statusSingPos;
2570 fValueAL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2571 fValueAL[22] = negEta;
2572 fValueAL[23] = negPhi;
2573 fValueAL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2574 fValueAL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2575 fValueAL[26] = nClsITSNeg;
2576 fValueAL[27] = nClsTPCNeg;
2577 fValueAL[28] = statusSingNeg;
2581 //---- V0 track variables----------------------
2583 fValueAL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2584 fValueAL[30] = posV0Eta;
2585 fValueAL[31] = posV0Phi;
2586 fValueAL[32] = statusV0Pos;
2589 fValueAL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2590 fValueAL[34] = negV0Eta;
2591 fValueAL[35] = negV0Phi;
2592 fValueAL[36] = statusV0Neg;
2594 fSparseAL->Fill(fValueAL);
2599 // void AliAnalysisTaskV0QA::SetESDtrackCuts()
2602 // fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
2604 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
2605 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);