Update from Carlos Perez: Strange flow updates
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskFlowStrange.cxx
index e550fa4..0fb0cc4 100644 (file)
@@ -59,6 +59,7 @@
 #include "AliFlowEvent.h"\r
 #include "AliFlowBayesianPID.h"\r
 #include "AliFlowCommonConstants.h"\r
+#include "AliFlowVector.h"\r
 \r
 #include "AliAnalysisTaskFlowStrange.h"\r
 \r
@@ -70,6 +71,9 @@ AliAnalysisTaskFlowStrange::AliAnalysisTaskFlowStrange() :
   fPIDResponse(NULL),\r
   fBayesianPID(NULL),\r
   fDebug(kFALSE),\r
+  fUseEventSelection(kTRUE),\r
+  fDoQA(kFALSE),\r
+  fPsi2(0.0),\r
   fSpecie(0),\r
   fMCmatch(-1),\r
   fMassBins(0),\r
@@ -99,6 +103,9 @@ AliAnalysisTaskFlowStrange::AliAnalysisTaskFlowStrange(const char *name,
   fPIDResponse(NULL),\r
   fBayesianPID(NULL),\r
   fDebug(kFALSE),\r
+  fUseEventSelection(kTRUE),\r
+  fDoQA(kFALSE),\r
+  fPsi2(0.0),\r
   fSpecie(0),\r
   fMCmatch(-1),\r
   fMassBins(0),\r
@@ -149,7 +156,7 @@ void AliAnalysisTaskFlowStrange::UserCreateOutputObjects()
   cc->SetNbinsMult(1); cc->SetMultMin(0);   cc->SetMultMax(1);\r
   cc->SetNbinsPt(120); cc->SetPtMin(0.0);   cc->SetPtMax(12.0);\r
   cc->SetNbinsPhi(1);  cc->SetPhiMin(0.0);  cc->SetPhiMax(TMath::TwoPi());\r
-  cc->SetNbinsEta(1);  cc->SetEtaMin(-2.0); cc->SetEtaMax(+2.0);\r
+  cc->SetNbinsEta(18);  cc->SetEtaMin(-0.9); cc->SetEtaMax(+0.9);\r
   cc->SetNbinsQ(1);    cc->SetQMin(0.0);    cc->SetQMax(1.0);\r
   cc->SetNbinsMass(fMassBins);\r
   cc->SetMassMin(fMinMass);\r
@@ -180,14 +187,16 @@ void AliAnalysisTaskFlowStrange::UserCreateOutputObjects()
 void AliAnalysisTaskFlowStrange::Exec(Option_t* option)\r
 {\r
   //bypassing ::exec (needed because of AMPT)\r
-  AliAnalysisTaskSE::Exec(option); // executes EVENT only for data analysis\r
-  if(fMCmatch>-1) AliAnalysisTaskFlowStrange::MyUserExec(option); // executes EVENT only for monteCarlo\r
+  if(fMCmatch==-1) // executes EVENT in data analysis\r
+    AliAnalysisTaskSE::Exec(option);\r
+  else // executes EVENT in monteCarlo\r
+    AliAnalysisTaskFlowStrange::MyUserExec(option);\r
 }\r
 //=======================================================================\r
 void AliAnalysisTaskFlowStrange::UserExec(Option_t *option)\r
 {\r
   // dummy user exec\r
-  if(fMCmatch==-1) AliAnalysisTaskFlowStrange::MyUserExec(option);\r
+  AliAnalysisTaskFlowStrange::MyUserExec(option);\r
 }\r
 //=======================================================================\r
 void AliAnalysisTaskFlowStrange::AddQAEvents()\r
@@ -204,7 +213,12 @@ void AliAnalysisTaskFlowStrange::AddQAEvents()
 \r
   TH1D *tTPCRFP = new TH1D("RFPTPC","TPC Reference Flow Particles;multiplicity",100,0,3000); tQAEvents->Add(tTPCRFP);\r
   TH1D *tVZERFP = new TH1D("RFPVZE","VZERO Reference Flow Particles;multiplicity",100,0,30000); tQAEvents->Add(tVZERFP);\r
-\r
+  TH1D *tPOI = new TH1D("POI","POIs;multiplicity",500,0,500); tQAEvents->Add( tPOI );\r
+  if(fDoQA) {\r
+    TH2D *tH2D = new TH2D("VTXZ","VTXZ;Global||SPD;SPD",60,-15,+15,60,-15,+15); tQAEvents->Add( tH2D );\r
+    TH3D *tH3D = new TH3D("EVPLANE","EVPLANE;TPC;V0A;V0C",72,0,TMath::Pi(),72,0,TMath::Pi(),72,0,TMath::Pi()); tQAEvents->Add( tH3D );\r
+    tH2D = new TH2D("VTXZSEL","VTXZ SEL;Global||SPD;SPD",40,-10,+10,40,-10,+10); tQAEvents->Add( tH2D );\r
+  }\r
   TProfile *tCuts = new TProfile("Cuts","Analysis Cuts",11,0,11);\r
   tCuts->Fill(0.5,fV0Cuts[0],1); tCuts->GetXaxis()->SetBinLabel(1,"dl");\r
   tCuts->Fill(1.5,fV0Cuts[1],1); tCuts->GetXaxis()->SetBinLabel(2,"dca");\r
@@ -224,111 +238,146 @@ void AliAnalysisTaskFlowStrange::AddQAEvents()
 void AliAnalysisTaskFlowStrange::AddQACandidates()\r
 {\r
   // function to add histogramming for candidates\r
-  TList *tQACuts;\r
-  TH1D *tPOI, *tMCdaughters;\r
-  TH2D *tDL, *tDCA, *tCTP, *tD0, *tD0D0, *tMCrads;\r
-  TH3D *tAP, *tMCmother, *tMCpdg;\r
-\r
-  tQACuts = new TList(); tQACuts->SetOwner(); tQACuts->SetName("QACutsBefore");\r
-  tDL   = new TH2D("BefDL",  "DL;[cm];Pt [GeV]",  50,0,10,  24,0,12); tQACuts->Add(tDL);\r
-  tDCA  = new TH2D("BefDCA", "DCA;[cm];Pt [GeV]", 50,0,1.001, 24,0,12); tQACuts->Add(tDCA);\r
-  tCTP  = new TH2D("BefCTP", "CTP;;Pt [GeV]",     80,0.91,1.001, 24,0,12); tQACuts->Add(tCTP);\r
-  tD0   = new TH2D("BefD0",  "D0;[cm];Pt [GeV]",  50,-1,+1, 24,0,12); tQACuts->Add(tD0);\r
-  tD0D0 = new TH2D("BefD0D0","D0D0;[cm^{2}];Pt [GeV]", 100,-1,+1, 24,0,12); tQACuts->Add(tD0D0);\r
-  tAP   = new TH3D("BefAP",  "AP;#alpha;q_{t}[GeV];Pt [GeV]", 80,-1,+1, 90,0,0.3, 24,0,12); tQACuts->Add(tAP);\r
-  fQAList->Add(tQACuts);\r
-\r
-  tQACuts = new TList(); tQACuts->SetOwner(); tQACuts->SetName("QACutsAfter");\r
-  tAP     = new TH3D("AftAP","AP;#alpha;q_{t}[GeV];Pt [GeV]", 80,-1,+1, 90,0,0.3, 60,0,12); tQACuts->Add(tAP);\r
-  tPOI    = new TH1D("POI","POIs;multiplicity",500,0,500); tQACuts->Add(tPOI);\r
+  TList *tList;\r
+  TH1D *tH1D;\r
+  TH2D *tH2D;\r
+  TH3D *tH3D;\r
+\r
+  Int_t nMass = 88;\r
+  Double_t dMinMass = 0.412, dMaxMass=0.588;\r
   switch(fSpecie) {\r
-  case(0):\r
-    tMCpdg = new TH3D("MCPDG","MC PDGm;p_{T} (GeV);Mass [GeV]",24,0,12,88,0.412,0.588,30,0,30); tQACuts->Add(tMCpdg);\r
-    break;\r
   case(1):\r
-    tMCpdg = new TH3D("MCPDG","MC PDGm;p_{T} (GeV);Mass [GeV]",24,0,12,92,1.075,1.167,30,0,30); tQACuts->Add(tMCpdg);\r
+    nMass = 92;\r
+    dMinMass = 1.075;\r
+    dMaxMass = 1.167;\r
     break;\r
   case(90):\r
-    tMCpdg = new TH3D("MCPDG","MC PDGm;p_{T} (GeV);Mass [GeV]",24,0,12,100,0.00,1.000,30,0,30); tQACuts->Add(tMCpdg);\r
+    nMass = 100;\r
+    dMinMass = 0.0;\r
+    dMaxMass = 1.0;\r
     break;\r
   }\r
-  if(tMCpdg) {\r
-    tMCpdg->GetZaxis()->SetBinLabel( 1,"NONE");\r
-    tMCpdg->GetZaxis()->SetBinLabel( 2,"NONE chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel( 3,"NONPDG");\r
-    tMCpdg->GetZaxis()->SetBinLabel( 4,"NONPDG chked"); // 3\r
-    tMCpdg->GetZaxis()->SetBinLabel( 5,"Truths");\r
-    tMCpdg->GetZaxis()->SetBinLabel( 6,"Truths chked"); // 1\r
-    tMCpdg->GetZaxis()->SetBinLabel( 7,"K_L0 chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel( 8,"K_S0 chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel( 9,"Lambda0 chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(10,"Lambda0_bar chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(11,"phi chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(12,"rho0 chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(13,"omega chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(14,"f_0 chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(15,"e- chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(16,"e+ chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(17,"pi+ chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(18,"pi- chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(19,"mu+ chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(20,"mu- chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(21,"K+ chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(22,"K- chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(23,"proton chked");\r
-    tMCpdg->GetZaxis()->SetBinLabel(24,"antiproton chked");\r
+\r
+  if(fDoQA) {\r
+    tList = new TList(); tList->SetOwner(); tList->SetName("QACutsBefore_IP");\r
+    tH3D = new TH3D("BefVOL", "VOLUME;Phi;Eta;Pt [GeV]",       63, 0.0,+6.3, 40,-1.0,+1.0, 60,0,12); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefRAP", "RAPIDITY;y;Pt [GeV]",           40,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefDLZ", "DLZ;[cm];Pt [GeV]",             50,-5.0,+5.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefDLXY","DLXY;[cm];Pt [GeV]",           100,0.00,100., 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefCTau","CTau;[cm];Pt [GeV]",           250,0.00,250., 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefDCA", "DCA;[cm];Pt [GeV]",             50,0.00,+5.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefCTP", "CTP;;Pt [GeV]",                 80,0.99,1.00, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefD0",  "D0;[cm];Pt [GeV]",              50,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefD0D0","D0D0;[cm^{2}];Pt [GeV]",        50,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefAP",  "AP;#alpha;q_{t}[GeV];Pt [GeV]", 80,-1.0,+1.0, 90,0,0.3, 60,0,12); tList->Add( tH3D );\r
+    fQAList->Add(tList);\r
+    tList = new TList(); tList->SetOwner(); tList->SetName("QACutsBefore_OP");\r
+    tH3D = new TH3D("BefVOL", "VOLUME;Phi;Eta;Pt [GeV]",       63, 0.0,+6.3, 40,-1.0,+1.0, 60,0,12); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefRAP", "RAPIDITY;y;Pt [GeV]",           40,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefDLZ", "DLZ;[cm];Pt [GeV]",             50,-5.0,+5.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefDLXY","DLXY;[cm];Pt [GeV]",           100,0.00,100., 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefCTau","CTau;[cm];Pt [GeV]",           250,0.00,250., 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefDCA", "DCA;[cm];Pt [GeV]",             50,0.00,+5.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefCTP", "CTP;;Pt [GeV]",                 50,0.99,1.00, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefD0",  "D0;[cm];Pt [GeV]",              50,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefD0D0","D0D0;[cm^{2}];Pt [GeV]",        50,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("BefAP",  "AP;#alpha;q_{t}[GeV];Pt [GeV]", 80,-1.0,+1.0, 90,0,0.3, 60,0,12); tList->Add( tH3D );\r
+    fQAList->Add(tList);\r
+    tList = new TList(); tList->SetOwner(); tList->SetName("QACutsAfter_IP");\r
+    tH3D = new TH3D("AftVOL", "VOLUME;Phi;Eta;Pt [GeV]",       63, 0.0,+6.3, 40,-1.0,+1.0, 60,0,12); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftRAP", "RAPIDITY;y;Pt [GeV]",           40,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftDLZ", "DLZ;[cm];Pt [GeV]",             50,-5.0,+5.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftDLXY","DLXY;[cm];Pt [GeV]",           100,0.00,100., 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftCTau","CTau;[cm];Pt [GeV]",           250,0.00,250., 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftDCA", "DCA;[cm];Pt [GeV]",             50,0.00,+5.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftCTP", "CTP;;Pt [GeV]",                 50,0.99,1.00, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftD0",  "D0;[cm];Pt [GeV]",              50,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftD0D0","D0D0;[cm^{2}];Pt [GeV]",        50,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftAP",  "AP;#alpha;q_{t}[GeV];Pt [GeV]", 80,-1.0,+1.0, 90,0,0.3, 60,0,12); tList->Add( tH3D );\r
+    fQAList->Add(tList);\r
+    tList = new TList(); tList->SetOwner(); tList->SetName("QACutsAfter_OP");\r
+    tH3D = new TH3D("AftVOL", "VOLUME;Phi;Eta;Pt [GeV]",       63, 0.0,+6.3, 40,-1.0,+1.0, 60,0,12); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftRAP", "RAPIDITY;y;Pt [GeV]",           40,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftDLZ", "DLZ;[cm];Pt [GeV]",             50,-5.0,+5.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftDLXY","DLXY;[cm];Pt [GeV]",           100,0.00,100., 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftCTau","CTau;[cm];Pt [GeV]",           250,0.00,250., 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftDCA", "DCA;[cm];Pt [GeV]",             50,0.00,+5.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftCTP", "CTP;;Pt [GeV]",                 50,0.99,1.00, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftD0",  "D0;[cm];Pt [GeV]",              50,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftD0D0","D0D0;[cm^{2}];Pt [GeV]",        50,-1.0,+1.0, 60,0,12, nMass, dMinMass, dMaxMass); tList->Add( tH3D );\r
+    tH3D = new TH3D("AftAP",  "AP;#alpha;q_{t}[GeV];Pt [GeV]", 80,-1.0,+1.0, 90,0,0.3, 60,0,12); tList->Add( tH3D );\r
+    fQAList->Add(tList);\r
   }\r
-  //Int_t nptbins=21;\r
-  //Double_t ptbins[22] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,\r
-  //                    2.0,2.2,2.4,2.6,2.8,3.2,3.6,4.0,5.0,6.0,\r
-  //                    8.0,12.};\r
-  tMCmother = new TH3D("MCMOTHER","MC MOTHER;truth p_{T} (GeV); mother p_{T} (GeV)",60,0,12,60,0,12,50,0,50); tQACuts->Add(tMCmother);\r
-  tMCmother->GetZaxis()->SetBinLabel( 1,"NONPDG chked");\r
-  tMCmother->GetZaxis()->SetBinLabel( 2,"PRIMARY chked");\r
-\r
-  tMCmother->GetZaxis()->SetBinLabel( 3,"Xi0 chked");\r
-  tMCmother->GetZaxis()->SetBinLabel( 4,"Xi0_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel( 5,"Xi- chked");\r
-  tMCmother->GetZaxis()->SetBinLabel( 6,"Xi-_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel( 7,"Omega- chked");\r
-  tMCmother->GetZaxis()->SetBinLabel( 8,"Omega+ chked");\r
-\r
-  tMCmother->GetZaxis()->SetBinLabel( 9,"K+ chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(10,"K- chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(11,"Lambda0 chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(12,"Lambda0_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(13,"K0 chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(14,"K0_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(15,"K_S0 chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(16,"K_L0 chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(17,"phi chked");\r
-\r
-  tMCmother->GetZaxis()->SetBinLabel(18,"D+ chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(19,"D- chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(20,"D0 chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(21,"D0_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(22,"D_s+ chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(23,"D_s- chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(24,"Lambda_c+ chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(25,"Lambda_c- chked");\r
-\r
-  tMCmother->GetZaxis()->SetBinLabel(26,"Sigma*- chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(27,"Sigma*-_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(28,"Sigma*+ chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(29,"Sigma*+_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(30,"Sigma*0 chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(31,"Sigma*0_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(32,"Sigma- chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(33,"Sigma+_bar chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(34,"Sigma0 chked");\r
-  tMCmother->GetZaxis()->SetBinLabel(35,"Sigma0_bar chked");\r
-\r
-  tMCmother->GetZaxis()->SetBinLabel(36,"NONE chked");\r
-\r
-  tMCdaughters = new TH1D("MCDAUGHTERS","MC DAUGHTERS",10,0,10); tQACuts->Add(tMCdaughters);\r
-  tMCrads = new TH2D("MCRADS","MC RADS",2,0,2,200,0,10); tQACuts->Add(tMCrads);\r
-\r
-  fQAList->Add(tQACuts);\r
+\r
+  if(fMCmatch>0) { // only for MCanalysis\r
+    tList = new TList(); tList->SetOwner(); tList->SetName("QAMC");\r
+    tH3D = new TH3D("MCPDG","MC PDGm;p_{T} (GeV);Mass [GeV]",24,0,12,nMass,dMinMass,dMaxMass,30,0,30); tList->Add( tH3D );\r
+    tH3D->GetZaxis()->SetBinLabel( 1,"NONE");\r
+    tH3D->GetZaxis()->SetBinLabel( 2,"NONE chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 3,"NONPDG");\r
+    tH3D->GetZaxis()->SetBinLabel( 4,"NONPDG chked"); // 3\r
+    tH3D->GetZaxis()->SetBinLabel( 5,"Truths");\r
+    tH3D->GetZaxis()->SetBinLabel( 6,"Truths chked"); // 1\r
+    tH3D->GetZaxis()->SetBinLabel( 7,"K_L0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 8,"K_S0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 9,"Lambda0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(10,"Lambda0_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(11,"phi chked");\r
+    tH3D->GetZaxis()->SetBinLabel(12,"rho0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(13,"omega chked");\r
+    tH3D->GetZaxis()->SetBinLabel(14,"f_0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(15,"e- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(16,"e+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(17,"pi+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(18,"pi- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(19,"mu+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(20,"mu- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(21,"K+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(22,"K- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(23,"proton chked");\r
+    tH3D->GetZaxis()->SetBinLabel(24,"antiproton chked");\r
+  \r
+    tH3D = new TH3D("MCMOTHER","MC MOTHER;truth p_{T} (GeV); mother p_{T} (GeV)",60,0,12,60,0,12,50,0,50); tList->Add( tH3D );\r
+    tH3D->GetZaxis()->SetBinLabel( 1,"NONPDG chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 2,"PRIMARY chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 3,"Xi0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 4,"Xi0_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 5,"Xi- chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 6,"Xi-_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 7,"Omega- chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 8,"Omega+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel( 9,"K+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(10,"K- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(11,"Lambda0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(12,"Lambda0_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(13,"K0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(14,"K0_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(15,"K_S0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(16,"K_L0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(17,"phi chked");\r
+    tH3D->GetZaxis()->SetBinLabel(18,"D+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(19,"D- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(20,"D0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(21,"D0_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(22,"D_s+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(23,"D_s- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(24,"Lambda_c+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(25,"Lambda_c- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(26,"Sigma*- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(27,"Sigma*-_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(28,"Sigma*+ chked");\r
+    tH3D->GetZaxis()->SetBinLabel(29,"Sigma*+_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(30,"Sigma*0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(31,"Sigma*0_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(32,"Sigma- chked");\r
+    tH3D->GetZaxis()->SetBinLabel(33,"Sigma+_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(34,"Sigma0 chked");\r
+    tH3D->GetZaxis()->SetBinLabel(35,"Sigma0_bar chked");\r
+    tH3D->GetZaxis()->SetBinLabel(36,"NONE chked");\r
+    tH1D = new TH1D("MCDAUGHTERS","MC DAUGHTERS",10,0,10); tList->Add( tH1D );\r
+    tH2D = new TH2D("MCRADS","MC RADS",2,0,2,200,0,10); tList->Add( tH2D );\r
+    fQAList->Add(tList);\r
+  } // only for MCanalysis\r
 \r
 }\r
 //=======================================================================\r
@@ -340,15 +389,27 @@ void AliAnalysisTaskFlowStrange::MyUserExec(Option_t *)
   fCandidates->SetLast(-1);\r
   if(tAOD) {\r
     ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("Events"))->Fill(0);\r
-    if(fCutsEvent->IsSelected(tAOD)) {\r
+    Double_t tVtxZ = tAOD->GetPrimaryVertex()->GetZ();\r
+    Double_t tSPDVtxZ = tAOD->GetPrimaryVertexSPD()->GetZ();\r
+    if( fDoQA )\r
+      ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("VTXZ"))->Fill( tVtxZ, tSPDVtxZ );\r
+    Bool_t tESelection = TMath::Abs(tVtxZ-tSPDVtxZ) < 0.5;\r
+    Bool_t tDSelection = kTRUE;\r
+    if(fUseEventSelection) {\r
+      tDSelection = fCutsEvent->IsSelected(tAOD);\r
+    } else {\r
+      if(TMath::Abs(tVtxZ)>10.0) tDSelection = kFALSE; // Cut on VtxZ mandatory!\r
+    }\r
+    if(tDSelection&&tESelection) {\r
       acceptEvent=kTRUE;\r
       ReadFromAODv0(tAOD);\r
+      if( fDoQA )\r
+       ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("VTXZSEL"))->Fill( tVtxZ, tSPDVtxZ );\r
     }\r
   }\r
   if(!acceptEvent) return;\r
   // QA filling\r
   ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("Events"))->Fill(1);\r
-\r
   ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("RFPTPC"))->Fill( fFlowEventTPC->GetNumberOfRPs() );\r
   Double_t mult=0;\r
   for(Int_t i=0;i!=fFlowEventVZE->GetNumberOfRPs();++i) {\r
@@ -356,11 +417,7 @@ void AliAnalysisTaskFlowStrange::MyUserExec(Option_t *)
     mult += pTrack->Weight();\r
   }\r
   ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("RFPVZE"))->Fill( mult );\r
-\r
-  if(fDebug) printf("TPCevent %d | VZEevent %d\n",\r
-                   fFlowEventTPC->NumberOfTracks(),\r
-                   fFlowEventVZE->NumberOfTracks() );\r
-  ((TH1D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("POI"))->Fill( fCandidates->GetEntriesFast() );\r
+  ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("POI"))->Fill( fCandidates->GetEntriesFast() );\r
   AddCandidates();\r
 \r
   PostData(1,fFlowEventTPC);\r
@@ -430,47 +487,46 @@ void AliAnalysisTaskFlowStrange::ChargedParticleAnalysis(AliAODEvent *tAOD)
       iRP->SetForRPSelection(kTRUE);\r
       // === MATCHED TO MC ===>>\r
       if(fMCmatch>0) {\r
-       TClonesArray* mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));\r
-       if(mcArray) {\r
-         TString sPDG="NONE";\r
-         TString sMOTHER = "NONE";\r
-         Double_t ptTruth=-1, ptMom=-1;\r
-         AliAODMCParticle *iTMC = dynamic_cast<AliAODMCParticle*>(mcArray->At( TMath::Abs(iT->GetLabel()) ));\r
-         if(iTMC) {\r
-           sPDG="NONPDG";\r
-           ptTruth = iTMC->Pt();\r
-           Int_t iPDG = iTMC->GetPdgCode();\r
-           TDatabasePDG *pdgDatabase = TDatabasePDG::Instance();\r
-           if(pdgDatabase->GetParticle(iPDG))\r
-             sPDG = (pdgDatabase->GetParticle(iPDG))->GetName();\r
-           if(iTMC->GetMother()>=0) {\r
-             AliAODMCParticle *iTMom = dynamic_cast<AliAODMCParticle*>(mcArray->At(iTMC->GetMother()));\r
-             if(iTMom) {\r
-               ptMom = iTMom->Pt();\r
-               sMOTHER="NONPDG";\r
-               Int_t iMomPDG = iTMom->GetPdgCode();\r
-               pdgDatabase = TDatabasePDG::Instance();\r
-               if(pdgDatabase->GetParticle(iMomPDG))\r
-                 sMOTHER = (pdgDatabase->GetParticle(iMomPDG))->GetName();\r
-             }\r
-           } else {\r
-             sMOTHER="PRIMARY";\r
-           }\r
-         }\r
-         Double_t dMASS=prob[3];\r
-         if(dMASS>1) dMASS=1;\r
-         if(dMASS<0) dMASS=0;\r
-         if(iT->GetLabel()>=0) {\r
-           sPDG = Form("%s chked",sPDG.Data());\r
-           sMOTHER = Form("%s chked",sMOTHER.Data());\r
-         }\r
-         ((TH3D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("MCPDG"))->Fill(iT->Pt(),dMASS,sPDG.Data(),1);\r
-         if(dMASS>=0.90)\r
-           ((TH3D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("MCMOTHER"))->Fill(ptTruth,ptMom,sMOTHER.Data(),1);\r
-       }\r
+       TClonesArray* mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));\r
+       if(mcArray) {\r
+         TString sPDG="NONE";\r
+         TString sMOTHER = "NONE";\r
+         Double_t ptTruth=-1, ptMom=-1;\r
+         AliAODMCParticle *iTMC = dynamic_cast<AliAODMCParticle*>(mcArray->At( TMath::Abs(iT->GetLabel()) ));\r
+          if(iTMC) {\r
+            sPDG="NONPDG";\r
+            ptTruth = iTMC->Pt();\r
+           Int_t iPDG = iTMC->GetPdgCode();\r
+            TDatabasePDG *pdgDatabase = TDatabasePDG::Instance();\r
+            if(pdgDatabase->GetParticle(iPDG))\r
+              sPDG = (pdgDatabase->GetParticle(iPDG))->GetName();\r
+            if(iTMC->GetMother()>=0) {\r
+              AliAODMCParticle *iTMom = dynamic_cast<AliAODMCParticle*>(mcArray->At(iTMC->GetMother()));\r
+              if(iTMom) {\r
+                ptMom = iTMom->Pt();\r
+                sMOTHER="NONPDG";\r
+                Int_t iMomPDG = iTMom->GetPdgCode();\r
+                pdgDatabase = TDatabasePDG::Instance();\r
+                if(pdgDatabase->GetParticle(iMomPDG))\r
+                sMOTHER = (pdgDatabase->GetParticle(iMomPDG))->GetName();\r
+              }\r
+            } else {\r
+              sMOTHER="PRIMARY";\r
+            }\r
+          }\r
+          Double_t dMASS=prob[3];\r
+          if(dMASS>1) dMASS=1;\r
+          if(dMASS<0) dMASS=0;\r
+          if(iT->GetLabel()>=0) {\r
+            sPDG = Form("%s chked",sPDG.Data());\r
+            sMOTHER = Form("%s chked",sMOTHER.Data());\r
+          }\r
+          ((TH3D*)((TList*)fQAList->FindObject("QAMC"))->FindObject("MCPDG"))->Fill(iT->Pt(),dMASS,sPDG.Data(),1);\r
+          if(dMASS>=0.90)\r
+            ((TH3D*)((TList*)fQAList->FindObject("QAMC"))->FindObject("MCMOTHER"))->Fill(ptTruth,ptMom,sMOTHER.Data(),1);\r
+        }\r
       }\r
       // <<=== MATCHED TO MC ===\r
-\r
     }\r
   }\r
 }\r
@@ -482,13 +538,24 @@ void AliAnalysisTaskFlowStrange::ReadFromAODv0(AliAODEvent *tAOD)
   fCutsPOI->SetEvent(tAOD,MCEvent());\r
   fFlowEventTPC->Fill(fCutsRFPTPC,fCutsPOI);\r
   fFlowEventVZE->Fill(fCutsRFPVZE,fCutsPOI);\r
+  fPsi2 = (fFlowEventVZE->GetQ()).Phi()/2;\r
+  if(fDoQA) {\r
+    AliFlowVector Qs[2];\r
+    fFlowEventVZE->TagSubeventsInEta(-5,1,1,+5);\r
+    fFlowEventVZE->Get2Qsub(Qs,2);\r
+    Double_t dEPV0C = Qs[1].Phi()/2;\r
+    Double_t dEPV0A = Qs[0].Phi()/2;\r
+    Double_t dEPTPC = (fFlowEventTPC->GetQ()).Phi()/2;\r
+    ((TH3D*)((TList*)fQAList->FindObject("Event"))->FindObject("EVPLANE"))->Fill( dEPTPC, dEPV0A, dEPV0C );\r
+  }\r
+\r
   if(fSpecie>80) {\r
     ChargedParticleAnalysis(tAOD);\r
     return;\r
   }\r
   Int_t nV0s = tAOD->GetNumberOfV0s();\r
   AliAODv0 *myV0;\r
-  Double_t dQT, dALPHA, dPT, dMASS=0.0;\r
+  Double_t dMASS=0.0;\r
   for (Int_t i=0; i!=nV0s; ++i) {\r
     myV0 = (AliAODv0*) tAOD->GetV0(i);\r
     if(!myV0) continue;\r
@@ -501,11 +568,7 @@ void AliAnalysisTaskFlowStrange::ReadFromAODv0(AliAODEvent *tAOD)
       dMASS = myV0->MassLambda();\r
       if(pass==2) dMASS = myV0->MassAntiLambda();\r
     }\r
-    dPT=myV0->Pt();\r
-    dQT=myV0->PtArmV0();\r
-    dALPHA=myV0->AlphaV0();\r
-    ((TH3D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("AftAP"))  ->Fill(dALPHA,dQT,dPT);\r
-    MakeTrack(dMASS, dPT, myV0->Phi(), myV0->Eta(),\r
+    MakeTrack(dMASS, myV0->Pt(), myV0->Phi(), myV0->Eta(),\r
               ((AliAODTrack*) myV0->GetDaughter(0))->GetID(),\r
               ((AliAODTrack*) myV0->GetDaughter(1))->GetID());\r
   }\r
@@ -552,7 +615,13 @@ Int_t AliAnalysisTaskFlowStrange::PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAO
   pvertex[0]=tAOD->GetPrimaryVertex()->GetX();\r
   pvertex[1]=tAOD->GetPrimaryVertex()->GetY();\r
   pvertex[2]=tAOD->GetPrimaryVertex()->GetZ();\r
+  Double_t dRAP;\r
+  if(fSpecie==0)\r
+    dRAP=myV0->RapK0Short();\r
+  else\r
+    dRAP=myV0->RapLambda();\r
   Double_t dDL=myV0->DecayLengthV0( pvertex );\r
+  Double_t dDLZ=myV0->DecayVertexV0Z()-pvertex[2];\r
   Double_t dDLXY=myV0->RadiusV0();\r
   Double_t dDCA=myV0->DcaV0Daughters();\r
   Double_t dCTP=myV0->CosPointingAngle( pvertex );\r
@@ -564,14 +633,17 @@ Int_t AliAnalysisTaskFlowStrange::PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAO
   if(myV0->ChargeProng(iPos)<0) dALPHA = -dALPHA; // protects for a change in convention\r
   Double_t dPT=myV0->Pt();\r
   Double_t dETA=myV0->Eta();\r
-  ((TH2D*)((TList*)fQAList->FindObject("QACutsBefore"))->FindObject("BefDL"))  ->Fill(dDL,dPT);\r
-  ((TH2D*)((TList*)fQAList->FindObject("QACutsBefore"))->FindObject("BefDCA")) ->Fill(dDCA,dPT);\r
-  ((TH2D*)((TList*)fQAList->FindObject("QACutsBefore"))->FindObject("BefCTP")) ->Fill(dCTP,dPT);\r
-  ((TH2D*)((TList*)fQAList->FindObject("QACutsBefore"))->FindObject("BefD0"))  ->Fill(dD0M,dPT);\r
-  ((TH2D*)((TList*)fQAList->FindObject("QACutsBefore"))->FindObject("BefD0"))  ->Fill(dD0P,dPT);\r
-  ((TH2D*)((TList*)fQAList->FindObject("QACutsBefore"))->FindObject("BefD0D0"))->Fill(dD0D0,dPT);\r
-  ((TH3D*)((TList*)fQAList->FindObject("QACutsBefore"))->FindObject("BefAP"))  ->Fill(dALPHA,dQT,dPT);\r
   Int_t passes = 1;\r
+  if(fSpecie==1&&dALPHA<0) passes = 2; // antilambda\r
+  Double_t dMASS = myV0->MassK0Short();\r
+  if(fSpecie==1) {\r
+    if(passes==2) dMASS = myV0->MassAntiLambda();\r
+    else dMASS = myV0->MassLambda();\r
+  }\r
+  Double_t dCT = dDL*dMASS/myV0->P();\r
+  Double_t ctaucut = 2.68;\r
+  if(fSpecie==1) ctaucut = 7.89;\r
+  ctaucut *= fV0Cuts[9];\r
   if(dDL<fV0Cuts[0]) passes = 0;\r
   if(dDCA >fV0Cuts[1]) passes = 0;\r
   if(dCTP <fV0Cuts[2]) passes = 0;\r
@@ -582,52 +654,56 @@ Int_t AliAnalysisTaskFlowStrange::PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAO
   if(dETA >fV0Cuts[7]) passes = 0;\r
   if(fSpecie==0) if(dQT<+fV0Cuts[5]*dALPHA) passes = 0;\r
   if(fSpecie==0) if(dQT<-fV0Cuts[5]*dALPHA) passes = 0;\r
-  if(fSpecie==1&&passes==1&&dALPHA<0) passes = 2; // antilambda\r
-\r
-  if(passes) {  // ct cut\r
-    Double_t ctaucut;\r
-    if(fSpecie==0) ctaucut = 2.68; else ctaucut = 7.89;\r
-    ctaucut *= fV0Cuts[9];\r
-    Double_t dCT = dDL;\r
-    Double_t dMASS;\r
-    if(fSpecie==0) {\r
-      dMASS = myV0->MassK0Short();\r
-    } else {\r
-      if(passes==2) dMASS = myV0->MassAntiLambda();\r
-      else dMASS = myV0->MassLambda();\r
-    }\r
-    dCT*=dMASS/myV0->P();\r
-    if(dCT<ctaucut) passes = 0;\r
-  }\r
+  if(dCT>ctaucut) passes = 0;\r
   if(dDLXY<fV0Cuts[10]) passes = 0;\r
 \r
-  //printf("PASSES %d\n",passes);\r
+  Double_t dPHI = myV0->Phi();\r
+  Double_t dDPHI = dPHI - fPsi2;\r
+  if( dDPHI < 0 ) dDPHI += TMath::TwoPi();\r
+  if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;\r
+  TString sIPOP = "IP";\r
+  if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) )\r
+    sIPOP = "OP";\r
+  if(fDoQA) {\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefRAP")) ->Fill(dRAP,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefDLZ")) ->Fill(dDLZ,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefDLXY"))->Fill(dDLXY, dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefCTau"))->Fill(dCT,   dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefDCA")) ->Fill(dDCA,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefCTP")) ->Fill(dCTP,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefD0"))  ->Fill(dD0M,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefD0"))  ->Fill(dD0P,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefD0D0"))->Fill(dD0D0, dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefAP"))  ->Fill(dALPHA,dQT,dPT);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsBefore_%s",sIPOP.Data())))->FindObject("BefVOL")) ->Fill(dPHI, dETA,dPT);\r
+  }\r
+\r
   if(passes&&fV0Cuts[8]) {\r
     switch(fSpecie) {\r
     case 0: // K0 PID\r
       if( (jT->GetTPCmomentum()<15) &&\r
-         (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(jT,AliPID::kPion))>fV0Cuts[8]) )\r
-       passes = 0;\r
+        (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(jT,AliPID::kPion))>fV0Cuts[8]) )\r
+        passes = 0;\r
       if( (iT->GetTPCmomentum()<15) &&\r
-         (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(iT,AliPID::kPion))>fV0Cuts[8]) )\r
-       passes = 0;\r
+        (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(iT,AliPID::kPion))>fV0Cuts[8]) )\r
+        passes = 0;\r
       break;\r
     case 1: // Lambda PID  i==pos j ==neg\r
       if(passes==1) {\r
-       if( (iT->GetTPCmomentum()<15) &&\r
-           (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(iT,AliPID::kProton))>fV0Cuts[8]) )\r
-         passes = 0;\r
-       if( (jT->GetTPCmomentum()<15) &&\r
-           (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(jT,AliPID::kPion))>fV0Cuts[8]) )\r
-         passes = 0;\r
+        if( (iT->GetTPCmomentum()<15) &&\r
+          (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(iT,AliPID::kProton))>fV0Cuts[8]) )\r
+          passes = 0;\r
+        if( (jT->GetTPCmomentum()<15) &&\r
+          (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(jT,AliPID::kPion))>fV0Cuts[8]) )\r
+          passes = 0;\r
       }\r
       if(passes==2) {\r
-       if( (iT->GetTPCmomentum()<15) &&\r
-           (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(iT,AliPID::kPion))>fV0Cuts[8]) )\r
-         passes = 0;\r
-       if( (jT->GetTPCmomentum()<15) &&\r
-           (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(jT,AliPID::kProton))>fV0Cuts[8]) )\r
-         passes = 0;\r
+        if( (iT->GetTPCmomentum()<15) &&\r
+          (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(iT,AliPID::kPion))>fV0Cuts[8]) )\r
+          passes = 0;\r
+        if( (jT->GetTPCmomentum()<15) &&\r
+          (TMath::Abs(fPIDResponse->NumberOfSigmasTPC(jT,AliPID::kProton))>fV0Cuts[8]) )\r
+          passes = 0;\r
       }\r
       break;\r
     }\r
@@ -636,7 +712,7 @@ Int_t AliAnalysisTaskFlowStrange::PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAO
   // AliAODRecoDecay::MatchToMC()\r
   if((passes>0)&&(fMCmatch>0)) {\r
     TClonesArray* mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));\r
-    passes=0;\r
+    Int_t mcpasses=0;\r
     if(mcArray) {\r
       TString sPDG="NONE";\r
       TString sMOTHER = "NONE";\r
@@ -645,34 +721,34 @@ Int_t AliAnalysisTaskFlowStrange::PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAO
       AliAODMCParticle *iTMC = dynamic_cast<AliAODMCParticle*>(mcArray->At( TMath::Abs(iT->GetLabel()) ));\r
       AliAODMCParticle *jTMC = dynamic_cast<AliAODMCParticle*>(mcArray->At( TMath::Abs(jT->GetLabel()) ));\r
       if((iTMC)&&(jTMC)) {\r
-       if((iTMC->GetMother()>=0)&&(jTMC->GetMother()>=0)) {\r
-         AliAODMCParticle *iTMom = dynamic_cast<AliAODMCParticle*>(mcArray->At(iTMC->GetMother()));\r
-         AliAODMCParticle *jTMom = dynamic_cast<AliAODMCParticle*>(mcArray->At(jTMC->GetMother()));\r
-         if((iTMom)&&(jTMom)) {\r
-           sPDG="NONPDG";\r
-           abc=3;\r
-           if(iTMC->GetMother()==jTMC->GetMother()) {\r
-             Int_t iMomPDG = iTMom->GetPdgCode();\r
-             abc=2;\r
-             TDatabasePDG *pdgDatabase = TDatabasePDG::Instance();\r
-             if(pdgDatabase->GetParticle(iMomPDG))\r
-               sPDG = (pdgDatabase->GetParticle(iMomPDG))->GetName();\r
-             Int_t pdgcode;\r
-             if(fSpecie) pdgcode = 3122; else pdgcode = 310;\r
-             if(TMath::Abs(iMomPDG)==pdgcode) {\r
-               Double_t pxSumDgs = iTMC->Px()+jTMC->Px();\r
-               Double_t pySumDgs = iTMC->Py()+jTMC->Py();\r
-               Double_t pzSumDgs = iTMC->Pz()+jTMC->Pz();\r
-               Double_t pxMother = iTMom->Px();\r
-               Double_t pyMother = iTMom->Py();\r
-               Double_t pzMother = iTMom->Pz();\r
-               sPDG = "Truths";\r
-               Double_t rads = TMath::Sqrt( iTMC->Xv()*iTMC->Xv() + iTMC->Yv()*iTMC->Yv() );\r
-               ((TH1D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("MCDAUGHTERS"))->Fill(iTMom->GetNDaughters());\r
-               if((TMath::Abs(pxMother-pxSumDgs)/(TMath::Abs(pxMother)+1.e-13)) < 0.00001 &&\r
-                  (TMath::Abs(pyMother-pySumDgs)/(TMath::Abs(pyMother)+1.e-13)) < 0.00001 &&\r
-                  (TMath::Abs(pzMother-pzSumDgs)/(TMath::Abs(pzMother)+1.e-13)) < 0.00001) {\r
-                 ((TH2D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("MCRADS"))->Fill(1.0,rads);\r
+        if((iTMC->GetMother()>=0)&&(jTMC->GetMother()>=0)) {\r
+          AliAODMCParticle *iTMom = dynamic_cast<AliAODMCParticle*>(mcArray->At(iTMC->GetMother()));\r
+          AliAODMCParticle *jTMom = dynamic_cast<AliAODMCParticle*>(mcArray->At(jTMC->GetMother()));\r
+          if((iTMom)&&(jTMom)) {\r
+            sPDG="NONPDG";\r
+            abc=3;\r
+            if(iTMC->GetMother()==jTMC->GetMother()) {\r
+              Int_t iMomPDG = iTMom->GetPdgCode();\r
+              abc=2;\r
+              TDatabasePDG *pdgDatabase = TDatabasePDG::Instance();\r
+              if(pdgDatabase->GetParticle(iMomPDG))\r
+                sPDG = (pdgDatabase->GetParticle(iMomPDG))->GetName();\r
+              Int_t pdgcode;\r
+              if(fSpecie) pdgcode = 3122; else pdgcode = 310;\r
+              if(TMath::Abs(iMomPDG)==pdgcode) {\r
+                Double_t pxSumDgs = iTMC->Px()+jTMC->Px();\r
+                Double_t pySumDgs = iTMC->Py()+jTMC->Py();\r
+                Double_t pzSumDgs = iTMC->Pz()+jTMC->Pz();\r
+                Double_t pxMother = iTMom->Px();\r
+                Double_t pyMother = iTMom->Py();\r
+                Double_t pzMother = iTMom->Pz();\r
+                sPDG = "Truths";\r
+                Double_t rads = TMath::Sqrt( iTMC->Xv()*iTMC->Xv() + iTMC->Yv()*iTMC->Yv() );\r
+                ((TH1D*)((TList*)fQAList->FindObject("QAMC"))->FindObject("MCDAUGHTERS"))->Fill(iTMom->GetNDaughters());\r
+                if((TMath::Abs(pxMother-pxSumDgs)/(TMath::Abs(pxMother)+1.e-13)) < 0.00001 &&\r
+                  (TMath::Abs(pyMother-pySumDgs)/(TMath::Abs(pyMother)+1.e-13)) < 0.00001 &&\r
+                  (TMath::Abs(pzMother-pzSumDgs)/(TMath::Abs(pzMother)+1.e-13)) < 0.00001) {\r
+                  ((TH2D*)((TList*)fQAList->FindObject("QAMC"))->FindObject("MCRADS"))->Fill(1.0,rads);\r
                  abc=1;\r
                  if(iTMom->GetMother()>=0) {\r
                    AliAODMCParticle *iGrandMa = dynamic_cast<AliAODMCParticle*>(mcArray->At(iTMom->GetMother()));\r
@@ -681,39 +757,52 @@ Int_t AliAnalysisTaskFlowStrange::PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAO
                    ptTruth = iTMom->Pt();\r
                    if(pdgDatabase->GetParticle(iGrandMaPDG))\r
                      sMOTHER = (pdgDatabase->GetParticle(iGrandMaPDG))->GetName();\r
-                 } else {\r
-                   sMOTHER = "PRIMARY";\r
-                 }\r
-               } else {\r
-                 ((TH2D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("MCRADS"))->Fill(0.0,rads);\r
-               }\r
-             }\r
-           }\r
-         }\r
-       }\r
+                  } else {\r
+                    sMOTHER = "PRIMARY";\r
+                  }\r
+                } else {\r
+                  ((TH2D*)((TList*)fQAList->FindObject("QAMC"))->FindObject("MCRADS"))->Fill(0.0,rads);\r
+                }\r
+              }\r
+            }\r
+          }\r
+        }\r
       }\r
-      Double_t dMASS;\r
+      Double_t dMCMASS;\r
       if(fSpecie==0) {\r
-       dMASS = myV0->MassK0Short();\r
-       if(dMASS>0.588) dMASS=0.587999;\r
-       if(dMASS<0.412) dMASS=0.412001;\r
+        dMCMASS = myV0->MassK0Short();\r
+        if(dMCMASS>0.588) dMCMASS=0.587999;\r
+        if(dMCMASS<0.412) dMCMASS=0.412001;\r
       } else {\r
-       dMASS = myV0->MassLambda();\r
-       if(passes==2) dMASS = myV0->MassAntiLambda();\r
-       if(dMASS>1.167) dMASS=1.1669;\r
-       if(dMASS<1.075) dMASS=1.0751;\r
+        dMCMASS = myV0->MassLambda();\r
+        if(passes==2) dMCMASS = myV0->MassAntiLambda();\r
+        if(dMCMASS>1.167) dMCMASS=1.1669;\r
+        if(dMCMASS<1.075) dMCMASS=1.0751;\r
       }\r
       if((iT->GetLabel()>=0)&&(jT->GetLabel()>=0)) {\r
-       sPDG = Form("%s chked",sPDG.Data());\r
-       sMOTHER = Form("%s chked",sMOTHER.Data());\r
-       if(fMCmatch==abc) passes=1;\r
+        sPDG = Form("%s chked",sPDG.Data());\r
+        sMOTHER = Form("%s chked",sMOTHER.Data());\r
+        if(fMCmatch==abc) mcpasses=1;\r
       }\r
-      ((TH3D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("MCPDG"))->Fill(dPT,dMASS,sPDG.Data(),1);\r
-      ((TH3D*)((TList*)fQAList->FindObject("QACutsAfter"))->FindObject("MCMOTHER"))->Fill(ptTruth,ptMom,sMOTHER.Data(),1);\r
-    }\r
+      ((TH3D*)((TList*)fQAList->FindObject("QAMC"))->FindObject("MCPDG"))->Fill(dPT,dMCMASS,sPDG.Data(),1);\r
+      ((TH3D*)((TList*)fQAList->FindObject("QAMC"))->FindObject("MCMOTHER"))->Fill(ptTruth,ptMom,sMOTHER.Data(),1);\r
+    }//mcArray\r
+    passes=mcpasses;\r
   }\r
   // <<=== MATCHED TO MC ===\r
-\r
+  if(passes&&fDoQA) {\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftRAP")) ->Fill(dRAP,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftDLZ")) ->Fill(dDLZ,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftDLXY"))->Fill(dDLXY, dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftCTau"))->Fill(dCT,   dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftDCA")) ->Fill(dDCA,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftCTP")) ->Fill(dCTP,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftD0"))  ->Fill(dD0M,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftD0"))  ->Fill(dD0P,  dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftD0D0"))->Fill(dD0D0, dPT, dMASS);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftAP"))  ->Fill(dALPHA,dQT,dPT);\r
+    ((TH3D*)((TList*)fQAList->FindObject(Form("QACutsAfter_%s",sIPOP.Data())))->FindObject("AftVOL")) ->Fill(dPHI, dETA,dPT);\r
+  }\r
   return passes;\r
 }\r
 //=======================================================================\r