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 "AliAnalysisTask.h"
18 #include "AliTrackReference.h"
19 #include "AliKFParticle.h"
20 #include "AliKFVertex.h"
21 #include "AliVertexerTracks.h"
22 #include "AliESDEvent.h"
23 #include "AliESDInputHandler.h"
24 #include "AliMCEvent.h"
25 #include "AliMCEventHandler.h"
30 #include "AliAnalysisTaskV0QA.h"
32 ClassImp(AliAnalysisTaskV0QA)
34 //________________________________________________________________________
35 AliAnalysisTaskV0QA::AliAnalysisTaskV0QA(const char *name) :AliAnalysisTask(name,""),
48 fgConvGamGeantIndex(0),
49 feNegConvGamGeantIndex(0),
50 fePosConvGamGeantIndex(0),
51 feNegConvGamGeantLength(0),
52 fePosConvGamGeantLength(0),
53 feNegConvGamSingleRecIndex(0),
54 fePosConvGamSingleRecIndex(0),
55 feNegConvGamV0RecIndex(0),
56 fePosConvGamV0RecIndex(0),
57 fConvGamV0RecIndexPos(0),
58 fConvGamV0RecIndexNeg(0),
60 flDecayLGeantIndex(0),
61 fpiNegDecayLGeantIndex(0),
62 fpPosDecayLGeantIndex(0),
63 fpiNegDecayLGeantLength(0),
64 fpPosDecayLGeantLength(0),
65 fpiNegDecayLSingleRecIndex(0),
66 fpPosDecayLSingleRecIndex(0),
67 fpiNegDecayLV0RecIndex(0),
68 fpPosDecayLV0RecIndex(0),
69 fDecayLV0RecIndexPos(0),
70 fDecayLV0RecIndexNeg(0),
72 falDecayALGeantIndex(0),
73 fpiPosDecayALGeantIndex(0),
74 fapNegDecayALGeantIndex(0),
75 fpiPosDecayALGeantLength(0),
76 fapNegDecayALGeantLength(0),
77 fpiPosDecayALSingleRecIndex(0),
78 fapNegDecayALSingleRecIndex(0),
79 fpiPosDecayALV0RecIndex(0),
80 fapNegDecayALV0RecIndex(0),
81 fDecayALV0RecIndexPos(0),
82 fDecayALV0RecIndexNeg(0),
84 fK0DecayK0GeantIndex(0),
85 fpiNegDecayK0GeantIndex(0),
86 fpiPosDecayK0GeantIndex(0),
87 fpiNegDecayK0GeantLength(0),
88 fpiPosDecayK0GeantLength(0),
89 fpiNegDecayK0SingleRecIndex(0),
90 fpiPosDecayK0SingleRecIndex(0),
91 fpiNegDecayK0V0RecIndex(0),
92 fpiPosDecayK0V0RecIndex(0),
93 fDecayK0V0RecIndexPos(0),
94 fDecayK0V0RecIndexNeg(0),
116 // Input slot #0 works with an Ntuple
117 DefineInput(0, TChain::Class());
118 // Output slot #0 writes into a TH1 container
119 // DefineOutput(0,TObjArray::Class());
120 DefineOutput(0,TList::Class());
122 // Reconstructed arrays
127 fValueK0 = new Double_t[fDim];
128 fValueL = new Double_t[fDim];
129 fValueAL = new Double_t[fDim];
130 fValueV0 = new Double_t[fDim];
131 fxminV0 = new Double_t[fDim];
132 fxmaxV0 = new Double_t[fDim];
133 fbinsV0 = new Int_t[fDim];
137 fgConvGamGeantIndex = new Int_t[fgDim];
138 feNegConvGamGeantIndex = new Int_t[fgDim];
139 fePosConvGamGeantIndex = new Int_t[fgDim];
140 feNegConvGamGeantLength = new Float_t[fgDim];
141 fePosConvGamGeantLength = new Float_t[fgDim];
143 feNegConvGamSingleRecIndex = new Int_t[fgDim];
144 fePosConvGamSingleRecIndex = new Int_t[fgDim];
146 feNegConvGamV0RecIndex = new Int_t[fgDim];
147 fePosConvGamV0RecIndex = new Int_t[fgDim];
149 fConvGamV0RecIndexPos = new Int_t[fgDim];
150 fConvGamV0RecIndexNeg = new Int_t[fgDim];
152 // Lambda to proton pi-
153 flDecayLGeantIndex = new Int_t[fgDim];
154 fpiNegDecayLGeantIndex = new Int_t[fgDim];
155 fpPosDecayLGeantIndex = new Int_t[fgDim];
156 fpiNegDecayLGeantLength = new Float_t[fgDim];
157 fpPosDecayLGeantLength = new Float_t[fgDim];
159 fpiNegDecayLSingleRecIndex = new Int_t[fgDim];
160 fpPosDecayLSingleRecIndex = new Int_t[fgDim];
162 fpiNegDecayLV0RecIndex = new Int_t[fgDim];
163 fpPosDecayLV0RecIndex = new Int_t[fgDim];
165 fDecayLV0RecIndexPos = new Int_t[fgDim];
166 fDecayLV0RecIndexNeg = new Int_t[fgDim];
169 fK0DecayK0GeantIndex = new Int_t[fgDim];
170 fpiNegDecayK0GeantIndex = new Int_t[fgDim];
171 fpiPosDecayK0GeantIndex = new Int_t[fgDim];
172 fpiNegDecayK0GeantLength = new Float_t[fgDim];
173 fpiPosDecayK0GeantLength = new Float_t[fgDim];
175 fpiNegDecayK0SingleRecIndex = new Int_t[fgDim];
176 fpiPosDecayK0SingleRecIndex = new Int_t[fgDim];
178 fpiNegDecayK0V0RecIndex = new Int_t[fgDim];
179 fpiPosDecayK0V0RecIndex = new Int_t[fgDim];
181 fDecayK0V0RecIndexPos = new Int_t[fgDim];
182 fDecayK0V0RecIndexNeg = new Int_t[fgDim];
184 //Antilambda to antiproton piplus
185 falDecayALGeantIndex = new Int_t[fgDim];
186 fpiPosDecayALGeantIndex = new Int_t[fgDim];
187 fapNegDecayALGeantIndex = new Int_t[fgDim];
188 fpiPosDecayALGeantLength = new Float_t[fgDim];
189 fapNegDecayALGeantLength = new Float_t[fgDim];
191 fpiPosDecayALSingleRecIndex = new Int_t[fgDim];
192 fapNegDecayALSingleRecIndex = new Int_t[fgDim];
194 fpiPosDecayALV0RecIndex = new Int_t[fgDim];
195 fapNegDecayALV0RecIndex = new Int_t[fgDim];
197 fDecayALV0RecIndexPos = new Int_t[fgDim];
198 fDecayALV0RecIndexNeg = new Int_t[fgDim];
202 fclRefsP = new TClonesArray("AliTrackReference");
203 fclRefsN = new TClonesArray("AliTrackReference");
205 // SetESDtrackCuts();
208 AliLog::SetGlobalLogLevel(AliLog::kError);
212 //________________________________________________________________________
213 void AliAnalysisTaskV0QA::ConnectInputData(Option_t *) {
214 printf(" ConnectInputData %s\n", GetName());
215 // Connect Input Data
217 AliESDInputHandler* esdH = (AliESDInputHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
218 fESD = esdH->GetEvent();
220 fChain = (TChain*)GetInputData(0);
224 //_____________________________________________________
225 AliAnalysisTaskV0QA::~AliAnalysisTaskV0QA()
227 // Remove all pointers
242 delete [] fgConvGamGeantIndex;
243 delete [] feNegConvGamGeantIndex;
244 delete [] fePosConvGamGeantIndex;
246 delete [] feNegConvGamSingleRecIndex;
247 delete [] fePosConvGamSingleRecIndex;
249 delete [] feNegConvGamV0RecIndex;
250 delete [] fePosConvGamV0RecIndex;
251 delete [] fConvGamV0RecIndexPos;
252 delete [] fConvGamV0RecIndexNeg;
254 delete [] flDecayLGeantIndex;
255 delete [] fpiNegDecayLGeantIndex;
256 delete [] fpPosDecayLGeantIndex;
258 delete [] fpiNegDecayLGeantLength;
259 delete [] fpPosDecayLGeantLength;
260 delete [] fpiNegDecayLSingleRecIndex;
261 delete [] fpPosDecayLSingleRecIndex;
263 delete [] fpiNegDecayLV0RecIndex;
264 delete [] fpPosDecayLV0RecIndex;
265 delete [] fDecayLV0RecIndexPos;
266 delete [] fDecayLV0RecIndexNeg;
268 delete [] falDecayALGeantIndex;
269 delete [] fpiPosDecayALGeantIndex;
270 delete [] fapNegDecayALGeantIndex;
272 delete [] fpiPosDecayALGeantLength;
273 delete [] fapNegDecayALGeantLength;
274 delete [] fpiPosDecayALSingleRecIndex;
275 delete [] fapNegDecayALSingleRecIndex;
277 delete [] fpiPosDecayALV0RecIndex;
278 delete [] fapNegDecayALV0RecIndex;
279 delete [] fDecayALV0RecIndexPos;
280 delete [] fDecayALV0RecIndexNeg;
283 delete [] fpiNegDecayK0GeantIndex;
284 delete [] fpiPosDecayK0GeantIndex;
286 delete [] fpiNegDecayK0GeantLength;
287 delete [] fpiPosDecayK0GeantLength;
288 delete [] fpiNegDecayK0SingleRecIndex;
289 delete [] fpiPosDecayK0SingleRecIndex;
291 delete [] fpiNegDecayK0V0RecIndex;
292 delete [] fpiPosDecayK0V0RecIndex;
294 delete [] fDecayK0V0RecIndexPos;
295 delete [] fDecayK0V0RecIndexNeg;
300 //________________________________________________________________________
301 void AliAnalysisTaskV0QA::CreateOutputObjects() {
302 // Create Ouptut objects
304 for(Int_t d=0;d<fDim;d++){
307 fxminV0[0]= 0; // 1/sqrt(pt) Gamma geant
311 fxminV0[1]=-2.5; // eta Gamma Geant
315 fxminV0[2]=-2*TMath::Pi(); // phi Gamma geant
316 fxmaxV0[2]= TMath::Pi();
319 fxminV0[3]= 0; // r geant
323 fxminV0[4]=-250; // z geant
327 fxminV0[5]= 0; // 1/sqrt(pt) Geant Pos
331 fxminV0[6]=-2.5; // eta geant Pos
335 fxminV0[7]=-2*TMath::Pi(); // phi Geant Pos
336 fxmaxV0[7]= TMath::Pi();
339 fxminV0[8]=0; // Track Length TPC Geant Pos
343 fxminV0[9]= 0; // 1/sqrt(pt) Geant Neg
347 fxminV0[10]=-2.5; // eta Geant Neg
351 fxminV0[11]=-2*TMath::Pi(); // phi Geant Neg
352 fxmaxV0[11]= TMath::Pi();
355 fxminV0[12]=0; // Track Length TPC Geant Neg
360 //-----------Rec single variables
362 fxminV0[13]= -0.5; // (pt-ptGeant)/ptGeant rec Pos
366 fxminV0[14]=-2.5; // eta rec Pos
370 fxminV0[15]=-2*TMath::Pi(); // phi rec Pos
371 fxmaxV0[15]= TMath::Pi();
374 fxminV0[16]= 0; // Impact parameter rec Pos
378 fxminV0[17]= 0; // nsigmas Impact parameter rec Pos
383 fxminV0[18]= -1; // Ncls ITS rec Pos
387 fxminV0[19]= -1; // Ncls TPC rec Pos
391 fxminV0[20]= -2; // Status Single TPC rec Pos
395 fxminV0[21]= -0.5; // (pt-ptGeant)/ptGeant rec Neg
399 fxminV0[22]=-2.5; // eta rec Neg
403 fxminV0[23]=-2*TMath::Pi(); // phi rec Neg
404 fxmaxV0[23]= TMath::Pi();
407 fxminV0[24]= 0; // Impact parameter rec Neg
411 fxminV0[25]= 0; // Sigmas Impact parameter rec Neg
416 fxminV0[26]= -1; // Ncls ITS rec Neg
420 fxminV0[27]= -1; // Ncls TPC rec Neg
424 fxminV0[28]= -2; // Status Single TPC rec Neg
427 // ------------------Rec V0 variables
431 fxminV0[29]= -0.5; // (pt-ptGeant)/ptGeant rec V0 Pos
435 fxminV0[30]=-2.5; // eta rec V0 Pos
439 fxminV0[31]=-2*TMath::Pi(); // phi rec V0 Pos
440 fxmaxV0[31]= TMath::Pi();
443 fxminV0[32]= -2; // Status V0 TPC rec Pos
449 fxminV0[33]= -0.5; // 1/sqrt(pt) rec V0 Neg
453 fxminV0[34]=-2.5; // eta rec V0 Neg
457 fxminV0[35]=-2*TMath::Pi(); // phi rec V0 Neg
458 fxmaxV0[35]= TMath::Pi();
462 fxminV0[36]= -2; // Status V0 TPC rec Neg
467 TString axisName[37]={"ptGammaGeant",
475 "TPCTrackLengthEPlusGeant",
479 "TPCTrackLengthEMinusGeant",
480 "ptResEPlusRecSingle",
483 "bXYZEPlusRecSingle",
484 "sigbXYZEPlusRecSingle",
485 "NclsITSEPlusRecSingle",
486 "NclsTPCEPlusRecSingle",
487 "statusRecSinglePos",
488 "ptResEMinusRecSingle",
489 "etaEMinusRecSingle",
490 "phiEMinusRecSingle",
491 "bXYZEMinusRecSingle",
492 "sigbXYZEMinusRecSingle",
493 "NclsITSEMinusRecSingle",
494 "NclsTPCEMinusRecSingle",
495 "statusRecSingleNeg",
503 "statusV0SingleNeg"};
506 fSparseV0= new THnSparseF("sparseV0","sparseV0",fDim,fbinsV0,fxminV0,fxmaxV0);
508 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
509 fSparseV0->GetAxis(iaxis)->SetName(axisName[iaxis]);
510 fSparseV0->GetAxis(iaxis)->SetTitle(axisName[iaxis]);
513 TString axisNameK0[37]={"ptK0Geant",
521 "TPCTrackLengthPiPlusGeant",
525 "TPCTrackLengthPiMinusGeant",
526 "ptResPiPlusRecSingle",
527 "etaPiPlusRecSingle",
528 "phiPiPlusRecSingle",
529 "bXYZPiPlusRecSingle",
530 "sigbXYZPiPlusRecSingle",
531 "NclsITSPiPlusRecSingle",
532 "NclsTPCPiPlusRecSingle",
533 "statusRecSinglePos",
534 "ptResPiMinusRecSingle",
535 "etaPiMinusRecSingle",
536 "phiPiMinusRecSingle",
537 "bXYZPiMinusRecSingle",
538 "sigbXYZPiMinusRecSingle",
539 "NclsITSPiMinusRecSingle",
540 "NclsTPCPiMinusRecSingle",
541 "statusRecSingleNeg",
553 fSparseK0= new THnSparseF("sparseK0","sparseK0",fDim,fbinsV0,fxminV0,fxmaxV0);
554 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
555 fSparseK0->GetAxis(iaxis)->SetName(axisNameK0[iaxis]);
556 fSparseK0->GetAxis(iaxis)->SetTitle(axisNameK0[iaxis]);
559 TString axisNameL[37]={"ptLGeant",
567 "TPCTrackLengthPPlusGeant",
571 "TPCTrackLengthPiMinusGeant",
572 "ptResPPlusRecSingle",
575 "bXYZPPlusRecSingle",
576 "sigbXYZPPlusRecSingle",
577 "NclsITSPPlusRecSingle",
578 "NclsTPCPPlusRecSingle",
579 "statusRecSinglePos",
580 "ptResPiMinusRecSingle",
581 "etaPiMinusRecSingle",
582 "phiPiMinusRecSingle",
583 "bXYZPiMinusRecSingle",
584 "sigbXYZPiMinusRecSingle",
585 "NclsITSPiMinusRecSingle",
586 "NclsTPCPiMinusRecSingle",
587 "statusRecSingleNeg",
598 fSparseL= new THnSparseF("sparseL","sparseL",fDim,fbinsV0,fxminV0,fxmaxV0);
599 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
600 fSparseL->GetAxis(iaxis)->SetName(axisNameL[iaxis]);
601 fSparseL->GetAxis(iaxis)->SetTitle(axisNameL[iaxis]);
604 TString axisNameAL[37]={"ptALGeant",
612 "TPCTrackLengthPiPlusGeant",
616 "TPCTrackLengthAPMinusGeant",
617 "ptResPiPlusRecSingle",
618 "etaPiPlusRecSingle",
619 "phiPiPlusRecSingle",
620 "bXYZPiPlusRecSingle",
621 "sigbXYZPiPlusRecSingle",
622 "NclsITSPiPlusRecSingle",
623 "NclsTPCPiPlusRecSingle",
624 "statusRecSinglePos",
625 "ptResAPMinusRecSingle",
626 "etaAPMinusRecSingle",
627 "phiAPMinusRecSingle",
628 "bXYZAPMinusRecSingle",
629 "sigbXYZAPMinusRecSingle",
630 "NclsITSAPMinusRecSingle",
631 "NclsTPCAPMinusRecSingle",
632 "statusRecSingleNeg",
643 fSparseAL= new THnSparseF("sparseAL","sparseAL",fDim,fbinsV0,fxminV0,fxmaxV0);
644 for (Int_t iaxis=0; iaxis<fDim; iaxis++){
645 fSparseAL->GetAxis(iaxis)->SetName(axisNameAL[iaxis]);
646 fSparseAL->GetAxis(iaxis)->SetTitle(axisNameAL[iaxis]);
649 // create output container
651 fOutputContainer = new TList() ;
652 fOutputContainer->SetName(GetName()) ;
655 fOutputContainer->Add(fSparseV0);
656 fOutputContainer->Add(fSparseK0);
657 fOutputContainer->Add(fSparseL);
658 fOutputContainer->Add(fSparseAL);
662 //________________________________________________________________________
663 void AliAnalysisTaskV0QA::Exec(Option_t *) {
664 // Execution of the Task
667 //cout<< "not a tree"<< endl;
675 fMCtruth = (AliMCEventHandler*)((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
677 // Double_t vertex[3];
678 Double_t maxVertex=150.;
680 Double_t lineCutZRSlope=0.662486;
681 Double_t lineCutZValue=7.;
685 Int_t piNegLIndex=-1;
687 Int_t apNegALIndex=-1;
688 Int_t piPosALIndex=-1;
695 for(Int_t i=0; i<fgDim;i++){
696 fgConvGamGeantIndex[i] = -1;
697 feNegConvGamGeantIndex[i] = -1;
698 fePosConvGamGeantIndex[i] = -1;
700 feNegConvGamSingleRecIndex[i] = -1;
701 fePosConvGamSingleRecIndex[i] = -1;
703 feNegConvGamV0RecIndex[i] = -1;
704 fePosConvGamV0RecIndex[i] = -1;
705 fConvGamV0RecIndexPos[i] = -1;
706 fConvGamV0RecIndexNeg[i] = -1;
709 fK0DecayK0GeantIndex[i] = -1;
710 fpiNegDecayK0GeantIndex[i] = -1;
711 fpiPosDecayK0GeantIndex[i] = -1;
713 fpiNegDecayK0SingleRecIndex[i] = -1;
714 fpiPosDecayK0SingleRecIndex[i] = -1;
716 fpiNegDecayK0V0RecIndex[i] = -1;
717 fpiPosDecayK0V0RecIndex[i] = -1;
718 fDecayK0V0RecIndexPos[i] = -1;
719 fDecayK0V0RecIndexNeg[i] = -1;
722 flDecayLGeantIndex[i] = -1;
723 fpiNegDecayLGeantIndex[i] = -1;
724 fpPosDecayLGeantIndex[i] = -1;
726 fpiNegDecayLSingleRecIndex[i] = -1;
727 fpPosDecayLSingleRecIndex[i] = -1;
729 fpiNegDecayLV0RecIndex[i] = -1;
730 fpPosDecayLV0RecIndex[i] = -1;
731 fDecayLV0RecIndexPos[i] = -1;
732 fDecayLV0RecIndexNeg[i] = -1;
735 falDecayALGeantIndex[i] = -1;
736 fpiPosDecayALGeantIndex[i] = -1;
737 fapNegDecayALGeantIndex[i] = -1;
739 fpiPosDecayALSingleRecIndex[i] = -1;
740 fapNegDecayALSingleRecIndex[i] = -1;
742 fpiPosDecayALV0RecIndex[i] = -1;
743 fapNegDecayALV0RecIndex[i] = -1;
744 fDecayALV0RecIndexPos[i] = -1;
745 fDecayALV0RecIndexNeg[i] = -1;
752 AliKFVertex primVtx(*(fESD->GetPrimaryVertex()));
753 fnTracksPrim=primVtx.GetNContributors();
756 if(fMCtruth && fnTracksPrim>0){
758 fStack = fMCtruth->MCEvent()->Stack();
763 for (Int_t iTracks = 0; iTracks < fMCtruth->MCEvent()->GetNumberOfTracks(); iTracks++) {
766 TParticle* particle = fStack->Particle(iTracks);
771 Printf("ERROR: Could not receive particle %d (mc loop)", iTracks);
775 if(particle->Pt()<0.050) continue;
776 if(TMath::Abs(particle->Eta())> 1.2) continue;
779 if (particle->GetPdgCode()== 22){
782 if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
783 continue; // no photon as mothers!
786 if(particle->GetMother(0) >= fStack->GetNprimary()){
787 continue; // the gamma has a mother, and it is not a primary particle
790 TParticle* ePos = NULL;
791 TParticle* eNeg = NULL;
795 if(particle->GetNDaughters() >= 2){
796 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
797 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
798 if(tmpDaughter->GetUniqueID() == 5){
799 if(tmpDaughter->GetPdgCode() == 11){
801 elecGIndex=daughterIndex;
803 else if(tmpDaughter->GetPdgCode() == -11){
805 posiGIndex=daughterIndex;
812 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
816 if(TMath::Abs(ePos->Eta())> maxEta || TMath::Abs(eNeg->Eta())> maxEta){
820 if(ePos->R()> maxVertex ){
821 continue; // cuts on distance from collision point
825 if( (TMath::Abs(ePos->Vz()) * lineCutZRSlope - lineCutZValue) > ePos->R() ){
826 continue; // line cut to exclude regions where we do not reconstruct
830 // Looking at the existance of TPC references
833 fMCtruth->MCEvent()->GetParticleAndTR(posiGIndex,ePosTPC,fclRefsP);
835 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(posiGIndex));
836 if(!mcParticlePos) continue;
839 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
843 int nPointsP = fclRefsP->GetEntries();
845 if (fRefTPC) delete fRefTPC;fRefTPC=NULL;
846 fRefTPC = new TObjArray();
848 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
849 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
850 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
855 for(int i=0; i<fRefTPC->GetEntries(); i++) {
856 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
857 fLabelsTPC[i] = ref->GetTrack();
860 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
861 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
862 if (aRef->GetTrack() != posiGIndex ) break;
870 fMCtruth->MCEvent()->GetParticleAndTR(elecGIndex,eNegTPC,fclRefsN);
872 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(elecGIndex));
873 if(!mcParticleNeg) continue;
876 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
877 int nPointsN = fclRefsN->GetEntries();
879 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
880 fRefTPC = new TObjArray();
882 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
883 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
884 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
889 for(int i=0; i<fRefTPC->GetEntries(); i++) {
890 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
891 fLabelsTPC[i] = ref->GetTrack();
894 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
895 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
896 if (aRef->GetTrack() != elecGIndex ) break;
902 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if e+/e- do not have a TPC ref continue;
903 ////////////////////////////////////////////////////////////////////
907 fgConvGamGeantIndex[fnConvGamGeant]=iTracks;
908 feNegConvGamGeantIndex[fnConvGamGeant] = elecGIndex;
909 fePosConvGamGeantIndex[fnConvGamGeant] = posiGIndex;
911 feNegConvGamGeantLength[fnConvGamGeant] = tpcTrackLengtheNeg;
912 fePosConvGamGeantLength[fnConvGamGeant] = tpcTrackLengthePos;
917 TParticle* piPos = NULL;
918 TParticle* piNeg = NULL;
922 if (particle->GetPdgCode()== 310){ // k0short
923 if(particle->GetNDaughters() == 2){
924 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
925 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
926 if(tmpDaughter->GetPdgCode() == 211){
928 fpiPosK0Index=daughterIndex;
930 else if(tmpDaughter->GetPdgCode() == -211){
932 fpiNegK0Index=daughterIndex;
937 if(piPos == NULL || piNeg == NULL){ // means we do not have two daughters from K0short decay
941 if(TMath::Abs(piPos->Eta())> maxEta || TMath::Abs(piNeg->Eta())> maxEta){
945 if(piPos->R()> maxVertex ){
946 continue; // cuts on distance from collision point
950 if( (TMath::Abs(piPos->Vz()) * lineCutZRSlope - lineCutZValue) > piPos->R() ){
951 continue; // line cut to exclude regions where we do not reconstruct
954 // Looking at the existance of TPC references
957 fMCtruth->MCEvent()->GetParticleAndTR(fpiPosK0Index,ePosTPC,fclRefsP);
959 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiPosK0Index));
960 if(!mcParticlePos) continue;
963 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
966 int nPointsP = fclRefsP->GetEntries();
967 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
968 fRefTPC = new TObjArray();
970 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
971 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
972 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
977 for(int i=0; i<fRefTPC->GetEntries(); i++) {
978 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
979 fLabelsTPC[i] = ref->GetTrack();
982 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
983 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
984 if (aRef->GetTrack() != fpiPosK0Index ) break;
992 fMCtruth->MCEvent()->GetParticleAndTR(fpiNegK0Index,eNegTPC,fclRefsN);
994 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(fpiNegK0Index));
995 if(!mcParticleNeg) continue;
998 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1000 int nPointsN = fclRefsN->GetEntries();
1001 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1002 fRefTPC = new TObjArray();
1004 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1005 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1006 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1011 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1012 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1013 fLabelsTPC[i] = ref->GetTrack();
1016 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1017 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1018 if (aRef->GetTrack() != fpiNegK0Index ) break;
1022 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if pi+/pi- do not have a TPC ref continue;
1023 ////////////////////////////////////////////////////////////////////
1027 fK0DecayK0GeantIndex[fnDecayK0Geant]=iTracks;
1028 fpiNegDecayK0GeantIndex[fnDecayK0Geant]=fpiNegK0Index;
1029 fpiPosDecayK0GeantIndex[fnDecayK0Geant]=fpiPosK0Index;
1030 fpiNegDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengtheNeg;
1031 fpiPosDecayK0GeantLength[fnDecayK0Geant]=tpcTrackLengthePos;
1036 TParticle* pPos = NULL;
1037 TParticle* piNegL = NULL;
1042 if (particle->GetPdgCode()== 3122){ //lambda
1044 if(particle->GetNDaughters() == 2){
1045 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1046 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1047 if(tmpDaughter->GetPdgCode() == 2212){
1049 pPosLIndex=daughterIndex;
1051 else if(tmpDaughter->GetPdgCode() == -211){
1052 piNegL = tmpDaughter;
1053 piNegLIndex=daughterIndex;
1058 if(pPos == NULL || piNegL == NULL){ // means we do not have two daughters from lambda decay
1062 if(TMath::Abs(pPos->Eta())> maxEta || TMath::Abs(piNegL->Eta())> maxEta){
1066 if(pPos->R()> maxVertex ){
1067 continue; // cuts on distance from collision point
1071 if( (TMath::Abs(pPos->Vz()) * lineCutZRSlope - lineCutZValue) > pPos->R() ){
1072 continue; // line cut to exclude regions where we do not reconstruct
1076 // Looking at the existance of TPC references
1079 fMCtruth->MCEvent()->GetParticleAndTR(pPosLIndex,ePosTPC,fclRefsP);
1081 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(pPosLIndex));
1082 if(!mcParticlePos) continue;
1085 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1088 int nPointsP = fclRefsP->GetEntries();
1089 if (fRefTPC) delete fRefTPC; fRefTPC=NULL;
1090 fRefTPC = new TObjArray();
1092 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1093 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1094 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1099 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1100 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1101 fLabelsTPC[i] = ref->GetTrack();
1104 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1105 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1106 if (aRef->GetTrack() != pPosLIndex ) break;
1114 fMCtruth->MCEvent()->GetParticleAndTR(piNegLIndex,eNegTPC,fclRefsN);
1116 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piNegLIndex));
1117 if(!mcParticleNeg) continue;
1120 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1122 int nPointsN = fclRefsN->GetEntries();
1123 if (fRefTPC) delete fRefTPC;
1124 fRefTPC = new TObjArray();
1126 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1127 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1128 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1133 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1134 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1135 fLabelsTPC[i] = ref->GetTrack();
1138 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1139 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1140 if (aRef->GetTrack() != piNegLIndex ) break;
1144 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1145 ////////////////////////////////////////////////////////////////////
1149 flDecayLGeantIndex[fnDecayLGeant]=iTracks;
1151 fpiNegDecayLGeantIndex[fnDecayLGeant]=piNegLIndex;
1152 fpPosDecayLGeantIndex[fnDecayLGeant]=pPosLIndex;
1154 fpiNegDecayLGeantLength[fnDecayLGeant]=tpcTrackLengtheNeg;
1155 fpPosDecayLGeantLength[fnDecayLGeant]=tpcTrackLengthePos;
1160 /////////////////////////////////////////////////////
1163 TParticle* apNeg = NULL;
1164 TParticle* piPosAL = NULL;
1169 if (particle->GetPdgCode()== -3122){ //antilambda
1171 if(particle->GetNDaughters() == 2){
1172 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1173 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1174 if(tmpDaughter->GetPdgCode() == -2212){
1176 apNegALIndex=daughterIndex;
1178 else if(tmpDaughter->GetPdgCode() == 211){
1179 piPosAL = tmpDaughter;
1180 piPosALIndex=daughterIndex;
1185 if(apNeg == NULL || piPosAL == NULL){ // means we do not have two daughters from antilambda decay
1189 if(TMath::Abs(apNeg->Eta())> maxEta || TMath::Abs(piPosAL->Eta())> maxEta){
1193 if(apNeg->R()> maxVertex ){
1194 continue; // cuts on distance from collision point
1198 if( (TMath::Abs(apNeg->Vz()) * lineCutZRSlope - lineCutZValue) > apNeg->R() ){
1199 continue; // line cut to exclude regions where we do not reconstruct
1203 // Looking at the existance of TPC references
1206 fMCtruth->MCEvent()->GetParticleAndTR(piPosALIndex,ePosTPC,fclRefsP);
1208 AliMCParticle *mcParticlePos = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(piPosALIndex));
1209 if(!mcParticlePos) continue;
1212 Float_t tpcTrackLengthePos = mcParticlePos->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counter,3.0);
1214 int nPointsP = fclRefsP->GetEntries();
1215 if (fRefTPC) delete fRefTPC;
1216 fRefTPC = new TObjArray();
1218 for(int iPoint=0; iPoint<nPointsP; iPoint++) {
1219 AliTrackReference *ref = (AliTrackReference*)fclRefsP->At(iPoint);
1220 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1225 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1226 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1227 fLabelsTPC[i] = ref->GetTrack();
1230 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1231 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1232 if (aRef->GetTrack() != piPosALIndex ) break;
1238 fMCtruth->MCEvent()->GetParticleAndTR(apNegALIndex,eNegTPC,fclRefsN);
1240 AliMCParticle *mcParticleNeg = (AliMCParticle*) (fMCtruth->MCEvent()->GetTrack(apNegALIndex));
1241 if(!mcParticleNeg) continue;
1244 Float_t tpcTrackLengtheNeg = mcParticleNeg->GetTPCTrackLength(fESD->GetMagneticField(),0.05,counterN,3.0);
1246 int nPointsN = fclRefsN->GetEntries();
1247 if (fRefTPC) delete fRefTPC;
1248 fRefTPC = new TObjArray();
1250 for(int iPoint=0; iPoint<nPointsN; iPoint++) {
1251 AliTrackReference *ref = (AliTrackReference*)fclRefsN->At(iPoint);
1252 if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
1257 for(int i=0; i<fRefTPC->GetEntries(); i++) {
1258 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[i];
1259 fLabelsTPC[i] = ref->GetTrack();
1262 for(int iPoint=GetTPCReference(iTracks);iPoint<fRefTPC->GetEntries();iPoint++){
1263 AliTrackReference* aRef = (AliTrackReference*)(*fRefTPC)[iPoint];
1264 if (aRef->GetTrack() != apNegALIndex ) break;
1270 if ( labelNegRefs==0 || labelPosRefs==0) continue; // if proton/pi- do not have a TPC ref continue;
1271 ////////////////////////////////////////////////////////////////////
1274 falDecayALGeantIndex[fnDecayALGeant]=iTracks;
1276 fpiPosDecayALGeantIndex[fnDecayALGeant]=piPosALIndex;
1277 fapNegDecayALGeantIndex[fnDecayALGeant]=apNegALIndex;
1279 fpiPosDecayALGeantLength[fnDecayALGeant]=tpcTrackLengthePos;
1280 fapNegDecayALGeantLength[fnDecayALGeant]=tpcTrackLengtheNeg;
1291 AliKFParticle::SetField(fESD->GetMagneticField());
1293 const AliESDVertex *pvertex = fESD->GetPrimaryVertex();
1295 pvertex->GetXYZ(xyzVtx);
1297 if(fnTracksPrim>0) {
1299 InspectListOfChargedParticles();
1303 if(fnConvGamGeant>-1){
1304 FillHnSparseGamma();
1307 if(fnDecayK0Geant>-1){
1311 if(fnDecayLGeant>-1){
1315 if(fnDecayALGeant>-1){
1322 PostData(0,fOutputContainer );
1327 void AliAnalysisTaskV0QA::Terminate(Option_t *) {
1328 // Draw some histogram at the end.
1333 Int_t AliAnalysisTaskV0QA::GetTPCReference(Int_t label) {
1334 // Get TPC References
1336 int start = TMath::BinarySearch(fRefTPC->GetEntries(), fLabelsTPC, label);
1338 while (start >= 0) {
1339 AliTrackReference *ref = (AliTrackReference*)(*fRefTPC)[start];
1340 if (ref->GetTrack() != label) return start+1;
1351 void AliAnalysisTaskV0QA::InspectListOfChargedParticles(){
1352 // Look at the list of particles for the single track reconstruction
1354 for(Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++){
1356 AliESDtrack* curTrack = fESD->GetTrack(iTracks);
1363 // if( !(curTrack->GetStatus() & AliESDtrack::kTPCrefit)){
1368 Int_t labelMC = TMath::Abs(curTrack->GetLabel());
1370 if ( labelMC > fStack->GetNtrack() ) continue;
1373 TParticle* curParticle = fStack->Particle(labelMC);
1374 if(curParticle->GetMother(0)==-1){
1379 if(TMath::Abs(curParticle->GetPdgCode()) == 11){ // e+/e-
1381 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==22 ){ // e+/e- from gamma
1382 if( curParticle->GetUniqueID()!=5 ){ // e+/e- from gamma conversion
1386 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1387 if(curTrack->GetSign()>0){
1388 if (labelMC== fePosConvGamGeantIndex[iGamConv]){
1389 fePosConvGamSingleRecIndex[iGamConv]=iTracks;
1392 if (labelMC== feNegConvGamGeantIndex[iGamConv]){
1393 feNegConvGamSingleRecIndex[iGamConv]=iTracks;
1396 } // loop over geant converted gammas
1399 } // condition to select reconstructed electrons
1403 if(TMath::Abs(curParticle->GetPdgCode()) == 211 || TMath::Abs(curParticle->GetPdgCode())==2212 ){ // pi+/pi-
1405 if( fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==310 ||
1406 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==3122 ||
1407 fStack->Particle(curParticle->GetMother(0))->GetPdgCode()==-3122 ){ // pi+/proton/pi- from K0/Lambda
1409 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1410 if(curTrack->GetSign()>0){
1411 if (labelMC== fpiPosDecayK0GeantIndex[iK0Dec]){
1412 fpiPosDecayK0SingleRecIndex[iK0Dec]=iTracks;
1415 if (labelMC== fpiNegDecayK0GeantIndex[iK0Dec]){
1416 fpiNegDecayK0SingleRecIndex[iK0Dec]=iTracks;
1419 } // loop over geant decay K0
1421 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1422 if(curTrack->GetSign()>0){
1423 if (labelMC== fpPosDecayLGeantIndex[iLDec]){
1424 fpPosDecayLSingleRecIndex[iLDec]=iTracks;
1427 if (labelMC== fpiNegDecayLGeantIndex[iLDec]){
1428 fpiNegDecayLSingleRecIndex[iLDec]=iTracks;
1431 } // loop over geant decay Lambda
1433 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1434 if(curTrack->GetSign()<0){
1435 if (labelMC== fapNegDecayALGeantIndex[iALDec]){
1436 fapNegDecayALSingleRecIndex[iALDec]=iTracks;
1439 if (labelMC== fpiPosDecayALGeantIndex[iALDec]){
1440 fpiPosDecayALSingleRecIndex[iALDec]=iTracks;
1443 } // loop over geant decay antiLambda
1445 } // condition to select reconstructed electrons
1446 } // all reconstructed track
1451 void AliAnalysisTaskV0QA::InspectListOfV0s(){
1452 // Look at the list of particles for the V0 reconstruction
1454 AliESDtrack* trackPos= NULL;
1455 AliESDtrack* trackNeg= NULL;
1456 Int_t grandMotherPos=-1;
1457 Int_t grandMotherNeg=-1;
1463 for(Int_t iV0MI = 0; iV0MI < fESD->GetNumberOfV0s(); iV0MI++) {
1465 AliESDv0 * fV0MIs = fESD->GetV0(iV0MI);
1468 if ( !fV0MIs->GetOnFlyStatus() ){
1471 if(fnTracksPrim<=0) {
1476 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1477 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1480 if ( trackPosTest->GetSign() == trackNegTest->GetSign()){
1486 // if( !(trackPosTest->GetStatus() & AliESDtrack::kTPCrefit)){
1490 // if( !(trackNegTest->GetStatus() & AliESDtrack::kTPCrefit)){
1494 if( trackPosTest->GetSign() ==1){
1495 trackPos =fESD->GetTrack(fV0MIs->GetPindex());
1496 trackNeg =fESD->GetTrack(fV0MIs->GetNindex());
1497 pIndex=fV0MIs->GetPindex();
1498 nIndex=fV0MIs->GetNindex();
1501 if( trackPosTest->GetSign() ==-1){
1502 trackPos =fESD->GetTrack(fV0MIs->GetNindex());
1503 trackNeg =fESD->GetTrack(fV0MIs->GetPindex());
1504 pIndex=fV0MIs->GetNindex();
1505 nIndex=fV0MIs->GetPindex();
1509 Int_t labelNeg=TMath::Abs(trackNeg->GetLabel());
1510 if(labelNeg > fStack->GetNtrack() ) continue;
1511 TParticle * particleNeg= fStack->Particle(labelNeg);
1513 Int_t labelPos=TMath::Abs(trackPos->GetLabel());
1514 if(labelPos > fStack->GetNtrack() ) continue;
1515 TParticle * particlePos= fStack->Particle(labelPos);
1518 if(particlePos->GetMother(0)>-1){
1519 grandMotherPos=fStack->Particle(particlePos->GetMother(0))->GetMother(0);
1520 motherPos=particlePos->GetMother(0);
1523 if(particleNeg->GetMother(0)>-1){
1524 grandMotherNeg=fStack->Particle(particleNeg->GetMother(0))->GetMother(0);
1525 motherNeg=particleNeg->GetMother(0);
1528 if(motherPos == motherNeg && motherPos!=-1 ){
1529 if( particlePos->GetPdgCode() ==-11 && particleNeg->GetPdgCode()==11 ){
1530 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1531 if (labelPos== fePosConvGamGeantIndex[iGamConv]){
1532 fePosConvGamV0RecIndex[iGamConv]=pIndex;
1533 fConvGamV0RecIndexPos[iGamConv]=iV0MI;
1535 if (labelNeg== feNegConvGamGeantIndex[iGamConv]){
1536 feNegConvGamV0RecIndex[iGamConv]=nIndex;
1537 fConvGamV0RecIndexNeg[iGamConv]=iV0MI;
1540 } // loop over geant converted gammas
1543 if( particlePos->GetPdgCode()==211 && particleNeg->GetPdgCode()==-211 ){
1544 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1545 if (labelPos== fpiPosDecayK0GeantIndex[iK0Dec]){
1546 fpiPosDecayK0V0RecIndex[iK0Dec]=pIndex;
1547 fDecayK0V0RecIndexPos[iK0Dec]=iV0MI;
1549 if (labelNeg== fpiNegDecayK0GeantIndex[iK0Dec]){
1550 fpiNegDecayK0V0RecIndex[iK0Dec]=nIndex;
1551 fDecayK0V0RecIndexNeg[iK0Dec]=iV0MI;
1554 } // loop over geant K0
1557 if( particlePos->GetPdgCode()==2212 && particleNeg->GetPdgCode()==-211 ){
1558 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1559 if (labelPos== fpPosDecayLGeantIndex[iLDec]){
1560 fpPosDecayLV0RecIndex[iLDec]=pIndex;
1561 fDecayLV0RecIndexPos[iLDec]=iV0MI;
1563 if (labelNeg== fpiNegDecayLGeantIndex[iLDec]){
1564 fpiNegDecayLV0RecIndex[iLDec]=nIndex;
1565 fDecayLV0RecIndexNeg[iLDec]=iV0MI;
1568 } // loop over geant Lambda
1571 if( particleNeg->GetPdgCode()==-2212 && particlePos->GetPdgCode()==211 ){
1572 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1573 if (labelNeg== fapNegDecayALGeantIndex[iALDec]){
1574 fapNegDecayALV0RecIndex[iALDec]=nIndex;
1575 fDecayALV0RecIndexNeg[iALDec]=iV0MI;
1577 if (labelPos== fpiPosDecayALGeantIndex[iALDec]){
1578 fpiPosDecayALV0RecIndex[iALDec]=pIndex;
1579 fDecayALV0RecIndexPos[iALDec]=iV0MI;
1582 } // loop over geant antiLambda
1589 for(Int_t iGamConv=0;iGamConv<fnConvGamGeant+1;iGamConv++ ){
1590 if ( fConvGamV0RecIndexNeg[iGamConv]!= fConvGamV0RecIndexPos[iGamConv]){
1591 fePosConvGamV0RecIndex[iGamConv]=-1;
1592 feNegConvGamV0RecIndex[iGamConv]=-1;
1593 fConvGamV0RecIndexNeg[iGamConv]=-1;
1594 fConvGamV0RecIndexPos[iGamConv]=-1;
1599 for(Int_t iLDec=0;iLDec<fnDecayLGeant+1;iLDec++ ){
1600 if(fDecayLV0RecIndexPos[iLDec] != fDecayLV0RecIndexNeg[iLDec]){
1601 fpiNegDecayLV0RecIndex[iLDec]=-1;
1602 fpPosDecayLV0RecIndex[iLDec]=-1;
1603 fDecayLV0RecIndexNeg[iLDec]=-1;
1604 fDecayLV0RecIndexPos[iLDec]=-1;
1608 for(Int_t iALDec=0;iALDec<fnDecayALGeant+1;iALDec++ ){
1609 if(fDecayALV0RecIndexPos[iALDec] != fDecayALV0RecIndexNeg[iALDec]){
1610 fpiPosDecayALV0RecIndex[iALDec]=-1;
1611 fapNegDecayALV0RecIndex[iALDec]=-1;
1612 fDecayALV0RecIndexNeg[iALDec]=-1;
1613 fDecayALV0RecIndexPos[iALDec]=-1;
1617 for(Int_t iK0Dec=0;iK0Dec<fnDecayK0Geant+1;iK0Dec++ ){
1618 if(fDecayK0V0RecIndexPos[iK0Dec] != fDecayK0V0RecIndexNeg[iK0Dec]){
1619 fpiNegDecayK0V0RecIndex[iK0Dec]=-1;
1620 fpiPosDecayK0V0RecIndex[iK0Dec]=-1;
1621 fDecayK0V0RecIndexNeg[iK0Dec]=-1;
1622 fDecayK0V0RecIndexPos[iK0Dec]=-1;
1628 void AliAnalysisTaskV0QA::FillHnSparseGamma()
1630 // Fill THnSparse Gamma
1632 Double_t massE=0.00051099892;
1644 TLorentzVector posSglTrack;
1645 TLorentzVector negSglTrack;
1646 Double_t posPt,posEta,posPhi;
1647 Double_t negPt,negEta,negPhi;
1649 TLorentzVector posV0Track;
1650 TLorentzVector negV0Track;
1651 Double_t posV0Pt,posV0Eta,posV0Phi;
1652 Double_t negV0Pt,negV0Eta,negV0Phi;
1654 Float_t nClsITSPos=-1;
1655 Float_t nClsITSNeg=-1;
1657 Float_t nClsTPCPos=-1;
1658 Float_t nClsTPCNeg=-1;
1660 Int_t statusSingPos=-1;
1661 Int_t statusSingNeg=-1;
1663 Int_t statusV0Pos=-1;
1664 Int_t statusV0Neg=-1;
1667 for(Int_t i=0;i<fnConvGamGeant+1;i++){
1668 TParticle* gamPart = fStack->Particle(fgConvGamGeantIndex[i]);
1669 TParticle* ePosPart = fStack->Particle(fePosConvGamGeantIndex[i]);
1670 TParticle* eNegPart = fStack->Particle(feNegConvGamGeantIndex[i]);
1671 if (fePosConvGamSingleRecIndex[i]!=-1){
1672 AliESDtrack * ePosSglTrack = fESD->GetTrack(fePosConvGamSingleRecIndex[i]);
1673 ePosSglTrack->GetPxPyPz(ppSgl);
1674 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massE);
1675 posPt = posSglTrack.Pt();
1676 posEta = posSglTrack.Eta();
1677 posPhi = posSglTrack.Phi();
1678 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1679 nClsITSPos=ePosSglTrack->GetNcls(0);
1680 nClsTPCPos=ePosSglTrack->GetNcls(1);
1685 posPhi = -2*TMath::Pi();
1695 if (feNegConvGamSingleRecIndex[i]!=-1){
1696 AliESDtrack * eNegSglTrack = fESD->GetTrack(feNegConvGamSingleRecIndex[i]);
1697 eNegSglTrack->GetPxPyPz(pmSgl);
1698 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massE);
1699 negPt = negSglTrack.Pt();
1700 negEta = negSglTrack.Eta();
1701 negPhi = negSglTrack.Phi();
1702 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
1703 nClsITSNeg=eNegSglTrack->GetNcls(0);
1704 nClsTPCNeg=eNegSglTrack->GetNcls(1);
1709 negPhi = -2*TMath::Pi();
1721 posV0Phi = -2*TMath::Pi();
1724 negV0Phi = -2*TMath::Pi();
1726 if(fConvGamV0RecIndexPos[i]!=-1){
1727 AliESDv0 * fV0MIs = fESD->GetV0(fConvGamV0RecIndexPos[i]);
1728 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1729 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1731 if (fePosConvGamV0RecIndex[i]!=-1 ){
1732 // AliESDtrack * ePosV0Track = fESD->GetTrack(ePosConvGamV0RecIndex[i]);
1733 if ( trackPosTest->GetSign()==1 ) {
1734 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1736 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1738 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massE);
1740 posV0Pt = posV0Track.Pt();
1741 posV0Eta = posV0Track.Eta();
1742 posV0Phi = posV0Track.Phi();
1747 posV0Phi = -2*TMath::Pi();
1751 if (feNegConvGamV0RecIndex[i]!=-1 ){
1752 // AliESDtrack * eNegV0Track = fESD->GetTrack(eNegConvGamV0RecIndex[i]);
1753 if ( trackNegTest->GetSign()==-1 ) {
1754 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1756 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1758 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massE);
1760 negV0Pt = negV0Track.Pt();
1761 negV0Eta = negV0Track.Eta();
1762 negV0Phi = negV0Track.Phi();
1767 negV0Phi = -2*TMath::Pi();
1772 xrG[0] = ePosPart->Vx();
1773 xrG[1] = ePosPart->Vy();
1774 xrG[2] = ePosPart->Vz();
1776 //--------- Geant variables ----------------------
1777 fValueV0[0] = 1./TMath::Sqrt(gamPart->Pt());
1778 fValueV0[1] = gamPart->Eta();
1780 Double_t tmpGPhi=gamPart->Phi();
1781 if( gamPart->Phi()>TMath::Pi()){
1782 tmpGPhi=gamPart->Phi()-2*TMath::Pi();
1784 fValueV0[2] = tmpGPhi;
1786 fValueV0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
1787 fValueV0[4] = xrG[2];
1790 fValueV0[5] = 1./TMath::Sqrt(ePosPart->Pt());
1791 fValueV0[6] = ePosPart->Eta();
1793 Double_t tmpPPhi=ePosPart->Phi();
1794 if( ePosPart->Phi()>TMath::Pi()){
1795 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
1797 fValueV0[7] = tmpPPhi;
1798 fValueV0[8] = fePosConvGamGeantLength[i];
1800 fValueV0[9] = 1./TMath::Sqrt(eNegPart->Pt());
1801 fValueV0[10] = eNegPart->Eta();
1803 Double_t tmpNPhi=eNegPart->Phi();
1804 if( eNegPart->Phi()>TMath::Pi()){
1805 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
1807 fValueV0[11] = tmpNPhi;
1808 fValueV0[12] = feNegConvGamGeantLength[i];
1810 //---- Single track variables----------------------
1812 fValueV0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
1813 fValueV0[14] = posEta;
1814 fValueV0[15] = posPhi;
1815 fValueV0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
1816 fValueV0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
1817 fValueV0[18] = nClsITSPos;
1818 fValueV0[19] = nClsTPCPos;
1819 fValueV0[20] = statusSingPos;
1822 fValueV0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
1823 fValueV0[22] = negEta;
1824 fValueV0[23] = negPhi;
1825 fValueV0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
1826 fValueV0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
1828 fValueV0[26] = nClsITSNeg;
1829 fValueV0[27] = nClsTPCNeg;
1830 fValueV0[28] = statusSingNeg;
1833 //---- V0 track variables----------------------
1835 fValueV0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
1836 fValueV0[30] = posV0Eta;
1837 fValueV0[31] = posV0Phi;
1838 fValueV0[32] = statusV0Pos;
1840 fValueV0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
1841 fValueV0[34] = negV0Eta;
1842 fValueV0[35] = negV0Phi;
1843 fValueV0[36] = statusV0Neg;
1845 fSparseV0->Fill(fValueV0);
1851 void AliAnalysisTaskV0QA::FillHnSparseK0()
1853 // Fill THnSparse K0
1855 Double_t massPi=0.13957018;
1867 TLorentzVector posSglTrack;
1868 TLorentzVector negSglTrack;
1869 Double_t posPt,posEta,posPhi;
1870 Double_t negPt,negEta,negPhi;
1872 TLorentzVector posV0Track;
1873 TLorentzVector negV0Track;
1874 Double_t posV0Pt,posV0Eta,posV0Phi;
1875 Double_t negV0Pt,negV0Eta,negV0Phi;
1877 Float_t nClsITSPos=-1;
1878 Float_t nClsITSNeg=-1;
1880 Float_t nClsTPCPos=-1;
1881 Float_t nClsTPCNeg=-1;
1883 Int_t statusSingPos=-1;
1884 Int_t statusSingNeg=-1;
1886 Int_t statusV0Pos=-1;
1887 Int_t statusV0Neg=-1;
1889 for(Int_t i=0;i<fnDecayK0Geant+1;i++){
1890 TParticle* k0Part = fStack->Particle(fK0DecayK0GeantIndex[i]);
1891 TParticle* ePosPart = fStack->Particle(fpiPosDecayK0GeantIndex[i]);
1892 TParticle* eNegPart = fStack->Particle(fpiNegDecayK0GeantIndex[i]);
1893 if (fpiPosDecayK0SingleRecIndex[i]!=-1){
1894 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayK0SingleRecIndex[i]);
1895 ePosSglTrack->GetPxPyPz(ppSgl);
1896 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
1897 posPt = posSglTrack.Pt();
1898 posEta = posSglTrack.Eta();
1899 posPhi = posSglTrack.Phi();
1900 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
1901 nClsITSPos=ePosSglTrack->GetNcls(0);
1902 nClsTPCPos=ePosSglTrack->GetNcls(1);
1907 posPhi = -2*TMath::Pi();
1918 if (fpiNegDecayK0SingleRecIndex[i]!=-1){
1919 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayK0SingleRecIndex[i]);
1920 eNegSglTrack->GetPxPyPz(pmSgl);
1921 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
1922 negPt = negSglTrack.Pt();
1923 negEta = negSglTrack.Eta();
1924 negPhi = negSglTrack.Phi();
1925 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
1926 nClsITSNeg=eNegSglTrack->GetNcls(0);
1927 nClsTPCNeg=eNegSglTrack->GetNcls(1);
1932 negPhi = -2*TMath::Pi();
1944 posV0Phi = -2*TMath::Pi();
1947 negV0Phi = -2*TMath::Pi();
1949 if(fDecayK0V0RecIndexPos[i]!=-1){
1950 AliESDv0 * fV0MIs = fESD->GetV0(fDecayK0V0RecIndexPos[i]);
1951 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
1952 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
1954 if (fpiPosDecayK0V0RecIndex[i]!=-1 ){
1955 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayK0V0RecIndex[i]);
1956 if ( trackPosTest->GetSign()==1 ) {
1957 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1959 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
1961 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
1963 posV0Pt = posV0Track.Pt();
1964 posV0Eta = posV0Track.Eta();
1965 posV0Phi = posV0Track.Phi();
1970 posV0Phi = -2*TMath::Pi();
1974 if (fpiNegDecayK0V0RecIndex[i]!=-1 ){
1975 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayK0V0RecIndex[i]);
1976 if ( trackNegTest->GetSign()==-1 ) {
1977 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1979 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
1981 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
1983 negV0Pt = negV0Track.Pt();
1984 negV0Eta = negV0Track.Eta();
1985 negV0Phi = negV0Track.Phi();
1990 negV0Phi = -2*TMath::Pi();
1995 xrG[0] = ePosPart->Vx();
1996 xrG[1] = ePosPart->Vy();
1997 xrG[2] = ePosPart->Vz();
2000 //--------- Geant variables ----------------------
2001 fValueK0[0] = 1./TMath::Sqrt(k0Part->Pt());
2002 fValueK0[1] = k0Part->Eta();
2004 Double_t tmpGPhi=k0Part->Phi();
2005 if( k0Part->Phi()>TMath::Pi()){
2006 tmpGPhi=k0Part->Phi()-2*TMath::Pi();
2008 fValueK0[2] = tmpGPhi;
2010 fValueK0[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2011 fValueK0[4] = xrG[2];
2014 fValueK0[5] = 1./TMath::Sqrt(ePosPart->Pt());
2015 fValueK0[6] = ePosPart->Eta();
2017 Double_t tmpPPhi=ePosPart->Phi();
2018 if( ePosPart->Phi()>TMath::Pi()){
2019 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2021 fValueK0[7] = tmpPPhi;
2022 fValueK0[8] = fpiPosDecayK0GeantLength[i];
2024 fValueK0[9] = 1./TMath::Sqrt(eNegPart->Pt());
2025 fValueK0[10] = eNegPart->Eta();
2027 Double_t tmpNPhi=eNegPart->Phi();
2028 if( eNegPart->Phi()>TMath::Pi()){
2029 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2031 fValueK0[11] = tmpNPhi;
2032 fValueK0[12] = fpiNegDecayK0GeantLength[i];
2033 //---- Single track variables----------------------
2035 fValueK0[13] = (posPt-ePosPart->Pt())/ePosPart->Pt() ;
2036 fValueK0[14] = posEta;
2037 fValueK0[15] = posPhi;
2038 fValueK0[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] );
2039 fValueK0[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2041 fValueK0[18] = nClsITSPos;
2042 fValueK0[19] = nClsTPCPos;
2043 fValueK0[20] = statusSingPos;
2045 fValueK0[21] = (negPt-eNegPart->Pt())/eNegPart->Pt();
2046 fValueK0[22] = negEta;
2047 fValueK0[23] = negPhi;
2048 fValueK0[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] );
2049 fValueK0[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0]+ bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2050 fValueK0[26] = nClsITSNeg;
2051 fValueK0[27] = nClsTPCNeg;
2052 fValueK0[28] = statusSingNeg;
2055 //---- V0 track variables----------------------
2057 fValueK0[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2058 fValueK0[30] = posV0Eta;
2059 fValueK0[31] = posV0Phi;
2060 fValueK0[32] = statusV0Pos;
2062 fValueK0[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2063 fValueK0[34] = negV0Eta;
2064 fValueK0[35] = negV0Phi;
2065 fValueK0[36] = statusV0Neg;
2067 fSparseK0->Fill(fValueK0);
2072 void AliAnalysisTaskV0QA::FillHnSparseL()
2074 // Fill THnSparse Lambda
2076 Double_t massPi=0.13957018;
2077 Double_t massP=0.93827203;
2091 TLorentzVector posSglTrack;
2092 TLorentzVector negSglTrack;
2093 Double_t posPt,posEta,posPhi;
2094 Double_t negPt,negEta,negPhi;
2096 TLorentzVector posV0Track;
2097 TLorentzVector negV0Track;
2098 Double_t posV0Pt,posV0Eta,posV0Phi;
2099 Double_t negV0Pt,negV0Eta,negV0Phi;
2101 Float_t nClsITSPos=-1;
2102 Float_t nClsITSNeg=-1;
2104 Float_t nClsTPCPos=-1;
2105 Float_t nClsTPCNeg=-1;
2107 Int_t statusSingPos=-1;
2108 Int_t statusSingNeg=-1;
2110 Int_t statusV0Pos=-1;
2111 Int_t statusV0Neg=-1;
2113 for(Int_t i=0;i<fnDecayLGeant+1;i++){
2114 TParticle* lPart = fStack->Particle(flDecayLGeantIndex[i]);
2115 TParticle* ePosPart = fStack->Particle(fpPosDecayLGeantIndex[i]);
2116 TParticle* eNegPart = fStack->Particle(fpiNegDecayLGeantIndex[i]);
2117 if (fpPosDecayLSingleRecIndex[i]!=-1){
2118 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpPosDecayLSingleRecIndex[i]);
2119 ePosSglTrack->GetPxPyPz(ppSgl);
2120 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massP);
2121 posPt = posSglTrack.Pt();
2122 posEta = posSglTrack.Eta();
2123 posPhi = posSglTrack.Phi();
2124 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2125 nClsITSPos=ePosSglTrack->GetNcls(0);
2126 nClsTPCPos=ePosSglTrack->GetNcls(1);
2131 posPhi = -2*TMath::Pi();
2141 if (fpiNegDecayLSingleRecIndex[i]!=-1){
2142 AliESDtrack * eNegSglTrack = fESD->GetTrack(fpiNegDecayLSingleRecIndex[i]);
2143 eNegSglTrack->GetPxPyPz(pmSgl);
2144 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massPi);
2145 negPt = negSglTrack.Pt();
2146 negEta = negSglTrack.Eta();
2147 negPhi = negSglTrack.Phi();
2148 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2149 nClsITSNeg=eNegSglTrack->GetNcls(0);
2150 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2155 negPhi = -2*TMath::Pi();
2167 posV0Phi = -2*TMath::Pi();
2170 negV0Phi = -2*TMath::Pi();
2172 if(fDecayLV0RecIndexPos[i]!=-1){
2173 AliESDv0 * fV0MIs = fESD->GetV0(fDecayLV0RecIndexPos[i]);
2174 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2175 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2177 if (fpPosDecayLV0RecIndex[i]!=-1 ){
2178 // AliESDtrack * ePosV0Track = fESD->GetTrack(pPosDecayLV0RecIndex[i]);
2179 if ( trackPosTest->GetSign()==1 ) {
2180 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2182 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2184 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massP);
2186 posV0Pt = posV0Track.Pt();
2187 posV0Eta = posV0Track.Eta();
2188 posV0Phi = posV0Track.Phi();
2193 posV0Phi = -2*TMath::Pi();
2197 if (fpiNegDecayLV0RecIndex[i]!=-1 ){
2198 // AliESDtrack * eNegV0Track = fESD->GetTrack(piNegDecayLV0RecIndex[i]);
2199 if ( trackNegTest->GetSign()==-1 ) {
2200 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2202 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2204 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massPi);
2206 negV0Pt = negV0Track.Pt();
2207 negV0Eta = negV0Track.Eta();
2208 negV0Phi = negV0Track.Phi();
2213 negV0Phi = -2*TMath::Pi();
2218 xrG[0] = ePosPart->Vx();
2219 xrG[1] = ePosPart->Vy();
2220 xrG[2] = ePosPart->Vz();
2222 //--------- Geant variables ----------------------
2223 fValueL[0] = 1./TMath::Sqrt(lPart->Pt());
2224 fValueL[1] = lPart->Eta();
2226 Double_t tmpGPhi=lPart->Phi();
2227 if( lPart->Phi()>TMath::Pi()){
2228 tmpGPhi=lPart->Phi()-2*TMath::Pi();
2230 fValueL[2] = tmpGPhi;
2232 fValueL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2233 fValueL[4] = xrG[2];
2236 fValueL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2237 fValueL[6] = ePosPart->Eta();
2239 Double_t tmpPPhi=ePosPart->Phi();
2240 if( ePosPart->Phi()>TMath::Pi()){
2241 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2243 fValueL[7] = tmpPPhi;
2244 fValueL[8] = fpPosDecayLGeantLength[i];
2246 fValueL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2247 fValueL[10] = eNegPart->Eta();
2249 Double_t tmpNPhi=eNegPart->Phi();
2250 if( eNegPart->Phi()>TMath::Pi()){
2251 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2253 fValueL[11] = tmpNPhi;
2254 fValueL[12] = fpiNegDecayLGeantLength[i];
2255 //---- Single track variables----------------------
2257 fValueL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2258 fValueL[14] = posEta;
2259 fValueL[15] = posPhi;
2260 fValueL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2261 fValueL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2262 fValueL[18] = nClsITSPos;
2263 fValueL[19] = nClsTPCPos;
2264 fValueL[20] = statusSingPos;
2266 fValueL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2267 fValueL[22] = negEta;
2268 fValueL[23] = negPhi;
2269 fValueL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2270 fValueL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2271 fValueL[26] = nClsITSNeg;
2272 fValueL[27] = nClsTPCNeg;
2273 fValueL[28] = statusSingNeg;
2277 //---- V0 track variables----------------------
2279 fValueL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2280 fValueL[30] = posV0Eta;
2281 fValueL[31] = posV0Phi;
2282 fValueL[32] = statusV0Pos;
2285 fValueL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2286 fValueL[34] = negV0Eta;
2287 fValueL[35] = negV0Phi;
2288 fValueL[36] = statusV0Neg;
2290 fSparseL->Fill(fValueL);
2296 void AliAnalysisTaskV0QA::FillHnSparseAL()
2298 // Fill THnSparse Antilambda
2300 Double_t massPi=0.13957018;
2301 Double_t massP=0.93827203;
2315 TLorentzVector posSglTrack;
2316 TLorentzVector negSglTrack;
2317 Double_t posPt,posEta,posPhi;
2318 Double_t negPt,negEta,negPhi;
2320 TLorentzVector posV0Track;
2321 TLorentzVector negV0Track;
2322 Double_t posV0Pt,posV0Eta,posV0Phi;
2323 Double_t negV0Pt,negV0Eta,negV0Phi;
2325 Float_t nClsITSPos=-1;
2326 Float_t nClsITSNeg=-1;
2328 Float_t nClsTPCPos=-1;
2329 Float_t nClsTPCNeg=-1;
2331 Int_t statusSingPos=-1;
2332 Int_t statusSingNeg=-1;
2334 Int_t statusV0Pos=-1;
2335 Int_t statusV0Neg=-1;
2338 for(Int_t i=0;i<fnDecayALGeant+1;i++){
2339 TParticle* alPart = fStack->Particle(falDecayALGeantIndex[i]);
2340 TParticle* eNegPart = fStack->Particle(fapNegDecayALGeantIndex[i]);
2341 TParticle* ePosPart = fStack->Particle(fpiPosDecayALGeantIndex[i]);
2342 if (fpiPosDecayALSingleRecIndex[i]!=-1){
2343 AliESDtrack * ePosSglTrack = fESD->GetTrack(fpiPosDecayALSingleRecIndex[i]);
2344 ePosSglTrack->GetPxPyPz(ppSgl);
2345 posSglTrack.SetXYZM(ppSgl[0],ppSgl[1],ppSgl[2],massPi);
2346 posPt = posSglTrack.Pt();
2347 posEta = posSglTrack.Eta();
2348 posPhi = posSglTrack.Phi();
2349 ePosSglTrack->GetImpactParameters(bPosSgl,bPosCov);
2350 nClsITSPos=ePosSglTrack->GetNcls(0);
2351 nClsTPCPos=ePosSglTrack->GetNcls(1);
2356 posPhi = -2*TMath::Pi();
2366 if (fapNegDecayALSingleRecIndex[i]!=-1){
2367 AliESDtrack * eNegSglTrack = fESD->GetTrack(fapNegDecayALSingleRecIndex[i]);
2368 eNegSglTrack->GetPxPyPz(pmSgl);
2369 negSglTrack.SetXYZM(pmSgl[0],pmSgl[1],pmSgl[2],massP);
2370 negPt = negSglTrack.Pt();
2371 negEta = negSglTrack.Eta();
2372 negPhi = negSglTrack.Phi();
2373 eNegSglTrack->GetImpactParameters(bNegSgl,bNegCov);
2374 nClsITSNeg=eNegSglTrack->GetNcls(0);
2375 nClsTPCNeg=eNegSglTrack->GetNcls(1);
2380 negPhi = -2*TMath::Pi();
2392 posV0Phi = -2*TMath::Pi();
2395 negV0Phi = -2*TMath::Pi();
2397 if(fDecayALV0RecIndexPos[i]!=-1){
2398 AliESDv0 * fV0MIs = fESD->GetV0(fDecayALV0RecIndexPos[i]);
2399 AliESDtrack* trackPosTest = fESD->GetTrack(fV0MIs->GetPindex());
2400 AliESDtrack* trackNegTest = fESD->GetTrack(fV0MIs->GetNindex());
2402 if (fpiPosDecayALV0RecIndex[i]!=-1 ){
2403 // AliESDtrack * ePosV0Track = fESD->GetTrack(piPosDecayALV0RecIndex[i]);
2404 if ( trackPosTest->GetSign()==1 ) {
2405 fV0MIs->GetPPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2407 fV0MIs->GetNPxPyPz(ppV0[0],ppV0[1],ppV0[2]);
2409 posV0Track.SetXYZM(ppV0[0],ppV0[1],ppV0[2],massPi);
2411 posV0Pt = posV0Track.Pt();
2412 posV0Eta = posV0Track.Eta();
2413 posV0Phi = posV0Track.Phi();
2418 posV0Phi = -2*TMath::Pi();
2422 if (fapNegDecayALV0RecIndex[i]!=-1 ){
2423 // AliESDtrack * eNegV0Track = fESD->GetTrack(apNegDecayALV0RecIndex[i]);
2424 if ( trackNegTest->GetSign()==-1 ) {
2425 fV0MIs->GetNPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2427 fV0MIs->GetPPxPyPz(pmV0[0],pmV0[1],pmV0[2]);
2429 negV0Track.SetXYZM(pmV0[0],pmV0[1],pmV0[2],massP);
2431 negV0Pt = negV0Track.Pt();
2432 negV0Eta = negV0Track.Eta();
2433 negV0Phi = negV0Track.Phi();
2438 negV0Phi = -2*TMath::Pi();
2443 xrG[0] = ePosPart->Vx();
2444 xrG[1] = ePosPart->Vy();
2445 xrG[2] = ePosPart->Vz();
2447 //--------- Geant variables ----------------------
2448 fValueAL[0] = 1./TMath::Sqrt(alPart->Pt());
2449 fValueAL[1] = alPart->Eta();
2451 Double_t tmpGPhi=alPart->Phi();
2452 if( alPart->Phi()>TMath::Pi()){
2453 tmpGPhi=alPart->Phi()-2*TMath::Pi();
2455 fValueAL[2] = tmpGPhi;
2457 fValueAL[3] = TMath::Sqrt(xrG[0]*xrG[0]+xrG[1]*xrG[1]);
2458 fValueAL[4] = xrG[2];
2461 fValueAL[5] = 1./TMath::Sqrt(ePosPart->Pt());
2462 fValueAL[6] = ePosPart->Eta();
2464 Double_t tmpPPhi=ePosPart->Phi();
2465 if( ePosPart->Phi()>TMath::Pi()){
2466 tmpPPhi = ePosPart->Phi()-2*TMath::Pi();
2468 fValueAL[7] = tmpPPhi;
2469 fValueAL[8] = fpiPosDecayALGeantLength[i];
2471 fValueAL[9] = 1./TMath::Sqrt(eNegPart->Pt());
2472 fValueAL[10] = eNegPart->Eta();
2474 Double_t tmpNPhi=eNegPart->Phi();
2475 if( eNegPart->Phi()>TMath::Pi()){
2476 tmpNPhi = eNegPart->Phi()-2*TMath::Pi();
2478 fValueAL[11] = tmpNPhi;
2479 fValueAL[12] = fapNegDecayALGeantLength[i];
2480 //---- Single track variables----------------------
2482 fValueAL[13] = (posPt-ePosPart->Pt())/ePosPart->Pt();
2483 fValueAL[14] = posEta;
2484 fValueAL[15] = posPhi;
2485 fValueAL[16] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1]);
2486 fValueAL[17] = TMath::Sqrt( bPosSgl[0]* bPosSgl[0] + bPosSgl[1]* bPosSgl[1] )/TMath::Sqrt(bPosCov[0]*bPosCov[0]+bPosCov[2]*bPosCov[2]);
2487 fValueAL[18] = nClsITSPos;
2488 fValueAL[19] = nClsTPCPos;
2489 fValueAL[20] = statusSingPos;
2491 fValueAL[21] = (negPt-eNegPart->Pt())/eNegPart->Pt() ;
2492 fValueAL[22] = negEta;
2493 fValueAL[23] = negPhi;
2494 fValueAL[24] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] );
2495 fValueAL[25] = TMath::Sqrt( bNegSgl[0]* bNegSgl[0] + bNegSgl[1]* bNegSgl[1] )/TMath::Sqrt(bNegCov[0]*bNegCov[0]+bNegCov[2]*bNegCov[2]);
2496 fValueAL[26] = nClsITSNeg;
2497 fValueAL[27] = nClsTPCNeg;
2498 fValueAL[28] = statusSingNeg;
2502 //---- V0 track variables----------------------
2504 fValueAL[29] = (posV0Pt-ePosPart->Pt())/ePosPart->Pt();
2505 fValueAL[30] = posV0Eta;
2506 fValueAL[31] = posV0Phi;
2507 fValueAL[32] = statusV0Pos;
2510 fValueAL[33] = (negV0Pt-eNegPart->Pt())/eNegPart->Pt();
2511 fValueAL[34] = negV0Eta;
2512 fValueAL[35] = negV0Phi;
2513 fValueAL[36] = statusV0Neg;
2515 fSparseAL->Fill(fValueAL);
2520 // void AliAnalysisTaskV0QA::SetESDtrackCuts()
2523 // fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
2525 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
2526 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);