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.
117 //________________________________________________________________________
118 AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTaskSE(name),
131 fgConvGamGeantIndex(0),
132 feNegConvGamGeantIndex(0),
133 fePosConvGamGeantIndex(0),
134 feNegConvGamGeantLength(0),
135 fePosConvGamGeantLength(0),
136 feNegConvGamSingleRecIndex(0),
137 fePosConvGamSingleRecIndex(0),
138 feNegConvGamV0RecIndex(0),
139 fePosConvGamV0RecIndex(0),
140 fConvGamV0RecIndexPos(0),
141 fConvGamV0RecIndexNeg(0),
143 flDecayLGeantIndex(0),
144 fpiNegDecayLGeantIndex(0),
145 fpPosDecayLGeantIndex(0),
146 fpiNegDecayLGeantLength(0),
147 fpPosDecayLGeantLength(0),
148 fpiNegDecayLSingleRecIndex(0),
149 fpPosDecayLSingleRecIndex(0),
150 fpiNegDecayLV0RecIndex(0),
151 fpPosDecayLV0RecIndex(0),
152 fDecayLV0RecIndexPos(0),
153 fDecayLV0RecIndexNeg(0),
155 falDecayALGeantIndex(0),
156 fpiPosDecayALGeantIndex(0),
157 fapNegDecayALGeantIndex(0),
158 fpiPosDecayALGeantLength(0),
159 fapNegDecayALGeantLength(0),
160 fpiPosDecayALSingleRecIndex(0),
161 fapNegDecayALSingleRecIndex(0),
162 fpiPosDecayALV0RecIndex(0),
163 fapNegDecayALV0RecIndex(0),
164 fDecayALV0RecIndexPos(0),
165 fDecayALV0RecIndexNeg(0),
167 fK0DecayK0GeantIndex(0),
168 fpiNegDecayK0GeantIndex(0),
169 fpiPosDecayK0GeantIndex(0),
170 fpiNegDecayK0GeantLength(0),
171 fpiPosDecayK0GeantLength(0),
172 fpiNegDecayK0SingleRecIndex(0),
173 fpiPosDecayK0SingleRecIndex(0),
174 fpiNegDecayK0V0RecIndex(0),
175 fpiPosDecayK0V0RecIndex(0),
176 fDecayK0V0RecIndexPos(0),
177 fDecayK0V0RecIndexNeg(0),
202 fValueK0 = new Double_t[fDim];
203 fValueL = new Double_t[fDim];
204 fValueAL = new Double_t[fDim];
205 fValueV0 = new Double_t[fDim];
206 fxminV0 = new Double_t[fDim];
207 fxmaxV0 = new Double_t[fDim];
208 fbinsV0 = new Int_t[fDim];
212 fgConvGamGeantIndex = new Int_t[fgDim];
213 feNegConvGamGeantIndex = new Int_t[fgDim];
214 fePosConvGamGeantIndex = new Int_t[fgDim];
215 feNegConvGamGeantLength = new Float_t[fgDim];
216 fePosConvGamGeantLength = new Float_t[fgDim];
218 feNegConvGamSingleRecIndex = new Int_t[fgDim];
219 fePosConvGamSingleRecIndex = new Int_t[fgDim];
221 feNegConvGamV0RecIndex = new Int_t[fgDim];
222 fePosConvGamV0RecIndex = new Int_t[fgDim];
224 fConvGamV0RecIndexPos = new Int_t[fgDim];
225 fConvGamV0RecIndexNeg = new Int_t[fgDim];
227 // Lambda to proton pi-
228 flDecayLGeantIndex = new Int_t[fgDim];
229 fpiNegDecayLGeantIndex = new Int_t[fgDim];
230 fpPosDecayLGeantIndex = new Int_t[fgDim];
231 fpiNegDecayLGeantLength = new Float_t[fgDim];
232 fpPosDecayLGeantLength = new Float_t[fgDim];
234 fpiNegDecayLSingleRecIndex = new Int_t[fgDim];
235 fpPosDecayLSingleRecIndex = new Int_t[fgDim];
237 fpiNegDecayLV0RecIndex = new Int_t[fgDim];
238 fpPosDecayLV0RecIndex = new Int_t[fgDim];
240 fDecayLV0RecIndexPos = new Int_t[fgDim];
241 fDecayLV0RecIndexNeg = new Int_t[fgDim];
244 fK0DecayK0GeantIndex = new Int_t[fgDim];
245 fpiNegDecayK0GeantIndex = new Int_t[fgDim];
246 fpiPosDecayK0GeantIndex = new Int_t[fgDim];
247 fpiNegDecayK0GeantLength = new Float_t[fgDim];
248 fpiPosDecayK0GeantLength = new Float_t[fgDim];
250 fpiNegDecayK0SingleRecIndex = new Int_t[fgDim];
251 fpiPosDecayK0SingleRecIndex = new Int_t[fgDim];
253 fpiNegDecayK0V0RecIndex = new Int_t[fgDim];
254 fpiPosDecayK0V0RecIndex = new Int_t[fgDim];
256 fDecayK0V0RecIndexPos = new Int_t[fgDim];
257 fDecayK0V0RecIndexNeg = new Int_t[fgDim];
259 //Antilambda to antiproton piplus
260 falDecayALGeantIndex = new Int_t[fgDim];
261 fpiPosDecayALGeantIndex = new Int_t[fgDim];
262 fapNegDecayALGeantIndex = new Int_t[fgDim];
263 fpiPosDecayALGeantLength = new Float_t[fgDim];
264 fapNegDecayALGeantLength = new Float_t[fgDim];
266 fpiPosDecayALSingleRecIndex = new Int_t[fgDim];
267 fapNegDecayALSingleRecIndex = new Int_t[fgDim];
269 fpiPosDecayALV0RecIndex = new Int_t[fgDim];
270 fapNegDecayALV0RecIndex = new Int_t[fgDim];
272 fDecayALV0RecIndexPos = new Int_t[fgDim];
273 fDecayALV0RecIndexNeg = new Int_t[fgDim];
277 fclRefsP = new TClonesArray("AliTrackReference");
278 fclRefsN = new TClonesArray("AliTrackReference");
280 // SetESDtrackCuts();
283 AliLog::SetGlobalLogLevel(AliLog::kError);
285 DefineOutput(1, TList::Class());
288 //_____________________________________________________
289 AliAnalysisTaskV0QA::~AliAnalysisTaskV0QA()
291 // Remove all pointers
306 delete [] fgConvGamGeantIndex;
307 delete [] feNegConvGamGeantIndex;
308 delete [] fePosConvGamGeantIndex;
310 delete [] feNegConvGamSingleRecIndex;
311 delete [] fePosConvGamSingleRecIndex;
313 delete [] feNegConvGamV0RecIndex;
314 delete [] fePosConvGamV0RecIndex;
315 delete [] fConvGamV0RecIndexPos;
316 delete [] fConvGamV0RecIndexNeg;
318 delete [] flDecayLGeantIndex;
319 delete [] fpiNegDecayLGeantIndex;
320 delete [] fpPosDecayLGeantIndex;
322 delete [] fpiNegDecayLGeantLength;
323 delete [] fpPosDecayLGeantLength;
324 delete [] fpiNegDecayLSingleRecIndex;
325 delete [] fpPosDecayLSingleRecIndex;
327 delete [] fpiNegDecayLV0RecIndex;
328 delete [] fpPosDecayLV0RecIndex;
329 delete [] fDecayLV0RecIndexPos;
330 delete [] fDecayLV0RecIndexNeg;
332 delete [] falDecayALGeantIndex;
333 delete [] fpiPosDecayALGeantIndex;
334 delete [] fapNegDecayALGeantIndex;
336 delete [] fpiPosDecayALGeantLength;
337 delete [] fapNegDecayALGeantLength;
338 delete [] fpiPosDecayALSingleRecIndex;
339 delete [] fapNegDecayALSingleRecIndex;
341 delete [] fpiPosDecayALV0RecIndex;
342 delete [] fapNegDecayALV0RecIndex;
343 delete [] fDecayALV0RecIndexPos;
344 delete [] fDecayALV0RecIndexNeg;
347 delete [] fpiNegDecayK0GeantIndex;
348 delete [] fpiPosDecayK0GeantIndex;
350 delete [] fpiNegDecayK0GeantLength;
351 delete [] fpiPosDecayK0GeantLength;
352 delete [] fpiNegDecayK0SingleRecIndex;
353 delete [] fpiPosDecayK0SingleRecIndex;
355 delete [] fpiNegDecayK0V0RecIndex;
356 delete [] fpiPosDecayK0V0RecIndex;
358 delete [] fDecayK0V0RecIndexPos;
359 delete [] fDecayK0V0RecIndexNeg;
364 //________________________________________________________________________
365 void AliAnalysisTaskV0QA::UserCreateOutputObjects() {
366 // Create Ouptut objects
368 for(Int_t d=0;d<fDim;d++){
371 fxminV0[0]= 0; // 1/sqrt(pt) Gamma geant
375 fxminV0[1]=-2.5; // eta Gamma Geant
379 fxminV0[2]=-2*TMath::Pi(); // phi Gamma geant
380 fxmaxV0[2]= TMath::Pi();
383 fxminV0[3]= 0; // r geant
387 fxminV0[4]=-250; // z geant
391 fxminV0[5]= 0; // 1/sqrt(pt) Geant Pos
395 fxminV0[6]=-2.5; // eta geant Pos
399 fxminV0[7]=-2*TMath::Pi(); // phi Geant Pos
400 fxmaxV0[7]= TMath::Pi();
403 fxminV0[8]=0; // Track Length TPC Geant Pos
407 fxminV0[9]= 0; // 1/sqrt(pt) Geant Neg
411 fxminV0[10]=-2.5; // eta Geant Neg
415 fxminV0[11]=-2*TMath::Pi(); // phi Geant Neg
416 fxmaxV0[11]= TMath::Pi();
419 fxminV0[12]=0; // Track Length TPC Geant Neg
424 //-----------Rec single variables
426 fxminV0[13]= -0.5; // (pt-ptGeant)/ptGeant rec Pos
430 fxminV0[14]=-2.5; // eta rec Pos
434 fxminV0[15]=-2*TMath::Pi(); // phi rec Pos
435 fxmaxV0[15]= TMath::Pi();
438 fxminV0[16]= 0; // Impact parameter rec Pos
442 fxminV0[17]= 0; // nsigmas Impact parameter rec Pos
447 fxminV0[18]= -1; // Ncls ITS rec Pos
451 fxminV0[19]= -1; // Ncls TPC rec Pos
455 fxminV0[20]= -2; // Status Single TPC rec Pos
459 fxminV0[21]= -0.5; // (pt-ptGeant)/ptGeant rec Neg
463 fxminV0[22]=-2.5; // eta rec Neg
467 fxminV0[23]=-2*TMath::Pi(); // phi rec Neg
468 fxmaxV0[23]= TMath::Pi();
471 fxminV0[24]= 0; // Impact parameter rec Neg
475 fxminV0[25]= 0; // Sigmas Impact parameter rec Neg
480 fxminV0[26]= -1; // Ncls ITS rec Neg
484 fxminV0[27]= -1; // Ncls TPC rec Neg
488 fxminV0[28]= -2; // Status Single TPC rec Neg
491 // ------------------Rec V0 variables
495 fxminV0[29]= -0.5; // (pt-ptGeant)/ptGeant rec V0 Pos
499 fxminV0[30]=-2.5; // eta rec V0 Pos
503 fxminV0[31]=-2*TMath::Pi(); // phi rec V0 Pos
504 fxmaxV0[31]= TMath::Pi();
507 fxminV0[32]= -2; // Status V0 TPC rec Pos
513 fxminV0[33]= -0.5; // 1/sqrt(pt) rec V0 Neg
517 fxminV0[34]=-2.5; // eta rec V0 Neg
521 fxminV0[35]=-2*TMath::Pi(); // phi rec V0 Neg
522 fxmaxV0[35]= TMath::Pi();
526 fxminV0[36]= -2; // Status V0 TPC rec Neg
531 TString axisName[37]={"ptGammaGeant",
539 "TPCTrackLengthEPlusGeant",
543 "TPCTrackLengthEMinusGeant",
544 "ptResEPlusRecSingle",
547 "bXYZEPlusRecSingle",
548 "sigbXYZEPlusRecSingle",
549 "NclsITSEPlusRecSingle",
550 "NclsTPCEPlusRecSingle",
551 "statusRecSinglePos",
552 "ptResEMinusRecSingle",
553 "etaEMinusRecSingle",
554 "phiEMinusRecSingle",
555 "bXYZEMinusRecSingle",
556 "sigbXYZEMinusRecSingle",
557 "NclsITSEMinusRecSingle",
558 "NclsTPCEMinusRecSingle",
559 "statusRecSingleNeg",
567 "statusV0SingleNeg"};
570 fSparseV0= new THnSparseF("sparseV0","sparseV0",fDim,fbinsV0,fxminV0,fxmaxV0);
572 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
573 fSparseV0->GetAxis(iaxis)->SetName(axisName[iaxis]);
574 fSparseV0->GetAxis(iaxis)->SetTitle(axisName[iaxis]);
577 TString axisNameK0[37]={"ptK0Geant",
585 "TPCTrackLengthPiPlusGeant",
589 "TPCTrackLengthPiMinusGeant",
590 "ptResPiPlusRecSingle",
591 "etaPiPlusRecSingle",
592 "phiPiPlusRecSingle",
593 "bXYZPiPlusRecSingle",
594 "sigbXYZPiPlusRecSingle",
595 "NclsITSPiPlusRecSingle",
596 "NclsTPCPiPlusRecSingle",
597 "statusRecSinglePos",
598 "ptResPiMinusRecSingle",
599 "etaPiMinusRecSingle",
600 "phiPiMinusRecSingle",
601 "bXYZPiMinusRecSingle",
602 "sigbXYZPiMinusRecSingle",
603 "NclsITSPiMinusRecSingle",
604 "NclsTPCPiMinusRecSingle",
605 "statusRecSingleNeg",
617 fSparseK0= new THnSparseF("sparseK0","sparseK0",fDim,fbinsV0,fxminV0,fxmaxV0);
618 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
619 fSparseK0->GetAxis(iaxis)->SetName(axisNameK0[iaxis]);
620 fSparseK0->GetAxis(iaxis)->SetTitle(axisNameK0[iaxis]);
623 TString axisNameL[37]={"ptLGeant",
631 "TPCTrackLengthPPlusGeant",
635 "TPCTrackLengthPiMinusGeant",
636 "ptResPPlusRecSingle",
639 "bXYZPPlusRecSingle",
640 "sigbXYZPPlusRecSingle",
641 "NclsITSPPlusRecSingle",
642 "NclsTPCPPlusRecSingle",
643 "statusRecSinglePos",
644 "ptResPiMinusRecSingle",
645 "etaPiMinusRecSingle",
646 "phiPiMinusRecSingle",
647 "bXYZPiMinusRecSingle",
648 "sigbXYZPiMinusRecSingle",
649 "NclsITSPiMinusRecSingle",
650 "NclsTPCPiMinusRecSingle",
651 "statusRecSingleNeg",
662 fSparseL= new THnSparseF("sparseL","sparseL",fDim,fbinsV0,fxminV0,fxmaxV0);
663 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
664 fSparseL->GetAxis(iaxis)->SetName(axisNameL[iaxis]);
665 fSparseL->GetAxis(iaxis)->SetTitle(axisNameL[iaxis]);
668 TString axisNameAL[37]={"ptALGeant",
676 "TPCTrackLengthPiPlusGeant",
680 "TPCTrackLengthAPMinusGeant",
681 "ptResPiPlusRecSingle",
682 "etaPiPlusRecSingle",
683 "phiPiPlusRecSingle",
684 "bXYZPiPlusRecSingle",
685 "sigbXYZPiPlusRecSingle",
686 "NclsITSPiPlusRecSingle",
687 "NclsTPCPiPlusRecSingle",
688 "statusRecSinglePos",
689 "ptResAPMinusRecSingle",
690 "etaAPMinusRecSingle",
691 "phiAPMinusRecSingle",
692 "bXYZAPMinusRecSingle",
693 "sigbXYZAPMinusRecSingle",
694 "NclsITSAPMinusRecSingle",
695 "NclsTPCAPMinusRecSingle",
696 "statusRecSingleNeg",
707 fSparseAL= new THnSparseF("sparseAL","sparseAL",fDim,fbinsV0,fxminV0,fxmaxV0);
708 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
709 fSparseAL->GetAxis(iaxis)->SetName(axisNameAL[iaxis]);
710 fSparseAL->GetAxis(iaxis)->SetTitle(axisNameAL[iaxis]);
713 // create output container
715 fOutputContainer = new TList() ;
716 fOutputContainer->SetName(GetName()) ;
719 fOutputContainer->Add(fSparseV0);
720 fOutputContainer->Add(fSparseK0);
721 fOutputContainer->Add(fSparseL);
722 fOutputContainer->Add(fSparseAL);
726 //________________________________________________________________________
727 void AliAnalysisTaskV0QA::UserExec(Option_t *) {
728 // Execution of the Task
730 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
733 //cout<< "not a tree"<< endl;
741 fMCtruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
743 // Double_t vertex[3];
744 Double_t maxVertex=150.;
746 Double_t lineCutZRSlope=0.662486;
747 Double_t lineCutZValue=7.;
751 Int_t piNegLIndex=-1;
753 Int_t apNegALIndex=-1;
754 Int_t piPosALIndex=-1;
761 for(Int_t i=0; i<fgDim;i++){
762 fgConvGamGeantIndex[i] = -1;
763 feNegConvGamGeantIndex[i] = -1;
764 fePosConvGamGeantIndex[i] = -1;
766 feNegConvGamSingleRecIndex[i] = -1;
767 fePosConvGamSingleRecIndex[i] = -1;
769 feNegConvGamV0RecIndex[i] = -1;
770 fePosConvGamV0RecIndex[i] = -1;
771 fConvGamV0RecIndexPos[i] = -1;
772 fConvGamV0RecIndexNeg[i] = -1;
775 fK0DecayK0GeantIndex[i] = -1;
776 fpiNegDecayK0GeantIndex[i] = -1;
777 fpiPosDecayK0GeantIndex[i] = -1;
779 fpiNegDecayK0SingleRecIndex[i] = -1;
780 fpiPosDecayK0SingleRecIndex[i] = -1;
782 fpiNegDecayK0V0RecIndex[i] = -1;
783 fpiPosDecayK0V0RecIndex[i] = -1;
784 fDecayK0V0RecIndexPos[i] = -1;
785 fDecayK0V0RecIndexNeg[i] = -1;
788 flDecayLGeantIndex[i] = -1;
789 fpiNegDecayLGeantIndex[i] = -1;
790 fpPosDecayLGeantIndex[i] = -1;
792 fpiNegDecayLSingleRecIndex[i] = -1;
793 fpPosDecayLSingleRecIndex[i] = -1;
795 fpiNegDecayLV0RecIndex[i] = -1;
796 fpPosDecayLV0RecIndex[i] = -1;
797 fDecayLV0RecIndexPos[i] = -1;
798 fDecayLV0RecIndexNeg[i] = -1;
801 falDecayALGeantIndex[i] = -1;
802 fpiPosDecayALGeantIndex[i] = -1;
803 fapNegDecayALGeantIndex[i] = -1;
805 fpiPosDecayALSingleRecIndex[i] = -1;
806 fapNegDecayALSingleRecIndex[i] = -1;
808 fpiPosDecayALV0RecIndex[i] = -1;
809 fapNegDecayALV0RecIndex[i] = -1;
810 fDecayALV0RecIndexPos[i] = -1;
811 fDecayALV0RecIndexNeg[i] = -1;
818 AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));
819 fnTracksPrim=primVtx.GetNContributors();
822 if(fMCtruth && fnTracksPrim>0){
824 fStack = fMCtruth->MCEvent()->Stack();
829 for (Int_t iTracks = 0; iTracks < fMCtruth->MCEvent()->GetNumberOfTracks(); iTracks++) {
832 TParticle* particle = fStack->Particle(iTracks);
837 Printf("ERROR: Could not receive particle %d (mc loop)", iTracks);
841 if(particle->Pt()<0.050) continue;
842 if(TMath::Abs(particle->Eta())> 1.2) continue;
845 if (particle->GetPdgCode()== 22){
848 if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
849 continue; // no photon as mothers!
852 if(particle->GetMother(0) >= fStack->GetNprimary()){
853 continue; // the gamma has a mother, and it is not a primary particle
856 TParticle* ePos = NULL;
857 TParticle* eNeg = NULL;
861 if(particle->GetNDaughters() >= 2){
862 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
863 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
864 if(tmpDaughter->GetUniqueID() == 5){
865 if(tmpDaughter->GetPdgCode() == 11){
867 elecGIndex=daughterIndex;
869 else if(tmpDaughter->GetPdgCode() == -11){
871 posiGIndex=daughterIndex;
878 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
882 if(TMath::Abs(ePos->Eta())> maxEta || TMath::Abs(eNeg->Eta())> maxEta){
886 if(ePos->R()> maxVertex ){
887 continue; // cuts on distance from collision point
891 if( (TMath::Abs(ePos->Vz()) * lineCutZRSlope - lineCutZValue) > ePos->R() ){
892 continue; // line cut to exclude regions where we do not reconstruct
896 // Looking at the existance of TPC references
899 fMCtruth->MCEvent()->GetParticleAndTR(posiGIndex,ePosTPC,fclRefsP);
901 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(posiGIndex));
902 if(!mcParticlePos) continue;
905 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
909 int nPointsP = fclRefsP->GetEntries();
911 if (fRefTPC) delete fRefTPC;fRefTPC=NULL;
912 fRefTPC = new TObjArray();
914 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
915 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
916 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
921 for(int i=0; i<fRefTPC->GetEntries(); i++) {
922 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
923 fLabelsTPC[i] = ref->GetTrack();
926 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
927 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
928 if (aRef->GetTrack() != posiGIndex ) break;
936 fMCtruth->MCEvent()->GetParticleAndTR(elecGIndex,eNegTPC,fclRefsN);
938 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(elecGIndex));
939 if(!mcParticleNeg) continue;
942 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
943 int nPointsN = fclRefsN->GetEntries();
945 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
946 fRefTPC = new TObjArray();
948 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
949 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
950 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
955 for(int i=0; i<fRefTPC->GetEntries(); i++) {
956 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
957 fLabelsTPC[i] = ref->GetTrack();
960 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
961 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
962 if (aRef->GetTrack() != elecGIndex ) break;
968 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if e+/e- do not have a TPC ref continue;
969 ////////////////////////////////////////////////////////////////////
973 fgConvGamGeantIndex[fnConvGamGeant]=iTracks;
974 feNegConvGamGeantIndex[fnConvGamGeant] = elecGIndex;
975 fePosConvGamGeantIndex[fnConvGamGeant] = posiGIndex;
977 feNegConvGamGeantLength[fnConvGamGeant] = tpcTrackLengtheNeg;
978 fePosConvGamGeantLength[fnConvGamGeant] = tpcTrackLengthePos;
983 TParticle* piPos = NULL;
984 TParticle* piNeg = NULL;
988 if (particle->GetPdgCode()== 310){ // k0short
989 if(particle->GetNDaughters() == 2){
990 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
991 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
992 if(tmpDaughter->GetPdgCode() == 211){
994 fpiPosK0Index=daughterIndex;
996 else if(tmpDaughter->GetPdgCode() == -211){
998 fpiNegK0Index=daughterIndex;
1003 if(piPos == NULL || piNeg == NULL){ // means we do not have two daughters from K0short decay
1007 if(TMath::Abs(piPos->Eta())> maxEta || TMath::Abs(piNeg->Eta())> maxEta){
1011 if(piPos->R()> maxVertex ){
1012 continue; // cuts on distance from collision point
1016 if( (TMath::Abs(piPos->Vz()) * lineCutZRSlope - lineCutZValue) > piPos->R() ){
1017 continue; // line cut to exclude regions where we do not reconstruct
1020 // Looking at the existance of TPC references
1023 fMCtruth->MCEvent()->GetParticleAndTR(fpiPosK0Index,ePosTPC,fclRefsP);
1025 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiPosK0Index));
1026 if(!mcParticlePos) continue;
1029 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1032 int nPointsP = fclRefsP->GetEntries();
1033 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1034 fRefTPC = new TObjArray();
1036 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1037 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1038 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1043 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1044 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1045 fLabelsTPC[i] = ref->GetTrack();
1048 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1049 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1050 if (aRef->GetTrack() != fpiPosK0Index ) break;
1058 fMCtruth->MCEvent()->GetParticleAndTR(fpiNegK0Index,eNegTPC,fclRefsN);
1060 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiNegK0Index));
1061 if(!mcParticleNeg) continue;
1064 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1066 int nPointsN = fclRefsN->GetEntries();
1067 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1068 fRefTPC = new TObjArray();
1070 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1071 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1072 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1077 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1078 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1079 fLabelsTPC[i] = ref->GetTrack();
1082 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1083 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1084 if (aRef->GetTrack() != fpiNegK0Index ) break;
1088 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if pi+/pi- do not have a TPC ref continue;
1089 ////////////////////////////////////////////////////////////////////
1093 fK0DecayK0GeantIndex[fnDecayK0Geant]=iTracks;
1094 fpiNegDecayK0GeantIndex[fnDecayK0Geant]=fpiNegK0Index;
1095 fpiPosDecayK0GeantIndex[fnDecayK0Geant]=fpiPosK0Index;
1096 fpiNegDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengtheNeg;
1097 fpiPosDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengthePos;
1102 TParticle* pPos = NULL;
1103 TParticle* piNegL = NULL;
1108 if (particle->GetPdgCode()== 3122){ //lambda
1110 if(particle->GetNDaughters() == 2){
1111 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1112 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1113 if(tmpDaughter->GetPdgCode() == 2212){
1115 pPosLIndex=daughterIndex;
1117 else if(tmpDaughter->GetPdgCode() == -211){
1118 piNegL = tmpDaughter;
1119 piNegLIndex=daughterIndex;
1124 if(pPos == NULL || piNegL == NULL){ // means we do not have two daughters from lambda decay
1128 if(TMath::Abs(pPos->Eta())> maxEta || TMath::Abs(piNegL->Eta())> maxEta){
1132 if(pPos->R()> maxVertex ){
1133 continue; // cuts on distance from collision point
1137 if( (TMath::Abs(pPos->Vz()) * lineCutZRSlope - lineCutZValue) > pPos->R() ){
1138 continue; // line cut to exclude regions where we do not reconstruct
1142 // Looking at the existance of TPC references
1145 fMCtruth->MCEvent()->GetParticleAndTR(pPosLIndex,ePosTPC,fclRefsP);
1147 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(pPosLIndex));
1148 if(!mcParticlePos) continue;
1151 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1154 int nPointsP = fclRefsP->GetEntries();
1155 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1156 fRefTPC = new TObjArray();
1158 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1159 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1160 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1165 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1166 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1167 fLabelsTPC[i] = ref->GetTrack();
1170 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1171 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1172 if (aRef->GetTrack() != pPosLIndex ) break;
1180 fMCtruth->MCEvent()->GetParticleAndTR(piNegLIndex,eNegTPC,fclRefsN);
1182 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piNegLIndex));
1183 if(!mcParticleNeg) continue;
1186 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1188 int nPointsN = fclRefsN->GetEntries();
1189 if (fRefTPC) delete fRefTPC;
1190 fRefTPC = new TObjArray();
1192 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1193 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1194 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1199 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1200 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1201 fLabelsTPC[i] = ref->GetTrack();
1204 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1205 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1206 if (aRef->GetTrack() != piNegLIndex ) break;
1210 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1211 ////////////////////////////////////////////////////////////////////
1215 flDecayLGeantIndex[fnDecayLGeant]=iTracks;
1217 fpiNegDecayLGeantIndex[fnDecayLGeant]=piNegLIndex;
1218 fpPosDecayLGeantIndex[fnDecayLGeant]=pPosLIndex;
1220 fpiNegDecayLGeantLength[fnDecayLGeant]=tpcTrackLengtheNeg;
1221 fpPosDecayLGeantLength[fnDecayLGeant]=tpcTrackLengthePos;
1226 /////////////////////////////////////////////////////
1229 TParticle* apNeg = NULL;
1230 TParticle* piPosAL = NULL;
1235 if (particle->GetPdgCode()== -3122){ //antilambda
1237 if(particle->GetNDaughters() == 2){
1238 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1239 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1240 if(tmpDaughter->GetPdgCode() == -2212){
1242 apNegALIndex=daughterIndex;
1244 else if(tmpDaughter->GetPdgCode() == 211){
1245 piPosAL = tmpDaughter;
1246 piPosALIndex=daughterIndex;
1251 if(apNeg == NULL || piPosAL == NULL){ // means we do not have two daughters from antilambda decay
1255 if(TMath::Abs(apNeg->Eta())> maxEta || TMath::Abs(piPosAL->Eta())> maxEta){
1259 if(apNeg->R()> maxVertex ){
1260 continue; // cuts on distance from collision point
1264 if( (TMath::Abs(apNeg->Vz()) * lineCutZRSlope - lineCutZValue) > apNeg->R() ){
1265 continue; // line cut to exclude regions where we do not reconstruct
1269 // Looking at the existance of TPC references
1272 fMCtruth->MCEvent()->GetParticleAndTR(piPosALIndex,ePosTPC,fclRefsP);
1274 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piPosALIndex));
1275 if(!mcParticlePos) continue;
1278 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1280 int nPointsP = fclRefsP->GetEntries();
1281 if (fRefTPC) delete fRefTPC;
1282 fRefTPC = new TObjArray();
1284 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1285 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1286 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1291 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1292 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1293 fLabelsTPC[i] = ref->GetTrack();
1296 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1297 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1298 if (aRef->GetTrack() != piPosALIndex ) break;
1304 fMCtruth->MCEvent()->GetParticleAndTR(apNegALIndex,eNegTPC,fclRefsN);
1306 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(apNegALIndex));
1307 if(!mcParticleNeg) continue;
1310 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1312 int nPointsN = fclRefsN->GetEntries();
1313 if (fRefTPC) delete fRefTPC;
1314 fRefTPC = new TObjArray();
1316 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1317 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1318 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1323 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1324 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1325 fLabelsTPC[i] = ref->GetTrack();
1328 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1329 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1330 if (aRef->GetTrack() != apNegALIndex ) break;
1336 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1337 ////////////////////////////////////////////////////////////////////
1340 falDecayALGeantIndex[fnDecayALGeant]=iTracks;
1342 fpiPosDecayALGeantIndex[fnDecayALGeant]=piPosALIndex;
1343 fapNegDecayALGeantIndex[fnDecayALGeant]=apNegALIndex;
1345 fpiPosDecayALGeantLength[fnDecayALGeant]=tpcTrackLengthePos;
1346 fapNegDecayALGeantLength[fnDecayALGeant]=tpcTrackLengtheNeg;
1357 AliKFParticle::SetField(fESD->GetMagneticField());
1359 const AliESDVertex *pvertex = fESD->GetPrimaryVertex();
1361 pvertex->GetXYZ(xyzVtx);
1363 if(fnTracksPrim>0) {
1365 InspectListOfChargedParticles();
1369 if(fnConvGamGeant>-1){
1370 FillHnSparseGamma();
1373 if(fnDecayK0Geant>-1){
1377 if(fnDecayLGeant>-1){
1381 if(fnDecayALGeant>-1){
1388 PostData(1, fOutputContainer );
1393 void AliAnalysisTaskV0QA::Terminate(Option_t *) {
1394 // Draw some histogram at the end.
1399 Int_t AliAnalysisTaskV0QA::GetTPCReference(Int_t label) {
1400 // Get TPC References
1402 int start = TMath::BinarySearch(fRefTPC->GetEntries(), fLabelsTPC, label);
1404 while (start >= 0) {
1405 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[start];
1406 if (ref->GetTrack() != label) return start+1;
1417 void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
1418 // Look at the list of particles for the single track reconstruction
1420 for(Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++){
1422 AliESDtrack* curTrack = fESD->GetTrack(iTracks);
1429 // if( !(curTrack->GetStatus() & AliESDtrack::kTPCrefit)){
1434 Int_t labelMC = TMath::Abs(curTrack->GetLabel());
1436 if ( labelMC > fStack->GetNtrack() ) continue;
1439 TParticle* curParticle = fStack->Particle(labelMC);
1440 if(curParticle->GetMother(0)==-1){
1445 if(TMath::Abs(curParticle->GetPdgCode()) == 11){ // e+/e-
1447 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==22 ){ // e+/e- from gamma
1448 if( curParticle->GetUniqueID()!=5 ){ // e+/e- from gamma conversion
1452 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1453 if(curTrack->GetSign()>0){
1454 if (labelMC== fePosConvGamGeantIndex[iGamConv]){
1455 fePosConvGamSingleRecIndex[iGamConv]=iTracks;
1458 if (labelMC== feNegConvGamGeantIndex[iGamConv]){
1459 feNegConvGamSingleRecIndex[iGamConv]=iTracks;
1462 } // loop over geant converted gammas
1465 } // condition to select reconstructed electrons
1469 if(TMath::Abs(curParticle->GetPdgCode()) == 211 || TMath::Abs(curParticle->GetPdgCode())==2212 ){ // pi+/pi-
1471 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==310 ||
1472 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==3122 ||
1473 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==-3122 ){ // pi+/proton/pi- from K0/Lambda
1475 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1476 if(curTrack->GetSign()>0){
1477 if (labelMC== fpiPosDecayK0GeantIndex[iK0Dec]){
1478 fpiPosDecayK0SingleRecIndex[iK0Dec]=iTracks;
1481 if (labelMC== fpiNegDecayK0GeantIndex[iK0Dec]){
1482 fpiNegDecayK0SingleRecIndex[iK0Dec]=iTracks;
1485 } // loop over geant decay K0
1487 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1488 if(curTrack->GetSign()>0){
1489 if (labelMC== fpPosDecayLGeantIndex[iLDec]){
1490 fpPosDecayLSingleRecIndex[iLDec]=iTracks;
1493 if (labelMC== fpiNegDecayLGeantIndex[iLDec]){
1494 fpiNegDecayLSingleRecIndex[iLDec]=iTracks;
1497 } // loop over geant decay Lambda
1499 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1500 if(curTrack->GetSign()<0){
1501 if (labelMC== fapNegDecayALGeantIndex[iALDec]){
1502 fapNegDecayALSingleRecIndex[iALDec]=iTracks;
1505 if (labelMC== fpiPosDecayALGeantIndex[iALDec]){
1506 fpiPosDecayALSingleRecIndex[iALDec]=iTracks;
1509 } // loop over geant decay antiLambda
1511 } // condition to select reconstructed electrons
1512 } // all reconstructed track
1517 void AliAnalysisTaskV0QA::InspectListOfV0s(){
1518 // Look at the list of particles for the V0 reconstruction
1520 AliESDtrack* trackPos= NULL;
1521 AliESDtrack* trackNeg= NULL;
1522 Int_t grandMotherPos=-1;
1523 Int_t grandMotherNeg=-1;
1529 for(Int_t iV0MI = 0; iV0MI < fESD->GetNumberOfV0s(); iV0MI++) {
1531 AliESDv0 * fV0MIs = fESD->GetV0(iV0MI);
1534 if ( !fV0MIs->GetOnFlyStatus() ){
1537 if(fnTracksPrim<=0) {
1542 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1543 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1546 if ( trackPosTest->GetSign() == trackNegTest->GetSign()){
1552 // if( !(trackPosTest->GetStatus() & AliESDtrack::kTPCrefit)){
1556 // if( !(trackNegTest->GetStatus() & AliESDtrack::kTPCrefit)){
1560 if( trackPosTest->GetSign() ==1){
1561 trackPos =fESD->GetTrack(fV0MIs->GetPindex());
1562 trackNeg =fESD->GetTrack(fV0MIs->GetNindex());
1563 pIndex=fV0MIs->GetPindex();
1564 nIndex=fV0MIs->GetNindex();
1567 if( trackPosTest->GetSign() ==-1){
1568 trackPos =fESD->GetTrack(fV0MIs->GetNindex());
1569 trackNeg =fESD->GetTrack(fV0MIs->GetPindex());
1570 pIndex=fV0MIs->GetNindex();
1571 nIndex=fV0MIs->GetPindex();
1575 Int_t labelNeg=TMath::Abs(trackNeg->GetLabel());
1576 if(labelNeg > fStack->GetNtrack() ) continue;
1577 TParticle * particleNeg= fStack->Particle(labelNeg);
1579 Int_t labelPos=TMath::Abs(trackPos->GetLabel());
1580 if(labelPos > fStack->GetNtrack() ) continue;
1581 TParticle * particlePos= fStack->Particle(labelPos);
1584 if(particlePos->GetMother(0)>-1){
1585 grandMotherPos=fStack->Particle(particlePos->GetMother(0))->GetMother(0);
1586 motherPos=particlePos->GetMother(0);
1589 if(particleNeg->GetMother(0)>-1){
1590 grandMotherNeg=fStack->Particle(particleNeg->GetMother(0))->GetMother(0);
1591 motherNeg=particleNeg->GetMother(0);
1594 if(motherPos == motherNeg && motherPos!=-1 ){
1595 if( particlePos->GetPdgCode() ==-11 && particleNeg->GetPdgCode()==11 ){
1596 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1597 if (labelPos== fePosConvGamGeantIndex[iGamConv]){
1598 fePosConvGamV0RecIndex[iGamConv]=pIndex;
1599 fConvGamV0RecIndexPos[iGamConv]=iV0MI;
1601 if (labelNeg== feNegConvGamGeantIndex[iGamConv]){
1602 feNegConvGamV0RecIndex[iGamConv]=nIndex;
1603 fConvGamV0RecIndexNeg[iGamConv]=iV0MI;
1606 } // loop over geant converted gammas
1609 if( particlePos->GetPdgCode()==211 && particleNeg->GetPdgCode()==-211 ){
1610 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1611 if (labelPos== fpiPosDecayK0GeantIndex[iK0Dec]){
1612 fpiPosDecayK0V0RecIndex[iK0Dec]=pIndex;
1613 fDecayK0V0RecIndexPos[iK0Dec]=iV0MI;
1615 if (labelNeg== fpiNegDecayK0GeantIndex[iK0Dec]){
1616 fpiNegDecayK0V0RecIndex[iK0Dec]=nIndex;
1617 fDecayK0V0RecIndexNeg[iK0Dec]=iV0MI;
1620 } // loop over geant K0
1623 if( particlePos->GetPdgCode()==2212 && particleNeg->GetPdgCode()==-211 ){
1624 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1625 if (labelPos== fpPosDecayLGeantIndex[iLDec]){
1626 fpPosDecayLV0RecIndex[iLDec]=pIndex;
1627 fDecayLV0RecIndexPos[iLDec]=iV0MI;
1629 if (labelNeg== fpiNegDecayLGeantIndex[iLDec]){
1630 fpiNegDecayLV0RecIndex[iLDec]=nIndex;
1631 fDecayLV0RecIndexNeg[iLDec]=iV0MI;
1634 } // loop over geant Lambda
1637 if( particleNeg->GetPdgCode()==-2212 && particlePos->GetPdgCode()==211 ){
1638 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1639 if (labelNeg== fapNegDecayALGeantIndex[iALDec]){
1640 fapNegDecayALV0RecIndex[iALDec]=nIndex;
1641 fDecayALV0RecIndexNeg[iALDec]=iV0MI;
1643 if (labelPos== fpiPosDecayALGeantIndex[iALDec]){
1644 fpiPosDecayALV0RecIndex[iALDec]=pIndex;
1645 fDecayALV0RecIndexPos[iALDec]=iV0MI;
1648 } // loop over geant antiLambda
1655 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1656 if ( fConvGamV0RecIndexNeg[iGamConv]!= fConvGamV0RecIndexPos[iGamConv]){
1657 fePosConvGamV0RecIndex[iGamConv]=-1;
1658 feNegConvGamV0RecIndex[iGamConv]=-1;
1659 fConvGamV0RecIndexNeg[iGamConv]=-1;
1660 fConvGamV0RecIndexPos[iGamConv]=-1;
1665 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1666 if(fDecayLV0RecIndexPos[iLDec] != fDecayLV0RecIndexNeg[iLDec]){
1667 fpiNegDecayLV0RecIndex[iLDec]=-1;
1668 fpPosDecayLV0RecIndex[iLDec]=-1;
1669 fDecayLV0RecIndexNeg[iLDec]=-1;
1670 fDecayLV0RecIndexPos[iLDec]=-1;
1674 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1675 if(fDecayALV0RecIndexPos[iALDec] != fDecayALV0RecIndexNeg[iALDec]){
1676 fpiPosDecayALV0RecIndex[iALDec]=-1;
1677 fapNegDecayALV0RecIndex[iALDec]=-1;
1678 fDecayALV0RecIndexNeg[iALDec]=-1;
1679 fDecayALV0RecIndexPos[iALDec]=-1;
1683 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1684 if(fDecayK0V0RecIndexPos[iK0Dec] != fDecayK0V0RecIndexNeg[iK0Dec]){
1685 fpiNegDecayK0V0RecIndex[iK0Dec]=-1;
1686 fpiPosDecayK0V0RecIndex[iK0Dec]=-1;
1687 fDecayK0V0RecIndexNeg[iK0Dec]=-1;
1688 fDecayK0V0RecIndexPos[iK0Dec]=-1;
1694 void AliAnalysisTaskV0QA::FillHnSparseGamma()
1696 // Fill THnSparse Gamma
1698 Double_t massE=0.00051099892;
1710 TLorentzVector posSglTrack;
1711 TLorentzVector negSglTrack;
1712 Double_t posPt,posEta,posPhi;
1713 Double_t negPt,negEta,negPhi;
1715 TLorentzVector posV0Track;
1716 TLorentzVector negV0Track;
1717 Double_t posV0Pt,posV0Eta,posV0Phi;
1718 Double_t negV0Pt,negV0Eta,negV0Phi;
1720 Float_t nClsITSPos=-1;
1721 Float_t nClsITSNeg=-1;
1723 Float_t nClsTPCPos=-1;
1724 Float_t nClsTPCNeg=-1;
1726 Int_t statusSingPos=-1;
1727 Int_t statusSingNeg=-1;
1729 Int_t statusV0Pos=-1;
1730 Int_t statusV0Neg=-1;
1733 for(Int_t i=0;i<fnConvGamGeant+1;i++){
1734 TParticle* gamPart = fStack->Particle(fgConvGamGeantIndex[i]);
1735 TParticle* ePosPart = fStack->Particle(fePosConvGamGeantIndex[i]);
1736 TParticle* eNegPart = fStack->Particle(feNegConvGamGeantIndex[i]);
1737 if (fePosConvGamSingleRecIndex[i]!=-1){
1738 AliESDtrack * ePosSglTrack = fESD->GetTrack(fePosConvGamSingleRecIndex[i]);
1739 ePosSglTrack->GetPxPyPz(ppSgl);
1740 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massE);
1741 posPt = posSglTrack.Pt();
1742 posEta = posSglTrack.Eta();
1743 posPhi = posSglTrack.Phi();
1744 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1745 nClsITSPos=ePosSglTrack->GetNcls(0);
1746 nClsTPCPos=ePosSglTrack->GetNcls(1);
1751 posPhi = -2*TMath::Pi();
1761 if (feNegConvGamSingleRecIndex[i]!=-1){
1762 AliESDtrack * eNegSglTrack = fESD->GetTrack(feNegConvGamSingleRecIndex[i]);
1763 eNegSglTrack->GetPxPyPz(pmSgl);
1764 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massE);
1765 negPt = negSglTrack.Pt();
1766 negEta = negSglTrack.Eta();
1767 negPhi = negSglTrack.Phi();
1768 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
1769 nClsITSNeg=eNegSglTrack->GetNcls(0);
1770 nClsTPCNeg=eNegSglTrack->GetNcls(1);
1775 negPhi = -2*TMath::Pi();
1787 posV0Phi = -2*TMath::Pi();
1790 negV0Phi = -2*TMath::Pi();
1792 if(fConvGamV0RecIndexPos[i]!=-1){
1793 AliESDv0 * fV0MIs = fESD->GetV0(fConvGamV0RecIndexPos[i]);
1794 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1795 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1797 if (fePosConvGamV0RecIndex[i]!=-1 ){
1798 // AliESDtrack * ePosV0Track = fESD->GetTrack(ePosConvGamV0RecIndex[i]);
1799 if ( trackPosTest->GetSign()==1 ) {
1800 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1802 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1804 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massE);
1806 posV0Pt = posV0Track.Pt();
1807 posV0Eta = posV0Track.Eta();
1808 posV0Phi = posV0Track.Phi();
1813 posV0Phi = -2*TMath::Pi();
1817 if (feNegConvGamV0RecIndex[i]!=-1 ){
1818 // AliESDtrack * eNegV0Track = fESD->GetTrack(eNegConvGamV0RecIndex[i]);
1819 if ( trackNegTest->GetSign()==-1 ) {
1820 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1822 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1824 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massE);
1826 negV0Pt = negV0Track.Pt();
1827 negV0Eta = negV0Track.Eta();
1828 negV0Phi = negV0Track.Phi();
1833 negV0Phi = -2*TMath::Pi();
1838 xrG[0] = ePosPart->Vx();
1839 xrG[1] = ePosPart->Vy();
1840 xrG[2] = ePosPart->Vz();
1842 //--------- Geant variables ----------------------
1843 fValueV0[0] = 1./TMath::Sqrt(gamPart->Pt());
1844 fValueV0[1] = gamPart->Eta();
1846 Double_t tmpGPhi=gamPart->Phi();
1847 if( gamPart->Phi()>TMath::Pi()){
1848 tmpGPhi=gamPart->Phi()-2*TMath::Pi();
1850 fValueV0[2] = tmpGPhi;
1852 fValueV0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
1853 fValueV0[4] = xrG[2];
1856 fValueV0[5] = 1./TMath::Sqrt(ePosPart->Pt());
1857 fValueV0[6] = ePosPart->Eta();
1859 Double_t tmpPPhi=ePosPart->Phi();
1860 if( ePosPart->Phi()>TMath::Pi()){
1861 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
1863 fValueV0[7] = tmpPPhi;
1864 fValueV0[8] = fePosConvGamGeantLength[i];
1866 fValueV0[9] = 1./TMath::Sqrt(eNegPart->Pt());
1867 fValueV0[10] = eNegPart->Eta();
1869 Double_t tmpNPhi=eNegPart->Phi();
1870 if( eNegPart->Phi()>TMath::Pi()){
1871 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
1873 fValueV0[11] = tmpNPhi;
1874 fValueV0[12] = feNegConvGamGeantLength[i];
1876 //---- Single track variables----------------------
1878 fValueV0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
1879 fValueV0[14] = posEta;
1880 fValueV0[15] = posPhi;
1881 fValueV0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
1882 fValueV0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
1883 fValueV0[18] = nClsITSPos;
1884 fValueV0[19] = nClsTPCPos;
1885 fValueV0[20] = statusSingPos;
1888 fValueV0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
1889 fValueV0[22] = negEta;
1890 fValueV0[23] = negPhi;
1891 fValueV0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
1892 fValueV0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
1894 fValueV0[26] = nClsITSNeg;
1895 fValueV0[27] = nClsTPCNeg;
1896 fValueV0[28] = statusSingNeg;
1899 //---- V0 track variables----------------------
1901 fValueV0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
1902 fValueV0[30] = posV0Eta;
1903 fValueV0[31] = posV0Phi;
1904 fValueV0[32] = statusV0Pos;
1906 fValueV0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
1907 fValueV0[34] = negV0Eta;
1908 fValueV0[35] = negV0Phi;
1909 fValueV0[36] = statusV0Neg;
1911 fSparseV0->Fill(fValueV0);
1917 void AliAnalysisTaskV0QA::FillHnSparseK0()
1919 // Fill THnSparse K0
1921 Double_t massPi=0.13957018;
1933 TLorentzVector posSglTrack;
1934 TLorentzVector negSglTrack;
1935 Double_t posPt,posEta,posPhi;
1936 Double_t negPt,negEta,negPhi;
1938 TLorentzVector posV0Track;
1939 TLorentzVector negV0Track;
1940 Double_t posV0Pt,posV0Eta,posV0Phi;
1941 Double_t negV0Pt,negV0Eta,negV0Phi;
1943 Float_t nClsITSPos=-1;
1944 Float_t nClsITSNeg=-1;
1946 Float_t nClsTPCPos=-1;
1947 Float_t nClsTPCNeg=-1;
1949 Int_t statusSingPos=-1;
1950 Int_t statusSingNeg=-1;
1952 Int_t statusV0Pos=-1;
1953 Int_t statusV0Neg=-1;
1955 for(Int_t i=0;i<fnDecayK0Geant+1;i++){
1956 TParticle* k0Part = fStack->Particle(fK0DecayK0GeantIndex[i]);
1957 TParticle* ePosPart = fStack->Particle(fpiPosDecayK0GeantIndex[i]);
1958 TParticle* eNegPart = fStack->Particle(fpiNegDecayK0GeantIndex[i]);
1959 if (fpiPosDecayK0SingleRecIndex[i]!=-1){
1960 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayK0SingleRecIndex[i]);
1961 ePosSglTrack->GetPxPyPz(ppSgl);
1962 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
1963 posPt = posSglTrack.Pt();
1964 posEta = posSglTrack.Eta();
1965 posPhi = posSglTrack.Phi();
1966 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1967 nClsITSPos=ePosSglTrack->GetNcls(0);
1968 nClsTPCPos=ePosSglTrack->GetNcls(1);
1973 posPhi = -2*TMath::Pi();
1984 if (fpiNegDecayK0SingleRecIndex[i]!=-1){
1985 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayK0SingleRecIndex[i]);
1986 eNegSglTrack->GetPxPyPz(pmSgl);
1987 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
1988 negPt = negSglTrack.Pt();
1989 negEta = negSglTrack.Eta();
1990 negPhi = negSglTrack.Phi();
1991 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
1992 nClsITSNeg=eNegSglTrack->GetNcls(0);
1993 nClsTPCNeg=eNegSglTrack->GetNcls(1);
1998 negPhi = -2*TMath::Pi();
2010 posV0Phi = -2*TMath::Pi();
2013 negV0Phi = -2*TMath::Pi();
2015 if(fDecayK0V0RecIndexPos[i]!=-1){
2016 AliESDv0 * fV0MIs = fESD->GetV0(fDecayK0V0RecIndexPos[i]);
2017 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2018 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2020 if (fpiPosDecayK0V0RecIndex[i]!=-1 ){
2021 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayK0V0RecIndex[i]);
2022 if ( trackPosTest->GetSign()==1 ) {
2023 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2025 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2027 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2029 posV0Pt = posV0Track.Pt();
2030 posV0Eta = posV0Track.Eta();
2031 posV0Phi = posV0Track.Phi();
2036 posV0Phi = -2*TMath::Pi();
2040 if (fpiNegDecayK0V0RecIndex[i]!=-1 ){
2041 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayK0V0RecIndex[i]);
2042 if ( trackNegTest->GetSign()==-1 ) {
2043 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2045 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2047 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2049 negV0Pt = negV0Track.Pt();
2050 negV0Eta = negV0Track.Eta();
2051 negV0Phi = negV0Track.Phi();
2056 negV0Phi = -2*TMath::Pi();
2061 xrG[0] = ePosPart->Vx();
2062 xrG[1] = ePosPart->Vy();
2063 xrG[2] = ePosPart->Vz();
2066 //--------- Geant variables ----------------------
2067 fValueK0[0] = 1./TMath::Sqrt(k0Part->Pt());
2068 fValueK0[1] = k0Part->Eta();
2070 Double_t tmpGPhi=k0Part->Phi();
2071 if( k0Part->Phi()>TMath::Pi()){
2072 tmpGPhi=k0Part->Phi()-2*TMath::Pi();
2074 fValueK0[2] = tmpGPhi;
2076 fValueK0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2077 fValueK0[4] = xrG[2];
2080 fValueK0[5] = 1./TMath::Sqrt(ePosPart->Pt());
2081 fValueK0[6] = ePosPart->Eta();
2083 Double_t tmpPPhi=ePosPart->Phi();
2084 if( ePosPart->Phi()>TMath::Pi()){
2085 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2087 fValueK0[7] = tmpPPhi;
2088 fValueK0[8] = fpiPosDecayK0GeantLength[i];
2090 fValueK0[9] = 1./TMath::Sqrt(eNegPart->Pt());
2091 fValueK0[10] = eNegPart->Eta();
2093 Double_t tmpNPhi=eNegPart->Phi();
2094 if( eNegPart->Phi()>TMath::Pi()){
2095 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2097 fValueK0[11] = tmpNPhi;
2098 fValueK0[12] = fpiNegDecayK0GeantLength[i];
2099 //---- Single track variables----------------------
2101 fValueK0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt() ;
2102 fValueK0[14] = posEta;
2103 fValueK0[15] = posPhi;
2104 fValueK0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
2105 fValueK0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2107 fValueK0[18] = nClsITSPos;
2108 fValueK0[19] = nClsTPCPos;
2109 fValueK0[20] = statusSingPos;
2111 fValueK0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
2112 fValueK0[22] = negEta;
2113 fValueK0[23] = negPhi;
2114 fValueK0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] );
2115 fValueK0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2116 fValueK0[26] = nClsITSNeg;
2117 fValueK0[27] = nClsTPCNeg;
2118 fValueK0[28] = statusSingNeg;
2121 //---- V0 track variables----------------------
2123 fValueK0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2124 fValueK0[30] = posV0Eta;
2125 fValueK0[31] = posV0Phi;
2126 fValueK0[32] = statusV0Pos;
2128 fValueK0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2129 fValueK0[34] = negV0Eta;
2130 fValueK0[35] = negV0Phi;
2131 fValueK0[36] = statusV0Neg;
2133 fSparseK0->Fill(fValueK0);
2138 void AliAnalysisTaskV0QA::FillHnSparseL()
2140 // Fill THnSparse Lambda
2142 Double_t massPi=0.13957018;
2143 Double_t massP=0.93827203;
2157 TLorentzVector posSglTrack;
2158 TLorentzVector negSglTrack;
2159 Double_t posPt,posEta,posPhi;
2160 Double_t negPt,negEta,negPhi;
2162 TLorentzVector posV0Track;
2163 TLorentzVector negV0Track;
2164 Double_t posV0Pt,posV0Eta,posV0Phi;
2165 Double_t negV0Pt,negV0Eta,negV0Phi;
2167 Float_t nClsITSPos=-1;
2168 Float_t nClsITSNeg=-1;
2170 Float_t nClsTPCPos=-1;
2171 Float_t nClsTPCNeg=-1;
2173 Int_t statusSingPos=-1;
2174 Int_t statusSingNeg=-1;
2176 Int_t statusV0Pos=-1;
2177 Int_t statusV0Neg=-1;
2179 for(Int_t i=0;i<fnDecayLGeant+1;i++){
2180 TParticle* lPart = fStack->Particle(flDecayLGeantIndex[i]);
2181 TParticle* ePosPart = fStack->Particle(fpPosDecayLGeantIndex[i]);
2182 TParticle* eNegPart = fStack->Particle(fpiNegDecayLGeantIndex[i]);
2183 if (fpPosDecayLSingleRecIndex[i]!=-1){
2184 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpPosDecayLSingleRecIndex[i]);
2185 ePosSglTrack->GetPxPyPz(ppSgl);
2186 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massP);
2187 posPt = posSglTrack.Pt();
2188 posEta = posSglTrack.Eta();
2189 posPhi = posSglTrack.Phi();
2190 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2191 nClsITSPos=ePosSglTrack->GetNcls(0);
2192 nClsTPCPos=ePosSglTrack->GetNcls(1);
2197 posPhi = -2*TMath::Pi();
2207 if (fpiNegDecayLSingleRecIndex[i]!=-1){
2208 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayLSingleRecIndex[i]);
2209 eNegSglTrack->GetPxPyPz(pmSgl);
2210 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
2211 negPt = negSglTrack.Pt();
2212 negEta = negSglTrack.Eta();
2213 negPhi = negSglTrack.Phi();
2214 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2215 nClsITSNeg=eNegSglTrack->GetNcls(0);
2216 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2221 negPhi = -2*TMath::Pi();
2233 posV0Phi = -2*TMath::Pi();
2236 negV0Phi = -2*TMath::Pi();
2238 if(fDecayLV0RecIndexPos[i]!=-1){
2239 AliESDv0 * fV0MIs = fESD->GetV0(fDecayLV0RecIndexPos[i]);
2240 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2241 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2243 if (fpPosDecayLV0RecIndex[i]!=-1 ){
2244 // AliESDtrack * ePosV0Track = fESD->GetTrack(pPosDecayLV0RecIndex[i]);
2245 if ( trackPosTest->GetSign()==1 ) {
2246 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2248 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2250 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massP);
2252 posV0Pt = posV0Track.Pt();
2253 posV0Eta = posV0Track.Eta();
2254 posV0Phi = posV0Track.Phi();
2259 posV0Phi = -2*TMath::Pi();
2263 if (fpiNegDecayLV0RecIndex[i]!=-1 ){
2264 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayLV0RecIndex[i]);
2265 if ( trackNegTest->GetSign()==-1 ) {
2266 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2268 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2270 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2272 negV0Pt = negV0Track.Pt();
2273 negV0Eta = negV0Track.Eta();
2274 negV0Phi = negV0Track.Phi();
2279 negV0Phi = -2*TMath::Pi();
2284 xrG[0] = ePosPart->Vx();
2285 xrG[1] = ePosPart->Vy();
2286 xrG[2] = ePosPart->Vz();
2288 //--------- Geant variables ----------------------
2289 fValueL[0] = 1./TMath::Sqrt(lPart->Pt());
2290 fValueL[1] = lPart->Eta();
2292 Double_t tmpGPhi=lPart->Phi();
2293 if( lPart->Phi()>TMath::Pi()){
2294 tmpGPhi=lPart->Phi()-2*TMath::Pi();
2296 fValueL[2] = tmpGPhi;
2298 fValueL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2299 fValueL[4] = xrG[2];
2302 fValueL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2303 fValueL[6] = ePosPart->Eta();
2305 Double_t tmpPPhi=ePosPart->Phi();
2306 if( ePosPart->Phi()>TMath::Pi()){
2307 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2309 fValueL[7] = tmpPPhi;
2310 fValueL[8] = fpPosDecayLGeantLength[i];
2312 fValueL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2313 fValueL[10] = eNegPart->Eta();
2315 Double_t tmpNPhi=eNegPart->Phi();
2316 if( eNegPart->Phi()>TMath::Pi()){
2317 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2319 fValueL[11] = tmpNPhi;
2320 fValueL[12] = fpiNegDecayLGeantLength[i];
2321 //---- Single track variables----------------------
2323 fValueL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2324 fValueL[14] = posEta;
2325 fValueL[15] = posPhi;
2326 fValueL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2327 fValueL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2328 fValueL[18] = nClsITSPos;
2329 fValueL[19] = nClsTPCPos;
2330 fValueL[20] = statusSingPos;
2332 fValueL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2333 fValueL[22] = negEta;
2334 fValueL[23] = negPhi;
2335 fValueL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2336 fValueL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2337 fValueL[26] = nClsITSNeg;
2338 fValueL[27] = nClsTPCNeg;
2339 fValueL[28] = statusSingNeg;
2343 //---- V0 track variables----------------------
2345 fValueL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2346 fValueL[30] = posV0Eta;
2347 fValueL[31] = posV0Phi;
2348 fValueL[32] = statusV0Pos;
2351 fValueL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2352 fValueL[34] = negV0Eta;
2353 fValueL[35] = negV0Phi;
2354 fValueL[36] = statusV0Neg;
2356 fSparseL->Fill(fValueL);
2362 void AliAnalysisTaskV0QA::FillHnSparseAL()
2364 // Fill THnSparse Antilambda
2366 Double_t massPi=0.13957018;
2367 Double_t massP=0.93827203;
2381 TLorentzVector posSglTrack;
2382 TLorentzVector negSglTrack;
2383 Double_t posPt,posEta,posPhi;
2384 Double_t negPt,negEta,negPhi;
2386 TLorentzVector posV0Track;
2387 TLorentzVector negV0Track;
2388 Double_t posV0Pt,posV0Eta,posV0Phi;
2389 Double_t negV0Pt,negV0Eta,negV0Phi;
2391 Float_t nClsITSPos=-1;
2392 Float_t nClsITSNeg=-1;
2394 Float_t nClsTPCPos=-1;
2395 Float_t nClsTPCNeg=-1;
2397 Int_t statusSingPos=-1;
2398 Int_t statusSingNeg=-1;
2400 Int_t statusV0Pos=-1;
2401 Int_t statusV0Neg=-1;
2404 for(Int_t i=0;i<fnDecayALGeant+1;i++){
2405 TParticle* alPart = fStack->Particle(falDecayALGeantIndex[i]);
2406 TParticle* eNegPart = fStack->Particle(fapNegDecayALGeantIndex[i]);
2407 TParticle* ePosPart = fStack->Particle(fpiPosDecayALGeantIndex[i]);
2408 if (fpiPosDecayALSingleRecIndex[i]!=-1){
2409 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayALSingleRecIndex[i]);
2410 ePosSglTrack->GetPxPyPz(ppSgl);
2411 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
2412 posPt = posSglTrack.Pt();
2413 posEta = posSglTrack.Eta();
2414 posPhi = posSglTrack.Phi();
2415 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2416 nClsITSPos=ePosSglTrack->GetNcls(0);
2417 nClsTPCPos=ePosSglTrack->GetNcls(1);
2422 posPhi = -2*TMath::Pi();
2432 if (fapNegDecayALSingleRecIndex[i]!=-1){
2433 AliESDtrack * eNegSglTrack = fESD->GetTrack(fapNegDecayALSingleRecIndex[i]);
2434 eNegSglTrack->GetPxPyPz(pmSgl);
2435 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massP);
2436 negPt = negSglTrack.Pt();
2437 negEta = negSglTrack.Eta();
2438 negPhi = negSglTrack.Phi();
2439 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2440 nClsITSNeg=eNegSglTrack->GetNcls(0);
2441 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2446 negPhi = -2*TMath::Pi();
2458 posV0Phi = -2*TMath::Pi();
2461 negV0Phi = -2*TMath::Pi();
2463 if(fDecayALV0RecIndexPos[i]!=-1){
2464 AliESDv0 * fV0MIs = fESD->GetV0(fDecayALV0RecIndexPos[i]);
2465 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2466 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2468 if (fpiPosDecayALV0RecIndex[i]!=-1 ){
2469 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayALV0RecIndex[i]);
2470 if ( trackPosTest->GetSign()==1 ) {
2471 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2473 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2475 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2477 posV0Pt = posV0Track.Pt();
2478 posV0Eta = posV0Track.Eta();
2479 posV0Phi = posV0Track.Phi();
2484 posV0Phi = -2*TMath::Pi();
2488 if (fapNegDecayALV0RecIndex[i]!=-1 ){
2489 // AliESDtrack * eNegV0Track = fESD->GetTrack(apNegDecayALV0RecIndex[i]);
2490 if ( trackNegTest->GetSign()==-1 ) {
2491 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2493 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2495 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massP);
2497 negV0Pt = negV0Track.Pt();
2498 negV0Eta = negV0Track.Eta();
2499 negV0Phi = negV0Track.Phi();
2504 negV0Phi = -2*TMath::Pi();
2509 xrG[0] = ePosPart->Vx();
2510 xrG[1] = ePosPart->Vy();
2511 xrG[2] = ePosPart->Vz();
2513 //--------- Geant variables ----------------------
2514 fValueAL[0] = 1./TMath::Sqrt(alPart->Pt());
2515 fValueAL[1] = alPart->Eta();
2517 Double_t tmpGPhi=alPart->Phi();
2518 if( alPart->Phi()>TMath::Pi()){
2519 tmpGPhi=alPart->Phi()-2*TMath::Pi();
2521 fValueAL[2] = tmpGPhi;
2523 fValueAL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2524 fValueAL[4] = xrG[2];
2527 fValueAL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2528 fValueAL[6] = ePosPart->Eta();
2530 Double_t tmpPPhi=ePosPart->Phi();
2531 if( ePosPart->Phi()>TMath::Pi()){
2532 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2534 fValueAL[7] = tmpPPhi;
2535 fValueAL[8] = fpiPosDecayALGeantLength[i];
2537 fValueAL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2538 fValueAL[10] = eNegPart->Eta();
2540 Double_t tmpNPhi=eNegPart->Phi();
2541 if( eNegPart->Phi()>TMath::Pi()){
2542 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2544 fValueAL[11] = tmpNPhi;
2545 fValueAL[12] = fapNegDecayALGeantLength[i];
2546 //---- Single track variables----------------------
2548 fValueAL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2549 fValueAL[14] = posEta;
2550 fValueAL[15] = posPhi;
2551 fValueAL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2552 fValueAL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2553 fValueAL[18] = nClsITSPos;
2554 fValueAL[19] = nClsTPCPos;
2555 fValueAL[20] = statusSingPos;
2557 fValueAL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2558 fValueAL[22] = negEta;
2559 fValueAL[23] = negPhi;
2560 fValueAL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2561 fValueAL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2562 fValueAL[26] = nClsITSNeg;
2563 fValueAL[27] = nClsTPCNeg;
2564 fValueAL[28] = statusSingNeg;
2568 //---- V0 track variables----------------------
2570 fValueAL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2571 fValueAL[30] = posV0Eta;
2572 fValueAL[31] = posV0Phi;
2573 fValueAL[32] = statusV0Pos;
2576 fValueAL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2577 fValueAL[34] = negV0Eta;
2578 fValueAL[35] = negV0Phi;
2579 fValueAL[36] = statusV0Neg;
2581 fSparseAL->Fill(fValueAL);
2586 // void AliAnalysisTaskV0QA::SetESDtrackCuts()
2589 // fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
2591 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
2592 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);