AliPhysics  master (3d17d9d)
AliAnalysisTaskSEXicZero2XiPifromKFP.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2019, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
19 // Author: Jianhui Zhu (1,2)
20 // (1) Central China Normal University
21 // (2) GSI Helmholtz Centre for Heavy Ion Research
22 // E-mail: zjh@mail.ccnu.edu.cn
24 
25 #include <iostream>
26 #include <TDatabasePDG.h>
27 #include <vector>
28 #include <TVector3.h>
29 #include "TChain.h"
30 #include "TCanvas.h"
31 #include "TH1F.h"
32 #include "TLine.h"
33 #include "TList.h"
34 #include "AliAnalysisTaskSE.h"
35 #include "AliAnalysisManager.h"
36 #include "AliAODEvent.h"
37 #include "AliAODInputHandler.h"
38 #include "AliESDtrack.h"
39 #include "AliCentrality.h"
42 #include "AliPIDResponse.h"
43 #include "AliAODInputHandler.h"
44 
45 #include "AliAODMCParticle.h"
46 
47 // includes added to play with KFParticle
48 #ifndef HomogeneousField
49 #define HomogeneousField
50 #endif
51 
52 using std::cout;
53 using std::endl;
54 
55 class AliAnalysisTaskSEXicZero2XiPifromKFP; // your analysis class
56 
57 ClassImp(AliAnalysisTaskSEXicZero2XiPifromKFP) // classimp: necessary for root
58 
59 std::ostream& operator<<(std::ostream& os, const KFParticleBase& particle) {
60  static const char *vn[14] = {"x","y","z","px","py","pz","E","S","M","t","p","Q","Chi2","NDF"};
61 
62  for (Int_t i = 0; i < 8; i++) {
63  if (i == 6) continue; // E
64  if (i == 7 && particle.GetParameter(i) <= 0.0) continue; // S
65  if (particle.GetParameter(i) == 0. && particle.GetCovariance(i,i) == 0) continue;
66  if (particle.GetCovariance(i,i) > 0)
67  os << " " << vn[i]<<": "<< std::setw(8) << particle.GetParameter(i)<< " +/- " << std::setw(6) << sqrt(particle.GetCovariance(i,i));
68  else
69  os << " " << vn[i] << ": " << std::setw(8) << particle.GetParameter(i);
70  }
71  float Mtp[3], MtpErr[3];
72  particle.GetMass(Mtp[0], MtpErr[0]); if (MtpErr[0] < 1e-7 || MtpErr[0] > 1e10) MtpErr[0] = -13;
73  particle.GetLifeTime(Mtp[1], MtpErr[1]); if (MtpErr[1] <= 0 || MtpErr[1] > 1e10) MtpErr[1] = -13;
74  particle.GetMomentum(Mtp[2], MtpErr[2]); if (MtpErr[2] <= 0 || MtpErr[2] > 1e10) MtpErr[2] = -13;
75  for (Int_t i = 8; i < 11; i++) {
76  if (i == 9 && Mtp[i-8] <= 0.0) continue; // t
77  if (MtpErr[i-8] > 0 && MtpErr[i-8] < 1e10) os << " " << vn[i] << ": " << std::setw(8) << Mtp[i-8] << " +/-" << std::setw(7) << MtpErr[i-8];
78  else os << " " << vn[i] << ": " << std::setw(8) << Mtp[i-8];
79  }
80  os << " pdg:" << std::setw(5) << particle.GetPDG() << " Q: "<< std::setw(2) << int(particle.GetQ()) << " chi2/NDF: " << std::setw(8) << particle.GetChi2() << "/" << std::setw(2) << particle.GetNDF();
81  return os;
82 }
83 
86  fIsMC(kFALSE),
87  fPID(0),
88  fAnaCuts(0),
89  fpVtx(0),
90  fMCEvent(0),
91  fBzkG(0),
92  fCentrality(0),
93  fRunNumber(0),
95  fAodTrackInd(0),
96  fOutputList(0),
97  fListCuts(0),
98  fTree_Event(0),
99  fVar_Event(0),
100  fTree_Xic0(0),
101  fVar_Xic0(0),
102  fTree_Xic0MCGen(0),
103  fVar_Xic0MCGen(0),
104  fCounter(0),
182  f2DHistLambdaXY(0),
187  fHistEvents(0),
188  fHTrigger(0),
189  fHistOnFlyStatus(0),
192  fHistChargeV0(0),
193  fHistNDaughterV0(0),
194  fHistNProngV0(0),
197  fHistXtrkP(0),
198  fHistYtrkP(0),
199  fHistZtrkP(0),
200  fHistXtrkP_XYZv(0),
201  fHistYtrkP_XYZv(0),
202  fHistZtrkP_XYZv(0),
209  fHistXtrkN(0),
210  fHistYtrkN(0),
211  fHistZtrkN(0),
212  fHistXtrkN_XYZv(0),
213  fHistYtrkN_XYZv(0),
214  fHistZtrkN_XYZv(0),
227  fHistXLambdaTot(0),
228  fHistYLambdaTot(0),
229  fHistZLambdaTot(0),
236  fHistXPion_KF_MC(0),
237  fHistYPion_KF_MC(0),
238  fHistZPion_KF_MC(0),
249  fHistXPion_PULL(0),
250  fHistYPion_PULL(0),
251  fHistZPion_PULL(0),
255  fHistXXiTot(0),
256  fHistYXiTot(0),
257  fHistZXiTot(0),
258  fHistXXicZeroTot(0),
259  fHistYXicZeroTot(0),
260  fHistZXicZeroTot(0),
266  fHistPtLambda(0),
268  fHistPtLambdaTot(0),
269  fHistPtXiMinus(0),
270  fHistPtXiPlus(0),
271  fHistPtXiTot(0),
272  fHistPtXicZero(0),
275  fHistMassK0S(0),
284  fHistMassLambda(0),
309  fHistMassXiMinus(0),
312  fHistMassXiPlus(0),
315  fHistMassXiTot(0),
317  fHistMassXicZero(0),
324  fHistChi2ndfPion(0),
330  fHistProbProton(0),
331  fHistProbPion(0),
332  fHistProbLambda(0),
339  fHistProbXiMinus(0),
341  fHistProbXiPlus(0),
343  fHistProbXicZero(0),
358  fHistDecayLXiTot(0),
367  fHistCosPA_XiTot(0),
368  fHistPVx(0),
369  fHistPVy(0),
370  fHistPVz(0),
371  fHCentrality(0),
378  fHistMCGen_XiTot(0),
389  fHistMCpdg_All(0),
392  fWriteXic0Tree(kFALSE),
393  fWriteXic0MCGenTree(kFALSE)
394 {
395  // default constructor, don't allocate memory here!
396  // this is used by root for IO purposes, it needs to remain empty
397 }
398 //_____________________________________________________________________________
400  AliAnalysisTaskSE(name),
401  fIsMC(kFALSE),
402  fPID(0),
403  fAnaCuts(cuts),
404  fpVtx(0),
405  fMCEvent(0),
406  fBzkG(0),
407  fCentrality(0),
408  fRunNumber(0),
409  fEvNumberCounter(0),
410  fAodTrackInd(0),
411  fOutputList(0),
412  fListCuts(0),
413  fTree_Event(0),
414  fVar_Event(0),
415  fTree_Xic0(0),
416  fVar_Xic0(0),
417  fTree_Xic0MCGen(0),
418  fVar_Xic0MCGen(0),
419  fCounter(0),
487  fHistEvents(0),
488  fHTrigger(0),
499  f2DHistLambdaXY(0),
504  fHistOnFlyStatus(0),
507  fHistChargeV0(0),
508  fHistNDaughterV0(0),
509  fHistNProngV0(0),
512  fHistXtrkP(0),
513  fHistYtrkP(0),
514  fHistZtrkP(0),
515  fHistXtrkP_XYZv(0),
516  fHistYtrkP_XYZv(0),
517  fHistZtrkP_XYZv(0),
524  fHistXtrkN(0),
525  fHistYtrkN(0),
526  fHistZtrkN(0),
527  fHistXtrkN_XYZv(0),
528  fHistYtrkN_XYZv(0),
529  fHistZtrkN_XYZv(0),
542  fHistXLambdaTot(0),
543  fHistYLambdaTot(0),
544  fHistZLambdaTot(0),
551  fHistXPion_KF_MC(0),
552  fHistYPion_KF_MC(0),
553  fHistZPion_KF_MC(0),
564  fHistXPion_PULL(0),
565  fHistYPion_PULL(0),
566  fHistZPion_PULL(0),
570  fHistXXiTot(0),
571  fHistYXiTot(0),
572  fHistZXiTot(0),
573  fHistXXicZeroTot(0),
574  fHistYXicZeroTot(0),
575  fHistZXicZeroTot(0),
581  fHistPtLambda(0),
583  fHistPtLambdaTot(0),
584  fHistPtXiMinus(0),
585  fHistPtXiPlus(0),
586  fHistPtXiTot(0),
587  fHistPtXicZero(0),
590  fHistMassK0S(0),
599  fHistMassLambda(0),
624  fHistMassXiMinus(0),
627  fHistMassXiPlus(0),
630  fHistMassXiTot(0),
632  fHistMassXicZero(0),
639  fHistChi2ndfPion(0),
645  fHistProbProton(0),
646  fHistProbPion(0),
647  fHistProbLambda(0),
654  fHistProbXiMinus(0),
656  fHistProbXiPlus(0),
658  fHistProbXicZero(0),
673  fHistDecayLXiTot(0),
682  fHistCosPA_XiTot(0),
683  fHistPVx(0),
684  fHistPVy(0),
685  fHistPVz(0),
686  fHCentrality(0),
693  fHistMCGen_XiTot(0),
704  fHistMCpdg_All(0),
707  fWriteXic0MCGenTree(kFALSE),
708  fWriteXic0Tree(kFALSE)
709 {
710  // constructor
711  DefineInput(0, TChain::Class()); // define the input of the analysis: in this case we take a 'chain' of events
712  // this chain is created by the analysis manager, so no need to worry about it,
713  // it does its work automatically
714  DefineOutput(1, TList::Class()); // define the ouptut of the analysis: in this case it's a list of histograms
715  // you can add more output objects by calling DefineOutput(2, classname::Class())
716  // if you add more output objects, make sure to call PostData for all of them, and to
717  // make changes to your AddTask macro!
718  DefineOutput(2, AliNormalizationCounter::Class());
719  DefineOutput(3, TTree::Class()); // event
720  DefineOutput(4, TTree::Class()); // Xic0
721  DefineOutput(5, TTree::Class()); // Xic0 MCGen
722 
723 }
724 //_____________________________________________________________________________
726 {
727  // destructor
728  if (fOutputList) {
729  delete fOutputList; // at the end of your task, it is deleted from memory by calling this function
730  fOutputList = 0;
731  }
732 
733  if (fListCuts) {
734  delete fListCuts;
735  fListCuts = 0;
736  }
737 
738  if (fAnaCuts) {
739  delete fAnaCuts;
740  fAnaCuts = 0;
741  }
742 
743  if (fTree_Event) {
744  delete fTree_Event;
745  fTree_Event = 0;
746  }
747 
748  if (fVar_Event) {
749  delete fVar_Event;
750  fVar_Event = 0;
751  }
752 
753  if (fTree_Xic0) {
754  delete fTree_Xic0;
755  fTree_Xic0 = 0;
756  }
757 
758  if (fVar_Xic0) {
759  delete fVar_Xic0;
760  fVar_Xic0 = 0;
761  }
762 
763  if (fTree_Xic0MCGen) {
764  delete fTree_Xic0MCGen;
765  fTree_Xic0MCGen = 0;
766  }
767 
768  if (fVar_Xic0MCGen) {
769  delete fVar_Xic0MCGen;
770  fVar_Xic0MCGen = 0;
771  }
772 
773  if (fCounter) {
774  delete fCounter;
775  fCounter = 0;
776  }
777 
778 
779 }
780 //_____________________________________________________________________________
782 {
783  // Initialization
784 
785  if (fDebug > 1) AliInfo("Init");
786 
787  fListCuts = new TList();
788  fListCuts->SetOwner();
789  fListCuts->SetName("ListCuts");
790  fListCuts->Add(new AliRDHFCutsKFP(*fAnaCuts));
791  PostData(1, fListCuts);
792 
793  return;
794 
795 }
796 //_____________________________________________________________________________
798 {
799  // create output objects
800  //
801  // this function is called ONCE at the start of your analysis (RUNTIME)
802  // here you ceate the histograms that you want to use
803  //
804  // the histograms are in this case added to a tlist, this list is in the end saved
805  // to an output file
806  //
807  fOutputList = new TList(); // this is a list which will contain all of your histograms
808  // at the end of the analysis, the contents of this list are written
809  // to the output file
810  fOutputList->SetOwner(kTRUE); // memory stuff: the list is owner of all objects it contains and will delete them
811  // if requested (dont worry about this now)
812 
813  DefineAnaHist(); // define analysis histograms
814 
815  // example of a histogram
816  fHistEvents = new TH1F("fHistEvents", "fHistEvents", 18, 0.5, 18.5);
817  fHistEvents->GetXaxis()->SetBinLabel(1,"Analyzed events");
818  fHistEvents->GetXaxis()->SetBinLabel(2,"AliAODVertex exists");
819  fHistEvents->GetXaxis()->SetBinLabel(3,"TriggerOK");
820  fHistEvents->GetXaxis()->SetBinLabel(4,"IsEventSelected");
821  fHistEvents->GetXaxis()->SetBinLabel(5,"V0 exists");
822  fHistEvents->GetXaxis()->SetBinLabel(6,"Cascade exists");
823 
824  fHistEvents->GetXaxis()->SetBinLabel(7,"MCarray exists");
825  fHistEvents->GetXaxis()->SetBinLabel(8,"MCheader exists");
826  fHistEvents->GetXaxis()->SetBinLabel(9,"triggerClass!=CINT1");
827  fHistEvents->GetXaxis()->SetBinLabel(10,"triggerMask!=kAnyINT");
828  fHistEvents->GetXaxis()->SetBinLabel(11,"triggerMask!=kAny");
829  fHistEvents->GetXaxis()->SetBinLabel(12,"vtxTitle.Contains(Z)");
830  fHistEvents->GetXaxis()->SetBinLabel(13,"vtxTitle.Contains(3D)");
831  fHistEvents->GetXaxis()->SetBinLabel(14,"vtxTitle.Doesn'tContain(Z-3D)");
832  fHistEvents->GetXaxis()->SetBinLabel(15,Form("zVtx<=%2.0fcm", fAnaCuts->GetMaxVtxZ()));
833  fHistEvents->GetXaxis()->SetBinLabel(16,"!IsEventSelected");
834  fHistEvents->GetXaxis()->SetBinLabel(17,"triggerMask!=kAnyINT || triggerClass!=CINT1");
835  fHistEvents->GetXaxis()->SetBinLabel(18,Form("zVtxMC<=%2.0fcm",fAnaCuts->GetMaxVtxZ()));
836  fHistEvents->GetYaxis()->SetTitle("counts");
837 
838  fHTrigger = new TH1F("fHTrigger", "counter", 18, -0.5, 17.5);
839  fHTrigger->SetStats(kTRUE);
840  fHTrigger->GetXaxis()->SetBinLabel(1,"X1");
841  fHTrigger->GetXaxis()->SetBinLabel(2,"kMB");
842  fHTrigger->GetXaxis()->SetBinLabel(3,"kSemiCentral");
843  fHTrigger->GetXaxis()->SetBinLabel(4,"kCentral");
844  fHTrigger->GetXaxis()->SetBinLabel(5,"kINT7");
845  fHTrigger->GetXaxis()->SetBinLabel(6,"kEMC7");
846  //fHTrigger->GetXaxis()->SetBinLabel(7,"Space");
847  fHTrigger->GetXaxis()->SetBinLabel(8,"kMB|kSemiCentral|kCentral");
848  fHTrigger->GetXaxis()->SetBinLabel(9,"kINT7|kEMC7");
849  fHTrigger->GetXaxis()->SetBinLabel(11,"kMB&kSemiCentral");
850  fHTrigger->GetXaxis()->SetBinLabel(12,"kMB&kCentral");
851  fHTrigger->GetXaxis()->SetBinLabel(13,"kINT7&kEMC7");
852 
853  fHistMCGen_Lambda_Pt = new TH1F("fHistMCGen_Lambda_Pt", "#it{p}_{T} distribution of #Lambda", 20, 0., 20.);
854  fHistMCGen_AntiLambda_Pt = new TH1F("fHistMCGen_AntiLambda_Pt", "#it{p}_{T} distribution of #bar{#Lambda}", 20, 0., 20.);
855  fHistMCGen_Lambda_Pt_wYcut = new TH1F("fHistMCGen_Lambda_Pt_wYcut", "#it{p}_{T} distribution of #Lambda", 20, 0., 20.);
856  fHistMCGen_AntiLambda_Pt_wYcut = new TH1F("fHistMCGen_AntiLambda_Pt_wYcut", "#it{p}_{T} distribution of #bar{#Lambda}", 20, 0., 20.);
857  fHistMCGen_XiMinus_Pt = new TH1F("fHistMCGen_XiMinus_Pt", "#it{p}_{T} distribution of #Xi^{-}", 20, 0., 20.);
858  fHistMCGen_XiPlus_Pt = new TH1F("fHistMCGen_XiPlus_Pt", "#it{p}_{T} distribution of #Xi^{+}", 20, 0., 20.);
859  fHistMCGen_XiMinus_Pt_wYcut = new TH1F("fHistMCGen_XiMinus_Pt_wYcut", "#it{p}_{T} distribution of #Xi^{-}", 20, 0., 20.);
860  fHistMCGen_XiPlus_Pt_wYcut = new TH1F("fHistMCGen_XiPlus_Pt_wYcut", "#it{p}_{T} distribution of #Xi^{+}", 20, 0., 20.);
861 
862 
863  fCounterGen_Cuts_Lambda = new TH1F("fCounterGen_Cuts_Lambda", "Counter of #Lambda (Gen)", 6, 0.5, 6.5);
864  fCounterGen_Cuts_Lambda->GetXaxis()->SetBinLabel(1,"inclusive #Lambda");
865  fCounterGen_Cuts_Lambda->GetXaxis()->SetBinLabel(2,"pri. #Lambda");
866  fCounterGen_Cuts_Lambda->GetXaxis()->SetBinLabel(3,"physical pri. #Lambda");
867  fCounterGen_Cuts_Lambda->GetXaxis()->SetBinLabel(4,"sec. from weak decay");
868  fCounterGen_Cuts_Lambda->GetXaxis()->SetBinLabel(5,"sec. from material");
869  fCounterGen_Cuts_Lambda->GetXaxis()->SetBinLabel(6,"from subsidiary");
870 
871  fCounterGen_Cuts_AntiLambda = new TH1F("fCounterGen_Cuts_AntiLambda", "Counter of #bar{#Lambda} (Gen)", 6, 0.5, 6.5);
872  fCounterGen_Cuts_AntiLambda->GetXaxis()->SetBinLabel(1,"inclusive #bar{#Lambda}");
873  fCounterGen_Cuts_AntiLambda->GetXaxis()->SetBinLabel(2,"pri. #bar{#Lambda}");
874  fCounterGen_Cuts_AntiLambda->GetXaxis()->SetBinLabel(3,"physical pri. #bar{#Lambda}");
875  fCounterGen_Cuts_AntiLambda->GetXaxis()->SetBinLabel(4,"sec. from weak decay");
876  fCounterGen_Cuts_AntiLambda->GetXaxis()->SetBinLabel(5,"sec. from material");
877  fCounterGen_Cuts_AntiLambda->GetXaxis()->SetBinLabel(6,"from subsidiary");
878 
879  fCounterGen_Cuts_XiMinus = new TH1F("fCounterGen_Cuts_XiMinus", "Counter of #Xi^{-} (Gen)", 6, 0.5, 6.5);
880  fCounterGen_Cuts_XiMinus->GetXaxis()->SetBinLabel(1,"inclusive #Xi^{-}");
881  fCounterGen_Cuts_XiMinus->GetXaxis()->SetBinLabel(2,"pri. #Xi^{-}");
882  fCounterGen_Cuts_XiMinus->GetXaxis()->SetBinLabel(3,"physical pri. #Xi^{-}");
883  fCounterGen_Cuts_XiMinus->GetXaxis()->SetBinLabel(4,"sec. from weak decay");
884  fCounterGen_Cuts_XiMinus->GetXaxis()->SetBinLabel(5,"sec. from material");
885  fCounterGen_Cuts_XiMinus->GetXaxis()->SetBinLabel(6,"from subsidiary");
886 
887  fCounterGen_Cuts_XiPlus = new TH1F("fCounterGen_Cuts_XiPlus", "Counter of #Xi^{+} (Gen)", 6, 0.5, 6.5);
888  fCounterGen_Cuts_XiPlus->GetXaxis()->SetBinLabel(1,"inclusive #Xi^{+}");
889  fCounterGen_Cuts_XiPlus->GetXaxis()->SetBinLabel(2,"pri. #Xi^{+}");
890  fCounterGen_Cuts_XiPlus->GetXaxis()->SetBinLabel(3,"physical pri. #Xi^{+}");
891  fCounterGen_Cuts_XiPlus->GetXaxis()->SetBinLabel(4,"sec. from weak decay");
892  fCounterGen_Cuts_XiPlus->GetXaxis()->SetBinLabel(5,"sec. from material");
893  fCounterGen_Cuts_XiPlus->GetXaxis()->SetBinLabel(6,"from subsidiary");
894 
895  fCounterRecMC_Cuts_Lambda = new TH1F("fCounterRecMC_Cuts_Lambda", "Counter of #Lambda (RecMC)", 8, 0.5, 8.5);
896  fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(1,"offline v0s");
897  fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(2,"N_daughter=2");
898  fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(3,"daug track exist");
899  fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(4,"daug cov. exist");
900  fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(5,"daug cov. QA");
901  fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(6,"STD v0 cuts");
902  fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(7,"KFP QA");
903  fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(8,"|y(#Lambda)|<0.5");
904 // fCounterRecMC_Cuts_Lambda->GetXaxis()->SetBinLabel(12,"sec. #Lambda cut");
905 
906  fCounterRecMC_Cuts_AntiLambda = new TH1F("fCounterRecMC_Cuts_AntiLambda", "Counter of #bar{#Lambda} (RecMC)", 8, 0.5, 8.5);
907  fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(1,"offline v0s");
908  fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(2,"N_daughter=2");
909  fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(3,"daug track exist");
910  fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(4,"daug cov. exist");
911  fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(5,"daug cov. QA");
912  fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(6,"STD v0 cuts");
913  fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(7,"KFP QA");
914  fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(8,"|y(#bar{#Lambda})|<0.5");
915 // fCounterRecMC_Cuts_AntiLambda->GetXaxis()->SetBinLabel(12,"sec. #bar{#Lambda} cut");
916 
917  fCounterRecMC_Cuts_XiMinus = new TH1F("fCounterRecMC_Cuts_XiMinus", "Counter of #Xi^{-} (RecMC)", 5, 0.5, 5.5);
918  fCounterRecMC_Cuts_XiMinus->GetXaxis()->SetBinLabel(1,"#pi cov. QA");
919  fCounterRecMC_Cuts_XiMinus->GetXaxis()->SetBinLabel(2,"STD sec. #pi cuts");
920  fCounterRecMC_Cuts_XiMinus->GetXaxis()->SetBinLabel(3,"KFP QA");
921  fCounterRecMC_Cuts_XiMinus->GetXaxis()->SetBinLabel(4,"PV constraint");
922  fCounterRecMC_Cuts_XiMinus->GetXaxis()->SetBinLabel(5,"|y(#Xi^{-})|<0.5");
923 
924  fCounterRecMC_Cuts_XiPlus = new TH1F("fCounterRecMC_Cuts_XiPlus", "Counter of #Xi^{+} (RecMC)", 5, 0.5, 5.5);
925  fCounterRecMC_Cuts_XiPlus->GetXaxis()->SetBinLabel(1,"#pi cov. QA");
926  fCounterRecMC_Cuts_XiPlus->GetXaxis()->SetBinLabel(2,"STD sec. #pi cuts");
927  fCounterRecMC_Cuts_XiPlus->GetXaxis()->SetBinLabel(3,"KFP QA");
928  fCounterRecMC_Cuts_XiPlus->GetXaxis()->SetBinLabel(4,"PV constraint");
929  fCounterRecMC_Cuts_XiPlus->GetXaxis()->SetBinLabel(5,"|y(#Xi^{+})|<0.5");
930 
931  fCounterRec_Cuts_Lambda = new TH1F("fCounterRec_Cuts_Lambda", "Counter of #Lambda candidates (Rec)", 8, 0.5, 8.5);
932  fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(1,"offline v0s");
933  fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(2,"N_daughter=2");
934  fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(3,"daug track exist");
935  fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(4,"daug cov. exist");
936  fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(5,"daug cov. QA");
937  fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(6,"STD v0 cuts");
938  fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(7,"KFP QA");
939  fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(8,"|y(#Lambda)|<0.5");
940 // fCounterRec_Cuts_Lambda->GetXaxis()->SetBinLabel(12,"sec. #Lambda cut");
941 
942  fCounterRec_Cuts_AntiLambda = new TH1F("fCounterRec_Cuts_AntiLambda", "Counter of #bar{#Lambda} candidates (Rec)", 8, 0.5, 8.5);
943  fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(1,"offline v0s");
944  fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(2,"N_daughter=2");
945  fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(3,"daug track exist");
946  fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(4,"daug cov. exist");
947  fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(5,"daug cov. QA");
948  fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(6,"STD v0 cuts");
949  fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(7,"KFP QA");
950  fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(8,"|y(#bar{#Lambda})|<0.5");
951 // fCounterRec_Cuts_AntiLambda->GetXaxis()->SetBinLabel(12,"sec. #bar{#Lambda} cut");
952 
953  fCounterRec_Cuts_XiMinus = new TH1F("fCounterRec_Cuts_XiMinus", "Counter of #Xi^{-} candidates (Rec)", 5, 0.5, 5.5);
954  fCounterRec_Cuts_XiMinus->GetXaxis()->SetBinLabel(1,"#pi cov. QA");
955  fCounterRec_Cuts_XiMinus->GetXaxis()->SetBinLabel(2,"STD sec. #pi");
956  fCounterRec_Cuts_XiMinus->GetXaxis()->SetBinLabel(3,"KFP QA");
957  fCounterRec_Cuts_XiMinus->GetXaxis()->SetBinLabel(4,"PV constraint");
958  fCounterRec_Cuts_XiMinus->GetXaxis()->SetBinLabel(5,"|y(#Xi^{-})|<0.5");
959 
960  fCounterRec_Cuts_XiPlus = new TH1F("fCounterRec_Cuts_XiPlus", "Counter of #Xi^{+} candidates (Rec)", 5, 0.5, 5.5);
961  fCounterRec_Cuts_XiPlus->GetXaxis()->SetBinLabel(1,"#pi cov. QA");
962  fCounterRec_Cuts_XiPlus->GetXaxis()->SetBinLabel(2,"STD sec. #pi cuts");
963  fCounterRec_Cuts_XiPlus->GetXaxis()->SetBinLabel(3,"KFP QA");
964  fCounterRec_Cuts_XiPlus->GetXaxis()->SetBinLabel(4,"PV constraint");
965  fCounterRec_Cuts_XiPlus->GetXaxis()->SetBinLabel(5,"|y(#Xi^{+})|<0.5");
966 
967  f2DCounterRecMC_CutsVsPt_Lambda = new TH2F("f2DCounterRecMC_CutsVsPt_Lambda", "", 20, 0.5, 20.5, 20, 0., 20.);
968  f2DCounterRecMC_CutsVsPt_Lambda->GetXaxis()->SetBinLabel(1,"offline v0s");
969  f2DCounterRecMC_CutsVsPt_Lambda->GetXaxis()->SetBinLabel(2,"N_daughter=2");
970  f2DCounterRecMC_CutsVsPt_Lambda->GetXaxis()->SetBinLabel(3,"daug track exist");
971  f2DCounterRecMC_CutsVsPt_Lambda->GetXaxis()->SetBinLabel(4,"daug cov. exist");
972  f2DCounterRecMC_CutsVsPt_Lambda->GetXaxis()->SetBinLabel(5,"daug cov. QA");
973  f2DCounterRecMC_CutsVsPt_Lambda->GetXaxis()->SetBinLabel(6,"STD v0 cuts");
974  f2DCounterRecMC_CutsVsPt_Lambda->GetXaxis()->SetBinLabel(7,"KFP QA");
975  f2DCounterRecMC_CutsVsPt_Lambda->GetXaxis()->SetBinLabel(8,"|y(#Lambda)|<0.5");
976 
977  f2DCounterRecMC_CutsVsPt_AntiLambda = new TH2F("f2DCounterRecMC_CutsVsPt_AntiLambda", "", 20, 0.5, 20.5, 20, 0., 20.);
978  f2DCounterRecMC_CutsVsPt_AntiLambda->GetXaxis()->SetBinLabel(1,"offline v0s");
979  f2DCounterRecMC_CutsVsPt_AntiLambda->GetXaxis()->SetBinLabel(2,"N_daughter=2");
980  f2DCounterRecMC_CutsVsPt_AntiLambda->GetXaxis()->SetBinLabel(3,"daug track exist");
981  f2DCounterRecMC_CutsVsPt_AntiLambda->GetXaxis()->SetBinLabel(4,"daug cov. exist");
982  f2DCounterRecMC_CutsVsPt_AntiLambda->GetXaxis()->SetBinLabel(5,"daug cov. QA");
983  f2DCounterRecMC_CutsVsPt_AntiLambda->GetXaxis()->SetBinLabel(6,"STD v0 cuts");
984  f2DCounterRecMC_CutsVsPt_AntiLambda->GetXaxis()->SetBinLabel(7,"KFP QA");
985  f2DCounterRecMC_CutsVsPt_AntiLambda->GetXaxis()->SetBinLabel(8,"|y(#bar{#Lambda})|<0.5");
986 
987  f2DCounterRecMC_CutsVsPt_XiMinus = new TH2F("f2DCounterRecMC_CutsVsPt_XiMinus", "", 20, 0.5, 20.5, 20, 0., 20.);
988  f2DCounterRecMC_CutsVsPt_XiMinus->GetXaxis()->SetBinLabel(1,"#pi cov. QA");
989  f2DCounterRecMC_CutsVsPt_XiMinus->GetXaxis()->SetBinLabel(2,"STD sec. #pi cuts");
990  f2DCounterRecMC_CutsVsPt_XiMinus->GetXaxis()->SetBinLabel(3,"KFP QA");
991  f2DCounterRecMC_CutsVsPt_XiMinus->GetXaxis()->SetBinLabel(4,"PV constraint");
992  f2DCounterRecMC_CutsVsPt_XiMinus->GetXaxis()->SetBinLabel(5,"|y(#Xi^{-})|<0.5");
993 
994  f2DCounterRecMC_CutsVsPt_XiPlus = new TH2F("f2DCounterRecMC_CutsVsPt_XiPlus", "", 20, 0.5, 20.5, 20, 0., 20.);
995  f2DCounterRecMC_CutsVsPt_XiPlus->GetXaxis()->SetBinLabel(1,"#pi cov. QA");
996  f2DCounterRecMC_CutsVsPt_XiPlus->GetXaxis()->SetBinLabel(2,"STD sec. #pi cuts");
997  f2DCounterRecMC_CutsVsPt_XiPlus->GetXaxis()->SetBinLabel(3,"KFP QA");
998  f2DCounterRecMC_CutsVsPt_XiPlus->GetXaxis()->SetBinLabel(4,"PV constraint");
999  f2DCounterRecMC_CutsVsPt_XiPlus->GetXaxis()->SetBinLabel(5,"|y(#Xi^{+})|<0.5");
1000 
1001  f2DHistMassPtLambda = new TH2F("f2DHistMassPtLambda", "#Lambda InvMass vs. P_{T}", 20, 0., 20., 1000, 1., 2.);
1002  f2DHistMassPtAntiLambda = new TH2F("f2DHistMassPtAntiLambda", "#bar{#Lambda} InvMass vs. P_{T}", 20, 0., 20., 1000, 1., 2.);
1003  f2DHistMassPtXiMinus = new TH2F("f2DHistMassPtXiMinus", "#Xi^{-} InvMass vs. P_{T}", 20, 0., 20., 1000, 1., 2.);
1004  f2DHistMassPtXiPlus = new TH2F("f2DHistMassPtXiPlus", "#Xi^{+} InvMass vs. P_{T}", 20, 0., 20., 1000, 1., 2.);
1005  f2DHistMassPtXicZero_woQtCut = new TH2F("f2DHistMassPtXicZero_woQtCut", "#Xi_{c}^{0} InvMass vs. P_{T}", 20, 0., 20., 1000, 2., 3.);
1006  f2DHistMassPtXicZero = new TH2F("f2DHistMassPtXicZero", "#Xi_{c}^{0} InvMass vs. P_{T}", 20, 0., 20., 1000, 2., 3.);
1007  f2DHistMassPtAntiXicZero = new TH2F("f2DHistMassPtAntiXicZero", "#bar{#Xi_{c}^{0}} InvMass vs. P_{T}", 20, 0., 20., 1000, 2., 3.);
1008  f2DHistMassPtXicZeroTot = new TH2F("f2DHistMassPtXicZeroTot", "#Xi_{c}^{0} + #bar{#Xi_{c}^{0}} InvMass vs. P_{T}", 20, 0., 20., 1000, 2., 3.);
1009 
1010  f2DHistChi2vsNDF_Lambda = new TH2F("f2DHistChi2vsNDF_Lambda", "#Lambda: #chi^{2} vs. NDF", 10, -5., 5., 2000, -100., 100.);
1011  f2DHistChi2vsNDF_Lambda_Match = new TH2F("f2DHistChi2vsNDF_Lambda_Match", "#Lambda: #chi^{2} vs. NDF", 10, -5., 5., 2000, -100., 100.);
1012  f2DHistChi2vsNDF_AntiLambda = new TH2F("f2DHistChi2vsNDF_AntiLambda", "#bar{#Lambda}: #chi^{2} vs. NDF", 10, -5., 5., 2000, -100., 100.);
1013 
1014  f2DHistXKFMCvsPt_Proton = new TH2F("f2DHistXKFMCvsPt_Proton", "Proton at decay vertex: (x_{Rec} - x_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1015  f2DHistYKFMCvsPt_Proton = new TH2F("f2DHistYKFMCvsPt_Proton", "Proton at decay vertex: (y_{Rec} - y_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1016  f2DHistZKFMCvsPt_Proton = new TH2F("f2DHistZKFMCvsPt_Proton", "Proton at decay vertex: (z_{Rec} - z_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1017  f2DHistXKFMCvsPt_Pion = new TH2F("f2DHistXKFMCvsPt_Pion", "Pion at decay vertex: (x_{Rec} - x_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1018  f2DHistYKFMCvsPt_Pion = new TH2F("f2DHistYKFMCvsPt_Pion", "Pion at decay vertex: (y_{Rec} - y_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1019  f2DHistZKFMCvsPt_Pion = new TH2F("f2DHistZKFMCvsPt_Pion", "Pion at decay vertex: (z_{Rec} - z_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1020  f2DHistXRecMCvsPt_Lambda = new TH2F("f2DHistXRecMCvsPt_Lambda", "#Lambda: (x_{Rec} - x_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1021  f2DHistXRecMCvsPt_AntiLambda = new TH2F("f2DHistXRecMCvsPt_AntiLambda", "#bar{#Lambda}: (x_{Rec} - x_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1022  f2DHistXV0MCvsPt_Lambda = new TH2F("f2DHistXV0MCvsPt_Lambda", "#Lambda: (x_{V0} - x_{MC}) vs. P_{T}", 20, 0., 20., 2000, -1., 1.);
1023 
1024  f2DHistPtRecMCvsPt_Lambda = new TH2F("f2DHistPtRecMCvsPt_Lambda", "#Lambda: ((p_{T}^{Rec} - p_{T}^{MC})/p_{T}^{Rec}) vs. p_{T}", 20, 0., 20., 2000, -1., 1.);
1025  f2DHistPtV0MCvsPt_Lambda = new TH2F("f2DHistPtV0MCvsPt_Lambda", "#Lambda: ((p_{T}^{Rec} - p_{T}^{MC})/p_{T}^{Rec}) vs. p_{T}", 20, 0., 20., 2000, -1., 1.);
1026  f2DHistPtRecMCvsPt_AntiLambda = new TH2F("f2DHistPtRecMCvsPt_AntiLambda", "#bar{#Lambda}: ((p_{T}^{Rec} - p_{T}^{MC})/p_{T}^{Rec}) vs. p_{T}", 20, 0., 20., 2000, -1., 1.);
1027 
1028  f2DHistMassRecMCvsPt_Lambda = new TH2F("f2DHistMassRecMCvsPt_Lambda", "#Lambda: (m_{Rec} - m_{MC}) vs. p_{T}", 20, 0., 20., 2000, -1., 1.);
1029  f2DHistMassV0MCvsPt_Lambda = new TH2F("f2DHistMassV0MCvsPt_Lambda", "#Lambda: (m_{Rec} - m_{MC}) vs. p_{T}", 20, 0., 20., 2000, -1., 1.);
1030  f2DHistMassRecMCvsPt_AntiLambda = new TH2F("f2DHistMassRecMCvsPt_AntiLambda", "#bar{#Lambda}: (m_{Rec} - m_{MC}) vs. p_{T}", 20, 0., 20., 2000, -1., 1.);
1031 
1032  f2DHistXPULLvsPt_Proton = new TH2F("f2DHistXPULLvsPt_Proton", "Proton at decay vertex: x_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1033  f2DHistYPULLvsPt_Proton = new TH2F("f2DHistYPULLvsPt_Proton", "Proton at decay vertex: y_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1034  f2DHistZPULLvsPt_Proton = new TH2F("f2DHistZPULLvsPt_Proton", "Proton at decay vertex: z_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1035  f2DHistXPULLvsPt_Pion = new TH2F("f2DHistXPULLvsPt_Pion", "Pion at decay vertex: x_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1036  f2DHistYPULLvsPt_Pion = new TH2F("f2DHistYPULLvsPt_Pion", "Pion at decay vertex: y_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1037  f2DHistZPULLvsPt_Pion = new TH2F("f2DHistZPULLvsPt_Pion", "Pion at decay vertex: z_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1038  f2DHistXPULLvsPt_Lambda = new TH2F("f2DHistXPULLvsPt_Lambda", "#Lambda: x_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1039  f2DHistXPULLvsPt_Lambda_V0 = new TH2F("f2DHistXPULLvsPt_Lambda_V0", "#Lambda: x_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1040  f2DHistXPULLvsPt_AntiLambda = new TH2F("f2DHistXPULLvsPt_AntiLambda", "#bar{#Lambda}: x_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1041 
1042  f2DHistPtPULLvsPt_Lambda = new TH2F("f2DHistPtPULLvsPt_Lambda", "#Lambda: p_{T}^{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1043  f2DHistPtPULLvsPt_Lambda_V0 = new TH2F("f2DHistPtPULLvsPt_Lambda_V0", "#Lambda: p_{T}^{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1044  f2DHistPtPULLvsPt_AntiLambda = new TH2F("f2DHistPtPULLvsPt_AntiLambda", "#bar{#Lambda}: p_{T}^{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1045 
1046  f2DHistMassPULLvsPt_Lambda = new TH2F("f2DHistMassPULLvsPt_Lambda", "#Lambda: m_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1047  f2DHistMassPULLvsPt_Lambda_V0 = new TH2F("f2DHistMassPULLvsPt_Lambda_V0", "#Lambda: m_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1048  f2DHistMassPULLvsPt_AntiLambda = new TH2F("f2DHistMassPULLvsPt_AntiLambda", "#bar{#Lambda}: m_{PULL} vs. p_{T}", 20, 0., 20., 2000, -10., 10.);
1049  f2DHistMassPULLvsRadius_Lambda = new TH2F("f2DHistMassPULLvsRadius_Lambda", "#Lambda: m_{PULL} vs. Radius", 200, 0., 20., 2000, -10., 10.);
1050  f2DHistMassPULLvsRadius_AntiLambda = new TH2F("f2DHistMassPULLvsRadius_AntiLambda", "#bar{#Lambda}: m_{PULL} vs. Radius", 200, 0., 20., 2000, -10., 10.);
1051 
1052  f2DHistArmenterosPodolanski_FirstDaugPos = new TH2F("f2DHistArmenterosPodolanski_FirstDaugPos", "f2DHistArmenterosPodolanski_FirstDaugPos", 1000, -1., 1., 1000, 0., 1.);
1053  f2DHistArmenterosPodolanski_FirstDaugNeg = new TH2F("f2DHistArmenterosPodolanski_FirstDaugNeg", "f2DHistArmenterosPodolanski_FirstDaugNeg", 1000, -1., 1., 1000, 0., 1.);
1054  f2DHistArmenterosPodolanski_candidate = new TH2F("f2DHistArmenterosPodolanski_candidate", "f2DHistArmenterosPodolanski_candidate", 1000, -1., 1., 1000, 0., 1.);
1055  f2DHistArmenterosPodolanski_Lam = new TH2F("f2DHistArmenterosPodolanski_Lam", "f2DHistArmenterosPodolanski_Lam", 1000, -1., 1., 1000, 0., 1.);
1056  f2DHistArmenterosPodolanski_AntiLam = new TH2F("f2DHistArmenterosPodolanski_AntiLam", "f2DHistArmenterosPodolanski_AntiLam", 1000, -1., 1., 1000, 0., 1.);
1057  f2DHistChargeDaughters = new TH2F("f2DHistChargeDaughters", "f2DHistChargeDaughters", 11, -5.5, 5.5, 11., -5.5, 5.5);
1058  f2DHistV0XY_OnFly = new TH2F("f2DHistV0XY_OnFly", "f2DHistV0XY_OnFly", 1000, -10., 10., 1000, -10., 10.);
1059  f2DHistV0XY_Offline = new TH2F("f2DHistV0XY_Offline", "f2DHistV0XY_Offline", 1000, -10., 10., 1000, -10., 10.);
1060  f2DHistV0XY_FirstDaugPos = new TH2F("f2DHistV0XY_FirstDaugPos", "f2DHistV0XY_FirstDaugPos", 1000, -10., 10., 1000, -10., 10.);
1061  f2DHistV0XY_FirstDaugNeg = new TH2F("f2DHistV0XY_FirstDaugNeg", "f2DHistV0XY_FirstDaugNeg", 1000, -10., 10., 1000, -10., 10.);
1062  f2DHistLambdaXY = new TH2F("f2DHistLambdaXY", "f2DHistLambdaXY", 1000, -10., 10., 1000, -10., 10.);
1063  f2DHistXiMinusXY_DV = new TH2F("f2DHistXiMinusXY_DV", "f2DHistXiMinusXY_DV", 1000, -10., 10., 1000, -10., 10.);
1064  f2DHistXiMinusXY_PV = new TH2F("f2DHistXiMinusXY_PV", "f2DHistXiMinusXY_PV", 1000, -10., 10., 1000, -10., 10.);
1065  f2DHistXiPlusXY_DV = new TH2F("f2DHistXiPlusXY_DV", "f2DHistXiPlusXY_DV", 1000, -10., 10., 1000, -10., 10.);
1066  f2DHistXiPlusXY_PV = new TH2F("f2DHistXiPlusXY_PV", "f2DHistXiPlusXY_PV", 1000, -10., 10., 1000, -10., 10.);
1067 
1068  fHistChargeV0 = new TH1F("fHistChargeV0", "fHistChargeV0", 11, -5.5, 5.5);
1069  fHistOnFlyStatus = new TH1F("fHistOnFlyStatus"," fHistOnFlyStatus", 3, -1.5, 1.5);
1070  fHistOnFlyStatus_FirstDaugPos = new TH1F("fHistOnFlyStatus__FirstDaugPos"," fHistOnFlyStatus__FirstDaugPos", 3, -1.5, 1.5);
1071  fHistOnFlyStatus_FirstDaugNeg = new TH1F("fHistOnFlyStatus_FirstDaugNeg", "fHistOnFlyStatus_FirstDaugNeg", 3, -1.5, 1.5);
1072  fHistNDaughterV0 = new TH1F("fHistNDaughterV0", "fHistNDaughterV0", 11, -0.5, 10.5);
1073  fHistNProngV0 = new TH1F("fHistNProngV0", "fHistNProngV0", 11, -0.5, 10.5);
1074  fHistChargeFirstDaughter = new TH1F("fHistChargeFirstDaughter", "fHistChargeFirstDaughter", 11, -5.5, 5.5);
1075  fHistChargeSecondDaughter = new TH1F("fHistChargeSecondDaughter", "fHistChargeSecondDaughter", 11, -5.5, 5.5);
1076  fHistXtrkP = new TH1F("fHistXtrkP", "fHistXtrkP", 400, -20., 20.);
1077  fHistYtrkP = new TH1F("fHistYtrkP", "fHistYtrkP", 400, -20., 20.);
1078  fHistZtrkP = new TH1F("fHistZtrkP", "fHistZtrkP", 400, -20., 20.);
1079  fHistXtrkP_XYZv = new TH1F("fHistXtrkP_XYZv", "fHistXtrkP_XYZv", 400, -20., 20.);
1080  fHistYtrkP_XYZv = new TH1F("fHistYtrkP_XYZv", "fHistYtrkP_XYZv", 400, -20., 20.);
1081  fHistZtrkP_XYZv = new TH1F("fHistZtrkP_XYZv", "fHistZtrkP_XYZv", 400, -20., 20.);
1082  fHistXtrkP_Rec_MC = new TH1F("fHistXtrkP_Rec_MC", "x^{Rec}-x^{MC} (track_P)", 2000, -100., 100.);
1083  fHistYtrkP_Rec_MC = new TH1F("fHistYtrkP_Rec_MC", "y^{Rec}-y^{MC} (track_P)", 2000, -100., 100.);
1084  fHistZtrkP_Rec_MC = new TH1F("fHistZtrkP_Rec_MC", "z^{Rec}-z^{MC} (track_P)", 2000, -100., 100.);
1085  fHistXtrkP_Rec_MC_XYZv = new TH1F("fHistXtrkP_Rec_MC_XYZv", "x^{Rec}-x^{MC} (track_P)", 2000, -100., 100.);
1086  fHistYtrkP_Rec_MC_XYZv = new TH1F("fHistYtrkP_Rec_MC_XYZv", "y^{Rec}-y^{MC} (track_P)", 2000, -100., 100.);
1087  fHistZtrkP_Rec_MC_XYZv = new TH1F("fHistZtrkP_Rec_MC_XYZv", "z^{Rec}-z^{MC} (track_P)", 2000, -100., 100.);
1088  fHistXtrkN = new TH1F("fHistXtrkN", "fHistXtrkN", 400, -20., 20.);
1089  fHistYtrkN = new TH1F("fHistYtrkN", "fHistYtrkN", 400, -20., 20.);
1090  fHistZtrkN = new TH1F("fHistZtrkN", "fHistZtrkN", 400, -20., 20.);
1091  fHistXtrkN_XYZv = new TH1F("fHistXtrkN_XYZv", "fHistXtrkN_XYZv", 400, -20., 20.);
1092  fHistYtrkN_XYZv = new TH1F("fHistYtrkN_XYZv", "fHistYtrkN_XYZv", 400, -20., 20.);
1093  fHistZtrkN_XYZv = new TH1F("fHistZtrkN_XYZv", "fHistZtrkN_XYZv", 400, -20., 20.);
1094  fHistXtrkN_Rec_MC = new TH1F("fHistXtrkN_Rec_MC", "x^{Rec}-x^{MC} (track_N)", 2000, -100., 100.);
1095  fHistYtrkN_Rec_MC = new TH1F("fHistYtrkN_Rec_MC", "y^{Rec}-x^{MC} (track_N)", 2000, -100., 100.);
1096  fHistZtrkN_Rec_MC = new TH1F("fHistZtrkN_Rec_MC", "z^{Rec}-x^{MC} (track_N)", 2000, -100., 100.);
1097  fHistXtrkN_Rec_MC_XYZv = new TH1F("fHistXtrkN_Rec_MC_XYZv", "x^{Rec}-x^{MC} (track_N)", 2000, -100., 100.);
1098  fHistYtrkN_Rec_MC_XYZv = new TH1F("fHistYtrkN_Rec_MC_XYZv", "y^{Rec}-y^{MC} (track_N)", 2000, -100., 100.);
1099  fHistZtrkN_Rec_MC_XYZv = new TH1F("fHistZtrkN_Rec_MC_XYZv", "z^{Rec}-z^{MC} (track_N)", 2000, -100., 100.);
1100  fHistLDeltaLRec_Lambda = new TH1F("fHistLDeltaLRec_Lambda", "primary #Lambda: l/#Deltal", 2000, -100., 100.);
1101  fHistLDeltaLRecMC_Lambda = new TH1F("fHistLDeltaLRecMC_Lambda", "primary #Lambda: l/#Deltal", 2000, -100., 100.);
1102  fHistLDeltaLRecMC_LambdaFromXi = new TH1F("fHistLDeltaLRecMC_LambdaFromXi", "#Lambda#leftarrow#Xi^{-}: l/#Deltal", 2000, -100., 100.);
1103  fHistLDeltaLRec_AntiLambda = new TH1F("fHistLDeltaLRec_AntiLambda", "primary #bar{#Lambda}: l/#Deltal", 2000, -100., 100.);
1104  fHistLDeltaLRecMC_AntiLambda = new TH1F("fHistLDeltaLRecMC_AntiLambda", "primary #bar{#Lambda}: l/#Deltal", 2000, -100., 100.);
1105  fHistLDeltaLRecMC_AntiLambdaFromXi = new TH1F("fHistLDeltaLRecMC_AntiLambdaFromXi", "#bar{#Lambda}#leftarrow#Xi^{+}: l/#Deltal", 2000, -100., 100.);
1106  fHistXLambdaTot = new TH1F("fHistXLambdaTot", "x_{Rec} at #Lambda decay vertex", 200, -100., 100.);
1107  fHistYLambdaTot = new TH1F("fHistYLambdaTot", "y_{Rec} at #Lambda decay vertex", 200, -100., 100.);
1108  fHistZLambdaTot = new TH1F("fHistZLambdaTot", "z_{Rec} at #Lambda decay vertex", 200, -100., 100.);
1109  fHistXLambda_KF_MC = new TH1F("fHistXLambda_KF_MC", "x^{Rec} - x^{MC} (#Lambda decay vertex)", 2000, -1., 1.);
1110  fHistYLambda_KF_MC = new TH1F("fHistYLambda_KF_MC", "y^{Rec} - y^{MC} (#Lambda decay vertex)", 2000, -1., 1.);
1111  fHistZLambda_KF_MC = new TH1F("fHistZLambda_KF_MC", "z^{Rec} - z^{MC} (#Lambda decay vertex)", 2000, -1., 1.);
1112  fHistXProton_KF_MC = new TH1F("fHistXProton_KF_MC", "x^{Rec} - x^{MC} (Proton at decay vertex)", 10000, -0.05, 0.05);
1113  fHistYProton_KF_MC = new TH1F("fHistYProton_KF_MC", "y^{Rec} - y^{MC} (Proton at decay vertex)", 10000, -0.05, 0.05);
1114  fHistZProton_KF_MC = new TH1F("fHistZProton_KF_MC", "z^{Rec} - z^{MC} (Proton at decay vertex)", 10000, -0.05, 0.05);
1115  fHistXPion_KF_MC = new TH1F("fHistXPion_KF_MC", "x^{Rec} - x^{MC} (Pion at decay vertex)", 10000, -0.05, 0.05);
1116  fHistYPion_KF_MC = new TH1F("fHistYPion_KF_MC", "y^{Rec} - y^{MC} (Pion at decay vertex)", 10000, -0.05, 0.05);
1117  fHistZPion_KF_MC = new TH1F("fHistZPion_KF_MC", "z^{Rec} - z^{MC} (Pion at decay vertex)", 10000, -0.05, 0.05);
1118  fHistXLambda_V0_MC = new TH1F("fHistXLambda_V0_MC", "x^{V0} - x^{MC} (#Lambda decay vertex)", 2000, -1., 1.);
1119  fHistXAntiLambda_Rec_MC = new TH1F("fHistXAntiLambda_Rec_MC", "x^{Rec} - x^{MC} (#bar{#Lambda} decay vertex)", 200, -1., 1.);
1120  fHistYAntiLambda_Rec_MC = new TH1F("fHistYAntiLambda_Rec_MC", "y^{Rec} - y^{MC} (#bar{#Lambda} decay vertex)", 200, -1., 1.);
1121  fHistZAntiLambda_Rec_MC = new TH1F("fHistZAntiLambda_Rec_MC", "z^{Rec} - z^{MC} (#bar{#Lambda} decay vertex)", 200, -1., 1.);
1122  fHistXProton_PULL = new TH1F("fHistXProton_PULL", "x^{PULL} (Proton at decay vertex)", 20000, -10., 10.);
1123  fHistYProton_PULL = new TH1F("fHistYProton_PULL", "y^{PULL} (Proton at decay vertex)", 20000, -10., 10.);
1124  fHistZProton_PULL = new TH1F("fHistZProton_PULL", "z^{PULL} (Proton at decay vertex)", 20000, -10., 10.);
1125  fHistXPion_PULL = new TH1F("fHistXPion_PULL", "x^{PULL} (Pion at decay vertex)", 20000, -10., 10.);
1126  fHistYPion_PULL = new TH1F("fHistYPion_PULL", "y^{PULL} (Pion at decay vertex)", 20000, -10., 10.);
1127  fHistZPion_PULL = new TH1F("fHistZPion_PULL", "z^{PULL} (Pion at decay vertex)", 20000, -10., 10.);
1128  fHistXLambda_PULL = new TH1F("fHistXLambda_PULL", "x^{PULL} (#Lambda decay vertex)", 2000, -10., 10.);
1129  fHistYLambda_PULL = new TH1F("fHistYLambda_PULL", "y^{PULL} (#Lambda decay vertex)", 2000, -10., 10.);
1130  fHistZLambda_PULL = new TH1F("fHistZLambda_PULL", "z^{PULL} (#Lambda decay vertex)", 2000, -10., 10.);
1131  fHistXAntiLambda_PULL = new TH1F("fHistXAntiLambda_PULL", "x^{PULL} (#bar{#Lambda} decay vertex)", 2000, -10., 10.);
1132  fHistYAntiLambda_PULL = new TH1F("fHistYAntiLambda_PULL", "y^{PULL} (#bar{#Lambda} decay vertex)", 2000, -10., 10.);
1133  fHistZAntiLambda_PULL = new TH1F("fHistZAntiLambda_PULL", "z^{PULL} (#bar{#Lambda} decay vertex)", 2000, -10., 10.);
1134  fHistXXiTot = new TH1F("fHistXXiTot", "fHistXXiTot", 200, -100., 100.);
1135  fHistYXiTot = new TH1F("fHistYXiTot", "fHistYXiTot", 200, -100., 100.);
1136  fHistZXiTot = new TH1F("fHistZXiTot", "fHistZXiTot", 200, -100., 100.);
1137  fHistXXicZeroTot = new TH1F("fHistXXicZeroTot", "fHistXXicZeroTot", 200, -100., 100.);
1138  fHistYXicZeroTot = new TH1F("fHistYXicZeroTot", "fHistYXicZeroTot", 200, -100., 100.);
1139  fHistZXicZeroTot = new TH1F("fHistZXicZeroTot", "fHistZXicZeroTot", 200, -100., 100.);
1140 
1141  fGenHistRapidity_Lambda = new TH1F("fGenHistRapidity_Lambda", "", 200, -10., 10.);
1142  fGenHistRapidity_AntiLambda = new TH1F("fGenHistRapidity_AntiLambda", "", 200, -10., 10.);
1143  fRecHistRapidity_Lambda_offline = new TH1F("fRecHistRapidity_Lambda_offline", "", 200, -10., 10.);
1144  fRecHistRapidity_Lambda_wSTD = new TH1F("fRecHistRapidity_Lambda_wSTD", "", 200, -10., 10.);
1145  fRecHistRapidity_AntiLambda_wSTD = new TH1F("fRecHistRapidity_AntiLambda_wSTD", "", 200, -10., 10.);
1146 
1147  fHistPtLambda = new TH1F("fHistPtLambda", "fHistPtLambda", 200, 0, 20); // create your histogra
1148  fHistPtAntiLambda = new TH1F("fHistPtAntiLambda", "fHistPtAntiLambda", 200, 0, 20);
1149  fHistPtLambdaTot = new TH1F("fHistPtLambdaTot", "fHistPtLambdaTot", 200, 0, 20);
1150  fHistPtXiMinus = new TH1F("fHistPtXiMinus", "fHistPtXiMinus", 200, 0, 20);
1151  fHistPtXiPlus = new TH1F("fHistPtXiPlus", "fHistPtXiPlus", 200, 0, 20);
1152  fHistPtXiTot = new TH1F("fHistPtXiTot", "fHistPtXiTot", 200, 0, 20);
1153  fHistPtXicZero = new TH1F("fHistPtXicZero", "fHistPtXicZero", 200, 0, 20);
1154  fHistPtAntiXicZero = new TH1F("fHistPtAntiXicZero", "fHistPtAntiXicZero", 200, 0, 20);
1155  fHistPtXicZeroTot = new TH1F("fHistPtXicZeroTot", "fHistPtXicZeroTot", 200, 0, 20);
1156  // your histogram in the output file, add it to the list!
1157  fHistMassK0S = new TH1F("fHistMassK0S", "HistMassK0S", 1000, 0., 1.);
1158  fHistMassLambda_woCut = new TH1F("fHistMassLambda_woCut", "fHistMassLambda_woCut", 1000, 1., 2.);
1159  fHistMassAntiLambda_woCut = new TH1F("fHistMassAntiLambda_woCut", "fHistMassAntiLambda_woCut", 1000, 1., 2.);
1160  fHistMassLambdaCheck = new TH1F("fHistMassLambdaCheck", "fHistMassLambdaCheck", 20000, -10., 10.);
1161  fHistMassAntiLambdaCheck = new TH1F("fHistMassAntiLambdaCheck", "fHistMassAntiLambdaCheck", 20000, -10., 10.);
1162  fHistMassLambda_wSTDv0Cut = new TH1F("fHistMassLambda_wSTDv0Cut", "fHistMassLambda_wSTDv0Cut", 1000, 1., 2.);
1163  fHistMassAntiLambda_wSTDv0Cut = new TH1F("fHistMassAntiLambda_wSTDv0Cut", "fHistMassAntiLambda_wSTDv0Cut", 1000, 1., 2.);
1164  fHistMassLambda_BeforeSecSel = new TH1F("fHistMassLambda_BeforeSecSel", "fHistMassLambda_BeforeSecSel", 1000, 1., 2.);
1165  fHistMassAntiLambda_BeforeSecSel = new TH1F("fHistMassAntiLambda_BeforeSecSel", "fHistMassAntiLambda_BeforeSecSel", 1000, 1., 2.);
1166  fHistMassLambda = new TH1F("fHistMassLambda", "fHistMassLambda", 1000, 1., 2.);
1167  fHistMassLambda_woArmenterosPodolanskiCut = new TH1F("fHistMassLambda_woArmenterosPodolanskiCut", "fHistMassLambda_woArmenterosPodolanskiCut", 1000, 1., 2.);
1168  fHistMassLambda_woMassCut = new TH1F("fHistMassLambda_woMassCut", "fHistMassLambda_woMassCut", 1000, 1., 2.);
1169  fHistMassAntiLambda = new TH1F("fHistMassAntiLambda", "fHistMassAntiLambda", 1000, 1., 2.);
1170  fHistMassAntiLambda_woMassCut = new TH1F("fHistMassAntiLambda_woMassCut", "fHistMassAntiLambda_woMassCut", 1000, 1., 2.);
1171  fHistMassLambdaTot = new TH1F("fHistMassLambdaTot", "fHistMassLambdaTot", 1000, 1., 2.);
1172  fHistMassLambda_Match = new TH1F("fHistMassLambda_Match", "fHistMassLambda_Match", 1000, 1., 2.);
1173  fHistMassAntiLambda_Match = new TH1F("fHistMassAntiLambda_Match", "fHistMassAntiLambda", 1000, 1., 2.);
1174  fHistMassLambdaTot_Match = new TH1F("fHistMassLambdaTot_Match", "fHistMassLambdaTot", 1000, 1., 2.);
1175  fHistMassLambda_V0 = new TH1F("fHistMassLambda_V0", "m (#Lambda) from V0", 1000, 1., 2.);
1176  fHistMassAntiLambda_V0 = new TH1F("fHistMassAntiLambda_V0", "m (#bar{#Lambda}) from V0", 1000, 1., 2.);
1177  fHistMassLambdaTot_V0 = new TH1F("fHistMassLambdaTot_V0", "fHistMassLambdaTot_V0", 1000, 1., 2.);
1178  fHistMassLambda_KF_V0 = new TH1F("fHistMassLambda_KF_V0", "m_{KF} - m_{V0} of #Lambda", 2000, -0.1, 0.1);
1179  fHistMassLambda_KF_MC = new TH1F("fHistMassLambda_KF_MC", "m_{KF} - m_{MC} of #Lambda", 200, -0.1, 0.1);
1180  fHistMassLambda_V0_MC = new TH1F("fHistMassLambda_V0_MC", "m_{V0} - m_{MC} of #Lambda", 200, -0.1, 0.1);
1181  fHistMassAntiLambda_KF_V0 = new TH1F("fHistMassAntiLambda_KF_V0", "m_{KF} - m_{V0} of #bar{#Lambda}", 200, -0.1, 0.1);
1182  fHistMassAntiLambda_KF_MC = new TH1F("fHistMassAntiLambda_KF_MC", "m_{KF} - m_{MC} of #bar{#Lambda}", 200, -0.1, 0.1);
1183  fHistMassLambda_PULL_KF = new TH1F("fHistMassLambda_PULL_KF", "m_{PULL} (KF) of #Lambda", 2000, -10., 10.);
1184  fHistMassAntiLambda_PULL_KF = new TH1F("fHistMassAntiLambda_PULL_KF", "m_{PULL} (KF) of #bar{#Lambda}", 2000, -10., 10.);
1185 
1186  fHistMassLambda_M = new TH1F("fHistMassLambda_M", "fHistMassLambda_M", 2000, 0., 2.);
1187  fHistMassAntiLambda_M = new TH1F("fHistMassAntiLambda_M", "fHistMassAntiLambda_M", 100, 1., 2.);
1188  fHistMassLambdaTot_M = new TH1F("fHistMassLambdaTot_M", "fHistMassLambdaTot_MV", 100, 1., 2.);
1189  fHistMassLambda_MV = new TH1F("fHistMassLambda_MV", "fHistMassLambda_MV", 100, 1., 2.);
1190  fHistMassAntiLambda_MV = new TH1F("fHistMassAntiLambda_MV", "fHistMassAntiLambda_MV", 100, 1., 2.);
1191  fHistMassLambdaTot_MV = new TH1F("fHistMassLambdaTot_MV", "fHistMassLambdaTot_MV", 100, 1., 2.);
1192  fHistMassXiMinus = new TH1F("fHistMassXiMinus", "fHistMassXiMinus", 1000, 1., 2.);
1193  fHistMassXiMinus_M = new TH1F("fHistMassXiMinus_M", "fHistMassXiMinus_M", 1000, 1., 2.);
1194  fHistMassXiMinus_Match = new TH1F("fHistMassXiMinus_Match", "fHistMassXiMinus_Match", 1000, 1., 2.);
1195  fHistMassXiPlus = new TH1F("fHistMassXiPlus", "fHistMassXiPlus", 1000, 1., 2.);
1196  fHistMassXiPlus_M = new TH1F("fHistMassXiPlus_M", "fHistMassXiPlus_M", 2000, 0., 2.);
1197  fHistMassXiTot = new TH1F("fHistMassXiTot", "fHistMassXiTot", 1000, 0., 10.);
1198  fHistMassXicZero_woQtCut = new TH1F("fHistMassXicZero_woQtCut", "fHistMassXicZero_woQtCut", 10000, 0., 10.);
1199  fHistMassXicZero = new TH1F("fHistMassXicZero", "fHistMassXicZero", 10000, 0., 10.);
1200  fHistMassAntiXicZero = new TH1F("fHistMassAntiXicZero", "fHistMassAntiXicZero", 10000, 0., 10.);
1201  fHistMassXicZeroTot = new TH1F("fHistMassXicZeroTot", "fHistMassXicZeroTot", 10000, 0., 10.);
1202  fHistQtDiffPionXiMinus = new TH1F("fHistQtDiffPionXiMinus", "fHistQtDiffPionXiMinus", 20000, -0.01, 0.01);
1203  fHistQtDiffPionXiPlus = new TH1F("fHistQtDiffPionXiPlus", "fHistQtDiffPionXiPlus", 20000, -0.01, 0.01);
1204  fHistMassXiMinus2 = new TH1F("fHistMassXiMinus2", "fHistMassXiMinus2", 100, 1.2, 1.4);
1205  fHistChi2ndfProton = new TH1F("fHistChi2ndfProton", "Proton at decay point: #chi^{2}/NDF", 2000, -100., 100.);
1206  fHistChi2ndfPion = new TH1F("fHistChi2ndfPion", "Pion at decay point: #chi^{2}/NDF", 2000, -100., 100.);
1207  fHistChi2ndfLambda = new TH1F("fHistChi2ndfLambda", "fHistChi2ndfLambda", 2000, -100., 100.);
1208  fHistChi2ndfLambda_Match = new TH1F("fHistChi2ndfLambda_Match", "fHistChi2ndfLambda", 2000, -100., 100.);
1209  fHistChi2ndfAntiLambda = new TH1F("fHistChi2ndfAntiLambda", "fHistChi2ndfAntiLambda", 2000, -100., 100.);
1210  fHistChi2ndfAntiLambda_Match = new TH1F("fHistChi2ndfAntiLambda_Match", "fHistChi2ndfAntiLambda", 2000, -100., 100.);
1211  fHistChi2ndfLambdaTot = new TH1F("fHistChi2ndfLambdaTot", "fHistChi2ndfLambdaTot", 2000, -100., 100.);
1212  fHistProbProton = new TH1F("fHistProbProton", "Proton at decay point: prob.", 1000, 0., 1.);
1213  fHistProbPion = new TH1F("fHistProbPion", "Pion at decay point: prob.", 1000, 0., 1.);
1214  fHistProbLambda = new TH1F("fHistProbLambda", "Prob (#Lambda) KF", 1000, 0., 1.);
1215  fHistProbLambda_chi2cut = new TH1F("fHistProbLambda_chi2cut", "Prob (#Lambda) KF", 1000, 0., 1.);
1216  fHistProbLambda_Match = new TH1F("fHistProbLambda_Match", "Prob (#Lambda) KF", 1000, 0., 1.);
1217  fHistProbAntiLambda = new TH1F("fHistProbAntiLambda", "Prob (#bar{#Lambda}) KF", 1000, 0., 1.);
1218  fHistProbAntiLambda_chi2cut = new TH1F("fHistProbAntiLambda_chi2cut", "Prob (#bar{#Lambda}) KF", 1000, 0., 1.);
1219  fHistProbAntiLambda_Match = new TH1F("fHistProbAntiLambda_Match", "Prob (#bar{#Lambda}) KF", 1000, 0., 1.);
1220  fHistProbLambdaTot = new TH1F("fHistProbLambdaTot", "Prob (#Lambda+#bar{#Lambda}) KF", 1000, 0., 1.);
1221  fHistProbXiMinus = new TH1F("fHistProbXiMinus", "Prob (#Xi^{-}) KF", 1000, 0., 1.);
1222  fHistProbXiMinus_chi2cut = new TH1F("fHistProbXiMinus_chi2cut", "Prob (#Xi^{-}) KF", 1000, 0., 1.);
1223  fHistProbXiPlus = new TH1F("fHistProbXiPlus", "Prob (#Xi^{+}) KF", 1000, 0., 1.);
1224  fHistProbXiPlus_chi2cut = new TH1F("fHistProbXiPlus_chi2cut", "Prob (#Xi^{+}) KF", 1000, 0., 1.);
1225  fHistProbXicZero = new TH1F("fHistProbXicZero", "Prob (#Xi_{c}^{0}) KF", 1000, 0., 1.);
1226  fHistProbXicZero_chi2cut = new TH1F("fHistProbXicZero_chi2cut", "Prob (#Xi_{c}^{0}) KF", 1000, 0., 1.);
1227  fHistProbAntiXicZero = new TH1F("fHistProbAntiXicZero", "Prob (#bar{#Xi_{c}^{0}}) KF", 1000, 0., 1.);
1228  fHistProbAntiXicZero_chi2cut = new TH1F("fHistProbAntiXicZero_chi2cut", "Prob (#bar{#Xi_{c}^{0}}) KF", 1000, 0., 1.);
1229  fHistChi2ndfXiMinus = new TH1F("fHistChi2ndfXiMinus", "fHistChi2ndfXiMinus", 2000, -100., 100.);
1230  fHistChi2ndfXiPlus = new TH1F("fHistChi2ndfXiPlus", "fHistChi2ndfXiPlus", 2000, -100., 100.);
1231  fHistChi2ndfXiTot = new TH1F("fHistChi2ndfXiTot", "fHistChi2ndfXiTot", 2000, -100., 100.);
1232  fHistChi2ndfXicZero = new TH1F("fHistChi2ndfXicZero", "fHistChi2ndfXicZero", 2000, -100., 100.);
1233  fHistChi2ndfAntiXicZero = new TH1F("fHistChi2ndfAntiXicZero", "fHistChi2ndfAntiXicZero", 2000, -100., 100.);
1234  fHistChi2ndfXicZeroTot = new TH1F("fHistChi2ndfXicZeroTot", "fHistChi2ndfXicZeroTot", 2000, -100., 100.);
1235  fHistDecayLLambda = new TH1F("fHistDecayLLambda", "fHistDecayLLambda", 1000, -100., 100.);
1236  fHistDecayLAntiLambda = new TH1F("fHistDecayLAntiLambda", "fHistDecayLAntiLambda", 1000, -100., 100.);
1237  fHistDecayLLambdaTot = new TH1F("fHistDecayLLambdaTot", "fHistDecayLLambdaTot", 1000, -100., 100.);
1238  fHistDecayLXiMinus = new TH1F("fHistDecayLXiMinus", "fHistDecayLXiMinus", 1000, -100., 100.);
1239  fHistDecayLXiPlus = new TH1F("fHistDecayLXiPlus", "fHistDecayLXiPlus", 1000, -100., 100.);
1240  fHistDecayLXiTot = new TH1F("fHistDecayLXiTot", "fHistDecayLXiTot", 1000, -100., 100.);
1241  fHistDecayLXicZero = new TH1F("fHistDecayLXicZero", "fHistDecayLXicZero", 1000, -100., 100.);
1242  fHistDecayLAntiXicZero = new TH1F("fHistDecayLAntiXicZero", "fHistDecayLAntiXicZero", 1000, -100., 100.);
1243  fHistDecayLXicZeroTot = new TH1F("fHistDecayLXicZeroTot", "fHistDecayLXicZeroTot", 1000, -100., 100.);
1244  fHistCosPA_Lambda = new TH1F("fHistCosPA_Lambda", "CosPA_Lambda", 200, -1., 1.);
1245  fHistCosPA_AntiLambda = new TH1F("fHistCosPA_AntiLambda", "CosPA_AntiLambda", 200, -1., 1.);
1246  fHistCosPA_LambdaTot = new TH1F("fHistCosPA_LambdaTot", "CosPA_LambdaTot", 200, -1., 1.);
1247  fHistCosPA_XiMinus = new TH1F("fHistCosPA_XiMinus", "CosPA_XiMinus", 200, -1., 1.);
1248  fHistCosPA_XiPlus = new TH1F("fHistCosPA_XiPlus", "CosPA_XiPlus", 200, -1., 1.);
1249  fHistCosPA_XiTot = new TH1F("fHistCosPA_XiTot", "CosPA_XiTot", 200, -1., 1.);
1250  fHistPVx = new TH1F("fHistPVx", "fHistPVx", 2000, -1., 1.);
1251  fHistPVy = new TH1F("fHistPVy", "fHistPVy", 2000, -1., 1.);
1252  fHistPVz = new TH1F("fHistPVz", "fHistPVz", 400, -20., 20.);
1253  fHCentrality = new TH1F("fHCentrality", "counter", 100, 0., 100.);
1254 
1255 
1256  fOutputList->Add(fHistEvents); // don't forget to add it to the list! the list will be written to file, so if you want
1257  fOutputList->Add(fHTrigger);
1274  fOutputList->Add(fHistMassK0S);
1275  /*
1276  fOutputList->Add(fGenHistRapidity_Lambda);
1277  fOutputList->Add(fRecHistRapidity_Lambda_offline);
1278  fOutputList->Add(fRecHistRapidity_Lambda_wSTD);
1279  fOutputList->Add(fGenHistRapidity_AntiLambda);
1280  fOutputList->Add(fRecHistRapidity_AntiLambda_wSTD);
1281  fOutputList->Add(fHistMCGen_Lambda_Pt);
1282  fOutputList->Add(fHistMCGen_AntiLambda_Pt);
1283  fOutputList->Add(fHistMCGen_Lambda_Pt_wYcut);
1284  fOutputList->Add(fHistMCGen_AntiLambda_Pt_wYcut);
1285  fOutputList->Add(fHistMCGen_XiMinus_Pt);
1286  fOutputList->Add(fHistMCGen_XiPlus_Pt);
1287  fOutputList->Add(fHistMCGen_XiMinus_Pt_wYcut);
1288  fOutputList->Add(fHistMCGen_XiPlus_Pt_wYcut);
1289  fOutputList->Add(fCounterGen_Cuts_XiMinus);
1290  fOutputList->Add(fCounterGen_Cuts_XiPlus);
1291  fOutputList->Add(fCounterRecMC_Cuts_XiMinus);
1292  fOutputList->Add(fCounterRecMC_Cuts_XiPlus);
1293  fOutputList->Add(fCounterRec_Cuts_XiMinus);
1294  fOutputList->Add(fCounterRec_Cuts_XiPlus);
1295  fOutputList->Add(f2DCounterRecMC_CutsVsPt_Lambda);
1296  fOutputList->Add(f2DCounterRecMC_CutsVsPt_AntiLambda);
1297  fOutputList->Add(f2DCounterRecMC_CutsVsPt_XiMinus);
1298  fOutputList->Add(f2DCounterRecMC_CutsVsPt_XiPlus);
1299  fOutputList->Add(f2DHistMassPtLambda);
1300  fOutputList->Add(f2DHistMassPtAntiLambda);
1301  fOutputList->Add(f2DHistMassPtXiMinus);
1302  fOutputList->Add(f2DHistMassPtXiPlus);
1303 // fOutputList->Add(f2DHistMassPtXicZero_woQtCut);
1304  fOutputList->Add(f2DHistMassPtXicZero);
1305  fOutputList->Add(f2DHistMassPtAntiXicZero);
1306  fOutputList->Add(f2DHistMassPtXicZeroTot);
1307  */
1308  /*
1309  fOutputList->Add(f2DHistChi2vsNDF_Lambda);
1310  fOutputList->Add(f2DHistChi2vsNDF_Lambda_Match);
1311  fOutputList->Add(f2DHistChi2vsNDF_AntiLambda);
1312  fOutputList->Add(f2DHistXKFMCvsPt_Proton);
1313  fOutputList->Add(f2DHistYKFMCvsPt_Proton);
1314  fOutputList->Add(f2DHistZKFMCvsPt_Proton);
1315  fOutputList->Add(f2DHistXPULLvsPt_Proton);
1316  fOutputList->Add(f2DHistYPULLvsPt_Proton);
1317  fOutputList->Add(f2DHistZPULLvsPt_Proton);
1318  fOutputList->Add(f2DHistXKFMCvsPt_Pion);
1319  fOutputList->Add(f2DHistYKFMCvsPt_Pion);
1320  fOutputList->Add(f2DHistZKFMCvsPt_Pion);
1321  fOutputList->Add(f2DHistXPULLvsPt_Pion);
1322  fOutputList->Add(f2DHistYPULLvsPt_Pion);
1323  fOutputList->Add(f2DHistZPULLvsPt_Pion);
1324  fOutputList->Add(f2DHistXRecMCvsPt_Lambda);
1325  fOutputList->Add(f2DHistXRecMCvsPt_AntiLambda);
1326  fOutputList->Add(f2DHistXV0MCvsPt_Lambda);
1327  fOutputList->Add(f2DHistPtRecMCvsPt_Lambda);
1328  fOutputList->Add(f2DHistPtV0MCvsPt_Lambda);
1329  fOutputList->Add(f2DHistPtRecMCvsPt_AntiLambda);
1330  fOutputList->Add(f2DHistMassRecMCvsPt_Lambda);
1331  fOutputList->Add(f2DHistMassV0MCvsPt_Lambda);
1332  fOutputList->Add(f2DHistMassRecMCvsPt_AntiLambda);
1333  fOutputList->Add(f2DHistXPULLvsPt_Lambda);
1334  fOutputList->Add(f2DHistXPULLvsPt_Lambda_V0);
1335  fOutputList->Add(f2DHistXPULLvsPt_AntiLambda);
1336  fOutputList->Add(f2DHistPtPULLvsPt_Lambda);
1337  fOutputList->Add(f2DHistPtPULLvsPt_Lambda_V0);
1338  fOutputList->Add(f2DHistPtPULLvsPt_AntiLambda);
1339  fOutputList->Add(f2DHistMassPULLvsPt_Lambda);
1340  fOutputList->Add(f2DHistMassPULLvsPt_Lambda_V0);
1341  fOutputList->Add(f2DHistMassPULLvsPt_AntiLambda);
1342  fOutputList->Add(f2DHistMassPULLvsRadius_Lambda);
1343  fOutputList->Add(f2DHistMassPULLvsRadius_AntiLambda);
1344  */
1345 // fOutputList->Add(f2DHistArmenterosPodolanski_FirstDaugPos);
1346 // fOutputList->Add(f2DHistArmenterosPodolanski_FirstDaugNeg);
1347 // fOutputList->Add(f2DHistArmenterosPodolanski_candidate);
1348  /*
1349  fOutputList->Add(fHistOnFlyStatus);
1350  fOutputList->Add(fHistOnFlyStatus_FirstDaugPos);
1351  fOutputList->Add(fHistOnFlyStatus_FirstDaugNeg);
1352  fOutputList->Add(fHistChargeV0);
1353  fOutputList->Add(fHistNDaughterV0);
1354  fOutputList->Add(fHistNProngV0);
1355  fOutputList->Add(fHistChargeFirstDaughter);
1356  fOutputList->Add(fHistChargeSecondDaughter);
1357  fOutputList->Add(f2DHistChargeDaughters);
1358  fOutputList->Add(f2DHistV0XY_OnFly);
1359  fOutputList->Add(f2DHistV0XY_Offline);
1360  */
1361  /*
1362  fOutputList->Add(f2DHistV0XY_FirstDaugPos);
1363  fOutputList->Add(f2DHistLambdaXY);
1364  fOutputList->Add(f2DHistXiMinusXY_DV);
1365  fOutputList->Add(f2DHistXiMinusXY_PV);
1366  fOutputList->Add(f2DHistXiPlusXY_DV);
1367  fOutputList->Add(f2DHistXiPlusXY_PV);
1368  */
1369  /*
1370  fOutputList->Add(f2DHistV0XY_FirstDaugNeg);
1371  fOutputList->Add(fHistXtrkP);
1372  fOutputList->Add(fHistYtrkP);
1373  fOutputList->Add(fHistZtrkP);
1374  fOutputList->Add(fHistXtrkP_XYZv);
1375  fOutputList->Add(fHistYtrkP_XYZv);
1376  fOutputList->Add(fHistZtrkP_XYZv);
1377  fOutputList->Add(fHistXtrkP_Rec_MC);
1378  fOutputList->Add(fHistYtrkP_Rec_MC);
1379  fOutputList->Add(fHistZtrkP_Rec_MC);
1380  fOutputList->Add(fHistXtrkP_Rec_MC_XYZv);
1381  fOutputList->Add(fHistYtrkP_Rec_MC_XYZv);
1382  fOutputList->Add(fHistZtrkP_Rec_MC_XYZv);
1383  fOutputList->Add(fHistXtrkN);
1384  fOutputList->Add(fHistYtrkN);
1385  fOutputList->Add(fHistZtrkN);
1386  fOutputList->Add(fHistXtrkN_XYZv);
1387  fOutputList->Add(fHistYtrkN_XYZv);
1388  fOutputList->Add(fHistZtrkN_XYZv);
1389  fOutputList->Add(fHistXtrkN_Rec_MC);
1390  fOutputList->Add(fHistYtrkN_Rec_MC);
1391  fOutputList->Add(fHistZtrkN_Rec_MC);
1392  fOutputList->Add(fHistXtrkN_Rec_MC_XYZv);
1393  fOutputList->Add(fHistYtrkN_Rec_MC_XYZv);
1394  fOutputList->Add(fHistZtrkN_Rec_MC_XYZv);
1395  fOutputList->Add(fHistXLambdaTot);
1396  fOutputList->Add(fHistYLambdaTot);
1397  fOutputList->Add(fHistZLambdaTot);
1398  fOutputList->Add(fHistXLambda_KF_MC);
1399  fOutputList->Add(fHistYLambda_KF_MC);
1400  fOutputList->Add(fHistZLambda_KF_MC);
1401  fOutputList->Add(fHistXProton_KF_MC);
1402  fOutputList->Add(fHistYProton_KF_MC);
1403  fOutputList->Add(fHistZProton_KF_MC);
1404  fOutputList->Add(fHistXPion_KF_MC);
1405  fOutputList->Add(fHistYPion_KF_MC);
1406  fOutputList->Add(fHistZPion_KF_MC);
1407  fOutputList->Add(fHistXLambda_V0_MC);
1408  fOutputList->Add(fHistXAntiLambda_Rec_MC);
1409  fOutputList->Add(fHistYAntiLambda_Rec_MC);
1410  fOutputList->Add(fHistZAntiLambda_Rec_MC);
1411  fOutputList->Add(fHistXLambda_PULL);
1412  fOutputList->Add(fHistYLambda_PULL);
1413  fOutputList->Add(fHistZLambda_PULL);
1414  fOutputList->Add(fHistXProton_PULL);
1415  fOutputList->Add(fHistYProton_PULL);
1416  fOutputList->Add(fHistZProton_PULL);
1417  fOutputList->Add(fHistXPion_PULL);
1418  fOutputList->Add(fHistYPion_PULL);
1419  fOutputList->Add(fHistZPion_PULL);
1420  fOutputList->Add(fHistXAntiLambda_PULL);
1421  fOutputList->Add(fHistYAntiLambda_PULL);
1422  fOutputList->Add(fHistZAntiLambda_PULL);
1423  fOutputList->Add(fHistXXiTot);
1424  fOutputList->Add(fHistYXiTot);
1425  fOutputList->Add(fHistZXiTot);
1426  fOutputList->Add(fHistXXicZeroTot);
1427  fOutputList->Add(fHistYXicZeroTot);
1428  fOutputList->Add(fHistZXicZeroTot);
1429  fOutputList->Add(fHistPtLambda);
1430  fOutputList->Add(fHistPtAntiLambda);
1431  fOutputList->Add(fHistPtLambdaTot);
1432  fOutputList->Add(fHistPtXiMinus);
1433  fOutputList->Add(fHistPtXiPlus);
1434  fOutputList->Add(fHistPtXiTot);
1435  fOutputList->Add(fHistPtXicZero);
1436  fOutputList->Add(fHistPtAntiXicZero);
1437  fOutputList->Add(fHistPtXicZeroTot);
1438  */
1439 
1440  /*
1441  fOutputList->Add(fHistMassLambda_woCut);
1442  fOutputList->Add(fHistMassAntiLambda_woCut);
1443 // fOutputList->Add(fHistMassLambdaCheck);
1444 // fOutputList->Add(fHistMassAntiLambdaCheck);
1445  fOutputList->Add(fHistMassLambda_wSTDv0Cut);
1446  fOutputList->Add(fHistMassAntiLambda_wSTDv0Cut);
1447  fOutputList->Add(fHistMassLambda_BeforeSecSel);
1448  fOutputList->Add(fHistMassAntiLambda_BeforeSecSel);
1449  fOutputList->Add(fHistMassLambda);
1450  fOutputList->Add(fHistMassLambda_woArmenterosPodolanskiCut);
1451  fOutputList->Add(fHistMassLambda_woMassCut);
1452  fOutputList->Add(fHistMassAntiLambda);
1453  fOutputList->Add(fHistMassAntiLambda_woMassCut);
1454  fOutputList->Add(fHistMassLambdaTot);
1455 // fOutputList->Add(fHistMassLambda_Match);
1456 // fOutputList->Add(fHistMassAntiLambda_Match);
1457 // fOutputList->Add(fHistMassLambdaTot_Match);
1458 // fOutputList->Add(fHistMassLambda_V0);
1459 // fOutputList->Add(fHistMassAntiLambda_V0);
1460 // fOutputList->Add(fHistMassLambdaTot_V0);
1461 // fOutputList->Add(fHistMassLambda_KF_V0);
1462 // fOutputList->Add(fHistMassLambda_KF_MC);
1463 // fOutputList->Add(fHistMassLambda_V0_MC);
1464 // fOutputList->Add(fHistMassAntiLambda_KF_V0);
1465 // fOutputList->Add(fHistMassAntiLambda_KF_MC);
1466 // fOutputList->Add(fHistMassLambda_PULL_KF);
1467 // fOutputList->Add(fHistMassAntiLambda_PULL_KF);
1468  fOutputList->Add(fHistMassLambda_M);
1469  fOutputList->Add(fHistMassAntiLambda_M);
1470 // fOutputList->Add(fHistMassLambdaTot_M);
1471 // fOutputList->Add(fHistMassLambda_MV);
1472 // fOutputList->Add(fHistMassAntiLambda_MV);
1473 // fOutputList->Add(fHistMassLambdaTot_MV);
1474  fOutputList->Add(fHistMassXiMinus);
1475  fOutputList->Add(fHistMassXiMinus_M);
1476 // fOutputList->Add(fHistMassXiMinus_Match);
1477  fOutputList->Add(fHistMassXiPlus);
1478  fOutputList->Add(fHistMassXiTot);
1479  fOutputList->Add(fHistMassXicZero_woQtCut);
1480  fOutputList->Add(fHistMassXicZero);
1481  fOutputList->Add(fHistMassAntiXicZero);
1482  fOutputList->Add(fHistMassXicZeroTot);
1483 
1484  fOutputList->Add(fHistQtDiffPionXiMinus);
1485  fOutputList->Add(fHistQtDiffPionXiPlus);
1486 
1487 // fOutputList->Add(fHistMassXiMinus2);
1488 // fOutputList->Add(fHistChi2ndfProton);
1489 // fOutputList->Add(fHistChi2ndfPion);
1490  fOutputList->Add(fHistChi2ndfLambda);
1491 // fOutputList->Add(fHistChi2ndfLambda_Match);
1492 // fOutputList->Add(fHistChi2ndfAntiLambda_Match);
1493 // fOutputList->Add(fHistChi2ndfLambdaTot);
1494 // fOutputList->Add(fHistProbProton);
1495 // fOutputList->Add(fHistProbPion);
1496  fOutputList->Add(fHistProbLambda);
1497  fOutputList->Add(fHistProbLambda_chi2cut);
1498 // fOutputList->Add(fHistProbLambda_Match);
1499  fOutputList->Add(fHistChi2ndfAntiLambda);
1500  fOutputList->Add(fHistProbAntiLambda);
1501  fOutputList->Add(fHistProbAntiLambda_chi2cut);
1502 // fOutputList->Add(fHistProbAntiLambda_Match);
1503  fOutputList->Add(fHistProbLambdaTot);
1504  fOutputList->Add(fHistChi2ndfXiMinus);
1505  fOutputList->Add(fHistProbXiMinus);
1506  fOutputList->Add(fHistProbXiMinus_chi2cut);
1507  fOutputList->Add(fHistChi2ndfXiPlus);
1508  fOutputList->Add(fHistProbXiPlus);
1509  fOutputList->Add(fHistProbXiPlus_chi2cut);
1510  fOutputList->Add(fHistChi2ndfXicZero);
1511  fOutputList->Add(fHistProbXicZero);
1512  fOutputList->Add(fHistProbXicZero_chi2cut);
1513  fOutputList->Add(fHistChi2ndfAntiXicZero);
1514  fOutputList->Add(fHistProbAntiXicZero);
1515  fOutputList->Add(fHistProbAntiXicZero_chi2cut);
1516 // fOutputList->Add(fHistChi2ndfXiPlus);
1517 // fOutputList->Add(fHistChi2ndfXiTot);
1518 // fOutputList->Add(fHistChi2ndfXicZero);
1519 // fOutputList->Add(fHistChi2ndfAntiXicZero);
1520 // fOutputList->Add(fHistChi2ndfXicZeroTot);
1521  fOutputList->Add(fHistDecayLLambda);
1522  fOutputList->Add(fHistDecayLAntiLambda);
1523  fOutputList->Add(fHistDecayLLambdaTot);
1524  fOutputList->Add(fHistDecayLXiMinus);
1525  fOutputList->Add(fHistDecayLXiPlus);
1526  fOutputList->Add(fHistDecayLXiTot);
1527  fOutputList->Add(fHistDecayLXicZero);
1528  fOutputList->Add(fHistDecayLAntiXicZero);
1529  fOutputList->Add(fHistDecayLXicZeroTot);
1530 // fOutputList->Add(fHistCosPA_Lambda);
1531 // fOutputList->Add(fHistCosPA_AntiLambda);
1532 // fOutputList->Add(fHistCosPA_LambdaTot);
1533 // fOutputList->Add(fHistCosPA_XiMinus);
1534 // fOutputList->Add(fHistCosPA_XiPlus);
1535 // fOutputList->Add(fHistCosPA_XiTot);
1536  fOutputList->Add(fHistPVx);
1537  fOutputList->Add(fHistPVy);
1538  fOutputList->Add(fHistPVz);
1539 // fOutputList->Add(fHCentrality);
1540  */
1541 
1542 /*
1543  fListCuts = new TList();
1544  fListCuts->SetOwner();
1545  fListCuts->SetName("ListCuts");
1546  fListCuts->Add(new AliRDHFCutsKFP(*fAnaCuts));
1547  PostData(3, fListCuts);
1548 */
1549 
1550  // Counter for Normalization
1551  TString normName="NormalizationCounter";
1552  AliAnalysisDataContainer *cont = GetOutputSlot(2)->GetContainer();
1553  if(cont) normName = (TString)cont->GetName();
1554  fCounter = new AliNormalizationCounter(normName.Data());
1555  fCounter->Init();
1556  PostData(2, fCounter);
1557  DefineEvent();
1558  PostData(3, fTree_Event); // postdata will notify the analysis manager of changes / updates to the
1559 
1561  PostData(4, fTree_Xic0);
1562 
1564  PostData(5, fTree_Xic0MCGen);
1565 
1566  return;
1567  // fOutputList object. the manager will in the end take care of writing your output to file
1568  // so it needs to know what's in the output
1569 }
1570 //_____________________________________________________________________________
1572 {
1573  // user exec
1574  // this function is called once for each event
1575  // the manager will take care of reading the events from file, and with the static function InputEvent() you
1576  // have access to the current event.
1577  // once you return from the UserExec function, the manager will retrieve the next event from the chain
1578 
1579  if (!fInputEvent) { // if the event is empty (getting it failed) skip this event
1580  AliError("NO EVENT FOUND!");
1581  return;
1582  }
1583  AliAODEvent* AODEvent = dynamic_cast<AliAODEvent*>(fInputEvent); // get an event (called AODEvent) from the input file
1584  // there's another event format (ESD) which works in a similar way
1585  // but is more cpu/memory unfriendly. for now, we'll stick with aod's
1586 
1587  fHistEvents->Fill(1);
1588 
1589  //--------------------------------------------------------------
1590  // First check if the event has magnetic field and proper vertex
1591  //--------------------------------------------------------------
1592 
1593  fBzkG = (Double_t)AODEvent->GetMagneticField();
1594  if (TMath::Abs(fBzkG)<0.001) return;
1595  KFParticle::SetField(fBzkG);
1596 
1597  fCounter->StoreEvent(AODEvent,fAnaCuts,fIsMC);
1598 
1599  fpVtx = (AliAODVertex*)AODEvent->GetPrimaryVertex();
1600  if (!fpVtx) return;
1601  fHistEvents->Fill(2);
1602 
1603  //------------------------------------------------
1604  // MC analysis setting
1605  //------------------------------------------------
1606 
1607  TClonesArray *mcArray = 0;
1608  AliAODMCHeader *mcHeader = 0;
1609 
1610  if (fIsMC) {
1611  fMCEvent = MCEvent(); // get the corresponding MC event fMCEvent
1612  if (!fMCEvent) {
1613  Printf("ERROR: Could not retrieve MC event");
1614  return;
1615  }
1616 
1617  // MC array need for maching
1618  mcArray = dynamic_cast<TClonesArray*>(AODEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1619  if ( !mcArray ) {
1620  AliError("Could not find Monte-Carlo in AOD");
1621  return;
1622  }
1623  fHistEvents->Fill(7); // number of MC array exist
1624 
1625  // load MC header
1626  mcHeader = (AliAODMCHeader*)AODEvent->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1627  if ( !mcHeader ) {
1628  AliError("AliAnalysisTaskSEXicZero2XiPifromKFP::UserExec: MC header branch not found!\n");
1629  return;
1630  }
1631  fHistEvents->Fill(8); // number of MC header exist
1632 
1633  Double_t zMCvtx = mcHeader->GetVtxZ();
1634  if ( TMath::Abs(zMCvtx) > fAnaCuts->GetMaxVtxZ() ) {
1635  AliDebug(2,Form("Event rejected: fabs(zVtxMC)=%f > fAnaCuts->GetMaxVtxZ()=%f", zMCvtx, fAnaCuts->GetMaxVtxZ()));
1636  return;
1637  } else {
1638  fHistEvents->Fill(18);
1639  }
1640  if ((TMath::Abs(zMCvtx) < fAnaCuts->GetMaxVtxZ()) && (!fAnaCuts->IsEventRejectedDuePhysicsSelection()) && (!fAnaCuts->IsEventRejectedDueToTrigger())) {
1641  Bool_t selevt = MakeMCAnalysis(mcArray);
1642  if(!selevt) return;
1643  }
1644  }
1645 
1646 
1647  //------------------------------------------------
1648  // Event selection
1649  //------------------------------------------------
1650  Bool_t IsTriggerNotOK = fAnaCuts->IsEventRejectedDueToTrigger();
1653  if( !IsTriggerNotOK && !IsPhysSelNotOK && !IsNoVertex && fabs(fpVtx->GetZ())<fAnaCuts->GetMaxVtxZ() ) fHistEvents->Fill(3);
1654 
1655  Bool_t IsEventSelected = fAnaCuts->IsEventSelected(AODEvent);
1656  if(!IsEventSelected) {
1657 // cout<<"Why: "<<fAnaCuts->GetWhyRejection()<<endl;
1658  return;
1659  }
1660  fHistEvents->Fill(4);
1661 
1662 
1663  Bool_t IsMB = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kMB)==(AliVEvent::kMB);
1664  Bool_t IsSemi = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kSemiCentral)==(AliVEvent::kSemiCentral);
1665  Bool_t IsCent = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kCentral)==(AliVEvent::kCentral);
1666  Bool_t IsINT7 = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kINT7)==(AliVEvent::kINT7);
1667  Bool_t IsEMC7 = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()&AliVEvent::kEMC7)==(AliVEvent::kEMC7);
1668  if(IsMB) fHTrigger->Fill(1);
1669  if(IsSemi) fHTrigger->Fill(2);
1670  if(IsCent) fHTrigger->Fill(3);
1671  if(IsINT7) fHTrigger->Fill(4);
1672  if(IsEMC7) fHTrigger->Fill(5);
1673  if(IsMB||IsSemi||IsCent) fHTrigger->Fill(7);
1674  if(IsINT7||IsEMC7) fHTrigger->Fill(8);
1675  if(IsMB&&IsSemi) fHTrigger->Fill(10);
1676  if(IsMB&&IsCent) fHTrigger->Fill(11);
1677  if(IsINT7&&IsEMC7) fHTrigger->Fill(12);
1678 
1679 // AliCentrality *cent = AODEvent->GetCentrality();
1680 // Float_t Centrality = cent->GetCentralityPercentile("V0M");
1681 // fHCentrality->Fill(Centrality);
1682 
1683  //------------------------------------------------
1684  // Check if the event has v0 candidate
1685  //------------------------------------------------
1686  Int_t num_v0 = AODEvent->GetNumberOfV0s();
1687  if (num_v0>0) fHistEvents->Fill(5);
1688 
1689  //------------------------------------------------
1690  // Check if the event has cascade candidate
1691  //------------------------------------------------
1692  Int_t num_casc = AODEvent->GetNumberOfCascades();
1693  if (num_casc<=0) return;
1694  fHistEvents->Fill(6);
1695 
1696  // set primary vertex
1697  KFPVertex pVertex;
1698  Double_t pos[3],cov[6];
1699  fpVtx->GetXYZ(pos);
1700  if ( fabs(pos[2])>10. ) return; // vertex cut on z-axis direction
1701  fpVtx->GetCovarianceMatrix(cov);
1702 // if ( !CheckVertexCov(fpVtx) ) cout << "Vertex Cov. is wrong!!!" << endl;
1703  pVertex.SetXYZ((Float_t)pos[0], (Float_t)pos[1], (Float_t)pos[2]);
1704  Float_t covF[6];
1705  for (Int_t i=0; i<6; i++) { covF[i] = (Float_t)cov[i]; }
1706  pVertex.SetCovarianceMatrix(covF);
1707  pVertex.SetChi2(fpVtx->GetChi2());
1708  pVertex.SetNDF(fpVtx->GetNDF());
1709  pVertex.SetNContributors(fpVtx->GetNContributors());
1710 
1711  KFParticle PV(pVertex);
1712 
1713  fHistPVx->Fill(pos[0]);
1714  fHistPVy->Fill(pos[1]);
1715  fHistPVz->Fill(pos[2]);
1716 
1717  if(!fAnaCuts) return;
1718 
1720 
1721 /*
1722  //--------------------------------------------------------------------------------------------------------
1723  // create a translation table: fAodTrackInd(mcTrackIndex) = aodTrackIndex, or = -1 if there is no aodTrack
1724  //--------------------------------------------------------------------------------------------------------
1725 
1726  fAodTrackInd.resize(0);
1727  fAodTrackInd.resize(fMCEvent->GetNumberOfTracks(), -1);
1728 
1729  Int_t nTracks = AODEvent->GetNumberOfTracks();
1730 // cout << "number of AOD tracks == " << nTracks << endl;
1731 
1732  // loop over all aod tracks and fill fAodTrackInd
1733  for(Int_t i=0; i < nTracks; i++) { // loop ove rall these tracks
1734  AliAODTrack* track = static_cast<AliAODTrack*>(AODEvent->GetTrack(i)); // get a track (type AliAODTrack) from the event
1735  if( !track || !track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA) || track->GetID()<0 ) continue; // if we failed, skip this track
1736 // cout << "Track Label:" << track->GetLabel() << endl;
1737 // cout << "i:" << i << endl;
1738 // cout << "Track ID:" << track->GetID() << endl;
1739  if (track->GetLabel()<0) continue;
1740  fAodTrackInd[track->GetLabel()]=i;
1741  } // continue until all the tracks are processed
1742 
1743  //--------------------------------------------------------------
1744  // we loop over all mc particles
1745  // check whether it is a Xi with two daughters
1746  // if the corresponding aod tracks exist
1747  // find the mother via kfparticle
1748  //--------------------------------------------------------------
1749 
1750  // loop over all primary MC particle
1751 // cout << "number of MC tracks == " << fMCEvent->GetNumberOfTracks() << endl;
1752 // cout << "number of MC particles == " << mcArray->GetEntriesFast() << endl;
1753  for (Long_t iPart=0; iPart < mcArray->GetEntriesFast(); iPart++) {
1754  AliAODMCParticle* mcPart = static_cast<AliAODMCParticle*>(mcArray->At(iPart));
1755  if (!mcPart) continue;
1756 // cout << "PDG CODE = " << mcPart->GetPdgCode() << endl;
1757 
1758  Int_t pdgDaughter[2] = {3312, 211};
1759  Int_t daughterIndex[2] = {0, 1};
1760 // MatchToMCXic0(mcArray, 4132, 2, daughterIndex, pdgDaughter);
1761 
1762  }
1763  }
1764 */
1765 
1766 
1767 //------------------------------------------------
1768 // Main analysis done in this function
1769 //------------------------------------------------
1770 
1771  fPID = fInputHandler->GetPIDResponse();
1772 // MakeAnaXicZeroFromV0(AODEvent, mcArray, PV);
1773  MakeAnaXicZeroFromCasc(AODEvent, mcArray, PV);
1774 
1775  PostData(2, fCounter);
1776  PostData(3, fTree_Event); // stream the results the analysis of this event to
1777  // the output manager which will take care of writing
1778  // it to a file
1779  PostData(4, fTree_Xic0);
1780  PostData(5, fTree_Xic0MCGen);
1781 
1782  return;
1783 }
1784 //_____________________________________________________________________________
1786 {
1787  // terminate
1788  // called at the END of the analysis (when all events are processed)
1789 /*
1790  TCanvas *c1 = new TCanvas();
1791  fHistDecayLLambda->Draw();
1792  TLine *lLPDG = new TLine(7.89, 0, 7.89, 1e10);
1793  lLPDG->SetLineColor(2);
1794  lLPDG->Draw();
1795 
1796  TCanvas *c2 = new TCanvas();
1797  fHistDecayLXiMinus->Draw();
1798  TLine *lXiPDG = new TLine(4.91, 0, 4.91, 1e10);
1799  lXiPDG->SetLineColor(2);
1800  lXiPDG->Draw();
1801 */
1802  return;
1803 }
1804 
1805 //_____________________________________________________________________________
1807 {
1808  // Analyse AliAODMCParticle
1809 
1810  Double_t Num_XicPM = 0;
1811  Double_t Num_Xic0 = 0;
1812  Int_t nmcpart = mcArray->GetEntriesFast();
1813  Int_t NDaughters = 2;
1814 
1815  for(Int_t i=0;i<nmcpart;i++) {
1816  AliAODMCParticle *mcpart = NULL;
1817  mcpart = (AliAODMCParticle*) mcArray->At(i);
1818 
1819 
1820 
1821 
1822  fHistMCpdg_All->Fill(mcpart->GetPdgCode());
1823 
1824 
1825 
1826  /*
1827  // =============== check generated particles in MC =====================
1828 
1829  if ( TMath::Abs(mcpart->GetPdgCode())==4232 ) { // Xic+
1830 // cout << "Particle: " << mcpart->GetPdgCode() << endl;
1831 // cout << "Daughters: " << endl;
1832  for(Int_t idau=mcpart->GetDaughterFirst();idau<=mcpart->GetDaughterLast();idau++) {
1833  if(idau<0) break;
1834  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
1835  fHistMCpdg_Dau_XicPM->Fill(mcdau->GetPdgCode());
1836 // cout << mcdau->GetPdgCode() << endl;
1837  }
1838  }
1839 
1840  if ( TMath::Abs(mcpart->GetPdgCode())==4132 ) { // Xic0
1841  cout << "==Xic0 Flag: " << mcpart->GetFlag() << "==" << endl;
1842  cout << "Daughters: " << endl;
1843  for(Int_t idau=mcpart->GetDaughterFirst();idau<=mcpart->GetDaughterLast();idau++) {
1844  if(idau<0) break;
1845  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
1846  fHistMCpdg_Dau_XicZero->Fill(mcdau->GetPdgCode());
1847 // cout << mcdau->GetPdgCode() << endl;
1848 // cout << "Flag:" << mcdau->GetFlag() << endl;
1849  if ( TMath::Abs(mcdau->GetPdgCode())==211 ) {
1850  cout << " Pi from Xic0 Flag:" << mcdau->GetFlag() << endl;
1851  }
1852 
1853  if ( TMath::Abs(mcdau->GetPdgCode())==3312 ) {
1854  cout << " Xi from Xic0 Flag:" << mcdau->GetFlag() << endl;
1855  for(Int_t idau=mcdau->GetDaughterFirst();idau<=mcdau->GetDaughterLast();idau++) {
1856  if(idau<0) break;
1857  AliAODMCParticle *mcdau1 = (AliAODMCParticle*) mcArray->At(idau);
1858  if ( TMath::Abs(mcdau1->GetPdgCode())==211 ) {
1859  cout << " Pi from Xi Flag:" << mcdau1->GetFlag() << endl;
1860  }
1861  if ( TMath::Abs(mcdau1->GetPdgCode())==3122 ) {
1862  cout << " Lambda from Xi Flag:" << mcdau1->GetFlag() << endl;
1863  for(Int_t idau=mcdau1->GetDaughterFirst();idau<=mcdau1->GetDaughterLast();idau++) {
1864  if(idau<0) break;
1865  AliAODMCParticle *mcdau2 = (AliAODMCParticle*) mcArray->At(idau);
1866  if ( TMath::Abs(mcdau2->GetPdgCode())==211 ) {
1867  cout << " Pi from Lambda Flag:" << mcdau2->GetFlag() << endl;
1868  }
1869  if ( TMath::Abs(mcdau2->GetPdgCode())==2212 ) {
1870  cout << " Proton from Lambda Flag:" << mcdau2->GetFlag() << endl;
1871  }
1872  }
1873  }
1874  }
1875  }
1876  }
1877  }
1878  // ======================================================================
1879  */
1880 
1881 
1882 
1883 
1884 
1885 // if ( mcpart->GetNDaughters() != NDaughters ) continue;
1886 
1887 
1888 
1889 
1890 
1891 
1892 
1893 
1894  // ======================================= Xic0 ====================================================
1895  if ( TMath::Abs(mcpart->GetPdgCode())==4132 && mcpart->GetNDaughters()==NDaughters ) { // 4132: Xic0
1896  Bool_t pifromXic_flag = kFALSE;
1897  Bool_t xi_flag = kFALSE;
1898  AliAODMCParticle *mcpipart = NULL;
1899  AliAODMCParticle *mccascpart = NULL;
1900  AliAODMCParticle *mcv0part = NULL;
1901  for(Int_t idau=mcpart->GetDaughterFirst();idau<=mcpart->GetDaughterLast();idau++) {
1902  if(idau<0) break;
1903  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
1904  if(TMath::Abs(mcdau->GetPdgCode())==211) { // 211: pion
1905  pifromXic_flag = kTRUE;
1906  mcpipart = mcdau;
1907  }
1908  if(TMath::Abs(mcdau->GetPdgCode())==3312) { // 3312: Xi
1909  xi_flag = kTRUE;
1910  mccascpart = mcdau;
1911  }
1912  }
1913 
1914  Int_t decaytype = -9999;
1915  if ( pifromXic_flag && xi_flag ) decaytype = 0;
1916  if ( pifromXic_flag && xi_flag) fHistMCXicZeroDecayType->Fill(1);
1917  if (!pifromXic_flag && xi_flag) fHistMCXicZeroDecayType->Fill(2);
1918  if ( pifromXic_flag && !xi_flag) fHistMCXicZeroDecayType->Fill(3);
1919  if (!pifromXic_flag && !xi_flag) fHistMCXicZeroDecayType->Fill(4);
1920 
1921  if (decaytype==0) FillTreeGenXic0(mcpart,mcpipart,mccascpart,decaytype);
1922  } // for Xic0
1923  // ======================================= Xi ====================================================
1924  if ( TMath::Abs(mcpart->GetPdgCode())==3312 && mcpart->GetNDaughters()==NDaughters ) { // 3312: Xi
1925  Bool_t pifromXi_flag = kFALSE;
1926  Bool_t v0_flag = kFALSE;
1927  Bool_t pifromLam_flag = kFALSE;
1928  Bool_t prfromLam_flag = kFALSE;
1929  AliAODMCParticle *mcv0part = NULL;
1930  for(Int_t idau=mcpart->GetDaughterFirst();idau<=mcpart->GetDaughterLast();idau++) {
1931  if(idau<0) break;
1932  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
1933  if(TMath::Abs(mcdau->GetPdgCode())==211){ // 211: pion
1934  pifromXi_flag = kTRUE;
1935  }
1936  if(TMath::Abs(mcdau->GetPdgCode())==3122 && mcdau->GetNDaughters()==NDaughters) { // 3122: lambda
1937  v0_flag = kTRUE;
1938  mcv0part = mcdau;
1939  for(Int_t jdau=mcv0part->GetDaughterFirst();jdau<=mcv0part->GetDaughterLast();jdau++) {
1940  if (jdau<0) break;
1941  AliAODMCParticle *mcdau_Lam = (AliAODMCParticle*) mcArray->At(jdau);
1942  if(TMath::Abs(mcdau_Lam->GetPdgCode())==211) pifromLam_flag = kTRUE;
1943  if(TMath::Abs(mcdau_Lam->GetPdgCode())==2212) prfromLam_flag = kTRUE;
1944  }
1945  }
1946  }
1947 
1948  Int_t decaytype = -9999;
1949  if ( pifromXi_flag && v0_flag && pifromLam_flag && prfromLam_flag) decaytype = 0;
1950  if ( pifromXi_flag && v0_flag) fHistMCXiDecayType->Fill(1);
1951  if (!pifromXi_flag && v0_flag) fHistMCXiDecayType->Fill(2);
1952  if ( pifromXi_flag && !v0_flag) fHistMCXiDecayType->Fill(3);
1953  if (!pifromXi_flag && !v0_flag) fHistMCXiDecayType->Fill(4);
1954 
1955  if (decaytype==0) {
1956 // FillMCCascROOTObjects(mcpart, mcArray);
1957  if (mcpart->GetPdgCode()>0) {
1958  fCounterGen_Cuts_XiMinus->Fill(1);
1959  if ( mcpart->IsPrimary() ) fCounterGen_Cuts_XiMinus->Fill(2);
1960  if ( mcpart->IsPhysicalPrimary() ) {
1961  fCounterGen_Cuts_XiMinus->Fill(3);
1962  fHistMCGen_XiMinus_Pt->Fill(mcpart->Pt());
1963  if (TMath::Abs(mcpart->Y())<0.5) {
1964  fHistMCGen_XiMinus_Pt_wYcut->Fill(mcpart->Pt());
1965  }
1966  }
1967  if ( mcpart->IsSecondaryFromWeakDecay() ) fCounterGen_Cuts_XiMinus->Fill(4);
1968  if ( mcpart->IsSecondaryFromMaterial() ) fCounterGen_Cuts_XiMinus->Fill(5);
1969  if ( mcpart->IsFromSubsidiaryEvent() ) fCounterGen_Cuts_XiMinus->Fill(6);
1970  }
1971  if (mcpart->GetPdgCode()<0) {
1972  fCounterGen_Cuts_XiPlus->Fill(1);
1973  if ( mcpart->IsPrimary() ) fCounterGen_Cuts_XiPlus->Fill(2);
1974  if ( mcpart->IsPhysicalPrimary() ) {
1975  fCounterGen_Cuts_XiPlus->Fill(3);
1976  fHistMCGen_XiPlus_Pt->Fill(mcpart->Pt());
1977  if (TMath::Abs(mcpart->Y())<0.5) {
1978  fHistMCGen_XiPlus_Pt_wYcut->Fill(mcpart->Pt());
1979  }
1980  }
1981  if ( mcpart->IsSecondaryFromWeakDecay() ) fCounterGen_Cuts_XiPlus->Fill(4);
1982  if ( mcpart->IsSecondaryFromMaterial() ) fCounterGen_Cuts_XiPlus->Fill(5);
1983  if ( mcpart->IsFromSubsidiaryEvent() ) fCounterGen_Cuts_XiPlus->Fill(6);
1984  }
1985  }
1986  } // for Xi
1987  // ======================================= Lambda ====================================================
1988  if ( TMath::Abs(mcpart->GetPdgCode())==3122 && mcpart->GetNDaughters()==NDaughters ) { // 3122: Lambda
1989  Bool_t pi_flag = kFALSE;
1990  Bool_t pr_flag = kFALSE;
1991  AliAODMCParticle *mcpi = NULL;
1992  AliAODMCParticle *mcpr = NULL;
1993  for(Int_t idau=mcpart->GetDaughterFirst();idau<=mcpart->GetDaughterLast();idau++) {
1994  if (idau<0) break;
1995  AliAODMCParticle *mcdau = (AliAODMCParticle*) mcArray->At(idau);
1996  if(TMath::Abs(mcdau->GetPdgCode())==211){
1997  pi_flag = kTRUE;
1998  mcpi = mcdau;
1999  }
2000  if(TMath::Abs(mcdau->GetPdgCode())==2212){
2001  pr_flag = kTRUE;
2002  mcpr = mcdau;
2003  }
2004  }
2005  Int_t decaytype = -9999;
2006  if ( pi_flag && pr_flag) decaytype = 0;
2007  if (decaytype==0) {
2008 // FillMCV0ROOTObjects(mcpart, mcArray);
2009  if (mcpart->GetPdgCode()>0) { // Lambda
2010  if (fabs(mcpart->Y())<0.8) fCounterGen_Cuts_Lambda->Fill(1);
2011 //================================== pri. and sec. lambda =====================================================
2012  if ( mcpart->IsPrimary() && fabs(mcpart->Y())<0.8 ) fCounterGen_Cuts_Lambda->Fill(2);
2013  if ( mcpart->IsPhysicalPrimary() ) {
2014  fGenHistRapidity_Lambda->Fill(mcpart->Y());
2015  if (fabs(mcpart->Y())<0.8) {
2016  fCounterGen_Cuts_Lambda->Fill(3);
2017  fHistMCGen_Lambda_Pt->Fill(mcpart->Pt());
2018  }
2019  if (TMath::Abs(mcpart->Y())<0.5) fHistMCGen_Lambda_Pt_wYcut->Fill(mcpart->Pt());
2020  }
2021  if ( mcpart->IsSecondaryFromWeakDecay() && fabs(mcpart->Y())<0.8 ) fCounterGen_Cuts_Lambda->Fill(4);
2022  if ( mcpart->IsSecondaryFromMaterial() && fabs(mcpart->Y())<0.8 ) fCounterGen_Cuts_Lambda->Fill(5);
2023  if ( mcpart->IsFromSubsidiaryEvent() && fabs(mcpart->Y())<0.8 ) fCounterGen_Cuts_Lambda->Fill(6);
2024 
2025  /*
2026  AliAODMCParticle *mother = mcpart;
2027  Int_t IndexMother = -1;
2028  while ( mother->GetMother()>=0 ) {
2029  IndexMother = mother->GetMother();
2030  mother = (AliAODMCParticle*)mcArray->At(IndexMother);
2031  if (!mother) {
2032  printf("no MC mother particle\n");
2033  break;
2034  }
2035  Int_t pdgMother = mother->GetPdgCode();
2036  cout << "Index Mother==" << IndexMother << ", " << "PDG Mother==" << pdgMother << endl;
2037  if ( pdgMother== 3122 ) {
2038  }
2039  }
2040  cout << "***************************" << endl;
2041  */
2042  }
2043 
2044  if (mcpart->GetPdgCode()<0) { // Anti-Lambda
2045  if (fabs(mcpart->Y())<0.8) fCounterGen_Cuts_AntiLambda->Fill(1);
2046 //================================== pri. and sec. anti-lambda =====================================================
2047  if ( mcpart->IsPrimary() && fabs(mcpart->Y())<0.8 ) fCounterGen_Cuts_AntiLambda->Fill(2);
2048  if ( mcpart->IsPhysicalPrimary() ) {
2049  fGenHistRapidity_AntiLambda->Fill(mcpart->Y());
2050  if (fabs(mcpart->Y())<0.8) {
2051  fCounterGen_Cuts_AntiLambda->Fill(3);
2052  fHistMCGen_AntiLambda_Pt->Fill(mcpart->Pt());
2053  }
2054  if (TMath::Abs(mcpart->Y())<0.5) fHistMCGen_AntiLambda_Pt_wYcut->Fill(mcpart->Pt());
2055  }
2056  if ( mcpart->IsSecondaryFromWeakDecay() && fabs(mcpart->Y())<0.8 ) fCounterGen_Cuts_AntiLambda->Fill(4);
2057  if ( mcpart->IsSecondaryFromMaterial() && fabs(mcpart->Y())<0.8 ) fCounterGen_Cuts_AntiLambda->Fill(5);
2058  if ( mcpart->IsFromSubsidiaryEvent() && fabs(mcpart->Y())<0.8 ) fCounterGen_Cuts_AntiLambda->Fill(6);
2059  }
2060 
2061  } // decaytype=0
2062  } // for lambda
2063  } // all loop of MC particles
2064 
2065  return kTRUE;
2066 
2067 }
2068 
2069 //_____________________________________________________________________________
2070 void AliAnalysisTaskSEXicZero2XiPifromKFP::FillTreeGenXic0(AliAODMCParticle *mcpart, AliAODMCParticle *mcpipart, AliAODMCParticle *mccascpart, Int_t decaytype)
2071 {
2072  // Fill histograms or tree depending
2073 
2074  if(!mcpart) return;
2075  if(!mcpipart) return;
2076  if(!mccascpart) return;
2077 
2078  for(Int_t i=0;i<19;i++){
2079  fVar_Xic0MCGen[i] = -9999.;
2080  }
2081 
2083  fVar_Xic0MCGen[ 1] = decaytype;
2084  if (mcpart->IsPrimary() && (!mcpart->IsPhysicalPrimary())) fVar_Xic0MCGen[2] = 1;
2085  if (mcpart->IsPhysicalPrimary()) fVar_Xic0MCGen[2] = 2;
2086  if (mcpart->IsSecondaryFromWeakDecay()) fVar_Xic0MCGen[2] = 3;
2087  if (mcpart->IsSecondaryFromMaterial()) fVar_Xic0MCGen[2] = 4;
2088  if (mcpart->IsFromSubsidiaryEvent()) fVar_Xic0MCGen[2] = 5;
2089  fVar_Xic0MCGen[ 3] = mcpart->Eta();
2090  fVar_Xic0MCGen[ 4] = mcpart->Y();
2091  fVar_Xic0MCGen[ 5] = mcpart->Px();
2092  fVar_Xic0MCGen[ 6] = mcpart->Py();
2093  fVar_Xic0MCGen[ 7] = mcpart->Pz();
2094  fVar_Xic0MCGen[ 8] = mcpipart->Px();
2095  fVar_Xic0MCGen[ 9] = mcpipart->Py();
2096  fVar_Xic0MCGen[10] = mcpipart->Pz();
2097  fVar_Xic0MCGen[11] = mccascpart->Px();
2098  fVar_Xic0MCGen[12] = mccascpart->Py();
2099  fVar_Xic0MCGen[13] = mccascpart->Pz();
2100  fVar_Xic0MCGen[14] = mcpart->GetPdgCode();
2101  fVar_Xic0MCGen[15] = mcpipart->GetPdgCode();
2102  fVar_Xic0MCGen[16] = mccascpart->GetPdgCode();
2103  fVar_Xic0MCGen[17] = fRunNumber;
2105 
2106  const Double_t massPion = TDatabasePDG::Instance()->GetParticle(211)->Mass();
2107  const Double_t massXi = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
2108  Double_t pipx = mcpipart->Px();
2109  Double_t pipy = mcpipart->Py();
2110  Double_t pipz = mcpipart->Pz();
2111 // Double_t piE = sqrt(pipx*pipx+pipy*pipy+pipz*pipz+0.000511*0.000511);
2112  Double_t piE = sqrt(pipx*pipx+pipy*pipy+pipz*pipz+massPion*massPion);
2113  Double_t cascpx = mccascpart->Px();
2114  Double_t cascpy = mccascpart->Py();
2115  Double_t cascpz = mccascpart->Pz();
2116  Double_t cascE = sqrt(cascpx*cascpx+cascpy*cascpy+cascpz*cascpz+massXi*massXi);
2117 
2118  Double_t InvMassPiXi = sqrt(pow(piE+cascE,2)-pow(pipx+cascpx,2)-pow(pipy+cascpy,2)-pow(pipz+cascpz,2));
2119 
2120  Double_t contXicZeroMC[3];
2121  contXicZeroMC[0] = mcpart->Pt();
2122  contXicZeroMC[1] = mcpart->Y();
2123  contXicZeroMC[2] = fCentrality;
2124 
2125  Double_t contPionMC[3];
2126  contPionMC[0] = mcpipart->Pt();
2127  contPionMC[1] = mcpipart->Eta();
2128  contPionMC[2] = fCentrality;
2129 
2130  Double_t contXiMC[3];
2131  contXiMC[0] = mccascpart->Pt();
2132  contXiMC[1] = mccascpart->Y();
2133  contXiMC[2] = fCentrality;
2134 
2135  Double_t contPiXiMassMCGen[3];
2136  contPiXiMassMCGen[0] = InvMassPiXi;
2137  contPiXiMassMCGen[1] = mcpart->Pt();
2138  contPiXiMassMCGen[2] = fCentrality;
2139 
2140  Double_t contPiXiMassvsPiPtMCGen[3];
2141  contPiXiMassvsPiPtMCGen[0] = InvMassPiXi;
2142  contPiXiMassvsPiPtMCGen[1] = mcpipart->Pt();
2143  contPiXiMassvsPiPtMCGen[2] = fCentrality;
2144 
2145  if (decaytype==0) {
2146  fHistMCGen_XicZeroTot->Fill(contXicZeroMC);
2147  if (mcpart->GetPdgCode()>0) fHistMCGen_XicZero->Fill(contXicZeroMC);
2148  if (mcpart->GetPdgCode()<0) fHistMCGen_AntiXicZero->Fill(contXicZeroMC);
2149  fHistMCGen_PionTot->Fill(contPionMC);
2150  if (mcpipart->GetPdgCode()>0) fHistMCGen_PionPlus->Fill(contPionMC);
2151  if (mcpipart->GetPdgCode()<0) fHistMCGen_PionMinus->Fill(contPionMC);
2152 // fHistMCGen_XiTot->Fill(contXiMC);
2153 // if (mccascpart->GetPdgCode()>0) fHistMCGen_XiMinus->Fill(contXiMC);
2154 // if (mccascpart->GetPdgCode()<0) fHistMCGen_XiPlus->Fill(contXiMC);
2155  fHistMCGen_PiXiInvMass->Fill(contPiXiMassMCGen);
2156  if (fabs(mcpipart->Eta())<fAnaCuts->GetProdTrackEtaRange()) {
2157  fHistMCGen_PiXiMassvsPiPt->Fill(contPiXiMassvsPiPtMCGen);
2158  if (mcpipart->GetPdgCode()>0) fHistMCGen_PiXiMassvsPiPt_PionPlus->Fill(contPiXiMassvsPiPtMCGen);
2159  if (mcpipart->GetPdgCode()<0) fHistMCGen_PiXiMassvsPiPt_PionMinus->Fill(contPiXiMassvsPiPtMCGen);
2160  }
2161  }
2162 
2163  if (fWriteXic0MCGenTree) fTree_Xic0MCGen->Fill();
2164 }
2165 
2166 //_____________________________________________________________________________
2167 void AliAnalysisTaskSEXicZero2XiPifromKFP::MakeAnaXicZeroFromV0(AliAODEvent *AODEvent, TClonesArray *mcArray, KFParticle PV)
2168 {
2169  // Main analysis called from "UserExec"
2170 
2171 // std::cout.setf(std::ios::fixed);
2172 // std::cout.setf(std::ios::showpoint);
2173 // std::cout.precision(3);
2174 
2175  // set the magnetic field
2176  KFParticle::SetField(fBzkG);
2177 
2178  const UInt_t nV0s = AODEvent->GetNumberOfV0s();
2179 // if (nV0s==0) return;
2180 
2181  Double_t xyzP[3], xyzN[3];
2182  Double_t xvyvzvP[3], xvyvzvN[3];
2183  Double_t covP[21], covN[21];
2184  const Int_t NDaughters = 2;
2185  const Float_t massLambda = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
2186  const Float_t massXi = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
2187  const Float_t massK0S = TDatabasePDG::Instance()->GetParticle(310)->Mass();
2188 
2189  const UInt_t nTracks = AODEvent->GetNumberOfTracks();
2190 // if (nTracks<4) return;
2191 
2192  // select good candidates for pion
2193  AliAODTrack *trackP[nTracks], *trackN[nTracks];
2194  Int_t flag_trkP = 0, flag_trkN = 0;
2195 
2196  for (UInt_t itrk=0; itrk<nTracks; itrk++) {
2197  AliAODTrack *trk = static_cast<AliAODTrack*>(AODEvent->GetTrack(itrk));
2198  Double_t covtest[21];
2199 // if ( !trk || trk->GetID()<0 || !trk->GetCovarianceXYZPxPyPz(covtest) || !CheckTrackCov(trk) || !fAnaCuts->SinglePionPoolCuts(trk) ) continue;
2200  if ( !trk || trk->GetID()<0 || !trk->GetCovarianceXYZPxPyPz(covtest) || !CheckTrackCov(trk) ) continue;
2201 
2202  if (trk->Charge() > 0 ) {
2203  trackP[flag_trkP] = trk;
2204  flag_trkP++;
2205  }
2206  if (trk->Charge() < 0 ) {
2207  trackN[flag_trkN] = trk;
2208  flag_trkN++;
2209  }
2210  }
2211 
2212  // at least one pion+ and one pion-
2213 // if ( flag_trkP < 1 || flag_trkN<1 ) return;
2214 
2215  // loop for v0
2216  for (UInt_t itrk=0; itrk<nV0s; itrk++) {
2217  // check v0
2218  AliAODv0 *v0 = AODEvent->GetV0(itrk);
2219 
2220 // if ( !v0 ) continue;
2221  if ( v0->GetOnFlyStatus() ) continue; // to select offline V0s
2222 
2223  fRecHistRapidity_Lambda_offline->Fill(v0->RapLambda());
2224 
2225  if ( fabs(v0->RapLambda())<0.8 ) {
2226  fCounterRec_Cuts_Lambda->Fill(1);
2227  fCounterRec_Cuts_AntiLambda->Fill(1);
2228 
2229  if ( fIsMC ) {
2230  AliAODTrack *trackP = (AliAODTrack*) (v0->GetDaughter(0));
2231  AliAODTrack *trackN = (AliAODTrack*) (v0->GetDaughter(1));
2232  if (trackP->Charge()<0) {
2233  trackP = (AliAODTrack*) (v0->GetDaughter(1));
2234  trackN = (AliAODTrack*) (v0->GetDaughter(0));
2235  }
2236  Int_t lab_Lam = MatchToMCLambda(trackP, trackN, mcArray);
2237  Int_t lab_AntiLam = MatchToMCAntiLambda(trackN, trackP, mcArray);
2238  if (lab_Lam>-1) {
2239  fCounterRecMC_Cuts_Lambda->Fill(1);
2240  f2DCounterRecMC_CutsVsPt_Lambda->Fill(1, sqrt(v0->Pt2V0()));
2241  }
2242  if (lab_AntiLam>-1) {
2244  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(1, sqrt(v0->Pt2V0()));
2245  }
2246  }
2247  }
2248 
2249  if ( v0->GetNDaughters()!=2 ) continue;
2250 
2251  if ( fabs(v0->RapLambda())<0.8 ) {
2252  fCounterRec_Cuts_Lambda->Fill(2);
2253  fCounterRec_Cuts_AntiLambda->Fill(2);
2254 
2255  if ( fIsMC ) {
2256  AliAODTrack *trackP = (AliAODTrack*) (v0->GetDaughter(0));
2257  AliAODTrack *trackN = (AliAODTrack*) (v0->GetDaughter(1));
2258  if (trackP->Charge()<0) {
2259  trackP = (AliAODTrack*) (v0->GetDaughter(1));
2260  trackN = (AliAODTrack*) (v0->GetDaughter(0));
2261  }
2262  Int_t lab_Lam = MatchToMCLambda(trackP, trackN, mcArray);
2263  Int_t lab_AntiLam = MatchToMCAntiLambda(trackN, trackP, mcArray);
2264  if (lab_Lam>-1) {
2265  fCounterRecMC_Cuts_Lambda->Fill(2);
2266  f2DCounterRecMC_CutsVsPt_Lambda->Fill(2, sqrt(v0->Pt2V0()));
2267  }
2268  if (lab_AntiLam>-1) {
2270  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(2, sqrt(v0->Pt2V0()));
2271  }
2272  }
2273  }
2274 
2275  // check daughters
2276  AliAODTrack *trk0 = (AliAODTrack*) (v0->GetDaughter(0));
2277  AliAODTrack *trk1 = (AliAODTrack*) (v0->GetDaughter(1));
2278  AliAODTrack *trkP=NULL, *trkN=NULL;
2279  if (!trk0 || !trk1 ) continue;
2280  if (trk0->Charge()>0) {
2281  trkP = (AliAODTrack*)v0->GetDaughter(0);
2282  trkN = (AliAODTrack*)v0->GetDaughter(1);
2283  }
2284  if (trk0->Charge()<0) {
2285  trkP = (AliAODTrack*)v0->GetDaughter(1);
2286  trkN = (AliAODTrack*)v0->GetDaughter(0);
2287  }
2288 
2289  if ( fabs(v0->RapLambda())<0.8 ) {
2290  fCounterRec_Cuts_Lambda->Fill(3);
2291  fCounterRec_Cuts_AntiLambda->Fill(3);
2292 
2293  if ( fIsMC ) {
2294  Int_t lab_Lam = MatchToMCLambda(trkP, trkN, mcArray);
2295  Int_t lab_AntiLam = MatchToMCAntiLambda(trkN, trkP, mcArray);
2296  if (lab_Lam>-1) {
2297  fCounterRecMC_Cuts_Lambda->Fill(3);
2298  f2DCounterRecMC_CutsVsPt_Lambda->Fill(3, sqrt(v0->Pt2V0()));
2299  }
2300  if (lab_AntiLam>-1) {
2302  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(3, sqrt(v0->Pt2V0()));
2303  }
2304  }
2305  }
2306 
2307  if ( !trkP->GetCovarianceXYZPxPyPz(covP) || !trkN->GetCovarianceXYZPxPyPz(covN) ) continue;
2308 
2309  if ( fabs(v0->RapLambda())<0.8 ) {
2310  fCounterRec_Cuts_Lambda->Fill(4);
2311  fCounterRec_Cuts_AntiLambda->Fill(4);
2312 
2313  if ( fIsMC ) {
2314  Int_t lab_Lam = MatchToMCLambda(trkP, trkN, mcArray);
2315  Int_t lab_AntiLam = MatchToMCAntiLambda(trkN, trkP, mcArray);
2316  if (lab_Lam>-1) {
2317  fCounterRecMC_Cuts_Lambda->Fill(4);
2318  f2DCounterRecMC_CutsVsPt_Lambda->Fill(4, sqrt(v0->Pt2V0()));
2319  }
2320  if (lab_AntiLam>-1) {
2322  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(4, sqrt(v0->Pt2V0()));
2323  }
2324  }
2325  }
2326 
2327  if ( !CheckTrackCov(trkP) || !CheckTrackCov(trkN) ) continue;
2328 
2329  if ( fabs(v0->RapLambda())<0.8 ) {
2330  fCounterRec_Cuts_Lambda->Fill(5);
2331  fCounterRec_Cuts_AntiLambda->Fill(5);
2332 
2333  if ( fIsMC ) {
2334  Int_t lab_Lam = MatchToMCLambda(trkP, trkN, mcArray);
2335  Int_t lab_AntiLam = MatchToMCAntiLambda(trkN, trkP, mcArray);
2336  if (lab_Lam>-1) {
2337  fCounterRecMC_Cuts_Lambda->Fill(5);
2338  f2DCounterRecMC_CutsVsPt_Lambda->Fill(5, sqrt(v0->Pt2V0()));
2339  }
2340  if (lab_AntiLam>-1) {
2342  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(5, sqrt(v0->Pt2V0()));
2343  }
2344  }
2345  }
2346 
2347  fHistMassLambda_woCut->Fill(v0->MassLambda());
2348  fHistMassAntiLambda_woCut->Fill(v0->MassAntiLambda());
2349 
2350  // v0 cut
2351  if ( !fAnaCuts->SingleV0LambdaTotCuts(v0) ) continue;
2352 
2353 // Float_t TPCnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron) : 1000;
2354 // Float_t TOFnSigma = fPID->GetPIDResponse() ? fPID->GetPIDResponse()->NumberOfSigmasTOF(track, AliPID::kElectron) : 1000;
2355 
2356 
2357 
2358 
2359 
2360  if (fAnaCuts->LambdaPIDCuts(v0) && fabs(v0->RapLambda())<0.8 ) {
2361  fRecHistRapidity_Lambda_wSTD->Fill(v0->RapLambda());
2362  fCounterRec_Cuts_Lambda->Fill(6);
2363  if ( fIsMC ) {
2364  Int_t lab_Lam = MatchToMCLambda(trkP, trkN, mcArray);
2365  if (lab_Lam>-1) {
2366  fCounterRecMC_Cuts_Lambda->Fill(6);
2367  f2DCounterRecMC_CutsVsPt_Lambda->Fill(6, sqrt(v0->Pt2V0()));
2368  }
2369  }
2370  }
2371  if (fAnaCuts->AntiLambdaPIDCuts(v0) && fabs(v0->RapLambda())<0.8 ) {
2372  fRecHistRapidity_AntiLambda_wSTD->Fill(v0->RapLambda());
2373  fCounterRec_Cuts_AntiLambda->Fill(6);
2374  if ( fIsMC ) {
2375  Int_t lab_AntiLam = MatchToMCAntiLambda(trkN, trkP, mcArray);
2376  if (lab_AntiLam>-1) {
2378  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(6, sqrt(v0->Pt2V0()));
2379  }
2380  }
2381  }
2382 
2383 // f2DHistChargeDaughters->Fill(trkP->Charge(), trkN->Charge());
2384 // fHistChargeV0->Fill(v0->Charge());
2385 // fHistNDaughterV0->Fill(v0->GetNDaughters());
2386 // fHistNProngV0->Fill(v0->GetNProngs());
2387 // fHistChargeFirstDaughter->Fill(trkP->Charge());
2388 // fHistChargeSecondDaughter->Fill(trkN->Charge());
2389 
2390  Double_t alpha_FirstDaugPos = (v0->MomPosAlongV0() - v0->MomNegAlongV0())/(v0->MomPosAlongV0() + v0->MomNegAlongV0());
2391 
2392  if (trk0->Charge()>0) {
2393  fHistMassLambda_wSTDv0Cut->Fill(v0->MassLambda());
2394  fHistMassAntiLambda_wSTDv0Cut->Fill(v0->MassAntiLambda());
2395  }
2396 
2397  if (trk0->Charge()<0) {
2398  alpha_FirstDaugPos = (v0->MomNegAlongV0() - v0->MomPosAlongV0())/(v0->MomPosAlongV0() + v0->MomNegAlongV0());
2399  fHistMassLambda_wSTDv0Cut->Fill(v0->MassAntiLambda());
2400  fHistMassAntiLambda_wSTDv0Cut->Fill(v0->MassLambda());
2401  }
2402 
2403  f2DHistArmenterosPodolanski_FirstDaugPos->Fill(alpha_FirstDaugPos, v0->PtArmV0());
2404  f2DHistV0XY_FirstDaugPos->Fill(v0->DecayVertexV0X(), v0->DecayVertexV0Y());
2405 
2406  trkP->GetXYZ(xyzP);
2407  trkP->XvYvZv(xvyvzvP);
2408  fHistXtrkP->Fill(xyzP[0]);
2409  fHistYtrkP->Fill(xyzP[1]);
2410  fHistZtrkP->Fill(xyzP[2]);
2411  fHistXtrkP_XYZv->Fill(xvyvzvP[0]);
2412  fHistYtrkP_XYZv->Fill(xvyvzvP[1]);
2413  fHistZtrkP_XYZv->Fill(xvyvzvP[2]);
2414  trkN->GetXYZ(xyzN);
2415  trkN->XvYvZv(xvyvzvN);
2416  fHistXtrkN->Fill(xyzN[0]);
2417  fHistYtrkN->Fill(xyzN[1]);
2418  fHistZtrkN->Fill(xyzN[2]);
2419  fHistXtrkN_XYZv->Fill(xvyvzvN[0]);
2420  fHistYtrkN_XYZv->Fill(xvyvzvN[1]);
2421  fHistZtrkN_XYZv->Fill(xvyvzvN[2]);
2422 
2423  KFParticle kfpProton = CreateKFParticleFromAODtrack(trkP, 2212);
2424  KFParticle kfpAntiProton = CreateKFParticleFromAODtrack(trkN, -2212);
2425  KFParticle kfpPionMinus = CreateKFParticleFromAODtrack(trkN, -211);
2426  KFParticle kfpPionPlus = CreateKFParticleFromAODtrack(trkP, 211);
2427  KFParticle kfpLambda;
2428  KFParticle kfpAntiLambda;
2429  KFParticle kfpK0Short;
2430 // kfpLambda.SetPDG(3122);
2431 // kfpAntiLambda.SetPDG(-3122);
2432  const KFParticle *vDaughters[2] = {&kfpProton, &kfpPionMinus};
2433  const KFParticle *vAntiDaughters[2] = {&kfpPionPlus, &kfpAntiProton};
2434  const KFParticle *vk0sDaughters[2] = {&kfpPionPlus, &kfpPionMinus};
2435 
2436  kfpLambda.Construct(vDaughters, NDaughters);
2437  kfpAntiLambda.Construct(vAntiDaughters, NDaughters);
2438  kfpK0Short.Construct(vk0sDaughters, NDaughters);
2439 
2440  Float_t massK0S_Rec, err_massK0S;
2441  kfpK0Short.GetMass(massK0S_Rec, err_massK0S);
2442  fHistMassK0S->Fill(massK0S_Rec);
2443 
2444 // if ( fabs(massK0S_Rec-massK0S)<=fAnaCuts->GetProdMassTolK0S() ) continue;
2445 
2446  Float_t massLambda_Rec, err_massLambda;
2447  kfpLambda.GetMass(massLambda_Rec, err_massLambda);
2448  Float_t massAntiLambda_Rec, err_massAntiLambda;
2449  kfpAntiLambda.GetMass(massAntiLambda_Rec, err_massAntiLambda);
2450 
2451  // check rapidity of lambda && anti-lambda
2452  if ( TMath::Abs(kfpLambda.GetE())<=TMath::Abs(kfpLambda.GetPz()) && TMath::Abs(kfpAntiLambda.GetE())<=TMath::Abs(kfpAntiLambda.GetPz()) ) continue;
2453 
2454  // chi2>0 && NDF>0 for selecting Lambda and Anti-Lambda candidates
2455  if ( (kfpLambda.GetNDF()<=0 || kfpLambda.GetChi2()<=0) && (kfpAntiLambda.GetNDF()<=0 || kfpAntiLambda.GetChi2()<=0) ) continue;
2456 
2457  // check cov. of Lambda and Anti-Lambda candidates
2458  if ( !CheckKFParticleCov(kfpLambda) && !CheckKFParticleCov(kfpAntiLambda) ) continue;
2459 
2460  // err_mass>0 of Lambda and Anti-Lambda candidates
2461  if ( err_massLambda<=0 && err_massAntiLambda<=0 ) continue;
2462 
2463  if (fAnaCuts->LambdaPIDCuts(v0) && TMath::Abs(kfpLambda.GetE())>TMath::Abs(kfpLambda.GetPz()) && kfpLambda.GetNDF()>0 && kfpLambda.GetChi2()>0 && CheckKFParticleCov(kfpLambda) && err_massLambda>0) {
2464  if (fabs(kfpLambda.GetRapidity())<0.8) {
2465  fCounterRec_Cuts_Lambda->Fill(7);
2466  fHistChi2ndfLambda->Fill(kfpLambda.GetChi2()/kfpLambda.GetNDF());
2467  fHistProbLambda->Fill(TMath::Prob(kfpLambda.GetChi2(), kfpLambda.GetNDF()));
2468  if (TMath::Abs(kfpLambda.GetRapidity())<0.5) fCounterRec_Cuts_Lambda->Fill(8);
2469  if ( fIsMC ) {
2470  Int_t lab_Lam = MatchToMCLambda(trkP, trkN, mcArray);
2471  if (lab_Lam>-1) {
2472  fCounterRecMC_Cuts_Lambda->Fill(7);
2473  f2DCounterRecMC_CutsVsPt_Lambda->Fill(7, kfpLambda.GetPt());
2474  if (TMath::Abs(kfpLambda.GetRapidity())<0.5) {
2475  fCounterRecMC_Cuts_Lambda->Fill(8);
2476  f2DCounterRecMC_CutsVsPt_Lambda->Fill(8, kfpLambda.GetPt());
2477  }
2478  }
2479  }
2480  }
2481  }
2482  if (fAnaCuts->AntiLambdaPIDCuts(v0) && TMath::Abs(kfpAntiLambda.GetE())>TMath::Abs(kfpAntiLambda.GetPz()) && kfpAntiLambda.GetNDF()>0 && kfpAntiLambda.GetChi2()>0 && CheckKFParticleCov(kfpAntiLambda) && err_massAntiLambda>0) {
2483  if (fabs(kfpAntiLambda.GetRapidity())<0.8) {
2484  fCounterRec_Cuts_AntiLambda->Fill(7);
2485  fHistChi2ndfAntiLambda->Fill(kfpAntiLambda.GetChi2()/kfpAntiLambda.GetNDF());
2486  fHistProbAntiLambda->Fill(TMath::Prob(kfpAntiLambda.GetChi2(), kfpAntiLambda.GetNDF()));
2487  if (TMath::Abs(kfpAntiLambda.GetRapidity())<0.5) fCounterRec_Cuts_AntiLambda->Fill(8);
2488  if ( fIsMC ) {
2489  Int_t lab_AntiLam = MatchToMCAntiLambda(trkN, trkP, mcArray);
2490  if (lab_AntiLam>-1) {
2492  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(7, kfpAntiLambda.GetPt());
2493  if (TMath::Abs(kfpAntiLambda.GetRapidity())<0.5) {
2495  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(8, kfpAntiLambda.GetPt());
2496  }
2497  }
2498  }
2499  }
2500  }
2501 
2502 
2503 // fHistMassLambda_LDeltaL->Fill(kfpLambda.GetMass());
2504  f2DHistArmenterosPodolanski_candidate->Fill(alpha_FirstDaugPos, v0->PtArmV0());
2505 
2506  //************************** calculate l/Δl for Lambda *************************************
2507  Double_t dx_Lambda = PV.GetX()-kfpLambda.GetX();
2508  Double_t dy_Lambda = PV.GetY()-kfpLambda.GetY();
2509  Double_t dz_Lambda = PV.GetZ()-kfpLambda.GetZ();
2510  Double_t l_Lambda = TMath::Sqrt(dx_Lambda*dx_Lambda + dy_Lambda*dy_Lambda + dz_Lambda*dz_Lambda);
2511  Double_t dl_Lambda = (PV.GetCovariance(0)+kfpLambda.GetCovariance(0))*dx_Lambda*dx_Lambda + (PV.GetCovariance(2)+kfpLambda.GetCovariance(2))*dy_Lambda*dy_Lambda + (PV.GetCovariance(5)+kfpLambda.GetCovariance(5))*dz_Lambda*dz_Lambda + 2*( (PV.GetCovariance(1)+kfpLambda.GetCovariance(1))*dx_Lambda*dy_Lambda + (PV.GetCovariance(3)+kfpLambda.GetCovariance(3))*dx_Lambda*dz_Lambda + (PV.GetCovariance(4)+kfpLambda.GetCovariance(4))*dy_Lambda*dz_Lambda );
2512  if ( fabs(l_Lambda)<1.e-8f ) l_Lambda = 1.e-8f;
2513  dl_Lambda = dl_Lambda<0. ? 1.e8f : sqrt(dl_Lambda)/l_Lambda;
2514  Double_t nErr_l_Lambda = l_Lambda/dl_Lambda;
2515  //***************************************************************************************
2516  //************************** calculate l/Δl for Anti-Lambda *************************************
2517  Double_t dx_AntiLambda = PV.GetX()-kfpAntiLambda.GetX();
2518  Double_t dy_AntiLambda = PV.GetY()-kfpAntiLambda.GetY();
2519  Double_t dz_AntiLambda = PV.GetZ()-kfpAntiLambda.GetZ();
2520  Double_t l_AntiLambda = TMath::Sqrt(dx_AntiLambda*dx_AntiLambda + dy_AntiLambda*dy_AntiLambda + dz_AntiLambda*dz_AntiLambda);
2521  Double_t dl_AntiLambda = (PV.GetCovariance(0)+kfpAntiLambda.GetCovariance(0))*dx_AntiLambda*dx_AntiLambda + (PV.GetCovariance(2)+kfpAntiLambda.GetCovariance(2))*dy_AntiLambda*dy_AntiLambda + (PV.GetCovariance(5)+kfpAntiLambda.GetCovariance(5))*dz_AntiLambda*dz_AntiLambda + 2*( (PV.GetCovariance(1)+kfpAntiLambda.GetCovariance(1))*dx_AntiLambda*dy_AntiLambda + (PV.GetCovariance(3)+kfpAntiLambda.GetCovariance(3))*dx_AntiLambda*dz_AntiLambda + (PV.GetCovariance(4)+kfpAntiLambda.GetCovariance(4))*dy_AntiLambda*dz_AntiLambda );
2522  if ( fabs(l_AntiLambda)<1.e-8f ) l_AntiLambda = 1.e-8f;
2523  dl_AntiLambda = dl_AntiLambda<0. ? 1.e8f : sqrt(dl_AntiLambda)/l_AntiLambda;
2524  Double_t nErr_l_AntiLambda = l_AntiLambda/dl_AntiLambda;
2525  //***************************************************************************************
2526 
2527 
2528  //======================================== start to reconstruct XicZero ============================
2529  if ( fAnaCuts->LambdaPIDCuts(v0) && TMath::Abs(kfpLambda.GetE())>TMath::Abs(kfpLambda.GetPz()) && kfpLambda.GetNDF()>0 && kfpLambda.GetChi2()>0 && CheckKFParticleCov(kfpLambda) && err_massLambda>0 && (kfpLambda.GetChi2()/kfpLambda.GetNDF())<fAnaCuts->GetKFPLam_Chi2geoMax() && nErr_l_Lambda>fAnaCuts->GetKFPLam_lDeltalMin() ) {
2530 
2531  fHistProbLambda_chi2cut->Fill(TMath::Prob(kfpLambda.GetChi2(), kfpLambda.GetNDF()));
2532  fHistMassLambda_woArmenterosPodolanskiCut->Fill(kfpLambda.GetMass());
2533  fHistMassLambda_woMassCut->Fill(kfpLambda.GetMass());
2534 
2535  if (TMath::Abs(kfpLambda.GetRapidity())<0.5) {
2536  fHistLDeltaLRec_Lambda->Fill(nErr_l_Lambda);
2537  if (fIsMC) {
2538  Int_t lab_Lam = MatchToMCLambda(trkP, trkN, mcArray);
2539  if (lab_Lam>-1) fHistLDeltaLRecMC_Lambda->Fill(nErr_l_Lambda);
2540  Int_t lab_LamFromXi = MatchToMCLambdaFromXi(trkP, trkN, mcArray);
2541 
2542  if (lab_LamFromXi>-1) fHistLDeltaLRecMC_LambdaFromXi->Fill(nErr_l_Lambda);
2543  }
2544  }
2545 
2546 // Double_t y = v0->PtArmV0();
2547 // Double_t x = alpha_FirstDaugPos;
2548 // Double_t ycut_L = 1.3 * (-1.*x*x + 1.38*x - 0.420);
2549 // Double_t ycut_H = 1.3 * (-1.*x*x + 1.38*x - 0.380);
2550 // if ( y<ycut_L || y>ycut_H ) continue;
2551 
2552 
2553  fHistMassLambda_BeforeSecSel->Fill(kfpLambda.GetMass());
2554 
2555  // select secondary Lambda
2556  /*
2557  KFParticle kfpLambda_sec = kfpLambda;
2558 // cout << "PV:" << PV << endl;
2559 // cout << "Lambda:" << kfpLambda << endl;
2560  kfpLambda_sec.SetProductionVertex(PV);
2561  */
2562 
2563 // cout << "DM2=" << 4.* (kfpLambda.GetCovariance(9)*kfpLambda.GetPx()*kfpLambda.GetPx() + kfpLambda.GetCovariance(14)*kfpLambda.GetPy()*kfpLambda.GetPy() + kfpLambda.GetCovariance(20)*kfpLambda.GetPz()*kfpLambda.GetPz() + kfpLambda.GetCovariance(27)*kfpLambda.GetE()*kfpLambda.GetE() + float(2.f) * ( (kfpLambda.GetCovariance(13)*kfpLambda.GetPy() + kfpLambda.GetCovariance(18)*kfpLambda.GetPz() - kfpLambda.GetCovariance(24)*kfpLambda.GetE() )*kfpLambda.GetPx() + ( kfpLambda.GetCovariance(19)*kfpLambda.GetPz() - kfpLambda.GetCovariance(25)*kfpLambda.GetE() )*kfpLambda.GetPy() - kfpLambda.GetCovariance(26)*kfpLambda.GetPz()*kfpLambda.GetE() ) ) << endl;
2564 
2565 // if ( kfpLambda_sec.GetChi2()/kfpLambda_sec.GetNDF()>=3 ) {
2566 
2567  /*
2568  fCounterRec_Cuts_Lambda->Fill(13);
2569  f2DCounterRecMC_CutsVsPt_Lambda->Fill(kfpLambda.GetPt(), 13);
2570  if ( fIsMC ) {
2571  Int_t lab_Lam = MatchToMCLambda(trkP, trkN, mcArray);
2572  if (lab_Lam>-1) fCounterRecMC_Cuts_Lambda->Fill(13);
2573  }
2574  */
2575 
2576  f2DHistLambdaXY->Fill(kfpLambda.GetX(), kfpLambda.GetY());
2577  fHistMassLambda->Fill(kfpLambda.GetMass());
2578  fHistMassLambdaTot->Fill(kfpLambda.GetMass());
2579  f2DHistMassPtLambda->Fill(kfpLambda.GetPt(), kfpLambda.GetMass());
2580  f2DHistChi2vsNDF_Lambda->Fill(kfpLambda.GetNDF(), kfpLambda.GetChi2());
2581 // fHistProbLambdaTot->Fill(TMath::Prob(kfpLambda.GetChi2(), kfpLambda.GetNDF()));
2582  Float_t ptLambda_Rec, err_ptLambda;
2583  kfpLambda.GetPt(ptLambda_Rec, err_ptLambda);
2584  fHistMassLambda_V0->Fill(v0->MassLambda());
2585  fHistMassLambdaTot_V0->Fill(v0->MassLambda());
2586  Double_t Lambda_KF_V0 = kfpLambda.GetMass() - v0->MassLambda();
2587  fHistMassLambda_KF_V0->Fill(Lambda_KF_V0);
2588  fHistPtLambda->Fill(kfpLambda.GetPt());
2589  fHistPtLambdaTot->Fill(kfpLambda.GetPt());
2590 
2591 // cout << "Proton" << kfpProton << endl;
2592 // cout << "Pion" << kfpPionMinus << endl;
2593 // cout << "Lambda:" << kfpLambda << endl;
2594 
2595 /*
2596  if ( fIsMC && trkP->GetLabel()>0 && trkN->GetLabel()>0 ) {
2597  AliAODMCParticle* mcTrkP = static_cast<AliAODMCParticle*>(mcArray->At(trkP->GetLabel()));
2598  AliAODMCParticle* mcTrkN = static_cast<AliAODMCParticle*>(mcArray->At(trkN->GetLabel()));
2599  if ( mcTrkP->GetPdgCode()==2212 && mcTrkN->GetPdgCode()==-211 ) {
2600  Int_t pdgDgv0[2]={2212, 211};
2601  Int_t labelLambda = v0->MatchToMC(3122, mcArray, 2, pdgDgv0);
2602  if ( labelLambda>-1 ) fCounterRecMC_Cuts_Lambda->Fill(13);
2603  }
2604  }
2605 */
2606 
2607  //======================================== reconstruct Xi- ============================
2608  if ( TMath::Abs(massLambda_Rec-massLambda)<=(fAnaCuts->GetProdMassTolLambda()) ) {
2609  f2DHistArmenterosPodolanski_Lam->Fill(alpha_FirstDaugPos, v0->PtArmV0());
2610  KFParticle kfpLambda_m = kfpLambda;
2611  kfpLambda_m.SetNonlinearMassConstraint(massLambda);
2612 // if (kfpLambda_m.GetE()<kfpLambda_m.GetP()) cout << "E<P!!!!!!!!!!!!!!!!" << endl;
2613 // kfpLambda_m.SetMassConstraint(massLambda);
2614 // Float_t massLam, errormassLam;
2615 // kfpLambda.GetMass(massLam, errormassLam);
2616 // if (kfpLambda.GetMass()<0.1) {cout << "massLam==" << massLam << endl; cout << "errormassLam==" << errormassLam << endl;}
2617  fHistMassLambda_M->Fill(kfpLambda_m.GetMass());
2618  if ( CheckKFParticleCov(kfpLambda_m) && TMath::Abs(kfpLambda.GetE())>TMath::Abs(kfpLambda.GetPz()) ) {
2619 
2620  for (Int_t itrkPion2=0; itrkPion2<flag_trkN; itrkPion2++) { // Loop for bachelor in cascade pion-
2621  if ( trackN[itrkPion2]->GetID()==trkN->GetID() ) continue;
2622  fCounterRec_Cuts_XiMinus->Fill(1);
2623  if ( fIsMC ) {
2624  Int_t lab_XiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
2625  if (lab_XiMinus>-1) {
2626  fCounterRecMC_Cuts_XiMinus->Fill(1);
2627  }
2628  }
2629 
2630  if ( !fAnaCuts->PassedTrackQualityCuts_SecondaryPion(trackN[itrkPion2]) ) continue;
2631 
2632  KFParticle kfpPion2 = CreateKFParticleFromAODtrack(trackN[itrkPion2], -211);
2633 
2634  // select secondary pion tracks
2635  /*
2636  KFParticle kfpPion2_sec = kfpPion2;
2637  kfpPion2_sec.SetProductionVertex(PV);
2638  if ( kfpPion2_sec.GetChi2()<=18.4 ) continue;
2639  fCounterRec_Cuts_XiMinus->Fill(2);
2640  if ( fIsMC ) {
2641  Int_t lab_XiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
2642  if (lab_XiMinus>-1) {
2643  fCounterRecMC_Cuts_XiMinus->Fill(2);
2644  }
2645  }
2646  */
2647 
2648  KFParticle kfpXiMinus;
2649 // kfpXiMinus.SetPDG(3312);
2650  const KFParticle *vXiDs[2] = {&kfpPion2, &kfpLambda_m};
2651  kfpXiMinus.Construct(vXiDs, NDaughters);
2652 
2653  // check rapidity of Xi-
2654  if ( TMath::Abs(kfpXiMinus.GetE())<=TMath::Abs(kfpXiMinus.GetPz()) ) continue;
2655 
2656  // err_massXi > 0
2657  Float_t massXiMinus_Rec, err_massXiMinus;
2658  kfpXiMinus.GetMass(massXiMinus_Rec, err_massXiMinus);
2659  if ( err_massXiMinus<=0 ) continue;
2660 
2661  if ( fabs(kfpXiMinus.GetRapidity())<0.8 ) {
2662  fCounterRec_Cuts_XiMinus->Fill(2);
2663  if ( fIsMC ) {
2664  Int_t lab_XiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
2665  if (lab_XiMinus>-1) {
2666  fCounterRecMC_Cuts_XiMinus->Fill(2);
2667  f2DCounterRecMC_CutsVsPt_XiMinus->Fill(2, kfpXiMinus.GetPt());
2668  }
2669  }
2670  }
2671 
2672  // chi2>0 && NDF>0
2673  if ( kfpXiMinus.GetNDF()<=0 || kfpXiMinus.GetChi2()<=0 ) continue;
2674 
2675  // Prefilter
2676  if ( kfpXiMinus.GetChi2()/kfpXiMinus.GetNDF() >= fAnaCuts->GetKFPXi_Chi2geoMax() ) continue;
2677 
2678  // check covariance matrix
2679  if ( !CheckKFParticleCov(kfpXiMinus) ) continue;
2680 
2681  if ( fabs(kfpXiMinus.GetRapidity())<0.8 ) {
2682  fCounterRec_Cuts_XiMinus->Fill(3);
2683  if ( fIsMC ) {
2684  Int_t lab_XiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
2685  if (lab_XiMinus>-1) {
2686  fCounterRecMC_Cuts_XiMinus->Fill(3);
2687  f2DCounterRecMC_CutsVsPt_XiMinus->Fill(3, kfpXiMinus.GetPt());
2688  }
2689  }
2690  }
2691  fHistChi2ndfXiMinus->Fill(kfpXiMinus.GetChi2()/kfpXiMinus.GetNDF());
2692  fHistProbXiMinus->Fill(TMath::Prob(kfpXiMinus.GetChi2(), kfpXiMinus.GetNDF()));
2693  /*
2694  // 0<chi2/NDF<cut
2695  if ( kfpXiMinus.GetChi2()/kfpXiMinus.GetNDF()<=0 || (kfpXiMinus.GetChi2()/kfpXiMinus.GetNDF())>=(fAnaCuts->GetKFPXiMinusChi2Cut()) ) continue;
2696  fCounterRec_Cuts_XiMinus->Fill(5);
2697  if ( fIsMC ) {
2698  Int_t lab_XiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
2699  if (lab_XiMinus>-1) {
2700  fCounterRecMC_Cuts_XiMinus->Fill(5);
2701  f2DCounterRecMC_CutsVsPt_XiMinus->Fill(5, kfpXiMinus.GetPt());
2702  }
2703  }
2704  fHistProbXiMinus_chi2cut->Fill(TMath::Prob(kfpXiMinus.GetChi2(), kfpXiMinus.GetNDF()));
2705  */
2706  // set production vertext to PV
2707 // KFParticle kfpXiMinus_pv = kfpXiMinus;
2708 // kfpXiMinus_pv.SetProductionVertex(PV);
2709  /*
2710  if ( kfpXiMinus_pv.GetChi2()/kfpXiMinus_pv.GetNDF()>=3 ) continue;
2711  fCounterRec_Cuts_XiMinus->Fill(6);
2712  if ( fIsMC ) {
2713  Int_t lab_XiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
2714  if (lab_XiMinus>-1) {
2715  fCounterRecMC_Cuts_XiMinus->Fill(6);
2716  f2DCounterRecMC_CutsVsPt_XiMinus->Fill(6, kfpXiMinus_pv.GetPt());
2717  }
2718  }
2719  */
2720  // store mass of Xi-
2721  fHistMassXiMinus->Fill(kfpXiMinus.GetMass());
2722  fHistMassXiTot->Fill(kfpXiMinus.GetMass());
2723  f2DHistMassPtXiMinus->Fill(kfpXiMinus.GetPt(), kfpXiMinus.GetMass());
2724 
2725  if ( fabs(kfpXiMinus.GetRapidity())<0.8 ) {
2726  fCounterRec_Cuts_XiMinus->Fill(4);
2727  if (TMath::Abs(kfpXiMinus.GetRapidity())<0.5) fCounterRec_Cuts_XiMinus->Fill(5);
2728  if ( fIsMC ) {
2729  Int_t lab_XiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
2730  if (lab_XiMinus>-1) {
2731  fCounterRecMC_Cuts_XiMinus->Fill(4);
2732  f2DCounterRecMC_CutsVsPt_XiMinus->Fill(4, kfpXiMinus.GetPt());
2733  if (TMath::Abs(kfpXiMinus.GetRapidity())<0.5) {
2734  fCounterRecMC_Cuts_XiMinus->Fill(5);
2735  f2DCounterRecMC_CutsVsPt_XiMinus->Fill(5, kfpXiMinus.GetPt());
2736  }
2737  }
2738  }
2739  }
2740 
2741  /*
2742  // calculate proper decay length of Xi- and lambda
2743  if ( kfpLambda.GetP()>0 && kfpXiMinus_pv.GetP()>0 ) {
2744  Double_t properDecayL_XiMinus = kfpXiMinus_pv.GetDecayLength() * kfpXiMinus_pv.GetMass() / kfpXiMinus_pv.GetP();
2745  fHistDecayLXiMinus->Fill(properDecayL_XiMinus);
2746  f2DHistXiMinusXY_DV->Fill(kfpXiMinus.GetX(), kfpXiMinus.GetY());
2747  f2DHistXiMinusXY_PV->Fill(kfpXiMinus_pv.GetX(), kfpXiMinus_pv.GetY());
2748  // calculate proper decay length of lambda
2749  kfpLambda.SetProductionVertex(kfpXiMinus);
2750  Double_t properDecayL_Lambda = kfpLambda.GetDecayLength() * kfpLambda.GetMass() / kfpLambda.GetP();
2751  fHistDecayLLambda->Fill(properDecayL_Lambda);
2752  }
2753  */
2754 
2755 
2756 
2757  //======================================== reconstruct XicZero ============================
2758  if ( TMath::Abs(massXiMinus_Rec-massXi)<=(fAnaCuts->GetProdMassTolXi()) ) {
2759  // set nonlinear mass constraint
2760  KFParticle kfpXiMinus_m = kfpXiMinus;
2761  kfpXiMinus_m.SetNonlinearMassConstraint(massXi);
2762 // kfpXiMinus_m.SetMassConstraint(massXi);
2763  fHistMassXiMinus_M->Fill(kfpXiMinus_m.GetMass());
2764  if ( CheckKFParticleCov(kfpXiMinus_m) && TMath::Abs(kfpXiMinus.GetE())>TMath::Abs(kfpXiMinus.GetPz()) ) {
2765 
2766  for (Int_t itrkBP=0; itrkBP<flag_trkP; itrkBP++) { // Loop for first bachelor pion+
2767  if ( trackP[itrkBP]->GetID()==trkP->GetID() ) continue;
2768 
2769 // if ( !fAnaCuts->SingleTrkCuts(trackP[itrkBP]) ) continue;
2770  if ( !fAnaCuts->PassedTrackQualityCuts_PrimaryPion(trackP[itrkBP]) ) continue;
2771 
2772  // DCA of Cascade-bachelor to PV (cm)
2773 // Double_t d0z0bach[2],covd0z0bach[3];
2774 // if (!trackN[itrkPion2]->PropagateToDCA(fpVtx,fBzkG,kVeryBig,d0z0bach,covd0z0bach)) continue;
2775 // if ( d0z0bach[0] <= fAnaCuts->GetProdDcaBachToPrimVertexMin() ) continue;
2776 
2777  KFParticle kfpBP = CreateKFParticleFromAODtrack(trackP[itrkBP], 211);
2778 
2779  // select primary pion tracks
2780  /*
2781  KFParticle kfpBP_prm = kfpBP;
2782  kfpBP_prm.SetProductionVertex(PV);
2783  if ( kfpBP_prm.GetChi2()>18.4 ) continue;
2784  */
2785 
2786 // if (fIsMC) {
2787 // Int_t labelXiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
2788 // Int_t labelXiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkBP], mcArray);
2789 // if (labelXiMinus>-1) {
2790 // fHistMassXiMinus_Match->Fill(kfpXiMinus.GetMass());
2791 // }
2792 // }
2793 
2794  // reconstruct XicZero
2795  KFParticle kfpXic0;
2796  const KFParticle *vXicZeroDs[2] = {&kfpBP, &kfpXiMinus_m};
2797  kfpXic0.Construct(vXicZeroDs, NDaughters);
2798  fHistProbXicZero->Fill(TMath::Prob(kfpXic0.GetChi2(), kfpXic0.GetNDF()));
2799 
2800 
2801 
2802  // chi2>0 && NDF>0
2803  if ( kfpXic0.GetNDF()<=0 || kfpXic0.GetChi2()<=0 ) continue;
2804 
2805  // Prefilter
2806  if ( kfpXic0.GetChi2()/kfpXic0.GetNDF() >= fAnaCuts->GetKFPXic0_Chi2geoMax() ) continue;
2807  if ( kfpXic0.GetPt() < fAnaCuts->GetPtMinXic0() ) continue;
2808 
2809  // check rapidity of XicZero
2810  if ( TMath::Abs(kfpXic0.GetE())<=TMath::Abs(kfpXic0.GetPz()) ) continue;
2811 
2812  // check covariance matrix
2813  if ( !CheckKFParticleCov(kfpXic0) ) continue;
2814 
2815  // err_massXicZero > 0
2816  Float_t massXicZero_Rec, err_massXicZero;
2817  kfpXic0.GetMass(massXicZero_Rec, err_massXicZero);
2818  if ( err_massXicZero<=0 ) continue;
2819 
2820  /*
2821  // 0<chi2/NDF<cut
2822  if ( kfpXic0.GetChi2()/kfpXic0.GetNDF()<=0 || (kfpXic0.GetChi2()/kfpXic0.GetNDF())>=(fAnaCuts->GetKFPXicZeroChi2Cut()) ) continue;
2823  fHistProbXicZero_chi2cut->Fill(TMath::Prob(kfpXic0.GetChi2(), kfpXic0.GetNDF()));
2824  */
2825 
2826  // set production vertext to PV
2827 // KFParticle kfpXic0_pv = kfpXic0;
2828 // kfpXic0_pv.SetProductionVertex(PV);
2829  /*
2830  if ( kfpXic0_pv.GetChi2()/kfpXic0_pv.GetNDF()>=3 ) continue;
2831  */
2832  /*
2833  // store mass of XicZero
2834  fHistMassXicZero->Fill(kfpXic0_pv.GetMass());
2835  fHistMassXicZeroTot->Fill(kfpXic0_pv.GetMass());
2836  f2DHistMassPtXicZero->Fill(kfpXic0_pv.GetPt(), kfpXic0_pv.GetMass());
2837  f2DHistMassPtXicZeroTot->Fill(kfpXic0_pv.GetPt(), kfpXic0_pv.GetMass());
2838 
2839 
2840  TVector3 momXiMinus(kfpXiMinus.GetPx(), kfpXiMinus.GetPy(), kfpXiMinus.GetPz());
2841 // TVector3 momBP(kfpBP_prm.GetPx(), kfpBP_prm.GetPy(), kfpBP_prm.GetPz());
2842  TVector3 momBP(kfpBP.GetPx(), kfpBP.GetPy(), kfpBP.GetPz());
2843  TVector3 momXicZero(kfpXic0_pv.GetPx(), kfpXic0_pv.GetPy(), kfpXic0_pv.GetPz());
2844  Float_t QtDiffPionXiMinus = momBP.Perp(momXicZero) - momXiMinus.Perp(momXicZero);
2845  fHistQtDiffPionXiMinus->Fill(QtDiffPionXiMinus);
2846  */
2847 
2848 // fHistMassXicZero_woQtCut->Fill(kfpXic0_pv.GetMass());
2849 // f2DHistMassPtXicZero_woQtCut->Fill(kfpXic0_pv.GetPt(), kfpXic0_pv.GetMass());
2850 // if (TMath::Abs(QtDiffPionXiMinus)>1.e-5) continue;
2851 
2852  if (fWriteXic0Tree) {
2853  Int_t lab_Xic0 = -9999.;
2854  if (fIsMC) {
2855  lab_Xic0 = MatchToMCXic0(trkP, trkN, trackN[itrkPion2], trackP[itrkBP], mcArray);
2856  }
2857  FillTreeRecXic0FromV0(kfpXic0, trackP[itrkBP], kfpBP, kfpXiMinus, kfpXiMinus_m, trackN[itrkPion2], v0, kfpK0Short, kfpLambda, kfpLambda_m, trkP, trkN, PV, mcArray, lab_Xic0);
2858  }
2859 
2860  kfpXic0.Clear();
2861  kfpBP.Clear();
2862  } // loop for XicZero
2863  }
2864  kfpXiMinus_m.Clear();
2865  } // Xi- mass cut
2866  kfpXiMinus.Clear();
2867  kfpPion2.Clear();
2868  } // loop for Xi-
2869  } // check cov. of lambda && |E|>|Pz| after nonlinear mass constrain
2870  kfpLambda_m.Clear();
2871  } // lambda mass cut
2872 // } // select secondary lambda
2873  } // separate lambda & anti-lambda and check cov. of lambda
2874 
2875 
2876  //======================================== start to reconstruct Anti-XicZero ============================
2877  if ( fAnaCuts->AntiLambdaPIDCuts(v0) && TMath::Abs(kfpAntiLambda.GetE())>TMath::Abs(kfpAntiLambda.GetPz()) && kfpAntiLambda.GetNDF()>0 && kfpAntiLambda.GetChi2()>0 && CheckKFParticleCov(kfpAntiLambda) && err_massAntiLambda>0 && (kfpAntiLambda.GetChi2()/kfpAntiLambda.GetNDF())<fAnaCuts->GetKFPLam_Chi2geoMax() && nErr_l_AntiLambda>fAnaCuts->GetKFPLam_lDeltalMin() ) {
2878  fHistProbAntiLambda_chi2cut->Fill(TMath::Prob(kfpAntiLambda.GetChi2(), kfpAntiLambda.GetNDF()));
2879  fHistMassAntiLambda_woMassCut->Fill(kfpAntiLambda.GetMass());
2880  fHistMassAntiLambda_BeforeSecSel->Fill(kfpAntiLambda.GetMass());
2881 
2882  if (TMath::Abs(kfpAntiLambda.GetRapidity())<0.5) {
2883  fHistLDeltaLRec_AntiLambda->Fill(nErr_l_AntiLambda);
2884  if (fIsMC) {
2885  Int_t lab_AntiLam = MatchToMCAntiLambda(trkN, trkP, mcArray);
2886  if (lab_AntiLam>-1) fHistLDeltaLRecMC_AntiLambda->Fill(nErr_l_AntiLambda);
2887  Int_t lab_AntiLamFromXi = MatchToMCAntiLambdaFromXi(trkN, trkP, mcArray);
2888  if (lab_AntiLamFromXi>-1) fHistLDeltaLRecMC_AntiLambdaFromXi->Fill(nErr_l_AntiLambda);
2889  }
2890  }
2891 
2892 
2893  // select secondary Anti-Lambda
2894  /*
2895  KFParticle kfpAntiLambda_sec = kfpAntiLambda;
2896  kfpAntiLambda_sec.SetProductionVertex(PV);
2897  */
2898 
2899 // if ( kfpAntiLambda_sec.GetChi2()/kfpAntiLambda_sec.GetNDF()>=3 ) {
2900 
2901  /*
2902  fCounterRec_Cuts_AntiLambda->Fill(13);
2903  f2DCounterRecMC_CutsVsPt_AntiLambda->Fill(kfpAntiLambda.GetPt(), 13);
2904  if ( fIsMC ) {
2905  Int_t lab_AntiLam = MatchToMCAntiLambda(trkN, trkP, mcArray);
2906  if (lab_AntiLam>-1) fCounterRecMC_Cuts_AntiLambda->Fill(13);
2907  }
2908  */
2909 
2910  fHistMassAntiLambda->Fill(kfpAntiLambda.GetMass());
2911  fHistMassLambdaTot->Fill(kfpAntiLambda.GetMass());
2912  f2DHistMassPtAntiLambda->Fill(kfpAntiLambda.GetPt(), kfpAntiLambda.GetMass());
2913  f2DHistChi2vsNDF_AntiLambda->Fill(kfpAntiLambda.GetNDF(), kfpAntiLambda.GetChi2());
2914 // fHistChi2ndfLambdaTot->Fill(kfpAntiLambda.GetChi2()/kfpAntiLambda.GetNDF());
2915 // fHistProbLambdaTot->Fill(TMath::Prob(kfpAntiLambda.GetChi2(), kfpAntiLambda.GetNDF()));
2916  Float_t ptAntiLambda_Rec, err_ptAntiLambda;
2917  kfpAntiLambda.GetPt(ptAntiLambda_Rec, err_ptAntiLambda);
2918  fHistMassAntiLambda_V0->Fill(v0->MassAntiLambda());
2919  fHistMassLambdaTot_V0->Fill(v0->MassAntiLambda());
2920  Double_t AntiLambda_KF_V0 = kfpAntiLambda.GetMass() - v0->MassAntiLambda();
2921  fHistMassAntiLambda_KF_V0->Fill(AntiLambda_KF_V0);
2922  fHistPtAntiLambda->Fill(kfpAntiLambda.GetPt());
2923  fHistPtLambdaTot->Fill(kfpAntiLambda.GetPt());
2924 
2925 
2926  /*
2927  if (fIsMC && trkP->GetLabel()>0 && trkN->GetLabel()>0) {
2928  AliAODMCParticle* mcTrkP = static_cast<AliAODMCParticle*>(mcArray->At(trkP->GetLabel()));
2929  AliAODMCParticle* mcTrkN = static_cast<AliAODMCParticle*>(mcArray->At(trkN->GetLabel()));
2930  Int_t pdgDgv0[2]={2212, 211};
2931  Int_t labelLambda = v0->MatchToMC(3122, mcArray, 2, pdgDgv0);
2932 
2933  if ( labelLambda>-1 && mcTrkP->GetPdgCode()==211 && mcTrkN->GetPdgCode()==-2212 ) {
2934  fCounterRec_Cuts_AntiLambda->Fill(14);
2935  }
2936  }
2937  */
2938 
2939  //======================================== reconstruct Xi+ ============================
2940  if ( TMath::Abs(massAntiLambda_Rec-massLambda)<=(fAnaCuts->GetProdMassTolLambda()) ) {
2941  f2DHistArmenterosPodolanski_AntiLam->Fill(alpha_FirstDaugPos, v0->PtArmV0());
2942  KFParticle kfpAntiLambda_m = kfpAntiLambda;
2943  kfpAntiLambda_m.SetNonlinearMassConstraint(massLambda);
2944 // kfpAntiLambda_m.SetMassConstraint(massLambda);
2945  fHistMassAntiLambda_M->Fill(kfpAntiLambda.GetMass());
2946  if ( CheckKFParticleCov(kfpAntiLambda_m) && TMath::Abs(kfpAntiLambda.GetE())>TMath::Abs(kfpAntiLambda.GetPz()) ) {
2947 
2948  for (Int_t itrkPion2=0; itrkPion2<flag_trkP; itrkPion2++) { // Loop for bachelor in cascade pion+
2949  if ( trackP[itrkPion2]->GetID()==trkP->GetID() ) continue;
2950  fCounterRec_Cuts_XiPlus->Fill(1);
2951  if ( fIsMC ) {
2952  Int_t lab_XiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkPion2], mcArray);
2953  if (lab_XiPlus>-1) {
2954  fCounterRecMC_Cuts_XiPlus->Fill(1);
2955  }
2956  }
2957 
2958  if ( !fAnaCuts->PassedTrackQualityCuts_SecondaryPion(trackP[itrkPion2]) ) continue;
2959 
2960  KFParticle kfpPion2 = CreateKFParticleFromAODtrack(trackP[itrkPion2], 211);
2961 
2962  // select secondary pion tracks
2963  /*
2964  KFParticle kfpPion2_sec = kfpPion2;
2965  kfpPion2_sec.SetProductionVertex(PV);
2966  if ( kfpPion2_sec.GetChi2()<=18.4 ) continue;
2967  fCounterRec_Cuts_XiPlus->Fill(2);
2968  if ( fIsMC ) {
2969  Int_t lab_XiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkPion2], mcArray);
2970  if (lab_XiPlus>-1) {
2971  fCounterRecMC_Cuts_XiPlus->Fill(2);
2972  }
2973  }
2974  */
2975 
2976  KFParticle kfpXiPlus;
2977 // kfpXiPlus.SetPDG(-3312);
2978  const KFParticle *vXiDs[2] = {&kfpPion2, &kfpAntiLambda_m};
2979  kfpXiPlus.Construct(vXiDs, NDaughters);
2980 
2981  // check rapidity of Xi+
2982  if ( TMath::Abs(kfpXiPlus.GetE())<=TMath::Abs(kfpXiPlus.GetPz()) ) continue;
2983 
2984  if ( fabs(kfpXiPlus.GetRapidity())<0.8 ) {
2985  fCounterRec_Cuts_XiPlus->Fill(2);
2986  if ( fIsMC ) {
2987  Int_t lab_XiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkPion2], mcArray);
2988  if (lab_XiPlus>-1) {
2989  fCounterRecMC_Cuts_XiPlus->Fill(2);
2990  f2DCounterRecMC_CutsVsPt_XiPlus->Fill(2, kfpXiPlus.GetPt());
2991  }
2992  }
2993  }
2994 
2995  // chi2>0 && NDF>0
2996  if ( kfpXiPlus.GetNDF()<=0 || kfpXiPlus.GetChi2()<=0 ) continue;
2997 
2998  // Prefilter
2999  if ( kfpXiPlus.GetChi2()/kfpXiPlus.GetNDF() >= fAnaCuts->GetKFPXi_Chi2geoMax() ) continue;
3000 
3001  // check covariance matrix
3002  if ( !CheckKFParticleCov(kfpXiPlus) ) continue;
3003 
3004  // cut on mass window
3005  Float_t massXiPlus_Rec, err_massXiPlus;
3006  kfpXiPlus.GetMass(massXiPlus_Rec, err_massXiPlus);
3007  if ( err_massXiPlus<=0 ) continue;
3008 
3009  if ( fabs(kfpXiPlus.GetRapidity())<0.8 ) {
3010  fCounterRec_Cuts_XiPlus->Fill(3);
3011  if ( fIsMC ) {
3012  Int_t lab_XiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkPion2], mcArray);
3013  if (lab_XiPlus>-1) {
3014  fCounterRecMC_Cuts_XiPlus->Fill(3);
3015  f2DCounterRecMC_CutsVsPt_XiPlus->Fill(3, kfpXiPlus.GetPt());
3016  }
3017  }
3018  }
3019  fHistChi2ndfXiPlus->Fill(kfpXiPlus.GetChi2()/kfpXiPlus.GetNDF());
3020  fHistProbXiPlus->Fill(TMath::Prob(kfpXiPlus.GetChi2(), kfpXiPlus.GetNDF()));
3021  /*
3022  // 0<chi2/NDF<cut
3023  if ( kfpXiPlus.GetChi2()/kfpXiPlus.GetNDF()<=0 || (kfpXiPlus.GetChi2()/kfpXiPlus.GetNDF())>=(fAnaCuts->GetKFPXiPlusChi2Cut()) ) continue;
3024  fCounterRec_Cuts_XiPlus->Fill(5);
3025  if ( fIsMC ) {
3026  Int_t lab_XiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkPion2], mcArray);
3027  if (lab_XiPlus>-1) {
3028  fCounterRecMC_Cuts_XiPlus->Fill(5);
3029  f2DCounterRecMC_CutsVsPt_XiPlus->Fill(5, kfpXiPlus.GetPt());
3030  }
3031  }
3032  fHistProbXiPlus_chi2cut->Fill(TMath::Prob(kfpXiPlus.GetChi2(), kfpXiPlus.GetNDF()));
3033  */
3034  // set production vertext to PV
3035 // KFParticle kfpXiPlus_pv = kfpXiPlus;
3036 // kfpXiPlus_pv.SetProductionVertex(PV);
3037  /*
3038  if ( kfpXiPlus_pv.GetChi2()/kfpXiPlus_pv.GetNDF()>=3 ) continue;
3039  fCounterRec_Cuts_XiPlus->Fill(6);
3040  if ( fIsMC ) {
3041  Int_t lab_XiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkPion2], mcArray);
3042  if (lab_XiPlus>-1) {
3043  fCounterRecMC_Cuts_XiPlus->Fill(6);
3044  f2DCounterRecMC_CutsVsPt_XiPlus->Fill(6, kfpXiPlus_pv.GetPt());
3045  }
3046  }
3047  */
3048  // store mass of Xi+
3049  fHistMassXiPlus->Fill(kfpXiPlus.GetMass());
3050  fHistMassXiTot->Fill(kfpXiPlus.GetMass());
3051  f2DHistMassPtXiPlus->Fill(kfpXiPlus.GetPt(), kfpXiPlus.GetMass());
3052 
3053  if ( fabs(kfpXiPlus.GetRapidity())<0.8 ) {
3054  fCounterRec_Cuts_XiPlus->Fill(4);
3055  if (TMath::Abs(kfpXiPlus.GetRapidity())<0.5) fCounterRec_Cuts_XiPlus->Fill(5);
3056  if ( fIsMC ) {
3057  Int_t lab_XiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkPion2], mcArray);
3058  if (lab_XiPlus>-1) {
3059  fCounterRecMC_Cuts_XiPlus->Fill(4);
3060  f2DCounterRecMC_CutsVsPt_XiPlus->Fill(4, kfpXiPlus.GetPt());
3061  if (TMath::Abs(kfpXiPlus.GetRapidity())<0.5) {
3062  fCounterRecMC_Cuts_XiPlus->Fill(5);
3063  f2DCounterRecMC_CutsVsPt_XiPlus->Fill(5, kfpXiPlus.GetPt());
3064  }
3065  }
3066  }
3067  }
3068 
3069  /*
3070  // calculate proper decay length of Xi+ and Anti-lambda
3071  if ( kfpAntiLambda.GetP()>0 || kfpXiPlus_pv.GetP()>0 ) {
3072  Double_t properDecayL_XiPlus = kfpXiPlus_pv.GetDecayLength() * kfpXiPlus_pv.GetMass() / kfpXiPlus_pv.GetP();
3073  fHistDecayLXiPlus->Fill(properDecayL_XiPlus);
3074  f2DHistXiPlusXY_DV->Fill(kfpXiPlus.GetX(), kfpXiPlus.GetY());
3075  f2DHistXiPlusXY_PV->Fill(kfpXiPlus_pv.GetX(), kfpXiPlus_pv.GetY());
3076  // calculate proper decay length of Anti-lambda
3077  kfpAntiLambda.SetProductionVertex(kfpXiPlus);
3078  Double_t properDecayL_AntiLambda = kfpAntiLambda.GetDecayLength() * kfpAntiLambda.GetMass() / kfpAntiLambda.GetP();
3079  fHistDecayLAntiLambda->Fill(properDecayL_AntiLambda);
3080  }
3081  */
3082 
3083 
3084 
3085 
3086  //======================================== reconstruct Anti-XicZero ============================
3087  if ( TMath::Abs(massXiPlus_Rec-massXi)<=(fAnaCuts->GetProdMassTolXi()) ) {
3088  // set nonlinear mass constraint
3089  KFParticle kfpXiPlus_m = kfpXiPlus;
3090  kfpXiPlus_m.SetNonlinearMassConstraint(massXi);
3091 // kfpXiPlus_m.SetMassConstraint(massXi);
3092  fHistMassXiPlus_M->Fill(kfpXiPlus_m.GetMass());
3093  if ( CheckKFParticleCov(kfpXiPlus_m) && TMath::Abs(kfpXiPlus.GetE())>TMath::Abs(kfpXiPlus.GetPz()) ) {
3094  for (Int_t itrkBP=0; itrkBP<flag_trkN; itrkBP++) { // Loop for first bachelor pion-
3095  if ( trackN[itrkBP]->GetID()==trkN->GetID() ) continue;
3096 
3097 // if ( !fAnaCuts->SingleTrkCuts(trackN[itrkBP]) ) continue;
3098  if ( !fAnaCuts->PassedTrackQualityCuts_PrimaryPion(trackN[itrkBP]) ) continue;
3099 
3100  // DCA of Cascade-bachelor to PV (cm)
3101 // Double_t d0z0bach[2],covd0z0bach[3];
3102 // if (!trackP[itrkPion2]->PropagateToDCA(fpVtx,fBzkG,kVeryBig,d0z0bach,covd0z0bach)) continue;
3103 // if ( d0z0bach[0] <= fAnaCuts->GetProdDcaBachToPrimVertexMin() ) continue;
3104 
3105  KFParticle kfpBP = CreateKFParticleFromAODtrack(trackN[itrkBP], -211);
3106 
3107  // select primary pion tracks
3108  /*
3109  KFParticle kfpBP_prm = kfpBP;
3110  kfpBP_prm.SetProductionVertex(PV);
3111  if ( kfpBP_prm.GetChi2()>18.4 ) continue;
3112  */
3113 
3114 // if (fIsMC) {
3115 // Int_t labelXiMinus = MatchToMCXiMinus(trkP, trkN, trackN[itrkPion2], mcArray);
3116 // Int_t labelXiPlus = MatchToMCXiPlus(trkN, trkP, trackP[itrkBP], mcArray);
3117 // if (labelXiMinus>-1) {
3118 // fHistMassXiMinus_Match->Fill(kfpXiMinus.GetMass());
3119 // }
3120 // }
3121 
3122  // reconstruct Anti-XicZero
3123  KFParticle kfpAntiXicZero;
3124  const KFParticle *vXicZeroDs[2] = {&kfpBP, &kfpXiPlus_m};
3125  kfpAntiXicZero.Construct(vXicZeroDs, NDaughters);
3126  fHistProbAntiXicZero->Fill(TMath::Prob(kfpAntiXicZero.GetChi2(), kfpAntiXicZero.GetNDF()));
3127  // check rapidity of Anti-XicZero
3128  if ( TMath::Abs(kfpAntiXicZero.GetE())<=TMath::Abs(kfpAntiXicZero.GetPz()) ) continue;
3129  // chi2>0 && NDF>0
3130  if ( kfpAntiXicZero.GetNDF()<=0 || kfpAntiXicZero.GetChi2()<=0 ) continue;
3131 
3132  // Prefilter
3133  if ( kfpAntiXicZero.GetChi2()/kfpAntiXicZero.GetNDF() >= fAnaCuts->GetKFPXic0_Chi2geoMax() ) continue;
3134  if ( kfpAntiXicZero.GetPt() < fAnaCuts->GetPtMinXic0() ) continue;
3135 
3136  // check covariance matrix
3137  if ( !CheckKFParticleCov(kfpAntiXicZero) ) continue;
3138  // err_massAntiXicZero > 0
3139  Float_t massAntiXicZero_Rec, err_massAntiXicZero;
3140  kfpAntiXicZero.GetMass(massAntiXicZero_Rec, err_massAntiXicZero);
3141  if ( err_massAntiXicZero<=0 ) continue;
3142 
3143  /*
3144  // 0<chi2/NDF<cut
3145  if ( kfpAntiXicZero.GetChi2()/kfpAntiXicZero.GetNDF()<=0 || (kfpAntiXicZero.GetChi2()/kfpAntiXicZero.GetNDF())>=(fAnaCuts->GetKFPAntiXicZeroChi2Cut()) ) continue;
3146  fHistProbAntiXicZero_chi2cut->Fill(TMath::Prob(kfpAntiXicZero.GetChi2(), kfpAntiXicZero.GetNDF()));
3147  */
3148  // set production vertext to PV
3149 // KFParticle kfpAntiXicZero_pv = kfpAntiXicZero;
3150 // kfpAntiXicZero_pv.SetProductionVertex(PV);
3151  /*
3152  if ( kfpAntiXicZero_pv.GetChi2()/kfpAntiXicZero_pv.GetNDF()>=3 ) continue;
3153  */
3154  /*
3155  // store mass of XicZero
3156  fHistMassAntiXicZero->Fill(kfpAntiXicZero_pv.GetMass());
3157  fHistMassXicZeroTot->Fill(kfpAntiXicZero_pv.GetMass());
3158  f2DHistMassPtAntiXicZero->Fill(kfpAntiXicZero_pv.GetPt(), kfpAntiXicZero_pv.GetMass());
3159  f2DHistMassPtXicZeroTot->Fill(kfpAntiXicZero_pv.GetPt(), kfpAntiXicZero_pv.GetMass());
3160 
3161 
3162  TVector3 momXiPlus(kfpXiPlus.GetPx(), kfpXiPlus.GetPy(), kfpXiPlus.GetPz());
3163 // TVector3 momBP(kfpBP_prm.GetPx(), kfpBP_prm.GetPy(), kfpBP_prm.GetPz());
3164  TVector3 momBP(kfpBP.GetPx(), kfpBP.GetPy(), kfpBP.GetPz());
3165  TVector3 momAntiXicZero(kfpAntiXicZero_pv.GetPx(), kfpAntiXicZero_pv.GetPy(), kfpAntiXicZero_pv.GetPz());
3166  Float_t QtDiffPionXiPlus = momBP.Perp(momAntiXicZero) - momXiPlus.Perp(momAntiXicZero);
3167  fHistQtDiffPionXiPlus->Fill(QtDiffPionXiPlus);
3168  */
3169 
3170 // if (TMath::Abs(QtDiffPionXiPlus)>1.e-5) continue;
3171 
3172  if (fWriteXic0Tree) {
3173  Int_t lab_AntiXic0 = -9999.;
3174  if (fIsMC) {
3175  lab_AntiXic0 = MatchToMCAntiXic0(trkN, trkP, trackP[itrkPion2], trackN[itrkBP], mcArray);
3176  }
3177  FillTreeRecXic0FromV0(kfpAntiXicZero, trackN[itrkBP], kfpBP, kfpXiPlus, kfpXiPlus_m, trackP[itrkPion2], v0, kfpK0Short, kfpAntiLambda, kfpAntiLambda_m, trkN, trkP, PV, mcArray, lab_AntiXic0);
3178  }
3179 
3180  kfpAntiXicZero.Clear();
3181  kfpBP.Clear();
3182  } // loop for Anti-XicZero
3183  }
3184  kfpXiPlus_m.Clear();
3185  } // Xi+ mass cut
3186  kfpXiPlus.Clear();
3187  kfpPion2.Clear();
3188  } // loop for Xi+
3189  } // check cov. of Anti-lambda && |E|>|Pz|
3190  kfpAntiLambda_m.Clear();
3191  } // Anti-lambda mass cut
3192 // } // select secondary anti-lambda
3193  } // separate lambda & anti-lambda and check cov. of Anti-lambda
3194 
3195 /*
3196  // check MC of Lambda
3197  if (fIsMC) {
3198  if ( trkP->GetLabel()<0 || trkN->GetLabel()<0 ) continue;
3199  AliAODMCParticle* mcTrkP = static_cast<AliAODMCParticle*>(mcArray->At(trkP->GetLabel()));
3200  AliAODMCParticle* mcTrkN = static_cast<AliAODMCParticle*>(mcArray->At(trkN->GetLabel()));
3201  Double_t xTrkP_Rec_MC = xyzP[0] - mcTrkP->Xv();
3202  Double_t yTrkP_Rec_MC = xyzP[1] - mcTrkP->Yv();
3203  Double_t zTrkP_Rec_MC = xyzP[2] - mcTrkP->Zv();
3204  Double_t xTrkP_Rec_MC_Xv = xvyvzvP[0] - mcTrkP->Xv();
3205  Double_t yTrkP_Rec_MC_Yv = xvyvzvP[1] - mcTrkP->Yv();
3206  Double_t zTrkP_Rec_MC_Zv = xvyvzvP[2] - mcTrkP->Zv();
3207 // cout << "x==" << xyzP[0] << endl;
3208 // cout << "xv==" << xvyvzvP[0] << endl;
3209 // cout << "xatDCA==" << trk->XAtDCA() << endl;
3210  fHistXtrkP_Rec_MC->Fill(xTrkP_Rec_MC);
3211  fHistYtrkP_Rec_MC->Fill(yTrkP_Rec_MC);
3212  fHistZtrkP_Rec_MC->Fill(zTrkP_Rec_MC);
3213  fHistXtrkP_Rec_MC_XYZv->Fill(xTrkP_Rec_MC_Xv);
3214  fHistYtrkP_Rec_MC_XYZv->Fill(yTrkP_Rec_MC_Yv);
3215  fHistZtrkP_Rec_MC_XYZv->Fill(zTrkP_Rec_MC_Zv);
3216  Double_t xTrkN_Rec_MC = xyzN[0] - mcTrkN->Xv();
3217  Double_t yTrkN_Rec_MC = xyzN[1] - mcTrkN->Yv();
3218  Double_t zTrkN_Rec_MC = xyzN[2] - mcTrkN->Zv();
3219  Double_t xTrkN_Rec_MC_Xv = xvyvzvN[0] - mcTrkN->Xv();
3220  Double_t yTrkN_Rec_MC_Yv = xvyvzvN[1] - mcTrkN->Yv();
3221  Double_t zTrkN_Rec_MC_Zv = xvyvzvN[2] - mcTrkN->Zv();
3222  fHistXtrkN_Rec_MC->Fill(xTrkN_Rec_MC);
3223  fHistYtrkN_Rec_MC->Fill(yTrkN_Rec_MC);
3224  fHistZtrkN_Rec_MC->Fill(zTrkN_Rec_MC);
3225  fHistXtrkN_Rec_MC_XYZv->Fill(xTrkN_Rec_MC_Xv);
3226  fHistYtrkN_Rec_MC_XYZv->Fill(yTrkN_Rec_MC_Yv);
3227  fHistZtrkN_Rec_MC_XYZv->Fill(zTrkN_Rec_MC_Zv);
3228 
3229  Int_t labelLambda = MatchToMCLambda(trkP, trkN, mcArray);
3230  Int_t labelAntiLambda = MatchToMCAntiLambda(trkN, trkP, mcArray);
3231 
3232 
3233  // Lambda
3234  if (labelLambda>-1) {
3235 
3236  fHistMassLambda_Match->Fill(kfpLambda.GetMass());
3237  fHistMassLambdaTot_Match->Fill(kfpLambda.GetMass());
3238  f2DHistChi2vsNDF_Lambda_Match->Fill(kfpLambda.GetNDF(), kfpLambda.GetChi2());
3239  fHistChi2ndfLambda_Match->Fill(kfpLambda.GetChi2()/kfpLambda.GetNDF());
3240  fHistProbLambda_Match->Fill(TMath::Prob(kfpLambda.GetChi2(), kfpLambda.GetNDF()));
3241 
3242  AliAODMCParticle* mcLambda = static_cast<AliAODMCParticle*>(mcArray->At(labelLambda));
3243  AliAODMCParticle* mcProton = static_cast<AliAODMCParticle*>(mcArray->At(mcLambda->GetDaughterFirst()));
3244  AliAODMCParticle* mcPion = static_cast<AliAODMCParticle*>(mcArray->At(mcLambda->GetDaughterLast()));
3245 // cout << "PDG Proton ==" << mcProton->GetPdgCode() << endl;
3246 // cout << "PDG Pion ==" << mcPion->GetPdgCode() << endl;
3247 
3248  //====================== check daughters =============================
3249  Double_t par_Proton[3], cov_Proton[6]={0.};
3250  Double_t par_Pion[3], cov_Pion[6]={0.};
3251  mcProton->XvYvZv(par_Proton);
3252  mcPion->XvYvZv(par_Pion);
3253  KFParticle kfpMCproton = CreateKFVertex(par_Proton, cov_Proton);
3254  KFParticle kfpMCpion = CreateKFVertex(par_Pion, cov_Pion);
3255  kfpProton.SetProductionVertex(kfpMCproton);
3256  kfpPionMinus.SetProductionVertex(kfpMCpion);
3257 // if ( kfpProton.GetNDF()<=0 || kfpProton.GetChi2()<0 ) continue;
3258 // if ( kfpProton.GetChi2()/kfpProton.GetNDF()<=0 || kfpProton.GetChi2()/kfpProton.GetNDF()>=3 ) continue;
3259 
3260  Double_t xProton_KF_MC = kfpProton.GetX() - mcProton->Xv();
3261  Double_t yProton_KF_MC = kfpProton.GetY() - mcProton->Yv();
3262  Double_t zProton_KF_MC = kfpProton.GetZ() - mcProton->Zv();
3263  Double_t xPion_KF_MC = kfpPionMinus.GetX() - mcPion->Xv();
3264  Double_t yPion_KF_MC = kfpPionMinus.GetY() - mcPion->Yv();
3265  Double_t zPion_KF_MC = kfpPionMinus.GetZ() - mcPion->Zv();
3266  fHistXProton_KF_MC->Fill(xProton_KF_MC);
3267  fHistYProton_KF_MC->Fill(yProton_KF_MC);
3268  fHistZProton_KF_MC->Fill(zProton_KF_MC);
3269  fHistXPion_KF_MC->Fill(xPion_KF_MC);
3270  fHistYPion_KF_MC->Fill(yPion_KF_MC);
3271  fHistZPion_KF_MC->Fill(zPion_KF_MC);
3272  f2DHistXKFMCvsPt_Proton->Fill(kfpProton.GetPt(), xProton_KF_MC);
3273  f2DHistYKFMCvsPt_Proton->Fill(kfpProton.GetPt(), yProton_KF_MC);
3274  f2DHistZKFMCvsPt_Proton->Fill(kfpProton.GetPt(), zProton_KF_MC);
3275  f2DHistXKFMCvsPt_Pion->Fill(kfpPionMinus.GetPt(), xPion_KF_MC);
3276  f2DHistYKFMCvsPt_Pion->Fill(kfpPionMinus.GetPt(), yPion_KF_MC);
3277  f2DHistZKFMCvsPt_Pion->Fill(kfpPionMinus.GetPt(), zPion_KF_MC);
3278 
3279  fHistChi2ndfProton->Fill(kfpProton.GetChi2()/kfpProton.GetNDF());
3280  fHistProbProton->Fill(TMath::Prob(kfpProton.GetChi2(), kfpProton.GetNDF()));
3281  fHistChi2ndfPion->Fill(kfpPionMinus.GetChi2()/kfpPionMinus.GetNDF());
3282  fHistProbPion->Fill(TMath::Prob(kfpPionMinus.GetChi2(), kfpPionMinus.GetNDF()));
3283 
3284  if (kfpProton.GetCovariance(0,0)>0) {
3285  Double_t err_xProton = TMath::Sqrt(kfpProton.GetCovariance(0,0));
3286  Double_t xProton_PULL = xProton_KF_MC/err_xProton;
3287  fHistXProton_PULL->Fill(xProton_PULL);
3288  f2DHistXPULLvsPt_Proton->Fill(kfpProton.GetPt(), xProton_PULL);
3289  }
3290  if (kfpProton.GetCovariance(1,1)>0) {
3291  Double_t err_yProton = TMath::Sqrt(kfpProton.GetCovariance(1,1));
3292  Double_t yProton_PULL = yProton_KF_MC/err_yProton;
3293  fHistYProton_PULL->Fill(yProton_PULL);
3294  f2DHistYPULLvsPt_Proton->Fill(kfpProton.GetPt(), yProton_PULL);
3295  }
3296  if (kfpProton.GetCovariance(2,2)>0) {
3297  Double_t err_zProton = TMath::Sqrt(kfpProton.GetCovariance(2,2));
3298  Double_t zProton_PULL = zProton_KF_MC/err_zProton;
3299  fHistZProton_PULL->Fill(zProton_PULL);
3300  f2DHistZPULLvsPt_Proton->Fill(kfpProton.GetPt(), zProton_PULL);
3301  }
3302 
3303  if (kfpPionMinus.GetCovariance(0,0)>0) {
3304  Double_t err_xPion = TMath::Sqrt(kfpPionMinus.GetCovariance(0,0));
3305  Double_t xPion_PULL = xPion_KF_MC/err_xPion;
3306  fHistXPion_PULL->Fill(xPion_PULL);
3307  f2DHistXPULLvsPt_Pion->Fill(kfpPionMinus.GetPt(), xPion_PULL);
3308  }
3309  if (kfpPionMinus.GetCovariance(1,1)>0) {
3310  Double_t err_yPion = TMath::Sqrt(kfpPionMinus.GetCovariance(1,1));
3311  Double_t yPion_PULL = yPion_KF_MC/err_yPion;
3312  fHistYPion_PULL->Fill(yPion_PULL);
3313  f2DHistYPULLvsPt_Pion->Fill(kfpPionMinus.GetPt(), yPion_PULL);
3314  }
3315  if (kfpPionMinus.GetCovariance(2,2)>0) {
3316  Double_t err_zPion = TMath::Sqrt(kfpPionMinus.GetCovariance(2,2));
3317  Double_t zPion_PULL = zPion_KF_MC/err_zPion;
3318  fHistZPion_PULL->Fill(zPion_PULL);
3319  f2DHistZPULLvsPt_Pion->Fill(kfpPionMinus.GetPt(), zPion_PULL);
3320  }
3321  //=====================================================================
3322 
3323  Double_t xLambda_KF_MC = kfpLambda.GetX() - mcProton->Xv();
3324  Double_t yLambda_KF_MC = kfpLambda.GetY() - mcProton->Yv();
3325  Double_t zLambda_KF_MC = kfpLambda.GetZ() - mcProton->Zv();
3326 
3327  Double_t xLambda_V0_MC = v0->DecayVertexV0X() - mcProton->Xv();
3328 
3329  Double_t ptLambda_KF_MC = ptLambda_Rec - mcLambda->Pt();
3330  Double_t ptLambda_KF_MC_R = ptLambda_KF_MC/ptLambda_Rec;
3331 
3332  Double_t ptLambda_V0_MC = v0->Pt() - mcLambda->Pt();
3333  Double_t ptLambda_V0_MC_R = ptLambda_V0_MC/(v0->Pt());
3334 
3335  fHistXLambda_KF_MC->Fill(xLambda_KF_MC);
3336  fHistYLambda_KF_MC->Fill(yLambda_KF_MC);
3337  fHistZLambda_KF_MC->Fill(zLambda_KF_MC);
3338  f2DHistXRecMCvsPt_Lambda->Fill(ptLambda_Rec, xLambda_KF_MC);
3339  f2DHistPtRecMCvsPt_Lambda->Fill(ptLambda_Rec, ptLambda_KF_MC_R);
3340 
3341  fHistXLambda_V0_MC->Fill(xLambda_V0_MC);
3342  f2DHistXV0MCvsPt_Lambda->Fill(v0->Pt(), xLambda_V0_MC);
3343  f2DHistPtV0MCvsPt_Lambda->Fill(v0->Pt(), ptLambda_V0_MC_R);
3344 
3345 
3346  if (err_ptLambda>0) {
3347  Double_t ptLambda_PULL = ptLambda_KF_MC/err_ptLambda;
3348  f2DHistPtPULLvsPt_Lambda->Fill(ptLambda_Rec, ptLambda_PULL);
3349  }
3350 
3351  if (err_massLambda>0) {
3352  Double_t massLambda_KF_MC = massLambda_Rec - massLambda;
3353  Double_t massLambda_V0_MC = v0->MassLambda() - massLambda;
3354  fHistMassLambda_KF_MC->Fill(massLambda_KF_MC);
3355  fHistMassLambda_V0_MC->Fill(massLambda_V0_MC);
3356  f2DHistMassRecMCvsPt_Lambda->Fill(ptLambda_Rec, massLambda_KF_MC);
3357  f2DHistMassV0MCvsPt_Lambda->Fill(v0->Pt(), massLambda_V0_MC);
3358  Double_t massLambda_PULL = massLambda_KF_MC/err_massLambda;
3359  fHistMassLambda_PULL_KF->Fill(massLambda_PULL);
3360  f2DHistMassPULLvsPt_Lambda->Fill(ptLambda_Rec, massLambda_PULL);
3361  Double_t radius_Lambda = TMath::Sqrt(kfpLambda.GetX()*kfpLambda.GetX()+kfpLambda.GetY()*kfpLambda.GetY());
3362  f2DHistMassPULLvsRadius_Lambda->Fill(radius_Lambda, massLambda_PULL);
3363  }
3364  if (kfpLambda.GetCovariance(0,0)>0) {
3365  Double_t err_xLambda = TMath::Sqrt(kfpLambda.GetCovariance(0,0));
3366  Double_t xLambda_PULL = xLambda_KF_MC/err_xLambda;
3367  fHistXLambda_PULL->Fill(xLambda_PULL);
3368  f2DHistXPULLvsPt_Lambda->Fill(ptLambda_Rec, xLambda_PULL);
3369  }
3370  if (kfpLambda.GetCovariance(1,1)>0) {
3371  Double_t err_yLambda = TMath::Sqrt(kfpLambda.GetCovariance(1,1));
3372  Double_t yLambda_PULL = yLambda_KF_MC/err_yLambda;
3373  fHistYLambda_PULL->Fill(yLambda_PULL);
3374  }
3375  if (kfpLambda.GetCovariance(2,2)>0) {
3376  Double_t err_zLambda = TMath::Sqrt(kfpLambda.GetCovariance(2,2));
3377  Double_t zLambda_PULL = zLambda_KF_MC/err_zLambda;
3378  fHistZLambda_PULL->Fill(zLambda_PULL);
3379  }
3380 
3381 
3382 
3383 // Double_t dz_Lambda[2], cov[3];
3384 // AliAODVertex *vtx_v0 = reinterpret_cast<AliAODVertex*>(v0);
3385 // trkP->PropagateToDCA(vtx_v0, fBzkG, kVeryBig, dz_Lambda, cov);
3386 // Double_t xyz_new[3]={-999,-999,-999};
3387 // trkP->GetXYZ(xyz_new);
3388 // Double_t xProton_V0_MC = xyz_new[0] - mcProton->Xv();
3389 // fHistXLambda_V0_MC->Fill(xProton_V0_MC);
3390 // f2DHistXV0MCvsPt_Lambda->Fill(trkP->Pt(), xProton_V0_MC);
3391 // if (cov[0]>0) {
3392 // Double_t err_xProton_V0 = TMath::Sqrt(cov[0]);
3393 // Double_t xProton_PULL_V0 = xProton_V0_MC/err_xProton_V0;
3394 // f2DHistXPULLvsPt_Lambda_V0->Fill(trkP->Pt(), xProton_PULL_V0);
3395 // }
3396 
3397 
3398 
3399 
3400 
3401  }
3402 
3403  // Anti-Lambda
3404  if (labelAntiLambda>-1) {
3405  fHistMassAntiLambda_Match->Fill(kfpAntiLambda.GetMass());
3406  fHistMassLambdaTot_Match->Fill(kfpAntiLambda.GetMass());
3407  fHistChi2ndfAntiLambda_Match->Fill(kfpAntiLambda.GetChi2()/kfpAntiLambda.GetNDF());
3408  fHistProbAntiLambda_Match->Fill(TMath::Prob(kfpAntiLambda.GetChi2(), kfpAntiLambda.GetNDF()));
3409 
3410  AliAODMCParticle* mcAntiLambda = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiLambda));
3411  AliAODMCParticle* mcAntiProton = static_cast<AliAODMCParticle*>(mcArray->At(mcAntiLambda->GetDaughterFirst()));
3412  AliAODMCParticle* mcAntiPion = static_cast<AliAODMCParticle*>(mcArray->At(mcAntiLambda->GetDaughterLast()));
3413 // cout << "PDG antiProton ==" << mcAntiProton->GetPdgCode() << endl;
3414 // cout << "PDG antiPion ==" << mcAntiPion->GetPdgCode() << endl;
3415 
3416  Double_t xAntiLambda_Rec_MC = kfpAntiLambda.GetX() - mcAntiProton->Xv();
3417  Double_t yAntiLambda_Rec_MC = kfpAntiLambda.GetY() - mcAntiProton->Yv();
3418  Double_t zAntiLambda_Rec_MC = kfpAntiLambda.GetZ() - mcAntiProton->Zv();
3419  Double_t ptAntiLmabda_Rec_MC = ptAntiLambda_Rec - mcAntiLambda->Pt();
3420  Double_t ptAntiLmabda_Rec_MC_R = ptAntiLmabda_Rec_MC/ptAntiLambda_Rec;
3421 
3422  fHistXAntiLambda_Rec_MC->Fill(xAntiLambda_Rec_MC);
3423  fHistYAntiLambda_Rec_MC->Fill(yAntiLambda_Rec_MC);
3424  fHistZAntiLambda_Rec_MC->Fill(zAntiLambda_Rec_MC);
3425  f2DHistXRecMCvsPt_AntiLambda->Fill(ptAntiLambda_Rec, xAntiLambda_Rec_MC);
3426  f2DHistPtRecMCvsPt_AntiLambda->Fill(ptAntiLambda_Rec, ptAntiLmabda_Rec_MC_R);
3427 
3428  if (err_ptAntiLambda>0) {
3429  Double_t ptAntiLambda_PULL = ptAntiLmabda_Rec_MC/err_ptAntiLambda;
3430  f2DHistPtPULLvsPt_AntiLambda->Fill(ptAntiLambda_Rec, ptAntiLambda_PULL);
3431  }
3432  if (err_massAntiLambda>0) {
3433  Double_t massAntiLambda_KF_MC = massAntiLambda_Rec - massLambda;
3434  fHistMassAntiLambda_KF_MC->Fill(massAntiLambda_KF_MC);
3435  f2DHistMassRecMCvsPt_AntiLambda->Fill(ptAntiLambda_Rec, massAntiLambda_KF_MC);
3436  Double_t massAntiLambda_PULL = massAntiLambda_KF_MC/err_massAntiLambda;
3437  fHistMassAntiLambda_PULL_KF->Fill(massAntiLambda_PULL);
3438  f2DHistMassPULLvsPt_AntiLambda->Fill(ptAntiLambda_Rec, massAntiLambda_PULL);
3439  Double_t radius_AntiLambda = TMath::Sqrt(kfpAntiLambda.GetX()*kfpAntiLambda.GetX()+kfpAntiLambda.GetY()*kfpAntiLambda.GetY());
3440  f2DHistMassPULLvsRadius_AntiLambda->Fill(radius_AntiLambda, massAntiLambda_PULL);
3441  }
3442  if (kfpAntiLambda.GetCovariance(0,0)>0) {
3443  Double_t err_xAntiLambda = TMath::Sqrt(kfpAntiLambda.GetCovariance(0,0));
3444  Double_t xAntiLambda_PULL = xAntiLambda_Rec_MC/err_xAntiLambda;
3445  fHistXAntiLambda_PULL->Fill(xAntiLambda_PULL);
3446  f2DHistXPULLvsPt_AntiLambda->Fill(ptAntiLambda_Rec, xAntiLambda_PULL);
3447  }
3448  if (kfpAntiLambda.GetCovariance(1,1)>0) {
3449  Double_t err_yAntiLambda = TMath::Sqrt(kfpAntiLambda.GetCovariance(1,1));
3450  Double_t yAntiLambda_PULL = yAntiLambda_Rec_MC/err_yAntiLambda;
3451  fHistYAntiLambda_PULL->Fill(yAntiLambda_PULL);
3452  }
3453  if (kfpAntiLambda.GetCovariance(2,2)>0) {
3454  Double_t err_zAntiLambda = TMath::Sqrt(kfpAntiLambda.GetCovariance(2,2));
3455  Double_t zAntiLambda_PULL = zAntiLambda_Rec_MC/err_zAntiLambda;
3456  fHistZAntiLambda_PULL->Fill(zAntiLambda_PULL);
3457  }
3458  }
3459  }
3460 */
3461 
3462 
3463 
3464 
3465 
3466 
3467 /*
3468  if (kfpLambda.GetChi2()<0) {
3469  cout << "==========" << endl;
3470  cout << "Positive track (daughter1)" << endl;
3471  cout << covP[0] << endl;
3472  cout << covP[1] << " " << covP[2] << endl;
3473  cout << covP[3] << " " << covP[4] << " " << covP[5] << endl;
3474  cout << covP[6] << " " << covP[7] << " " << covP[8] << " " << covP[9] << endl;
3475  cout << covP[10] << " " << covP[11] << " " << covP[12] << " " << covP[13] << " " << covP[14] << endl;
3476  cout << covP[15] << " " << covP[16] << " " << covP[17] << " " << covP[18] << " " << covP[19] << " " << covP[20] << endl;
3477  cout << "Negative track (daughter2)" << endl;
3478  cout << covN[0] << endl;
3479  cout << covN[1] << " " << covN[2] << endl;
3480  cout << covN[3] << " " << covN[4] << " " << covN[5] << endl;
3481  cout << covN[6] << " " << covN[7] << " " << covN[8] << " " << covN[9] << endl;
3482  cout << covN[10] << " " << covN[11] << " " << covN[12] << " " << covN[13] << " " << covN[14] << endl;
3483  cout << covN[15] << " " << covN[16] << " " << covN[17] << " " << covN[18] << " " << covN[19] << " " << covN[20] << endl;
3484  std::cout << "Lambda at DP" << std::endl << " " << kfpLambda << std::endl;
3485  }
3486 
3487  if (kfpLambda.GetNDF()<0) {
3488  cout << "==========" << endl;
3489  cout << "Positive track (daughter1)" << endl;
3490  cout << kfpProton << endl;
3491  cout << "Negative track (daughter2)" << endl;
3492  cout << kfpPionMinus << endl;
3493  std::cout << "Lambda at DP" << std::endl << " " << kfpLambda << std::endl;
3494  }
3495 */
3496 
3497 
3498 
3499 
3500 
3501 /*
3502  f2DHistChi2vsNDF_Lambda->Fill(kfpLambda.GetNDF(), kfpLambda.GetChi2());
3503  f2DHistChi2vsNDF_AntiLambda->Fill(kfpAntiLambda.GetNDF(), kfpAntiLambda.GetChi2());
3504  fHistChi2ndfLambda->Fill(kfpLambda.GetChi2()/kfpLambda.GetNDF());
3505  fHistChi2ndfAntiLambda->Fill(kfpAntiLambda.GetChi2()/kfpAntiLambda.GetNDF());
3506  fHistChi2ndfLambdaTot->Fill(kfpLambda.GetChi2()/kfpLambda.GetNDF());
3507  fHistChi2ndfLambdaTot->Fill(kfpAntiLambda.GetChi2()/kfpAntiLambda.GetNDF());
3508 
3509  fHistProbLambda->Fill(TMath::Prob(kfpLambda.GetChi2(), kfpLambda.GetNDF()));
3510  fHistProbAntiLambda->Fill(TMath::Prob(kfpAntiLambda.GetChi2(), kfpAntiLambda.GetNDF()));
3511  fHistProbLambdaTot->Fill(TMath::Prob(kfpLambda.GetChi2(), kfpLambda.GetNDF()));
3512  fHistProbLambdaTot->Fill(TMath::Prob(kfpAntiLambda.GetChi2(), kfpAntiLambda.GetNDF()));
3513 
3514  Float_t massLambda_Rec, err_massLambda;
3515  Float_t massAntiLambda_Rec, err_massAntiLambda;
3516  Float_t ptLambda_Rec, err_ptLambda;
3517  Float_t ptAntiLambda_Rec, err_ptAntiLambda;
3518 
3519  kfpLambda.GetMass(massLambda_Rec, err_massLambda);
3520  kfpAntiLambda.GetMass(massAntiLambda_Rec, err_massAntiLambda);
3521  kfpLambda.GetPt(ptLambda_Rec, err_ptLambda);
3522  kfpAntiLambda.GetPt(ptAntiLambda_Rec, err_ptAntiLambda);
3523 
3524 // fHistMassLambda->Fill(kfpLambda.GetMass());
3525  fHistMassAntiLambda->Fill(kfpAntiLambda.GetMass());
3526  fHistMassLambdaTot->Fill(kfpLambda.GetMass());
3527  fHistMassLambdaTot->Fill(kfpAntiLambda.GetMass());
3528 
3529  fHistMassLambda_V0->Fill(v0->MassLambda());
3530  fHistMassAntiLambda_V0->Fill(v0->MassAntiLambda());
3531  fHistMassLambdaTot_V0->Fill(v0->MassLambda());
3532  fHistMassLambdaTot_V0->Fill(v0->MassAntiLambda());
3533 
3534  Double_t Lambda_KF_V0 = kfpLambda.GetMass() - v0->MassLambda();
3535  Double_t AntiLambda_KF_V0 = kfpAntiLambda.GetMass() - v0->MassAntiLambda();
3536 
3537  fHistMassLambda_KF_V0->Fill(Lambda_KF_V0);
3538  fHistMassAntiLambda_KF_V0->Fill(AntiLambda_KF_V0);
3539 
3540  fHistPtLambda->Fill(kfpLambda.GetPt());
3541  fHistPtAntiLambda->Fill(kfpAntiLambda.GetPt());
3542  fHistPtLambdaTot->Fill(kfpLambda.GetPt());
3543  fHistPtLambdaTot->Fill(kfpAntiLambda.GetPt());
3544 */
3545 
3546 
3547 
3548 // std::cout << "Proton at DP" << std::endl << " " << kfpProton << std::endl;
3549 // std::cout << "Pion3 at DP" << std::endl << " " << kfpPion3 << std::endl;
3550 // std::cout << "Lambda at DP" << std::endl << " " << kfpLambda << std::endl;
3551 
3552 
3553  // set linearised mass constraint
3554 // kfpLambda.SetMassConstraint(massLambda);
3555 // kfpAntiLambda.SetMassConstraint(massLambda);
3556  // set the exact nonlinear mass constraint
3557 
3558 /*
3559  if ( kfpLambda.GetChi2()/kfpLambda.GetNDF()<3 && kfpLambda.GetMass()>0 ) {
3560  kfpLambda.SetNonlinearMassConstraint(massLambda);
3561  fHistMassLambda_M->Fill(kfpLambda.GetMass());
3562  fHistMassLambdaTot_M->Fill(kfpLambda.GetMass());
3563  }
3564  if ( kfpAntiLambda.GetChi2()/kfpAntiLambda.GetNDF()<3 && kfpAntiLambda.GetMass()>0 ) {
3565  kfpAntiLambda.SetNonlinearMassConstraint(massLambda);
3566  fHistMassAntiLambda_M->Fill(kfpAntiLambda.GetMass());
3567  fHistMassLambdaTot_M->Fill(kfpAntiLambda.GetMass());
3568  }
3569 */
3570 
3571  kfpK0Short.Clear();
3572  kfpAntiLambda.Clear();
3573  kfpLambda.Clear();
3574  kfpPionPlus.Clear();
3575  kfpPionMinus.Clear();
3576  kfpAntiProton.Clear();
3577  kfpProton.Clear();
3578  }
3579 
3580  return;
3581 }
3582 
3583 //_____________________________________________________________________________
3584 void AliAnalysisTaskSEXicZero2XiPifromKFP::MakeAnaXicZeroFromCasc(AliAODEvent *AODEvent, TClonesArray *mcArray, KFParticle PV)
3585 {
3586  // Main analysis called from "UserExec"
3587 
3588 // std::cout.setf(std::ios::fixed);
3589 // std::cout.setf(std::ios::showpoint);
3590 // std::cout.precision(3);
3591 
3592  // set the magnetic field
3593  KFParticle::SetField(fBzkG);
3594 
3595  const UInt_t nCasc = AODEvent->GetNumberOfCascades();
3596 
3597  Double_t xyzP[3], xyzN[3];
3598  Double_t xvyvzvP[3], xvyvzvN[3];
3599  Double_t covP[21], covN[21], covB[21];
3600  const Int_t NDaughters = 2;
3601  const Float_t massLambda = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
3602  const Float_t massXi = TDatabasePDG::Instance()->GetParticle(3312)->Mass();
3603  const Float_t massK0S = TDatabasePDG::Instance()->GetParticle(310)->Mass();
3604 
3605  // select good candidates for pion
3606  const UInt_t nTracks = AODEvent->GetNumberOfTracks();
3607  AliAODTrack *trackP[nTracks], *trackN[nTracks];
3608  Int_t flag_trkP = 0, flag_trkN = 0;
3609 
3610  for (UInt_t itrk=0; itrk<nTracks; itrk++) {
3611  AliAODTrack *trk = static_cast<AliAODTrack*>(AODEvent->GetTrack(itrk));
3612  Double_t covtest[21];
3613  if ( !trk || trk->GetID()<0 || !trk->GetCovarianceXYZPxPyPz(covtest) || !CheckTrackCov(trk) ) continue;
3614 
3615  if (trk->Charge() > 0 ) {
3616  trackP[flag_trkP] = trk;
3617  flag_trkP++;
3618  }
3619  if (trk->Charge() < 0 ) {
3620  trackN[flag_trkN] = trk;
3621  flag_trkN++;
3622  }
3623  }
3624 
3625  for (UInt_t iCasc=0; iCasc<nCasc; iCasc++) {
3626  AliAODcascade *casc = AODEvent->GetCascade(iCasc);
3627  // cascade cut
3628  if ( !fAnaCuts->SingleCascCuts(casc) ) continue;
3629 
3630  AliAODTrack *ptrack = (AliAODTrack*) (casc->GetDaughter(0));
3631  AliAODTrack *ntrack = (AliAODTrack*) (casc->GetDaughter(1));
3632  AliAODTrack *btrack = (AliAODTrack*) (casc->GetDecayVertexXi()->GetDaughter(0));
3633 
3634  if ( !ptrack||!ntrack||!btrack ) continue;
3635 
3636  // check charge of the first daughter, if negative, define it as the second one
3637  if ( ptrack->Charge()<0 ) {
3638  ptrack = (AliAODTrack*) (casc->GetDaughter(1));
3639  ntrack = (AliAODTrack*) (casc->GetDaughter(0));
3640  }
3641 
3642  if ( !ptrack->GetCovarianceXYZPxPyPz(covP) || !ntrack->GetCovarianceXYZPxPyPz(covN) || !btrack->GetCovarianceXYZPxPyPz(covB) ) continue;
3643 
3644  if ( !CheckTrackCov(ptrack) || !CheckTrackCov(ntrack) || !CheckTrackCov(btrack) ) continue;
3645 
3646  KFParticle kfpProton = CreateKFParticleFromAODtrack(ptrack, 2212);
3647  KFParticle kfpPionMinus = CreateKFParticleFromAODtrack(ntrack, -211);
3648  KFParticle kfpAntiProton = CreateKFParticleFromAODtrack(ntrack, -2212);
3649  KFParticle kfpPionPlus = CreateKFParticleFromAODtrack(ptrack, 211);
3650 
3651  // === K0S ===
3652  KFParticle kfpK0Short;
3653  const KFParticle *vk0sDaughters[2] = {&kfpPionPlus, &kfpPionMinus};
3654 
3655  kfpK0Short.Construct(vk0sDaughters, NDaughters);
3656 
3657  Float_t massK0S_Rec, err_massK0S;
3658  kfpK0Short.GetMass(massK0S_Rec, err_massK0S);
3659  // ============
3660 
3661  if ( btrack->Charge()<0 ) {
3662 
3663  const KFParticle *vDaughters[2] = {&kfpProton, &kfpPionMinus};
3664 
3665  KFParticle kfpLambda;
3666  kfpLambda.Construct(vDaughters, NDaughters);
3667  Float_t massLambda_Rec, err_massLambda;
3668  kfpLambda.GetMass(massLambda_Rec, err_massLambda);
3669 
3670  // check rapidity of lambda
3671  if ( TMath::Abs(kfpLambda.GetE())<=TMath::Abs(kfpLambda.GetPz()) ) continue;
3672 
3673  // chi2>0 && NDF>0 for selecting Lambda
3674  if ( (kfpLambda.GetNDF()<=0 || kfpLambda.GetChi2()<=0) ) continue;
3675 
3676  // check cov. of Lambda
3677  if ( !CheckKFParticleCov(kfpLambda) ) continue;
3678 
3679  // err_mass>0 of Lambda
3680  if ( err_massLambda<=0 ) continue;
3681 
3682  // Chi2geo cut of Lambda
3683  if ( (kfpLambda.GetChi2()/kfpLambda.GetNDF()) >= fAnaCuts->GetKFPLam_Chi2geoMax() ) continue;
3684 
3685  //************************** calculate l/Δl for Lambda *************************************
3686  Double_t dx_Lambda = PV.GetX()-kfpLambda.GetX();
3687  Double_t dy_Lambda = PV.GetY()-kfpLambda.GetY();
3688  Double_t dz_Lambda = PV.GetZ()-kfpLambda.GetZ();
3689  Double_t l_Lambda = TMath::Sqrt(dx_Lambda*dx_Lambda + dy_Lambda*dy_Lambda + dz_Lambda*dz_Lambda);
3690  Double_t dl_Lambda = (PV.GetCovariance(0)+kfpLambda.GetCovariance(0))*dx_Lambda*dx_Lambda + (PV.GetCovariance(2)+kfpLambda.GetCovariance(2))*dy_Lambda*dy_Lambda + (PV.GetCovariance(5)+kfpLambda.GetCovariance(5))*dz_Lambda*dz_Lambda + 2*( (PV.GetCovariance(1)+kfpLambda.GetCovariance(1))*dx_Lambda*dy_Lambda + (PV.GetCovariance(3)+kfpLambda.GetCovariance(3))*dx_Lambda*dz_Lambda + (PV.GetCovariance(4)+kfpLambda.GetCovariance(4))*dy_Lambda*dz_Lambda );
3691  if ( fabs(l_Lambda)<1.e-8f ) l_Lambda = 1.e-8f;
3692  dl_Lambda = dl_Lambda<0. ? 1.e8f : sqrt(dl_Lambda)/l_Lambda;
3693  Double_t nErr_l_Lambda = l_Lambda/dl_Lambda;
3694  //***************************************************************************************
3695 
3696  // l/Deltal cut of Lambda
3697  if ( nErr_l_Lambda <= fAnaCuts->GetKFPLam_lDeltalMin() ) continue;
3698 
3699  // mass window cut of Lambda
3700  if ( TMath::Abs(massLambda_Rec-massLambda) > (fAnaCuts->GetProdMassTolLambda()) ) continue;
3701 
3702  KFParticle kfpLambda_m = kfpLambda;
3703  kfpLambda_m.SetNonlinearMassConstraint(massLambda);
3704 
3705  if ( !CheckKFParticleCov(kfpLambda_m) || TMath::Abs(kfpLambda.GetE()) <= TMath::Abs(kfpLambda.GetPz()) ) continue;
3706 
3707  KFParticle kfpPion2 = CreateKFParticleFromAODtrack(btrack, -211);
3708  KFParticle kfpXiMinus;
3709  const KFParticle *vXiDs[2] = {&kfpPion2, &kfpLambda_m};
3710  kfpXiMinus.Construct(vXiDs, NDaughters);
3711 
3712  // check rapidity of Xi-
3713  if ( TMath::Abs(kfpXiMinus.GetE())<=TMath::Abs(kfpXiMinus.GetPz()) ) continue;
3714 
3715  // err_massXi > 0
3716  Float_t massXiMinus_Rec, err_massXiMinus;
3717  kfpXiMinus.GetMass(massXiMinus_Rec, err_massXiMinus);
3718  if ( err_massXiMinus<=0 ) continue;
3719 
3720  // chi2>0 && NDF>0
3721  if ( kfpXiMinus.GetNDF()<=0 || kfpXiMinus.GetChi2()<=0 ) continue;
3722 
3723  // Prefilter
3724  if ( kfpXiMinus.GetChi2()/kfpXiMinus.GetNDF() >= fAnaCuts->GetKFPXi_Chi2geoMax() ) continue;
3725 
3726  // check covariance matrix
3727  if ( !CheckKFParticleCov(kfpXiMinus) ) continue;
3728 
3729  // mass window cut of Xi-
3730  if ( TMath::Abs(massXiMinus_Rec-massXi) > (fAnaCuts->GetProdMassTolXi()) ) continue;
3731 
3732  KFParticle kfpXiMinus_m = kfpXiMinus;
3733  kfpXiMinus_m.SetNonlinearMassConstraint(massXi);
3734 
3735  if ( !CheckKFParticleCov(kfpXiMinus_m) || TMath::Abs(kfpXiMinus.GetE()) <= TMath::Abs(kfpXiMinus.GetPz()) ) continue;
3736 
3737  for (Int_t itrkBP=0; itrkBP<flag_trkP; itrkBP++) { // Loop for first bachelor pion+
3738 
3739  if ( trackP[itrkBP]->GetID() == ptrack->GetID() ) continue;
3740 
3741  if ( !fAnaCuts->PassedTrackQualityCuts_PrimaryPion(trackP[itrkBP]) ) continue;
3742 
3743  KFParticle kfpBP = CreateKFParticleFromAODtrack(trackP[itrkBP], 211);
3744 
3745  // reconstruct Xic0
3746  KFParticle kfpXic0;
3747  const KFParticle *vXicZeroDs[2] = {&kfpBP, &kfpXiMinus_m};
3748  kfpXic0.Construct(vXicZeroDs, NDaughters);
3749 
3750  // chi2>0 && NDF>0
3751  if ( kfpXic0.GetNDF()<=0 || kfpXic0.GetChi2()<=0 ) continue;
3752 
3753  // Prefilter
3754  if ( kfpXic0.GetChi2()/kfpXic0.GetNDF() >= fAnaCuts->GetKFPXic0_Chi2geoMax() ) continue;
3755  if ( kfpXic0.GetPt() < fAnaCuts->GetPtMinXic0() ) continue;
3756 
3757  // check rapidity of Xic0
3758  if ( TMath::Abs(kfpXic0.GetE())<=TMath::Abs(kfpXic0.GetPz()) ) continue;
3759 
3760  // check covariance matrix
3761  if ( !CheckKFParticleCov(kfpXic0) ) continue;
3762 
3763  // err_massXic0 > 0
3764  Float_t massXic0_Rec, err_massXic0;
3765  kfpXic0.GetMass(massXic0_Rec, err_massXic0);
3766  if ( err_massXic0<=0 ) continue;
3767 
3768  if (fWriteXic0Tree) {
3769  Int_t lab_Xic0 = -9999.;
3770  if (fIsMC) {
3771  lab_Xic0 = MatchToMCXic0(ptrack, ntrack, btrack, trackP[itrkBP], mcArray);
3772  }
3773  FillTreeRecXic0FromCasc(kfpXic0, trackP[itrkBP], kfpBP, kfpXiMinus, kfpXiMinus_m, btrack, casc, kfpK0Short, kfpLambda, kfpLambda_m, ptrack, ntrack, PV, mcArray, lab_Xic0);
3774  }
3775  kfpXic0.Clear();
3776  kfpBP.Clear();
3777  } // Loop for first bachelor pion+
3778  kfpXiMinus_m.Clear();
3779  kfpXiMinus.Clear();
3780  kfpPion2.Clear();
3781  kfpLambda_m.Clear();
3782  kfpLambda.Clear();
3783  }
3784 
3785  if ( btrack->Charge()>0 ) {
3786 
3787  const KFParticle *vAntiDaughters[2] = {&kfpPionPlus, &kfpAntiProton};
3788 
3789  KFParticle kfpAntiLambda;
3790  kfpAntiLambda.Construct(vAntiDaughters, NDaughters);
3791  Float_t massAntiLambda_Rec, err_massAntiLambda;
3792  kfpAntiLambda.GetMass(massAntiLambda_Rec, err_massAntiLambda);
3793 
3794  // check rapidity of Anti-Lambda
3795  if ( TMath::Abs(kfpAntiLambda.GetE())<=TMath::Abs(kfpAntiLambda.GetPz()) ) continue;
3796 
3797  // chi2>0 && NDF>0 for selecting Anti-Lambda
3798  if ( kfpAntiLambda.GetNDF()<=0 || kfpAntiLambda.GetChi2()<=0 ) continue;
3799 
3800  // check cov. of Anti-Lambda
3801  if ( !CheckKFParticleCov(kfpAntiLambda) ) continue;
3802 
3803  // err_mass>0 of Anti-Lambda
3804  if ( err_massAntiLambda<=0 ) continue;
3805 
3806  // Chi2geo cut of Anti-Lambda
3807  if ( (kfpAntiLambda.GetChi2()/kfpAntiLambda.GetNDF()) >= fAnaCuts->GetKFPLam_Chi2geoMax() ) continue;
3808 
3809  //************************** calculate l/Δl for Anti-Lambda *************************************
3810  Double_t dx_AntiLambda = PV.GetX()-kfpAntiLambda.GetX();
3811  Double_t dy_AntiLambda = PV.GetY()-kfpAntiLambda.GetY();
3812  Double_t dz_AntiLambda = PV.GetZ()-kfpAntiLambda.GetZ();
3813  Double_t l_AntiLambda = TMath::Sqrt(dx_AntiLambda*dx_AntiLambda + dy_AntiLambda*dy_AntiLambda + dz_AntiLambda*dz_AntiLambda);
3814  Double_t dl_AntiLambda = (PV.GetCovariance(0)+kfpAntiLambda.GetCovariance(0))*dx_AntiLambda*dx_AntiLambda + (PV.GetCovariance(2)+kfpAntiLambda.GetCovariance(2))*dy_AntiLambda*dy_AntiLambda + (PV.GetCovariance(5)+kfpAntiLambda.GetCovariance(5))*dz_AntiLambda*dz_AntiLambda + 2*( (PV.GetCovariance(1)+kfpAntiLambda.GetCovariance(1))*dx_AntiLambda*dy_AntiLambda + (PV.GetCovariance(3)+kfpAntiLambda.GetCovariance(3))*dx_AntiLambda*dz_AntiLambda + (PV.GetCovariance(4)+kfpAntiLambda.GetCovariance(4))*dy_AntiLambda*dz_AntiLambda );
3815  if ( fabs(l_AntiLambda)<1.e-8f ) l_AntiLambda = 1.e-8f;
3816  dl_AntiLambda = dl_AntiLambda<0. ? 1.e8f : sqrt(dl_AntiLambda)/l_AntiLambda;
3817  Double_t nErr_l_AntiLambda = l_AntiLambda/dl_AntiLambda;
3818  //***************************************************************************************
3819 
3820  // l/Deltal cut of Anti-Lambda
3821  if ( nErr_l_AntiLambda <= fAnaCuts->GetKFPLam_lDeltalMin() ) continue;
3822 
3823  // mass window cut of Anti-Lambda
3824  if ( TMath::Abs(massAntiLambda_Rec-massLambda) > (fAnaCuts->GetProdMassTolLambda()) ) continue;
3825 
3826  KFParticle kfpAntiLambda_m = kfpAntiLambda;
3827  kfpAntiLambda_m.SetNonlinearMassConstraint(massLambda);
3828 
3829  if ( !CheckKFParticleCov(kfpAntiLambda_m) || TMath::Abs(kfpAntiLambda.GetE()) <= TMath::Abs(kfpAntiLambda.GetPz()) ) continue;
3830 
3831  KFParticle kfpPion2 = CreateKFParticleFromAODtrack(btrack, 211);
3832  KFParticle kfpXiPlus;
3833  const KFParticle *vXiDs[2] = {&kfpPion2, &kfpAntiLambda_m};
3834  kfpXiPlus.Construct(vXiDs, NDaughters);
3835 
3836  // check rapidity of Xi+
3837  if ( TMath::Abs(kfpXiPlus.GetE())<=TMath::Abs(kfpXiPlus.GetPz()) ) continue;
3838 
3839  // err_massXi > 0
3840  Float_t massXiPlus_Rec, err_massXiPlus;
3841  kfpXiPlus.GetMass(massXiPlus_Rec, err_massXiPlus);
3842  if ( err_massXiPlus<=0 ) continue;
3843 
3844  // chi2>0 && NDF>0
3845  if ( kfpXiPlus.GetNDF()<=0 || kfpXiPlus.GetChi2()<=0 ) continue;
3846 
3847  // Prefilter
3848  if ( kfpXiPlus.GetChi2()/kfpXiPlus.GetNDF() >= fAnaCuts->GetKFPXi_Chi2geoMax() ) continue;
3849 
3850  // check covariance matrix
3851  if ( !CheckKFParticleCov(kfpXiPlus) ) continue;
3852 
3853  // mass window cut of Xi+
3854  if ( TMath::Abs(massXiPlus_Rec-massXi) > (fAnaCuts->GetProdMassTolXi()) ) continue;
3855 
3856  KFParticle kfpXiPlus_m = kfpXiPlus;
3857  kfpXiPlus_m.SetNonlinearMassConstraint(massXi);
3858 
3859  if ( !CheckKFParticleCov(kfpXiPlus_m) || TMath::Abs(kfpXiPlus.GetE()) <= TMath::Abs(kfpXiPlus.GetPz()) ) continue;
3860 
3861  for (Int_t itrkBP=0; itrkBP<flag_trkN; itrkBP++) { // Loop for first bachelor pion-
3862 
3863  if ( trackN[itrkBP]->GetID() == ntrack->GetID() ) continue;
3864 
3865  if ( !fAnaCuts->PassedTrackQualityCuts_PrimaryPion(trackN[itrkBP]) ) continue;
3866 
3867  KFParticle kfpBP = CreateKFParticleFromAODtrack(trackN[itrkBP], -211);
3868 
3869  // reconstruct Anti-Xic0
3870  KFParticle kfpAntiXic0;
3871  const KFParticle *vXic0Ds[2] = {&kfpBP, &kfpXiPlus_m};
3872  kfpAntiXic0.Construct(vXic0Ds, NDaughters);
3873 
3874  // chi2>0 && NDF>0
3875  if ( kfpAntiXic0.GetNDF()<=0 || kfpAntiXic0.GetChi2()<=0 ) continue;
3876 
3877  // Prefilter
3878  if ( kfpAntiXic0.GetChi2()/kfpAntiXic0.GetNDF() >= fAnaCuts->GetKFPXic0_Chi2geoMax() ) continue;
3879  if ( kfpAntiXic0.GetPt() < fAnaCuts->GetPtMinXic0() ) continue;
3880 
3881  // check rapidity of Anti-Xic0
3882  if ( TMath::Abs(kfpAntiXic0.GetE())<=TMath::Abs(kfpAntiXic0.GetPz()) ) continue;
3883 
3884  // check covariance matrix
3885  if ( !CheckKFParticleCov(kfpAntiXic0) ) continue;
3886 
3887  // err_massAntiXic0 > 0
3888  Float_t massAntiXic0_Rec, err_massAntiXic0;
3889  kfpAntiXic0.GetMass(massAntiXic0_Rec, err_massAntiXic0);
3890  if ( err_massAntiXic0<=0 ) continue;
3891 
3892  if (fWriteXic0Tree) {
3893  Int_t lab_AntiXic0 = -9999.;
3894  if (fIsMC) {
3895  lab_AntiXic0 = MatchToMCAntiXic0(ntrack, ptrack, btrack, trackN[itrkBP], mcArray);
3896  }
3897  FillTreeRecXic0FromCasc(kfpAntiXic0, trackN[itrkBP], kfpBP, kfpXiPlus, kfpXiPlus_m, btrack, casc, kfpK0Short, kfpAntiLambda, kfpAntiLambda_m, ntrack, ptrack, PV, mcArray, lab_AntiXic0);
3898  }
3899  kfpAntiXic0.Clear();
3900  kfpBP.Clear();
3901  } // Loop for first bachelor pion-
3902  kfpXiPlus_m.Clear();
3903  kfpXiPlus.Clear();
3904  kfpPion2.Clear();
3905  kfpAntiLambda_m.Clear();
3906  kfpAntiLambda.Clear();
3907  }
3908 
3909  kfpK0Short.Clear();
3910  kfpPionPlus.Clear();
3911  kfpAntiProton.Clear();
3912  kfpPionMinus.Clear();
3913  kfpProton.Clear();
3914 
3915  }
3916 
3917  return;
3918 }
3919 
3920 //_____________________________________________________________________________
3921 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCXic0(AliAODTrack *trackProton, AliAODTrack *trackPion3, AliAODTrack *trackPion2, AliAODTrack *trackAntiPion1, TClonesArray *mcArray)
3922 {
3923  // Check if all of the tracks is matched to a MC signal
3924  // If no, return -1;
3925  // If yes, return label (>=0) of the AliAODMCParticle
3926 
3927  Int_t labelProton = fabs(trackProton->GetLabel());
3928  if (labelProton<0) return -1;
3929  AliAODMCParticle* mcProton = static_cast<AliAODMCParticle*>(mcArray->At(labelProton));
3930  Int_t labelPion3 = fabs(trackPion3->GetLabel());
3931  if (labelPion3<0) return -1;
3932  AliAODMCParticle* mcPion3 = static_cast<AliAODMCParticle*>(mcArray->At(labelPion3));
3933  Int_t labelPion2 = fabs(trackPion2->GetLabel());
3934  if (labelPion2<0) return -1;
3935  AliAODMCParticle* mcPion2 = static_cast<AliAODMCParticle*>(mcArray->At(labelPion2));
3936  Int_t labelAntiPion1 = fabs(trackAntiPion1->GetLabel());
3937  if (labelAntiPion1<0) return -1;
3938  AliAODMCParticle* mcAntiPion1 = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiPion1));
3939 
3940  if ( mcProton->GetPdgCode() != 2212 || mcPion3->GetPdgCode() != -211 || mcPion2->GetPdgCode() != -211 || mcAntiPion1->GetPdgCode() != 211) return -1; // check pdg
3941 
3942  Int_t IndexMother[2];
3943  IndexMother[0] = mcProton->GetMother();
3944  IndexMother[1] = mcPion3->GetMother();
3945  if ( IndexMother[0]<0 || IndexMother[1]<0 ) return -1; // check mother exist
3946  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
3947  AliAODMCParticle* mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
3948  if ( mcMother->GetPdgCode() != 3122 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is lambda
3949 
3950  IndexMother[0] = mcMother->GetMother(); // mother of lambda
3951  IndexMother[1] = mcPion2->GetMother();
3952  if ( IndexMother[0]<0 || IndexMother[1]<0 ) return -1; // check mother exist
3953  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
3954  mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
3955  if ( mcMother->GetPdgCode() != 3312 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is Xi-
3956 
3957  IndexMother[0] = mcMother->GetMother(); // mother of Xi-
3958  IndexMother[1] = mcAntiPion1->GetMother();
3959  if ( IndexMother[0]<0 || IndexMother[1]<0 ) return -1; // check mother exist
3960  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
3961  mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
3962  if ( mcMother->GetPdgCode() != 4132 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is Xic0
3963 
3964 // if ( mcMother->IsPrimary() ) return 1;
3965  if ( mcMother->IsPhysicalPrimary() ) return 2;
3966  if ( mcMother->IsSecondaryFromWeakDecay() ) return 3;
3967  if ( mcMother->IsSecondaryFromMaterial() ) return 4;
3968  if ( mcMother->IsFromSubsidiaryEvent() ) return 5;
3969 
3970 // return IndexMother[0];
3971  return 0;
3972 }
3973 
3974 //_____________________________________________________________________________
3975 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCAntiXic0(AliAODTrack *trackAntiProton, AliAODTrack *trackAntiPion3, AliAODTrack *trackAntiPion2, AliAODTrack *trackPion1, TClonesArray *mcArray)
3976 {
3977  // Check if all of the tracks is matched to a MC signal
3978  // If no, return -1;
3979  // If yes, return label (>=0) of the AliAODMCParticle
3980 
3981  Int_t labelAntiProton = fabs(trackAntiProton->GetLabel());
3982  if (labelAntiProton<0) return -1;
3983  AliAODMCParticle* mcAntiProton = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiProton));
3984  Int_t labelAntiPion3 = fabs(trackAntiPion3->GetLabel());
3985  if (labelAntiPion3<0) return -1;
3986  AliAODMCParticle* mcAntiPion3 = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiPion3));
3987  Int_t labelAntiPion2 = fabs(trackAntiPion2->GetLabel());
3988  if (labelAntiPion2<0) return -1;
3989  AliAODMCParticle* mcAntiPion2 = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiPion2));
3990  Int_t labelPion1 = fabs(trackPion1->GetLabel());
3991  if (labelPion1<0) return -1;
3992  AliAODMCParticle* mcPion1 = static_cast<AliAODMCParticle*>(mcArray->At(labelPion1));
3993  if ( mcAntiProton->GetPdgCode() != -2212 || mcAntiPion3->GetPdgCode() != 211 || mcAntiPion2->GetPdgCode() != 211 || mcPion1->GetPdgCode() != -211) return -1; // check pdg
3994 
3995  Int_t IndexMother[2];
3996  IndexMother[0] = mcAntiProton->GetMother();
3997  IndexMother[1] = mcAntiPion3->GetMother();
3998  if ( IndexMother[0]<0 || IndexMother[1]<0 ) return -1; // check mother exist
3999  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4000  AliAODMCParticle* mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4001  if ( mcMother->GetPdgCode() != -3122 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is anti-lambda
4002 
4003  IndexMother[0] = mcMother->GetMother(); // mother of lambda
4004  IndexMother[1] = mcAntiPion2->GetMother();
4005  if ( IndexMother[0]<0 || IndexMother[1]<0 ) return -1; // check mother exist
4006  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4007  mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4008  if ( mcMother->GetPdgCode() != -3312 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is Xi+
4009 
4010  IndexMother[0] = mcMother->GetMother(); // mother of Xi+
4011  IndexMother[1] = mcPion1->GetMother();
4012  if ( IndexMother[0]<0 || IndexMother[1]<0 ) return -1; // check mother exist
4013  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4014  mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4015  if ( mcMother->GetPdgCode() != -4132 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is anti-Xic0
4016 
4017 // if ( mcMother->IsPrimary() ) return 1;
4018  if ( mcMother->IsPhysicalPrimary() ) return 2;
4019  if ( mcMother->IsSecondaryFromWeakDecay() ) return 3;
4020  if ( mcMother->IsSecondaryFromMaterial() ) return 4;
4021  if ( mcMother->IsFromSubsidiaryEvent() ) return 5;
4022 
4023 // return IndexMother[0];
4024  return 0;
4025 }
4026 
4027 //_____________________________________________________________________________
4028 void AliAnalysisTaskSEXicZero2XiPifromKFP::SelectTrack(AliVEvent *event, Int_t trkEntries, Int_t &nSeleTrks, Bool_t *seleFlags)
4029 {
4030  // Select good tracks using fAnaCuts (AliRDHFCuts object)
4031  if(trkEntries==0) return;
4032 
4033  nSeleTrks=0;
4034  for(Int_t i=0; i<trkEntries; i++) {
4035  seleFlags[i] = kFALSE;
4036 
4037  AliVTrack *track;
4038  track = (AliVTrack*)event->GetTrack(i);
4039 
4040 // if(track->GetID()<0) continue;
4041  Double_t covtest[21];
4042  if(!track->GetCovarianceXYZPxPyPz(covtest)) continue;
4043 
4044 // AliAODTrack *aodt = (AliAODTrack*)track;
4045 
4046 /*
4047  if(!fAnaCuts) continue;
4048  if(fAnaCuts->SingleTrkCuts(aodt)){
4049  seleFlags[i]=kTRUE;
4050  nSeleTrks++;
4051 // fHistoPiPtRef->Fill(aodt->Pt());
4052  }
4053 */
4054  } // end loop on tracks
4055 }
4056 //_____________________________________________________________________________
4058 {
4059  KFParticle::SetField(fBzkG);
4060 
4061  // Interface to KFParticle
4062  KFPTrack kfpTrk;
4063  // Set the values
4064  kfpTrk.SetParameters((Float_t) param[0],(Float_t) param[1],(Float_t) param[2],
4065  (Float_t) param[3],(Float_t) param[4],(Float_t) param[5]);
4066  kfpTrk.SetCharge(charge);
4067  Float_t covF[21];
4068  for (Int_t i = 0; i<21;i++) { covF[i] = (Float_t) cov[i]; }
4069  kfpTrk.SetCovarianceMatrix(covF);
4070  kfpTrk.SetNDF(1);
4071  kfpTrk.SetChi2(Chi2perNDF);
4072 
4073  // Build KFParticle
4074  KFParticle kfp(kfpTrk, pdg);
4075  return kfp;
4076 }
4077 //_____________________________________________________________________________
4079 {
4080  KFParticle::SetField(fBzkG);
4081 
4082  KFPVertex kfpVtx;
4083  // Set the values
4084  Float_t paramF[3] = {(Float_t) param[0],(Float_t) param[1],(Float_t) param[2]};
4085  kfpVtx.SetXYZ(paramF);
4086  Float_t covF[6] = {(Float_t) cov[0],(Float_t) cov[1],(Float_t) cov[2],
4087  (Float_t) cov[3],(Float_t) cov[4],(Float_t) cov[5]};
4088  kfpVtx.SetCovarianceMatrix(covF);
4089  KFVertex kfv(kfpVtx);
4090  return kfv;
4091 }
4092 //_____________________________________________________________________________
4094 {
4095  Double_t covMatrix[6];
4096  vtx->GetCovarianceMatrix(covMatrix);
4097  Double_t cov[3][3]={0.};
4098  cov[0][0] = covMatrix[0];
4099  cov[1][0] = covMatrix[1];
4100  cov[1][1] = covMatrix[2];
4101  cov[2][0] = covMatrix[3];
4102  cov[2][1] = covMatrix[4];
4103  cov[2][2] = covMatrix[5];
4104  if ( cov[0][0]<0 || cov[1][1]<0 || cov[2][2]<0 ) return kFALSE;
4105  for (Int_t i=0; i<3; i++) {
4106  for (Int_t j=0; j<3; j++) {
4107  if (i<=j) continue;
4108  if ( fabs(cov[i][j]) > TMath::Sqrt(cov[i][i]*cov[j][j]) ) return kFALSE;
4109  }
4110  }
4111 
4112  return kTRUE;
4113 }
4114 //_____________________________________________________________________________
4116 {
4117  Double_t covMatrix[21];
4118  track->GetCovarianceXYZPxPyPz(covMatrix);
4119  Double_t cov[6][6]={0.};
4120  cov[0][0] = covMatrix[0];
4121  cov[1][0] = covMatrix[1];
4122  cov[1][1] = covMatrix[2];
4123  cov[2][0] = covMatrix[3];
4124  cov[2][1] = covMatrix[4];
4125  cov[2][2] = covMatrix[5];
4126  cov[3][0] = covMatrix[6];
4127  cov[3][1] = covMatrix[7];
4128  cov[3][2] = covMatrix[8];
4129  cov[3][3] = covMatrix[9];
4130  cov[4][0] = covMatrix[10];
4131  cov[4][1] = covMatrix[11];
4132  cov[4][2] = covMatrix[12];
4133  cov[4][3] = covMatrix[13];
4134  cov[4][4] = covMatrix[14];
4135  cov[5][0] = covMatrix[15];
4136  cov[5][1] = covMatrix[16];
4137  cov[5][2] = covMatrix[17];
4138  cov[5][3] = covMatrix[18];
4139  cov[5][4] = covMatrix[19];
4140  cov[5][5] = covMatrix[20];
4141  if ( cov[0][0]<0 || cov[1][1]<0 || cov[2][2]<0 || cov[3][3]<0 || cov[4][4]<0 || cov[5][5]<0 ) return kFALSE;
4142  for (Int_t i=0; i<6; i++) {
4143  for (Int_t j=0; j<6; j++) {
4144  if (i<=j) continue;
4145  if ( fabs(cov[i][j]) > TMath::Sqrt(cov[i][i]*cov[j][j]) ) return kFALSE;
4146  }
4147  }
4148 
4149  return kTRUE;
4150 }
4151 //_____________________________________________________________________________
4153 {
4154  if ( kfp.GetCovariance(0,0)<0 || kfp.GetCovariance(1,1)<0 || kfp.GetCovariance(2,2)<0 || kfp.GetCovariance(3,3)<0 || kfp.GetCovariance(4,4)<0 || kfp.GetCovariance(5,5)<0 ) return kFALSE;
4155  for (Int_t i=0; i<6; i++) {
4156  for (Int_t j=0; j<6; j++) {
4157  if (i<=j) continue;
4158  if ( fabs(kfp.GetCovariance(i,j)) > TMath::Sqrt(kfp.GetCovariance(i,i)*kfp.GetCovariance(j,j)) ) return kFALSE;
4159  }
4160  }
4161 
4162  return kTRUE;
4163 }
4164 
4165 //_____________________________________________________________________________
4167 {
4168  KFParticle::SetField(fBzkG);
4169 
4170  Double_t trackParam[6];
4171  Double_t covMatrix[21];
4172 
4173  Bool_t IsDCA = track->GetXYZ(trackParam);
4174 // if (IsDCA) cout << "track position is at DCA" << endl;
4175 // if (!IsDCA) cout << "track position is at first point" << endl;
4176 // track->XvYvZv(trackParam);
4177  track->GetPxPyPz(&trackParam[3]);
4178  track->GetCovarianceXYZPxPyPz(covMatrix);
4179 
4180  KFPTrack kfpt;
4181  kfpt.SetParameters(trackParam);
4182  kfpt.SetCovarianceMatrix(covMatrix);
4183  kfpt.SetCharge(track->Charge());
4184  kfpt.SetNDF(1);
4185  kfpt.SetChi2(track->Chi2perNDF());
4186 
4187  KFParticle kfp(kfpt, pdg);
4188 
4189  return kfp;
4190 }
4191 //_____________________________________________________________________________
4192 KFParticle AliAnalysisTaskSEXicZero2XiPifromKFP::CreateKFMotherParticle(AliAODTrack *track1, AliAODTrack *track2, Int_t pdg1, Int_t pdg2)
4193 {
4194  KFParticle::SetField(fBzkG);
4195 
4196  Double_t trackParam[6];
4197  Double_t covMatrix[21];
4198 
4199  track1->GetXYZ(trackParam);
4200  track1->GetPxPyPz(&trackParam[3]);
4201  track1->GetCovarianceXYZPxPyPz(covMatrix);
4202 
4203  KFPTrack kfpt1;
4204  kfpt1.SetParameters(trackParam);
4205  kfpt1.SetCovarianceMatrix(covMatrix);
4206  kfpt1.SetCharge(track1->Charge());
4207  kfpt1.SetNDF(1);
4208  kfpt1.SetChi2(track1->Chi2perNDF());
4209 
4210  track2->GetXYZ(trackParam);
4211  track2->GetPxPyPz(&trackParam[3]);
4212  track2->GetCovarianceXYZPxPyPz(covMatrix);
4213 
4214  KFPTrack kfpt2;
4215  kfpt2.SetParameters(trackParam);
4216  kfpt2.SetCovarianceMatrix(covMatrix);
4217  kfpt2.SetCharge(track2->Charge());
4218  kfpt2.SetNDF(1);
4219  kfpt2.SetChi2(track2->Chi2perNDF());
4220 
4221  // now we have all info to create the KFParticle version of the daughters
4222  KFParticle kfpDaughter1(kfpt1, pdg1);
4223  KFParticle kfpDaughter2(kfpt2, pdg2);
4224 
4225  KFParticle kfpMother(kfpDaughter1, kfpDaughter2);
4226 
4227  return kfpMother;
4228 }
4229 //_____________________________________________________________________________
4230 KFParticle AliAnalysisTaskSEXicZero2XiPifromKFP::CreateSecKFParticle(KFParticle kfp1, AliAODTrack *track2, Int_t pdg1, Int_t pdg2)
4231 {
4232  KFParticle::SetField(fBzkG);
4233 
4234  Double_t trackParam[6];
4235  Double_t covMatrix[21];
4236 
4237  track2->GetXYZ(trackParam);
4238 // track2->XvYvZv(trackParam);
4239  track2->GetPxPyPz(&trackParam[3]);
4240  track2->GetCovarianceXYZPxPyPz(covMatrix);
4241 
4242  KFPTrack kfpt2;
4243  kfpt2.SetParameters(trackParam);
4244  kfpt2.SetCovarianceMatrix(covMatrix);
4245  kfpt2.SetCharge(track2->Charge());
4246  kfpt2.SetNDF(1);
4247  kfpt2.SetChi2(track2->Chi2perNDF());
4248 
4249  KFParticle kfpDaughter2(kfpt2, pdg2);
4250 
4251  kfp1.SetPDG(pdg1);
4252 // KFParticle kfpMother(kfp1, kfpDaughter2);
4253  KFParticle kfpMother;
4254 // const KFParticle *vDaughters[2] = {&kfp1, &kfpDaughter2};
4255  const KFParticle *vDaughters[2] = {&kfpDaughter2, &kfp1}; // the order is important
4256  kfpMother.Construct(vDaughters, 2);
4257 
4258  return kfpMother;
4259 }
4260 
4261 //_____________________________________________________________________________
4263 {
4264  Double_t v[3];
4265  v[0] = kfp.GetX() - kfpmother.GetX();
4266  v[1] = kfp.GetY() - kfpmother.GetY();
4267  v[2] = kfp.GetZ() - kfpmother.GetZ();
4268 
4269  Double_t p[3];
4270  p[0] = kfp.GetPx();
4271  p[1] = kfp.GetPy();
4272  p[2] = kfp.GetPz();
4273 
4274  Double_t ptimesv2 = (p[0]*p[0]+p[1]*p[1]+p[2]*p[2])*(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
4275 
4276  if ( ptimesv2<=0 ) return 0.0;
4277  else {
4278  Double_t cos = (v[0]*p[0]+v[1]*p[1]+v[2]*p[2]) / TMath::Sqrt(ptimesv2);
4279  if(cos > 1.0) cos = 1.0;
4280  if(cos < -1.0) cos = -1.0;
4281  return cos;
4282  }
4283 }
4284 
4285 //_____________________________________________________________________________
4286 Double_t AliAnalysisTaskSEXicZero2XiPifromKFP::CosThetaStarKF(Int_t ip, UInt_t pdgvtx, UInt_t pdgprong0, UInt_t pdgprong1, KFParticle kfpvtx, KFParticle kfpprong0, KFParticle kfpprong1)
4287 {
4288  Double_t massvtx = TDatabasePDG::Instance()->GetParticle(pdgvtx)->Mass();
4289  Double_t massp[2];
4290 
4291  massp[0] = TDatabasePDG::Instance()->GetParticle(pdgprong0)->Mass();
4292  massp[1] = TDatabasePDG::Instance()->GetParticle(pdgprong1)->Mass();
4293 
4294  Double_t pStar = TMath::Sqrt((massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1])*(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1])-4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx);
4295 
4296  Double_t e = kfpvtx.GetE();
4297  Double_t beta = kfpvtx.GetP()/e;
4298  Double_t gamma = e/massvtx;
4299 
4300  TVector3 mom;
4301  TVector3 momTot(kfpvtx.GetPx(), kfpvtx.GetPy(), kfpvtx.GetPz());
4302 
4303  if (ip==0) {
4304  mom.SetXYZ(kfpprong0.GetPx(), kfpprong0.GetPy(), kfpprong0.GetPz());
4305  }
4306  if (ip==1) {
4307  mom.SetXYZ(kfpprong1.GetPx(), kfpprong1.GetPy(), kfpprong1.GetPz());
4308  }
4309 
4310  Double_t cts = ( (mom.Dot(momTot)/momTot.Mag()) /gamma-beta*TMath::Sqrt(pStar*pStar+massp[ip]*massp[ip]) ) / pStar;
4311 
4312  return cts;
4313 }
4314 
4315 //_____________________________________________________________________________
4316 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCXiMinus(AliAODTrack *trackProton, AliAODTrack *trackPion3, AliAODTrack *trackPion2, TClonesArray *mcArray)
4317 {
4318  // Check if all of the tracks is matched to a MC signal
4319  // If no, return -1;
4320  // If yes, return label (>=0) of the AliAODMCParticle
4321 
4322  Int_t labelProton = fabs(trackProton->GetLabel());
4323  if (labelProton<0) return -1;
4324  AliAODMCParticle* mcProton = static_cast<AliAODMCParticle*>(mcArray->At(labelProton));
4325  Int_t labelPion3 = fabs(trackPion3->GetLabel());
4326  if (labelPion3<0) return -1;
4327  AliAODMCParticle* mcPion3 = static_cast<AliAODMCParticle*>(mcArray->At(labelPion3));
4328  Int_t labelPion2 = fabs(trackPion2->GetLabel());
4329  if (labelPion2<0) return -1;
4330  AliAODMCParticle* mcPion2 = static_cast<AliAODMCParticle*>(mcArray->At(labelPion2));
4331 
4332  if ( mcProton->GetPdgCode() != 2212 || mcPion3->GetPdgCode() != -211 || mcPion2->GetPdgCode() != -211 ) return -1; // check pdg
4333 
4334  Int_t IndexMother[4];
4335  IndexMother[0] = mcProton->GetMother();
4336  IndexMother[1] = mcPion3->GetMother();
4337  if ( IndexMother[0]<0 || IndexMother[1]<0 ) return -1; // check mother exist
4338  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4339  AliAODMCParticle* mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4340  if ( mcMother->GetPdgCode() != 3122 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is lambda
4341 
4342  IndexMother[2] = mcMother->GetMother(); // mother of lambda
4343  IndexMother[3] = mcPion2->GetMother();
4344  if ( IndexMother[2]<0 || IndexMother[3]<0 ) return -1; // check mother exist
4345  if ( IndexMother[2] != IndexMother[3] ) return -1; // check the same mother
4346  mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[2]));
4347  if ( mcMother->GetPdgCode() != 3312 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is Xi-
4348 
4349 // if ( mcMother->IsPrimary() ) return 1;
4350  if ( mcMother->IsPhysicalPrimary() ) return 2;
4351  if ( mcMother->IsSecondaryFromWeakDecay() ) return 3;
4352  if ( mcMother->IsSecondaryFromMaterial() ) return 4;
4353  if ( mcMother->IsFromSubsidiaryEvent() ) return 5;
4354 
4355 // return IndexMother[2];
4356  return 0;
4357 }
4358 //_____________________________________________________________________________
4359 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCXiPlus(AliAODTrack *trackAntiProton, AliAODTrack *trackAntiPion3, AliAODTrack *trackAntiPion2, TClonesArray *mcArray)
4360 {
4361  // Check if all of the tracks is matched to a MC signal
4362  // If no, return -1;
4363  // If yes, return label (>=0) of the AliAODMCParticle
4364 
4365  Int_t labelAntiProton = fabs(trackAntiProton->GetLabel());
4366  if (labelAntiProton<0) return -1;
4367  AliAODMCParticle* mcAntiProton = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiProton));
4368  Int_t labelAntiPion3 = fabs(trackAntiPion3->GetLabel());
4369  if (labelAntiPion3<0) return -1;
4370  AliAODMCParticle* mcAntiPion3 = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiPion3));
4371  Int_t labelAntiPion2 = fabs(trackAntiPion2->GetLabel());
4372  if (labelAntiPion2<0) return -1;
4373  AliAODMCParticle* mcAntiPion2 = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiPion2));
4374 
4375  if ( mcAntiProton->GetPdgCode() != -2212 || mcAntiPion3->GetPdgCode() != 211 || mcAntiPion2->GetPdgCode() != 211 ) return -1; // check pdg
4376 
4377  Int_t IndexMother[4];
4378  IndexMother[0] = mcAntiProton->GetMother();
4379  IndexMother[1] = mcAntiPion3->GetMother();
4380  if ( IndexMother[0]<0 || IndexMother[1]<0 ) return -1; // check mother exist
4381  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4382  AliAODMCParticle* mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4383  if ( mcMother->GetPdgCode() != -3122 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is Anti-lambda
4384 
4385  IndexMother[2] = mcMother->GetMother(); // mother of lambda
4386  IndexMother[3] = mcAntiPion2->GetMother();
4387  if ( IndexMother[2]<0 || IndexMother[3]<0 ) return -1; // check mother exist
4388  if ( IndexMother[2] != IndexMother[3] ) return -1; // check the same mother
4389  mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[2]));
4390  if ( mcMother->GetPdgCode() != -3312 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is Xi+
4391 
4392 // if ( mcMother->IsPrimary() ) return 1;
4393  if ( mcMother->IsPhysicalPrimary() ) return 2;
4394  if ( mcMother->IsSecondaryFromWeakDecay() ) return 3;
4395  if ( mcMother->IsSecondaryFromMaterial() ) return 4;
4396  if ( mcMother->IsFromSubsidiaryEvent() ) return 5;
4397 
4398 // return IndexMother[2];
4399  return 0;
4400 }
4401 //_____________________________________________________________________________
4402 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCLambda(AliAODTrack *trackProton, AliAODTrack *trackPion3, TClonesArray *mcArray)
4403 {
4404  // Check if all of the tracks is matched to a MC signal
4405  // If no, return -1;
4406  // If yes, return label (>=0) of the AliAODMCParticle
4407 
4408  Int_t labelProton = fabs(trackProton->GetLabel());
4409  if (labelProton<=0) return -1;
4410  AliAODMCParticle* mcProton = static_cast<AliAODMCParticle*>(mcArray->At(labelProton));
4411  Int_t labelPion3 = fabs(trackPion3->GetLabel());
4412  if (labelPion3<=0) return -1;
4413  AliAODMCParticle* mcPion3 = static_cast<AliAODMCParticle*>(mcArray->At(labelPion3));
4414 
4415  if ( mcProton->GetPdgCode() != 2212 || mcPion3->GetPdgCode() != -211 ) return -1; // check PDG
4416 
4417  Int_t IndexMother[2];
4418  IndexMother[0] = mcProton->GetMother();
4419  IndexMother[1] = mcPion3->GetMother();
4420  if ( IndexMother[0]<=0 || IndexMother[1]<=0 ) return -1; // check mother exist
4421  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4422  AliAODMCParticle* mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4423  if ( mcMother->GetPdgCode() != 3122 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is lambda and only have two daughters
4424 
4425 // AliAODMCParticle* mcMother2 = static_cast<AliAODMCParticle*>(mcArray->At(fabs(mcMother->GetMother())));
4426 
4427 // if ( mcMother->IsPrimary() ) return 1;
4428  if ( mcMother->IsPhysicalPrimary() ) return 2;
4429  if ( mcMother->IsSecondaryFromWeakDecay() ) return 3;
4430  if ( mcMother->IsSecondaryFromMaterial() ) return 4;
4431  if ( mcMother->IsFromSubsidiaryEvent() ) return 5;
4432 
4433 // return IndexMother[0];
4434  return 0;
4435 
4436 }
4437 //_____________________________________________________________________________
4438 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCLambdaFromXi(AliAODTrack *trackProton, AliAODTrack *trackPion3, TClonesArray *mcArray)
4439 {
4440  // Check if all of the tracks is matched to a MC signal
4441  // If no, return -1;
4442  // If yes, return label (>=0) of the AliAODMCParticle
4443 
4444  Int_t labelProton = fabs(trackProton->GetLabel());
4445  if (labelProton<=0) return -1;
4446  AliAODMCParticle* mcProton = static_cast<AliAODMCParticle*>(mcArray->At(labelProton));
4447  Int_t labelPion3 = fabs(trackPion3->GetLabel());
4448  if (labelPion3<=0) return -1;
4449  AliAODMCParticle* mcPion3 = static_cast<AliAODMCParticle*>(mcArray->At(labelPion3));
4450 
4451  if ( mcProton->GetPdgCode() != 2212 || mcPion3->GetPdgCode() != -211 ) return -1; // check PDG
4452 
4453  Int_t IndexMother[2];
4454  IndexMother[0] = mcProton->GetMother();
4455  IndexMother[1] = mcPion3->GetMother();
4456  if ( IndexMother[0]<=0 || IndexMother[1]<=0 ) return -1; // check mother exist
4457  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4458  AliAODMCParticle* mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4459  if ( mcMother->GetPdgCode() != 3122 ) return -1; // check mother is lambda
4460 
4461  Int_t Index_Mother_Xi = mcMother->GetMother();
4462  if ( Index_Mother_Xi<=0 ) return -1;
4463  AliAODMCParticle* mcMother_Xi = static_cast<AliAODMCParticle*>(mcArray->At(Index_Mother_Xi));
4464  if ( mcMother_Xi->GetPdgCode() != 3312 ) return -1;
4465 
4466 // if ( !mcMother_Xi->IsPhysicalPrimary() ) return -1; // check IsPhysicalPrimary()
4467 
4468  return IndexMother[0];
4469 
4470 }
4471 
4472 //_____________________________________________________________________________
4473 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCAntiLambda(AliAODTrack *trackAntiProton, AliAODTrack *trackAntiPion3, TClonesArray *mcArray)
4474 {
4475  // Check if all of the tracks is matched to a MC signal
4476  // If no, return -1;
4477  // If yes, return label (>=0) of the AliAODMCParticle
4478 
4479  Int_t labelAntiProton = fabs(trackAntiProton->GetLabel());
4480  if (labelAntiProton<=0) return -1;
4481  AliAODMCParticle* mcAntiProton = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiProton));
4482  Int_t labelAntiPion3 = fabs(trackAntiPion3->GetLabel());
4483  if (labelAntiPion3<=0) return -1;
4484  AliAODMCParticle* mcAntiPion3 = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiPion3));
4485 
4486  if ( mcAntiProton->GetPdgCode() != -2212 || mcAntiPion3->GetPdgCode() != 211 ) return -1; // check PDG
4487 
4488  Int_t IndexMother[2];
4489  IndexMother[0] = mcAntiProton->GetMother();
4490  IndexMother[1] = mcAntiPion3->GetMother();
4491  if ( IndexMother[0]<=0 || IndexMother[1]<=0 ) return -1; // check mother exist
4492  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4493  AliAODMCParticle* mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4494  if ( mcMother->GetPdgCode() != -3122 || mcMother->GetNDaughters()!=2 ) return -1; // check mother is Anti-lambda and only have two daughters
4495 
4496 // if ( mcMother->IsPrimary() ) return 1;
4497  if ( mcMother->IsPhysicalPrimary() ) return 2;
4498  if ( mcMother->IsSecondaryFromWeakDecay() ) return 3;
4499  if ( mcMother->IsSecondaryFromMaterial() ) return 4;
4500  if ( mcMother->IsFromSubsidiaryEvent() ) return 5;
4501 
4502 // return IndexMother[0];
4503  return 0;
4504 
4505 }
4506 
4507 //_____________________________________________________________________________
4508 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCAntiLambdaFromXi(AliAODTrack *trackAntiProton, AliAODTrack *trackAntiPion3, TClonesArray *mcArray)
4509 {
4510  // Check if all of the tracks is matched to a MC signal
4511  // If no, return -1;
4512  // If yes, return label (>=0) of the AliAODMCParticle
4513 
4514  Int_t labelAntiProton = fabs(trackAntiProton->GetLabel());
4515  if (labelAntiProton<=0) return -1;
4516  AliAODMCParticle* mcAntiProton = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiProton));
4517  Int_t labelAntiPion3 = fabs(trackAntiPion3->GetLabel());
4518  if (labelAntiPion3<=0) return -1;
4519  AliAODMCParticle* mcAntiPion3 = static_cast<AliAODMCParticle*>(mcArray->At(labelAntiPion3));
4520 
4521  if ( mcAntiProton->GetPdgCode() != -2212 || mcAntiPion3->GetPdgCode() != 211 ) return -1; // check PDG
4522 
4523  Int_t IndexMother[2];
4524  IndexMother[0] = mcAntiProton->GetMother();
4525  IndexMother[1] = mcAntiPion3->GetMother();
4526  if ( IndexMother[0]<=0 || IndexMother[1]<=0 ) return -1; // check mother exist
4527  if ( IndexMother[0] != IndexMother[1] ) return -1; // check the same mother
4528  AliAODMCParticle* mcMother = static_cast<AliAODMCParticle*>(mcArray->At(IndexMother[0]));
4529  if ( mcMother->GetPdgCode() != -3122 ) return -1; // check mother is Anti-lambda
4530 
4531  Int_t Index_Mother_Xi = mcMother->GetMother();
4532  if ( Index_Mother_Xi<=0 ) return -1;
4533  AliAODMCParticle* mcMother_Xi = static_cast<AliAODMCParticle*>(mcArray->At(Index_Mother_Xi));
4534  if ( mcMother_Xi->GetPdgCode() != -3312 ) return -1;
4535 
4536 // if ( !mcMother_Xi->IsPhysicalPrimary() ) return -1; // check IsPhysicalPrimary()
4537 
4538  return IndexMother[0];
4539 
4540 }
4541 
4542 //_____________________________________________________________________________
4543 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToMCPion(AliAODTrack *track, TClonesArray *mcArray)
4544 {
4545  Int_t labelPion = fabs(track->GetLabel());
4546  if (labelPion<=0) return -1;
4547  AliAODMCParticle* mcPion = static_cast<AliAODMCParticle*>(mcArray->At(labelPion));
4548  if ( TMath::Abs(mcPion->GetPdgCode()) != 211 ) return -1;
4549 
4550  return labelPion;
4551 }
4552 
4553 //_____________________________________________________________________________
4554 Int_t AliAnalysisTaskSEXicZero2XiPifromKFP::MatchToXicZeroMC(TClonesArray *mcArray, Int_t PDGXicZero, const Int_t nDaughters, const Int_t *daughterIndex, const Int_t *daughterPDG)
4555 {
4561 
4562  Int_t IndexMom[10] = {0};
4563  Int_t IndexMother=-1;
4564  Bool_t pdgUsed[10] = {0};
4565 
4566  // loop on daughter Index
4567  for(Int_t i=0; i<nDaughters; i++) {
4568  IndexMom[i]=-1;
4569  Int_t Index = daughterIndex[i];
4570  if(Index<0) {
4571  printf("daughter with negative index %d\n", Index);
4572  return -1;
4573  }
4574  AliAODMCParticle *part = (AliAODMCParticle*)mcArray->At(Index);
4575  if(!part) {
4576  printf("no MC particle\n");
4577  return -1;
4578  }
4579 
4580  // check the PDG of the daughter
4581  Int_t pdgPart = part->GetPdgCode();
4582  for(Int_t j=0; j<nDaughters; j++) {
4583  if(!pdgUsed[j] && pdgPart==daughterPDG[j]) {
4584  pdgUsed[j]=kTRUE;
4585  break;
4586  }
4587  }
4588 
4589  AliAODMCParticle *mother = part;
4590  while ( mother->GetMother()>=0 ) {
4591  IndexMother = mother->GetMother();
4592  mother = (AliAODMCParticle*)mcArray->At(IndexMother);
4593  if (!mother) {
4594  printf("no MC mother particle\n");
4595  break;
4596  }
4597  Int_t pdgMother = mother->GetPdgCode();
4598  if ( pdgMother==PDGXicZero ) { // check mother is XicZero
4599  IndexMom[i]=IndexMother;
4600  break;
4601  } else if( pdgMother>PDGXicZero || pdgMother<10 ) {
4602  break;
4603  }
4604  }
4605 
4606  if( IndexMom[i]==-1 ) return -1; // mother PDG not ok for this daughter
4607 
4608  } // end loop on daughters
4609 
4610  IndexMother=IndexMom[0];
4611  for(Int_t i=0; i<nDaughters; i++) {
4612  // all Index have to be the same and !=-1
4613  if(IndexMom[i]==-1) return -1;
4614  if(IndexMom[i]!=IndexMother) return -1;
4615  // check that all daughter PDGs are matched
4616  if(pdgUsed[i]==kFALSE) return -1;
4617  }
4618 
4619  return IndexMother;
4620 }
4621 
4622 //_____________________________________________________________________________
4624 {
4625  // This is to define tree variables
4626 
4627  const char* nameoutput = GetOutputSlot(3)->GetContainer()->GetName();
4628  fTree_Event = new TTree(nameoutput, "Event");
4629  Int_t nVar = 7;
4630  fVar_Event = new Float_t[nVar];
4631  TString *fVarNames = new TString[nVar];
4632 
4633  fVarNames[0] = "centrality";
4634  fVarNames[1] = "z_vtx_reco";
4635  fVarNames[2] = "n_vtx_contributors";
4636  fVarNames[3] = "n_tracks";
4637  fVarNames[4] = "is_ev_rej";
4638  fVarNames[5] = "run_number";
4639  fVarNames[6] = "ev_id";
4640 
4641  for (Int_t ivar=0; ivar<nVar; ivar++) {
4642  fTree_Event->Branch(fVarNames[ivar].Data(), &fVar_Event[ivar], Form("%s/f", fVarNames[ivar].Data()));
4643  }
4644 
4645  return;
4646 
4647 }
4648 
4649 //_____________________________________________________________________________
4651 {
4652  // This is to define tree variables
4653 
4654  const char* nameoutput = GetOutputSlot(4)->GetContainer()->GetName();
4655  fTree_Xic0 = new TTree(nameoutput, "Xic0 variables tree");
4656  Int_t nVar = 35;
4657  fVar_Xic0 = new Float_t[nVar];
4658  TString *fVarNames = new TString[nVar];
4659 
4660  fVarNames[0] = "nSigmaTPC_PiFromXic0";
4661  fVarNames[1] = "nSigmaTOF_PiFromXic0";
4662  fVarNames[2] = "nSigmaTPC_PiFromXi";
4663  fVarNames[3] = "nSigmaTOF_PiFromXi";
4664  fVarNames[4] = "nSigmaTPC_PiFromLam";
4665  fVarNames[5] = "nSigmaTPC_PrFromLam";
4666  fVarNames[6] = "DCA_LamDau";
4667  fVarNames[7] = "chi2geo_Lam";
4668  fVarNames[8] = "chi2geo_Xi";
4669  fVarNames[9] = "chi2topo_Lam";
4670  fVarNames[10] = "chi2topo_Xi";
4671  fVarNames[11] = "ldl_Lam";
4672  fVarNames[12] = "ldl_Xi";
4673  fVarNames[13] = "DecayL_Lam";
4674  fVarNames[14] = "DecayL_Xi";
4675  fVarNames[15] = "DecayLxy_Lam";
4676  fVarNames[16] = "DecayLxy_Xi";
4677  fVarNames[17] = "PA_Lam";
4678  fVarNames[18] = "PA_Xi";
4679  fVarNames[19] = "pt_Lam";
4680  fVarNames[20] = "rap_Lam";
4681  fVarNames[21] = "mass_Lam";
4682  fVarNames[22] = "pt_Xi";
4683  fVarNames[23] = "rap_Xi";
4684  fVarNames[24] = "mass_Xi";
4685  fVarNames[25] = "pt_PiFromXic0";
4686  fVarNames[26] = "eta_PiFromXic0";
4687  fVarNames[27] = "pt_Xic0";
4688  fVarNames[28] = "rap_Xic0";
4689  fVarNames[29] = "mass_Xic0";
4690  fVarNames[30] = "mass_K0S";
4691  fVarNames[31] = "CosThetaStar_PiFromXic0";
4692  fVarNames[32] = "CosThetaStar_Xi";
4693  fVarNames[33] = "PA_LamToPV";
4694  fVarNames[34] = "Source_Xic0";
4695 
4696  for (Int_t ivar=0; ivar<nVar; ivar++) {
4697  fTree_Xic0->Branch(fVarNames[ivar].Data(), &fVar_Xic0[ivar], Form("%s/f", fVarNames[ivar].Data()));
4698  }
4699 
4700  return;
4701 }
4702 
4703 /*
4704 //_____________________________________________________________________________
4705 void AliAnalysisTaskSEXicZero2XiPifromKFP::DefineVarTreePiPlus()
4706 {
4707  // This is to define tree variables
4708 
4709  const char* nameoutput = GetOutputSlot(6)->GetContainer()->GetName();
4710  fVarTree_PiPlus = new TTree(nameoutput, "PiPlus variables tree");
4711  Int_t nVar = 5;
4712  fVar_PiPlus = new Float_t[nVar];
4713  TString *fVarNames = new TString[nVar];
4714 
4715  fVarNames[0] = "charge_PiPlus";
4716  fVarNames[1] = "pt_PiPlus";
4717  fVarNames[2] = "pz_PiPlus";
4718  fVarNames[3] = "eta_PiPlus";
4719  fVarNames[4] = "MatchToMC";
4720 
4721  for (Int_t ivar=0; ivar<nVar; ivar++) {
4722  fVarTree_PiPlus->Branch(fVarNames[ivar].Data(), &fVar_PiPlus[ivar], Form("%s/f", fVarNames[ivar].Data()));
4723  }
4724 
4725  return;
4726 }
4727 */
4728 
4729 /*
4730 //_____________________________________________________________________________
4731 void AliAnalysisTaskSEXicZero2XiPifromKFP::DefineVarTreePiMinus()
4732 {
4733  // This is to define tree variables
4734 
4735  const char* nameoutput = GetOutputSlot(9)->GetContainer()->GetName();
4736  fVarTree_PiMinus = new TTree(nameoutput, "PiMinus variables tree");
4737  Int_t nVar = 5;
4738  fVar_PiMinus = new Float_t[nVar];
4739  TString *fVarNames = new TString[nVar];
4740 
4741  fVarNames[0] = "charge_PiMinus";
4742  fVarNames[1] = "pt_PiMinus";
4743  fVarNames[2] = "pz_PiMinus";
4744  fVarNames[3] = "eta_PiMinus";
4745  fVarNames[4] = "MatchToMC";
4746 
4747  for (Int_t ivar=0; ivar<nVar; ivar++) {
4748  fVarTree_PiMinus->Branch(fVarNames[ivar].Data(), &fVar_PiMinus[ivar], Form("%s/f", fVarNames[ivar].Data()));
4749  }
4750 
4751  return;
4752 }
4753 */
4754 
4755 //_____________________________________________________________________________
4757 {
4758  const char* nameoutput = GetOutputSlot(5)->GetContainer()->GetName();
4759  fTree_Xic0MCGen = new TTree(nameoutput,"Xic0 MC variables tree");
4760  Int_t nVar = 19;
4761  fVar_Xic0MCGen = new Float_t[nVar];
4762  TString *fVarNames = new TString[nVar];
4763 
4764  fVarNames[ 0]="Centrality";
4765  fVarNames[ 1]="DecayType";
4766  fVarNames[ 2]="XicSource";
4767  fVarNames[ 3]="XicEta";
4768  fVarNames[ 4]="XicY";
4769  fVarNames[ 5]="XicPx";
4770  fVarNames[ 6]="XicPy";
4771  fVarNames[ 7]="XicPz";
4772  fVarNames[ 8]="PiPx";
4773  fVarNames[ 9]="PiPy";
4774  fVarNames[10]="PiPz";
4775  fVarNames[11]="CascPx";
4776  fVarNames[12]="CascPy";
4777  fVarNames[13]="CascPz";
4778  fVarNames[14]="XicPdgCode";
4779  fVarNames[15]="PiPdgCode";
4780  fVarNames[16]="CascPdgCode";
4781  fVarNames[17]="RunNumber";
4782  fVarNames[18]="EvNumber";
4783 
4784  for (Int_t ivar=0; ivar<nVar; ivar++) {
4785  fTree_Xic0MCGen->Branch(fVarNames[ivar].Data(),&fVar_Xic0MCGen[ivar],Form("%s/f",fVarNames[ivar].Data()));
4786  }
4787 
4788  return;
4789 }
4790 
4791 //_____________________________________________________________________________
4792 Double_t AliAnalysisTaskSEXicZero2XiPifromKFP::InvMassV0atPV(AliAODTrack *trk1, AliAODTrack *trk2, Int_t pdg1, Int_t pdg2)
4793 {
4794 
4795  Double_t mass1 = TDatabasePDG::Instance()->GetParticle(pdg1)->Mass();
4796  Double_t mass2 = TDatabasePDG::Instance()->GetParticle(pdg2)->Mass();
4797  Double_t E1 = TMath::Sqrt(mass1*mass1 + trk1->P()*trk1->P());
4798  Double_t E2 = TMath::Sqrt(mass2*mass2 + trk2->P()*trk2->P());
4799  Double_t mass = TMath::Sqrt( (E1+E2)*(E1+E2) - (trk1->Px()+trk2->Px())*(trk1->Px()+trk2->Px()) - (trk1->Py()+trk2->Py())*(trk1->Py()+trk2->Py()) - (trk1->Pz()+trk2->Pz())*(trk1->Pz()+trk2->Pz()) );
4800 
4801  return mass;
4802 }
4803 
4804 //_____________________________________________________________________________
4806 {
4807  // Define analysis histograms
4808 
4809  Int_t bins_xicmcgen[3] = {20, 20, 10};
4810  Double_t xmin_xicmcgen[3] = {0., -1., 0.};
4811  Double_t xmax_xicmcgen[3] = {20., 1., 100.};
4812  fHistMCGen_XicZeroTot = new THnSparseF("fHistMCGen_XicZeroTot","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4813  fHistMCGen_XicZero = new THnSparseF("fHistMCGen_XicZero","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4814  fHistMCGen_AntiXicZero = new THnSparseF("fHistMCGen_AntiXicZero","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4815  fHistMCGen_PionTot = new THnSparseF("fHistMCGen_PionTot","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4816  fHistMCGen_PionPlus = new THnSparseF("fHistMCGen_PionPlus","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4817  fHistMCGen_PionMinus = new THnSparseF("fHistMCGen_PionMinus","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4818  fHistMCGen_XiTot = new THnSparseF("fHistMCGen_XiTot","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4819  fHistMCGen_XiMinus = new THnSparseF("fHistMCGen_XiMinus","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4820  fHistMCGen_XiPlus = new THnSparseF("fHistMCGen_XiPlus","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4821  fHistMCGen_Lambda = new THnSparseF("fHistMCGen_Lambda","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4822  fHistMCGen_AntiLambda = new THnSparseF("fHistMCGen_AntiLambda","",3,bins_xicmcgen,xmin_xicmcgen,xmax_xicmcgen);
4823 
4824  Int_t bins_masspt[3] = {300, 20, 10};
4825  Double_t xmin_masspt[3] = {1., 0., 0.};
4826  Double_t xmax_masspt[3] = {4., 20., 100.};
4827  fHistMCGen_PiXiInvMass = new THnSparseF("fHistMCGen_PiXiInvMass","",3,bins_masspt,xmin_masspt,xmax_masspt);
4828  fHistMCGen_PiXiMassvsPiPt = new THnSparseF("fHistMCGen_PiXiMassvsPiPt","",3,bins_masspt,xmin_masspt,xmax_masspt);
4829  fHistMCGen_PiXiMassvsPiPt_PionPlus = new THnSparseF("fHistMCGen_PiXiMassvsPiPt_PionPlus","",3,bins_masspt,xmin_masspt,xmax_masspt);
4830  fHistMCGen_PiXiMassvsPiPt_PionMinus = new THnSparseF("fHistMCGen_PiXiMassvsPiPt_PionMinus","",3,bins_masspt,xmin_masspt,xmax_masspt);
4831 
4832  fHistMCXicZeroDecayType = new TH1F("fHistMCXicZeroDecayType","",4,0.5,4.5);
4833  fHistMCXiDecayType = new TH1F("fHistMCXiDecayType","",4,0.5,4.5);
4834 
4835  fHistMCpdg_All = new TH1F("fHistMCpdg_All", "PDG", 20000, -10000, 10000);
4836  fHistMCpdg_Dau_XicZero = new TH1F("fHistMCpdg_Dau_XicZero", "PDG of daughters of Xic0 & anti-Xic0", 20000, -10000, 10000);
4837  fHistMCpdg_Dau_XicPM = new TH1F("fHistMCpdg_Dau_XicPM", "PDG of daughters of Xic+ & Xic-", 20000, -10000, 10000);
4838 
4854 
4857 
4861 
4862 }
4863 
4864 /*
4865 //_____________________________________________________________________________
4866 void AliAnalysisTaskSEXicZero2XiPifromKFP::FillPiPlusROOTObjects(AliAODTrack *track, TClonesArray *mcArray)
4867 {
4868  for (Int_t i=0; i<5; i++) {
4869  fVar_PiPlus[i] = -9999.;
4870  }
4871 
4872  fVar_PiPlus[0] = track->Charge();
4873  fVar_PiPlus[1] = track->Pt();
4874  fVar_PiPlus[2] = track->Pz();
4875  fVar_PiPlus[3] = track->Eta();
4876 
4877  if (fIsMC) {
4878  Int_t lab_Pion = MatchToMCPion(track, mcArray);
4879  if (lab_Pion>-1) fVar_PiPlus[4] = 1;
4880  }
4881 
4882  fVarTree_PiPlus->Fill();
4883 
4884  return;
4885 
4886 }
4887 
4888 //_____________________________________________________________________________
4889 void AliAnalysisTaskSEXicZero2XiPifromKFP::FillPiMinusROOTObjects(AliAODTrack *track, TClonesArray *mcArray)
4890 {
4891  for (Int_t i=0; i<5; i++) {
4892  fVar_PiMinus[i] = -9999.;
4893  }
4894 
4895  fVar_PiMinus[0] = track->Charge();
4896  fVar_PiMinus[1] = track->Pt();
4897  fVar_PiMinus[2] = track->Pz();
4898  fVar_PiMinus[3] = track->Eta();
4899 
4900  if (fIsMC) {
4901  Int_t lab_Pion = MatchToMCPion(track, mcArray);
4902  if (lab_Pion>-1) fVar_PiMinus[4] = 1;
4903  }
4904 
4905  fVarTree_PiMinus->Fill();
4906 
4907  return;
4908 
4909 }
4910 */
4911 
4912 //_____________________________________________________________________________
4914 {
4915 
4916  for (Int_t i=0; i<7; i++) {
4917  fVar_Event[i] = 0.;
4918  }
4919 
4920  Double_t pos[3];
4921  fpVtx->GetXYZ(pos);
4922 
4923  fVar_Event[1] = pos[2];
4924 
4925  fTree_Event->Fill();
4926 
4927  return;
4928 
4929 }
4930 
4931 //_____________________________________________________________________________
4932 void AliAnalysisTaskSEXicZero2XiPifromKFP::FillTreeRecXic0FromV0(KFParticle kfpXic0, AliAODTrack *trackPiFromXic0, KFParticle kfpBP, KFParticle kfpXiMinus, KFParticle kfpXiMinus_m, AliAODTrack *trackPiFromXi, AliAODv0 *v0, KFParticle kfpK0Short, KFParticle kfpLambda, KFParticle kfpLambda_m, AliAODTrack *trkProton, AliAODTrack *trkPion, KFParticle PV, TClonesArray *mcArray, Int_t lab_Xic0)
4933 {
4934 
4935  for (Int_t i=0; i<32; i++) {
4936  fVar_Xic0[i] = -9999.;
4937  }
4938 
4939 // Float_t nSigmaTOF_PiFromXic0 = fAnaCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trackPiFromXic0,AliPID::kPion);
4940 // Float_t nSigmaTOF_PiFromXi = fAnaCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTOF(trackPiFromXi,AliPID::kPion);
4941 
4942 // Float_t nSigmaTPC_PiFromXic0 = fAnaCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trackPiFromXic0,AliPID::kPion);
4943 // Float_t nSigmaTPC_PiFromXi = fAnaCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trackPiFromXi,AliPID::kPion);
4944 // Float_t nSigmaTPC_PrFromLam = fAnaCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkProton,AliPID::kProton);
4945 // Float_t nSigmaTPC_PiFromLam = fAnaCuts->GetPidHF()->GetPidResponse()->NumberOfSigmasTPC(trkPion,AliPID::kPion);
4946 
4947 
4948  Float_t nSigmaTOF_PiFromXic0 = fPID->NumberOfSigmasTOF(trackPiFromXic0,AliPID::kPion);
4949  Float_t nSigmaTOF_PiFromXi = fPID->NumberOfSigmasTOF(trackPiFromXi,AliPID::kPion);
4950  Float_t nSigmaTPC_PiFromXic0 = fPID->NumberOfSigmasTPC(trackPiFromXic0,AliPID::kPion);
4951  Float_t nSigmaTPC_PiFromXi = fPID->NumberOfSigmasTPC(trackPiFromXi,AliPID::kPion);
4952  Float_t nSigmaTPC_PrFromLam = fPID->NumberOfSigmasTPC(trkProton,AliPID::kProton);
4953  Float_t nSigmaTPC_PiFromLam = fPID->NumberOfSigmasTPC(trkPion,AliPID::kPion);
4954 
4955  if ( fabs(nSigmaTPC_PiFromXic0)>=4. || fabs(nSigmaTPC_PiFromXi)>=4. || fabs(nSigmaTPC_PrFromLam)>=4. || fabs(nSigmaTPC_PiFromLam)>=4. ) return;
4956 
4957 // AliAODTrack *trk0 = (AliAODTrack*) (v0->GetDaughter(0));
4958 
4959 // Double_t alpha_FirstDaugPos = (v0->MomPosAlongV0() - v0->MomNegAlongV0())/(v0->MomPosAlongV0() + v0->MomNegAlongV0());
4960 
4961 // if (trk0->Charge()<0) {
4962 // alpha_FirstDaugPos = (v0->MomNegAlongV0() - v0->MomPosAlongV0())/(v0->MomPosAlongV0() + v0->MomNegAlongV0());
4963 // }
4964 
4965  KFParticle kfpLambda_pv = kfpLambda;
4966  kfpLambda_pv.SetProductionVertex(PV);
4967 // KFParticle kfpXiMinus_pv = kfpXiMinus;
4968 // kfpXiMinus_pv.SetProductionVertex(PV);
4969  KFParticle kfpXic0_pv = kfpXic0;
4970  kfpXic0_pv.SetProductionVertex(PV);
4971 
4972  KFParticle kfpXiMinus_Xic0 = kfpXiMinus;
4973  kfpXiMinus_Xic0.SetProductionVertex(kfpXic0_pv);
4974 
4975  KFParticle kfpBP_Xic0 = kfpBP;
4976  kfpBP_Xic0.SetProductionVertex(kfpXic0_pv);
4977 
4978  //************************** calculate l/Δl for Lambda *************************************
4979  Double_t dx_Lambda = PV.GetX()-kfpLambda.GetX();
4980  Double_t dy_Lambda = PV.GetY()-kfpLambda.GetY();
4981  Double_t dz_Lambda = PV.GetZ()-kfpLambda.GetZ();
4982  Double_t l_Lambda = TMath::Sqrt(dx_Lambda*dx_Lambda + dy_Lambda*dy_Lambda + dz_Lambda*dz_Lambda);
4983  Double_t dl_Lambda = (PV.GetCovariance(0)+kfpLambda.GetCovariance(0))*dx_Lambda*dx_Lambda + (PV.GetCovariance(2)+kfpLambda.GetCovariance(2))*dy_Lambda*dy_Lambda + (PV.GetCovariance(5)+kfpLambda.GetCovariance(5))*dz_Lambda*dz_Lambda + 2*( (PV.GetCovariance(1)+kfpLambda.GetCovariance(1))*dx_Lambda*dy_Lambda + (PV.GetCovariance(3)+kfpLambda.GetCovariance(3))*dx_Lambda*dz_Lambda + (PV.GetCovariance(4)+kfpLambda.GetCovariance(4))*dy_Lambda*dz_Lambda );
4984  if ( fabs(l_Lambda)<1.e-8f ) l_Lambda = 1.e-8f;
4985  dl_Lambda = dl_Lambda<0. ? 1.e8f : sqrt(dl_Lambda)/l_Lambda;
4986  if ( dl_Lambda<=0 ) return;
4987  //***************************************************************************************
4988  //************************** calculate l/Δl for Xi- *************************************
4989  Double_t dx_Xi = PV.GetX()-kfpXiMinus.GetX();
4990  Double_t dy_Xi = PV.GetY()-kfpXiMinus.GetY();
4991  Double_t dz_Xi = PV.GetZ()-kfpXiMinus.GetZ();
4992  Double_t l_Xi = TMath::Sqrt(dx_Xi*dx_Xi + dy_Xi*dy_Xi + dz_Xi*dz_Xi);
4993  Double_t dl_Xi = (PV.GetCovariance(0)+kfpXiMinus.GetCovariance(0))*dx_Xi*dx_Xi + (PV.GetCovariance(2)+kfpXiMinus.GetCovariance(2))*dy_Xi*dy_Xi + (PV.GetCovariance(5)+kfpXiMinus.GetCovariance(5))*dz_Xi*dz_Xi + 2*( (PV.GetCovariance(1)+kfpXiMinus.GetCovariance(1))*dx_Xi*dy_Xi + (PV.GetCovariance(3)+kfpXiMinus.GetCovariance(3))*dx_Xi*dz_Xi + (PV.GetCovariance(4)+kfpXiMinus.GetCovariance(4))*dy_Xi*dz_Xi );
4994  if ( fabs(l_Xi)<1.e-8f ) l_Xi = 1.e-8f;
4995  dl_Xi = dl_Xi<0. ? 1.e8f : sqrt(dl_Xi)/l_Xi;
4996  if ( dl_Xi<=0 ) return;
4997  //***************************************************************************************
4998 
4999  // calculate CosPointingAngle
5000  Double_t cosPA_v0 = CosPointingAngleKF(kfpLambda_m, kfpXiMinus);
5001  KFParticle kfpLambda_Xi = kfpLambda_m;
5002  kfpLambda_Xi.SetProductionVertex(kfpXiMinus);
5003 
5004  Double_t cosPA_XiToPV = CosPointingAngleKF(kfpXiMinus_m, PV);
5005  Double_t cosPA_XiToXic = CosPointingAngleKF(kfpXiMinus_m, kfpXic0);
5006  KFParticle kfpXiMinus_Xic = kfpXiMinus_m;
5007  kfpXiMinus_Xic.SetProductionVertex(kfpXic0);
5008 
5009  if ( kfpLambda_Xi.GetChi2()/kfpLambda_Xi.GetNDF() >= fAnaCuts->GetKFPLam_Chi2topoMax() ) return;
5010  if ( kfpXiMinus_Xic.GetChi2()/kfpXiMinus_Xic.GetNDF() >= fAnaCuts->GetKFPXi_Chi2topoMax() ) return;
5011  if ( l_Xi/dl_Xi <= fAnaCuts->GetKFPXi_lDeltalMin() ) return;
5012 
5013  const Float_t PDGmassXic0 = TDatabasePDG::Instance()->GetParticle(4132)->Mass();
5014  Float_t mass_Xic_PV, err_mass_Xic_PV;
5015  kfpXic0_pv.GetMass(mass_Xic_PV, err_mass_Xic_PV);
5016  fVar_Xic0[29] = mass_Xic_PV;
5017 
5018  if ( fabs(mass_Xic_PV-PDGmassXic0) > fAnaCuts->GetProdMassTolXic0() ) return;
5019 
5020  fVar_Xic0[0] = nSigmaTPC_PiFromXic0;
5021  fVar_Xic0[1] = nSigmaTOF_PiFromXic0;
5022  fVar_Xic0[2] = nSigmaTPC_PiFromXi;
5023  fVar_Xic0[3] = nSigmaTOF_PiFromXi;
5024  fVar_Xic0[4] = nSigmaTPC_PiFromLam;
5025  fVar_Xic0[5] = nSigmaTPC_PrFromLam;
5026  fVar_Xic0[6] = v0->DcaV0Daughters(); // DCA_LamDau
5027  fVar_Xic0[7] = kfpLambda.GetChi2()/kfpLambda.GetNDF(); // chi2geo_Lam
5028  fVar_Xic0[8] = kfpXiMinus.GetChi2()/kfpXiMinus.GetNDF();
5029  fVar_Xic0[9] = kfpLambda_Xi.GetChi2()/kfpLambda_Xi.GetNDF();
5030  fVar_Xic0[10] = kfpXiMinus_Xic.GetChi2()/kfpXiMinus_Xic.GetNDF();
5031 
5032  fVar_Xic0[11] = l_Lambda/dl_Lambda;
5033  fVar_Xic0[12] = l_Xi/dl_Xi;
5034 
5035  Float_t DecayL_Lam, err_DecayL_Lam;
5036  Float_t DecayL_Xi, err_DecayL_Xi;
5037  Float_t DecayL_XicZero, err_DecayL_XicZero;
5038  Float_t DecayLxy_Lam, err_DecayLxy_Lam;
5039  Float_t DecayLxy_Xi, err_DecayLxy_Xi;
5040  Float_t DecayLxy_XicZero, err_DecayLxy_XicZero;
5041  kfpLambda_Xi.GetDecayLength(DecayL_Lam, err_DecayL_Lam);
5042  kfpXiMinus_Xic.GetDecayLength(DecayL_Xi, err_DecayL_Xi);
5043 // kfpXic0_pv.GetDecayLength(DecayL_XicZero, err_DecayL_XicZero);
5044  kfpLambda_Xi.GetDecayLengthXY(DecayLxy_Lam, err_DecayLxy_Lam);
5045  kfpXiMinus_Xic.GetDecayLengthXY(DecayLxy_Xi, err_DecayLxy_Xi);
5046 // kfpXic0_pv.GetDecayLengthXY(DecayLxy_XicZero, err_DecayLxy_XicZero);
5047  fVar_Xic0[13] = DecayL_Lam;
5048  fVar_Xic0[14] = DecayL_Xi;
5049 // fVar_Xic0[34] = DecayL_XicZero;
5050  fVar_Xic0[15] = DecayLxy_Lam;
5051  fVar_Xic0[16] = DecayLxy_Xi;
5052 // fVar_Xic0[37] = DecayLxy_XicZero;
5053 
5054  fVar_Xic0[17] = TMath::ACos(cosPA_v0); // PA_Lam
5055  fVar_Xic0[18] = TMath::ACos(cosPA_XiToPV); // PA_Xi
5056 
5057  fVar_Xic0[19] = kfpLambda.GetPt();
5058  fVar_Xic0[20] = kfpLambda.GetRapidity();
5059  Float_t mass_Lam, err_mass_Lam;
5060  kfpLambda.GetMass(mass_Lam, err_mass_Lam);
5061  fVar_Xic0[21] = mass_Lam;
5062 
5063  fVar_Xic0[22] = kfpXiMinus.GetPt();
5064  fVar_Xic0[23] = kfpXiMinus.GetRapidity();
5065  Float_t mass_Xi, err_mass_Xi;
5066  kfpXiMinus.GetMass(mass_Xi, err_mass_Xi);
5067  fVar_Xic0[24] = mass_Xi;
5068 
5069  fVar_Xic0[25] = trackPiFromXic0->Pt();
5070  fVar_Xic0[26] = trackPiFromXic0->Eta();
5071 
5072  fVar_Xic0[27] = kfpXic0_pv.GetPt();
5073  if ( TMath::Abs(kfpXic0_pv.GetE())>TMath::Abs(kfpXic0_pv.GetPz()) ) {
5074  fVar_Xic0[28] = kfpXic0_pv.GetRapidity();
5075  }
5076 
5077  Float_t massK0S_Rec, err_massK0S;