from Carlos Perez:
authormkrzewic <mkrzewic@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Jun 2013 13:04:57 +0000 (13:04 +0000)
committermkrzewic <mkrzewic@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 13 Jun 2013 13:04:57 +0000 (13:04 +0000)
new features

PWG/FLOW/Tasks/AliAnalysisTaskFlowStrange.cxx
PWG/FLOW/Tasks/AliAnalysisTaskFlowStrange.h
PWGCF/FLOW/macros/AddTaskFlowStrange.C

index c10479e..ee59c92 100644 (file)
 /////////////////////////////////////////////////////\r
 // AliAnalysisTaskFlowStrange:\r
 // Analysis task to select K0/Lambda candidates for flow analysis.\r
-// Uses one AliESDtrackCuts object for both daughters and\r
-// QA histograms to monitor the reconstruction.\r
 // Authors: Cristian Ivan (civan@cern.ch)\r
-//          Carlos Perez (cperez@cern.ch)\r
-//          Pawel Debski (pdebski@cern.ch)\r
+//          Carlos Perez  (cperez@cern.ch)\r
+//          Pawel Debski  (pdebski@cern.ch)\r
 //////////////////////////////////////////////////////\r
 \r
 #include "TChain.h"\r
 #include "TH1D.h"\r
 #include "TH2D.h"\r
 #include "TH3D.h"\r
+#include "TF1.h"\r
 #include "TProfile.h"\r
+#include "TProfile2D.h"\r
 #include "TVector3.h"\r
+#include "TStopwatch.h"\r
+#include "TFile.h"\r
 \r
 #include "AliAnalysisManager.h"\r
 #include "AliInputEventHandler.h"\r
 \r
+#include "AliVVertex.h"\r
+#include "AliVVZERO.h"\r
+#include "AliStack.h"\r
+#include "AliMCEvent.h"\r
+\r
 #include "AliESDEvent.h"\r
 #include "AliESDtrack.h"\r
 #include "AliESDVertex.h"\r
@@ -44,6 +51,8 @@
 #include "AliAODTrack.h"\r
 #include "AliAODVertex.h"\r
 #include "AliAODv0.h"\r
+#include "AliAODTracklets.h"\r
+#include "AliAODHeader.h"\r
 \r
 #include "AliAODMCParticle.h"\r
 #include "TClonesArray.h"\r
@@ -69,883 +78,1066 @@ ClassImp(AliAnalysisTaskFlowStrange)
 AliAnalysisTaskFlowStrange::AliAnalysisTaskFlowStrange() :\r
   AliAnalysisTaskSE(),\r
   fPIDResponse(NULL),\r
-  fBayesianPID(NULL),\r
-  fDebug(kFALSE),\r
-  fUseEventSelection(kTRUE),\r
-  fDoQA(kFALSE),\r
-  fDoExtraQA(kFALSE),\r
+  fFB1(NULL),\r
+  fFB1024(NULL),\r
+  fTPCevent(NULL),\r
+  fVZEevent(NULL),\r
+  fCandidates(NULL),\r
+  fList(NULL),\r
+  fDebug(0),\r
+  fQAlevel(0),\r
+  fReadESD(kFALSE),\r
+  fReadMC(kFALSE),\r
+  fAvoidExec(kFALSE),\r
+  fSkipSelection(kFALSE),\r
+  fSkipFlow(kFALSE),\r
+  fUseFP(kFALSE),\r
   fRunOnpA(kFALSE),\r
   fRunOnpp(kFALSE),\r
-  fCalib(NULL),\r
-  fPsi2(0.0),\r
+  fExtraEventRejection(kFALSE),\r
+  fCentMethod("V0MTRK"),\r
+  fCentPerMin(0),\r
+  fCentPerMax(100),\r
+  fThisCent(-1.0),\r
+  fExcludeTPCEdges(kFALSE),\r
   fSpecie(0),\r
-  fMCmatch(-1),\r
+  fOnline(kFALSE),\r
+  fHomemade(kFALSE),\r
+  fWhichPsi(1),\r
+  fVZEsave(kFALSE),\r
+  fVZEload(NULL),\r
+  fVZEResponse(NULL),\r
+  fVZEQA(NULL),\r
+  fPsi2(0.0),\r
   fMassBins(0),\r
   fMinMass(0.0),\r
   fMaxMass(0.0),\r
-  fCutsEvent(NULL),\r
-  fCutsRFPTPC(NULL),\r
-  fCutsRFPVZE(NULL),\r
-  fCutsPOI(NULL),\r
-  fCutsDau(NULL),\r
-  fFlowEventTPC(NULL),\r
-  fFlowEventVZE(NULL),\r
-  fCandidates(NULL),\r
-  fQAList(NULL)\r
-{\r
+  fRFPFilterBit(1),\r
+  fRFPminPt(0.2),\r
+  fRFPmaxPt(5.0),\r
+  fRFPminEta(-0.8),\r
+  fRFPmaxEta(+0.8),\r
+  fRFPTPCsignal(10.0),\r
+  fRFPmaxIPxy(2.4),\r
+  fRFPmaxIPz(3.2),\r
+  fRFPTPCncls(70),\r
+  fDecayMass(0.0),\r
+  fDecayPhi(0.0),\r
+  fDecayEta(0.0),\r
+  fDecayPt(0.0),\r
+  fDecayDCAdaughters(0.0),\r
+  fDecayCosinePointingAngleXY(0.0),\r
+  fDecayRadXY(0.0),\r
+  fDecayDecayLength(0.0),\r
+  fDecayQt(0.0),\r
+  fDecayAlpha(0.0),\r
+  fDecayRapidity(0.0),\r
+  fDecayProductIPXY(0.0),\r
+  fDecayIDneg(0),\r
+  fDecayIDpos(0),\r
+  fDecayMinEta(0.0),\r
+  fDecayMaxEta(0.0),\r
+  fDecayMinPt(0.0),\r
+  fDecayMaxDCAdaughters(0.0),\r
+  fDecayMinCosinePointingAngleXY(0.0),\r
+  fDecayMinQt(0.0),\r
+  fDecayAPCutPie(kTRUE),\r
+  fDecayMinRadXY(0.0),\r
+  fDecayMaxDecayLength(0.0),\r
+  fDecayMaxProductIPXY(0.0),\r
+  fDecayMaxRapidity(0.0),\r
+  fDaughterPhi(0.0),\r
+  fDaughterEta(0.0),\r
+  fDaughterPt(0.0),\r
+  fDaughterNClsTPC(0),\r
+  fDaughterCharge(0),\r
+  fDaughterNFClsTPC(0),\r
+  fDaughterNSClsTPC(0),\r
+  fDaughterChi2PerNClsTPC(0.0),\r
+  fDaughterXRows(0.0),\r
+  fDaughterImpactParameterXY(0.0),\r
+  fDaughterImpactParameterZ(0.0),\r
+  fDaughterStatus(0),\r
+  fDaughterNSigmaPID(0.0),\r
+  fDaughterKinkIndex(0),\r
+  fDaughterMinEta(0.0),\r
+  fDaughterMaxEta(0.0),\r
+  fDaughterMinPt(0.0),\r
+  fDaughterMinNClsTPC(0),\r
+  fDaughterMinXRows(0),\r
+  fDaughterMaxChi2PerNClsTPC(0.0),\r
+  fDaughterMinXRowsOverNClsFTPC(0.0),\r
+  fDaughterMinImpactParameterXY(0.0),\r
+  fDaughterMaxNSigmaPID(0.0) {\r
   //ctor\r
-  for (Int_t i=0; i!=11; ++i)\r
-    fV0Cuts[i] = 0;\r
 }\r
 //=======================================================================\r
-AliAnalysisTaskFlowStrange::AliAnalysisTaskFlowStrange(const char *name,\r
-                                                      AliFlowEventCuts *cutsEvent,\r
-                                                      AliFlowTrackCuts *cutsRFPTPC,\r
-                                                      AliFlowTrackCuts *cutsRFPVZE,\r
-                                                      AliESDtrackCuts *cutsDau) :\r
+AliAnalysisTaskFlowStrange::AliAnalysisTaskFlowStrange(const char *name) :\r
   AliAnalysisTaskSE(name),\r
   fPIDResponse(NULL),\r
-  fBayesianPID(NULL),\r
-  fDebug(kFALSE),\r
-  fUseEventSelection(kTRUE),\r
-  fDoQA(kFALSE),\r
-  fDoExtraQA(kFALSE),\r
+  fFB1(NULL),\r
+  fFB1024(NULL),\r
+  fTPCevent(NULL),\r
+  fVZEevent(NULL),\r
+  fCandidates(NULL),\r
+  fList(NULL),\r
+  fDebug(0),\r
+  fQAlevel(0),\r
+  fReadESD(kFALSE),\r
+  fReadMC(kFALSE),\r
+  fAvoidExec(kFALSE),\r
+  fSkipSelection(kFALSE),\r
+  fSkipFlow(kFALSE),\r
+  fUseFP(kFALSE),\r
   fRunOnpA(kFALSE),\r
   fRunOnpp(kFALSE),\r
-  fCalib(NULL),\r
-  fPsi2(0.0),\r
+  fExtraEventRejection(kFALSE),\r
+  fCentMethod("V0MTRK"),\r
+  fCentPerMin(0),\r
+  fCentPerMax(100),\r
+  fThisCent(-1.0),\r
+  fExcludeTPCEdges(kFALSE),\r
   fSpecie(0),\r
-  fMCmatch(-1),\r
+  fOnline(kFALSE),\r
+  fHomemade(kFALSE),\r
+  fWhichPsi(1),\r
+  fVZEsave(kFALSE),\r
+  fVZEload(NULL),\r
+  fVZEResponse(NULL),\r
+  fVZEQA(NULL),\r
+  fPsi2(0.0),\r
   fMassBins(0),\r
   fMinMass(0.0),\r
   fMaxMass(0.0),\r
-  fCutsEvent(cutsEvent),\r
-  fCutsRFPTPC(cutsRFPTPC),\r
-  fCutsRFPVZE(cutsRFPVZE),\r
-  fCutsPOI(NULL),\r
-  fCutsDau(cutsDau),\r
-  fFlowEventTPC(NULL),\r
-  fFlowEventVZE(NULL),\r
-  fCandidates(NULL),\r
-  fQAList(NULL)\r
-{\r
+  fRFPFilterBit(1),\r
+  fRFPminPt(0.2),\r
+  fRFPmaxPt(5.0),\r
+  fRFPminEta(-0.8),\r
+  fRFPmaxEta(+0.8),\r
+  fRFPTPCsignal(10.0),\r
+  fRFPmaxIPxy(2.4),\r
+  fRFPmaxIPz(3.2),\r
+  fRFPTPCncls(70),\r
+  fDecayMass(0.0),\r
+  fDecayPhi(0.0),\r
+  fDecayEta(0.0),\r
+  fDecayPt(0.0),\r
+  fDecayDCAdaughters(0.0),\r
+  fDecayCosinePointingAngleXY(0.0),\r
+  fDecayRadXY(0.0),\r
+  fDecayDecayLength(0.0),\r
+  fDecayQt(0.0),\r
+  fDecayAlpha(0.0),\r
+  fDecayRapidity(0.0),\r
+  fDecayProductIPXY(0.0),\r
+  fDecayIDneg(0),\r
+  fDecayIDpos(0),\r
+  fDecayMinEta(0.0),\r
+  fDecayMaxEta(0.0),\r
+  fDecayMinPt(0.0),\r
+  fDecayMaxDCAdaughters(0.0),\r
+  fDecayMinCosinePointingAngleXY(0.0),\r
+  fDecayMinQt(0.0),\r
+  fDecayAPCutPie(kTRUE),\r
+  fDecayMinRadXY(0.0),\r
+  fDecayMaxDecayLength(0.0),\r
+  fDecayMaxProductIPXY(0.0),\r
+  fDecayMaxRapidity(0.0),\r
+  fDaughterPhi(0.0),\r
+  fDaughterEta(0.0),\r
+  fDaughterPt(0.0),\r
+  fDaughterNClsTPC(0),\r
+  fDaughterCharge(0),\r
+  fDaughterNFClsTPC(0),\r
+  fDaughterNSClsTPC(0),\r
+  fDaughterChi2PerNClsTPC(0.0),\r
+  fDaughterXRows(0.0),\r
+  fDaughterImpactParameterXY(0.0),\r
+  fDaughterImpactParameterZ(0.0),\r
+  fDaughterStatus(0),\r
+  fDaughterNSigmaPID(0.0),\r
+  fDaughterKinkIndex(0),\r
+  fDaughterMinEta(0.0),\r
+  fDaughterMaxEta(0.0),\r
+  fDaughterMinPt(0.0),\r
+  fDaughterMinNClsTPC(0),\r
+  fDaughterMinXRows(0),\r
+  fDaughterMaxChi2PerNClsTPC(0.0),\r
+  fDaughterMinXRowsOverNClsFTPC(0.0),\r
+  fDaughterMinImpactParameterXY(0.0),\r
+  fDaughterMaxNSigmaPID(0.0) {\r
   //ctor\r
-  for (Int_t i=0; i!=11; ++i)\r
-    fV0Cuts[i] = 0;\r
-\r
   DefineInput( 0,TChain::Class());\r
-  DefineOutput(1,AliFlowEventSimple::Class()); // TPC object\r
-  DefineOutput(2,AliFlowEventSimple::Class()); // VZE object\r
-  DefineOutput(3,TList::Class());\r
+  DefineOutput(1,TList::Class());\r
+  DefineOutput(2,AliFlowEventSimple::Class()); // TPC object\r
+  DefineOutput(3,AliFlowEventSimple::Class()); // VZE object\r
 }\r
 //=======================================================================\r
-AliAnalysisTaskFlowStrange::~AliAnalysisTaskFlowStrange()\r
-{\r
+AliAnalysisTaskFlowStrange::~AliAnalysisTaskFlowStrange() {\r
   //dtor\r
-  if (fQAList)       delete fQAList;\r
-  if (fFlowEventTPC) delete fFlowEventTPC;\r
-  if (fFlowEventVZE) delete fFlowEventVZE;\r
-  if (fCandidates)   delete fCandidates;\r
-  if (fCutsDau)      delete fCutsDau;\r
-  if (fCutsPOI)      delete fCutsPOI;\r
-  if (fCutsRFPTPC)   delete fCutsRFPTPC;\r
-  if (fCutsRFPVZE)   delete fCutsRFPVZE;\r
-  if (fCalib)        delete fCalib;\r
-}\r
-//=======================================================================\r
-void AliAnalysisTaskFlowStrange::UserCreateOutputObjects()\r
-{\r
+  if (fCandidates) delete fCandidates;\r
+  if (fTPCevent)   delete fTPCevent;\r
+  if (fVZEevent)   delete fVZEevent;\r
+  if (fList)       delete fList;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::UserCreateOutputObjects() {\r
   //UserCreateOutputObjects\r
-  fQAList=new TList();\r
-  fQAList->SetOwner();\r
+  fList=new TList();\r
+  fList->SetOwner();\r
   AddQAEvents();\r
   AddQACandidates();\r
 \r
+  if(fReadESD) MakeFilterBits();\r
+\r
   AliFlowCommonConstants *cc = AliFlowCommonConstants::GetMaster();\r
-  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(18);  cc->SetEtaMin(-0.9); cc->SetEtaMax(+0.9);\r
-  cc->SetNbinsQ(1);    cc->SetQMin(0.0);    cc->SetQMax(1.0);\r
+  cc->SetNbinsMult(100); cc->SetMultMin(0);   cc->SetMultMax(4000);\r
+  cc->SetNbinsPt(200); cc->SetPtMin(0.0);   cc->SetPtMax(20.0);\r
+  cc->SetNbinsPhi(100);  cc->SetPhiMin(0.0);  cc->SetPhiMax(TMath::TwoPi());\r
+  cc->SetNbinsEta(100);  cc->SetEtaMin(-0.9); cc->SetEtaMax(+0.9);\r
+  cc->SetNbinsQ(100);    cc->SetQMin(0.0);    cc->SetQMax(3.0);\r
   cc->SetNbinsMass(fMassBins);\r
   cc->SetMassMin(fMinMass);\r
   cc->SetMassMax(fMaxMass);\r
 \r
-  fCutsPOI = new AliFlowTrackCuts("dumb_cuts");\r
-  fCutsPOI->SetParamType( fCutsRFPTPC->GetParamType() );\r
-  fCutsPOI->SetPtRange(+1.0,-1.0);\r
-  fCutsPOI->SetEtaRange(+1.0,-1.0);\r
-\r
-  fBayesianPID = new AliFlowBayesianPID();\r
-  fBayesianPID->SetNewTrackParam();\r
-  fFlowEventTPC = new AliFlowEvent(3000);\r
-  fFlowEventVZE = new AliFlowEvent(500);\r
-  fCandidates = new TObjArray(100);\r
-  fCandidates->SetOwner();\r
-\r
-  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();\r
+  //loading pid response\r
+  AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();\r
   AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());\r
   fPIDResponse = inputHandler->GetPIDResponse();\r
 \r
-  PostData(1,fFlowEventTPC);\r
-  PostData(2,fFlowEventVZE);\r
-  PostData(3,fQAList);\r
+  fTPCevent = new AliFlowEvent(100);\r
+  fVZEevent = new AliFlowEvent(100);\r
 \r
-}\r
-//=======================================================================\r
-void AliAnalysisTaskFlowStrange::Exec(Option_t* option)\r
-{\r
-  //bypassing ::exec (needed because of AMPT)\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(fRunOnpA) { // temporal extra cuts for pA (2BE REMOVED!)\r
-    AliAODEvent *aod=dynamic_cast<AliAODEvent*>(InputEvent());\r
-    if(!aod) return;\r
-    if(aod->GetHeader()->GetEventNumberESDFile() == 0) return; //rejecting first chunk\r
-     // https://twiki.cern.ch/twiki/bin/viewauth/ALICE/PAVertexSelectionStudies\r
-    const AliAODVertex* trkVtx = aod->GetPrimaryVertex();\r
-    if (!trkVtx || trkVtx->GetNContributors()<=0) return;\r
-    TString vtxTtl = trkVtx->GetTitle();\r
-    if (!vtxTtl.Contains("VertexerTracks")) return;\r
-    Float_t zvtx = trkVtx->GetZ();\r
-    const AliAODVertex* spdVtx = aod->GetPrimaryVertexSPD();\r
-    if (spdVtx->GetNContributors()<=0) return;\r
-    TString vtxTyp = spdVtx->GetTitle();\r
-    Double_t cov[6]={0};\r
-    spdVtx->GetCovarianceMatrix(cov);\r
-    Double_t zRes = TMath::Sqrt(cov[5]);\r
-    if (vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;\r
-    if (TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;\r
-    if (TMath::Abs(zvtx) > 10) return;\r
-  }\r
+  //array of candidates\r
+  fCandidates = new TObjArray(100);\r
+  fCandidates->SetOwner();\r
 \r
-  AliAnalysisTaskFlowStrange::MyUserExec(option);\r
+  PostData(1,fList);\r
+  if(fUseFP) { // for connection to the flow package\r
+    PostData(2,fTPCevent);\r
+    PostData(3,fVZEevent);\r
+  }\r
 }\r
 //=======================================================================\r
-void AliAnalysisTaskFlowStrange::AddQAEvents()\r
-{\r
+void AliAnalysisTaskFlowStrange::AddQAEvents() {\r
   // function to add event qa\r
+  TH1D *tH1D;\r
+  TProfile *tProfile;\r
   TList *tQAEvents=new TList();\r
   tQAEvents->SetName("Event");\r
   tQAEvents->SetOwner();\r
+  tH1D = new TH1D("Events","Number of Events",5,0,5); tQAEvents->Add(tH1D);\r
+  tH1D->GetXaxis()->SetBinLabel(1,"exec");\r
+  tH1D->GetXaxis()->SetBinLabel(2,"userexec");\r
+  tH1D->GetXaxis()->SetBinLabel(3,"reached");\r
+  tH1D->GetXaxis()->SetBinLabel(4,"selected");\r
+  tH1D->GetXaxis()->SetBinLabel(5,"rejectedByLowQw");\r
+  tProfile = new TProfile("Configuration","Configuration",20,0,20); tQAEvents->Add(tProfile);\r
+  tProfile->Fill( 0.5,fCentPerMin,1); tProfile->GetXaxis()->SetBinLabel( 1,"fCentPerMin");\r
+  tProfile->Fill( 1.5,fCentPerMax,1); tProfile->GetXaxis()->SetBinLabel( 2,"fCentPerMax");\r
+  tProfile->Fill( 2.5,fDaughterMinEta,1);               tProfile->GetXaxis()->SetBinLabel( 3,"fDaughterMinEta");\r
+  tProfile->Fill( 3.5,fDaughterMaxEta,1);               tProfile->GetXaxis()->SetBinLabel( 4,"fDaughterMaxEta");\r
+  tProfile->Fill( 4.5,fDaughterMinPt,1);                tProfile->GetXaxis()->SetBinLabel( 5,"fDaughterMinPt");\r
+  tProfile->Fill( 5.5,fDaughterMinNClsTPC,1);           tProfile->GetXaxis()->SetBinLabel( 6,"fDaughterMinNClsTPC");\r
+  tProfile->Fill( 6.5,fDaughterMaxChi2PerNClsTPC,1);    tProfile->GetXaxis()->SetBinLabel( 7,"fDaughterMaxChi2PerNClsTPC");\r
+  tProfile->Fill( 7.5,fDaughterMinXRowsOverNClsFTPC,1); tProfile->GetXaxis()->SetBinLabel( 8,"fDaughterMinXRowsOverNClsFTPC");\r
+  tProfile->Fill( 8.5,fDaughterMinImpactParameterXY,1); tProfile->GetXaxis()->SetBinLabel( 9,"fDaughterMinImpactParameterXY");\r
+  tProfile->Fill( 9.5,fDaughterMaxNSigmaPID,1);         tProfile->GetXaxis()->SetBinLabel(10,"fDaughterMaxNSigmaPID");\r
+  tProfile->Fill(10.5,fDecayMaxDCAdaughters,1);          tProfile->GetXaxis()->SetBinLabel(11,"fDecayMaxDCAdaughters");\r
+  tProfile->Fill(11.5,fDecayMinCosinePointingAngleXY,1); tProfile->GetXaxis()->SetBinLabel(12,"fDecayMinCosinePointingAngleXY");\r
+  tProfile->Fill(12.5,fDecayMinQt,1);                    tProfile->GetXaxis()->SetBinLabel(13,"fDecayMinQt");\r
+  tProfile->Fill(13.5,fDecayMinRadXY,1);                 tProfile->GetXaxis()->SetBinLabel(14,"fDecayMinRadXY");\r
+  tProfile->Fill(14.5,fDecayMaxDecayLength,1);           tProfile->GetXaxis()->SetBinLabel(15,"fDecayMaxDecayLength");\r
+  tProfile->Fill(15.5,fDecayMaxProductIPXY,1);           tProfile->GetXaxis()->SetBinLabel(16,"fDecayMaxProductIPXY");\r
+  tProfile->Fill(16.5,fDecayMaxRapidity,1);              tProfile->GetXaxis()->SetBinLabel(17,"fDecayMaxRapidity");\r
+  tProfile->Fill(17.5,fDecayMinEta,1);                   tProfile->GetXaxis()->SetBinLabel(18,"fDecayMinEta");\r
+  tProfile->Fill(18.5,fDecayMaxEta,1);                   tProfile->GetXaxis()->SetBinLabel(19,"fDecayMaxEta");\r
+  tProfile->Fill(19.5,fDecayMinPt,1);                    tProfile->GetXaxis()->SetBinLabel(20,"fDecayMinPt");\r
 \r
-  TH1D *tEvent = new TH1D("Events","Number of Events",3,0,3); tQAEvents->Add(tEvent);\r
-  tEvent->GetXaxis()->SetBinLabel(1,"reached");\r
-  tEvent->GetXaxis()->SetBinLabel(2,"selected");\r
-  tEvent->GetXaxis()->SetBinLabel(3,"unexpected");\r
-\r
+  tH1D = new TH1D("POI","POIs;multiplicity",800,0,800);         tQAEvents->Add(tH1D);\r
+  tH1D = new TH1D("UNTAG","UNTAG;Untagged Daughters",800,0,800);tQAEvents->Add(tH1D);\r
+  tH1D = new TH1D("RealTime","RealTime;LogT sec",2000,-10,+10); tQAEvents->Add(tH1D);\r
+  fList->Add(tQAEvents);\r
+  AddEventSpy();\r
+  AddMakeQSpy();\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddEventSpy() {\r
   TH2D *tH2D;\r
-  TH1D *tTPCRFP = new TH1D("RFPTPC","TPC Reference Flow Particles;multiplicity",3000,0,3000); tQAEvents->Add(tTPCRFP);\r
-  TH1D *tVZERFP = new TH1D("RFPVZE","VZERO Reference Flow Particles;multiplicity",3000,0,30000); tQAEvents->Add(tVZERFP);\r
-  tH2D = new TH2D("TPCPhiEta","TPC RFP;Phi;Eta",100,0,TMath::TwoPi(),100,-1.0,+1.0); tQAEvents->Add( tH2D );\r
-  tH2D = new TH2D("VZEPhiEta","VZE RFP;Phi;Eta",20,0,TMath::TwoPi(),40,-4.0,+6.0); tQAEvents->Add( tH2D );\r
-  TH1D *tPOI = new TH1D("POI","POIs;multiplicity",500,0,500); tQAEvents->Add( tPOI );\r
-  if(fDoQA) {\r
-    printf("QA enabled\n");\r
-    tH2D = new TH2D("VTXZ","VTXZ;Global||SPD;SPD",60,-25,+25,60,-25,+25); 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
-    tH3D = new TH3D("PRIMVERTEX","PRIMVERTEX;#sigma_{x};#sigma_{y};#sigma_{z}",100,0,5e-3,100,0,5e-3,100,0,8e-3); tQAEvents->Add( tH3D );\r
-    double dArrayPt[25] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,\r
-                          1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,\r
-                          2.5, 3.0, 3.5, 4.0, 5.0 };\r
-    tH2D = new TH2D("TPCPtQx","TPCPtQx;pT;Qx/M",24,dArrayPt,100,-0.2,+0.2); tQAEvents->Add( tH2D );\r
-    tH2D = new TH2D("TPCPtQy","TPCPtQy;pT;Qy/M",24,dArrayPt,100,-0.2,+0.2); tQAEvents->Add( tH2D );\r
-    tH2D = new TH2D("TPCPtEta","TPCPtEta;pT;Eta/M",24,dArrayPt,100,-0.3,+0.3); tQAEvents->Add( tH2D );\r
-    tH2D = new TH2D("TPCQxQy","TPCQxQy;Qx/M;Qy/M",100,-0.3,+0.3,100,-0.3,+0.3); tQAEvents->Add( tH2D );\r
-    tH2D = new TH2D("VZEQxQy","VZEQxQy;Qx/M;Qy/M",100,-0.3,+0.3,100,-0.3,+0.3); 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
-  tCuts->Fill(2.5,fV0Cuts[2],1); tCuts->GetXaxis()->SetBinLabel(3,"ctp");\r
-  tCuts->Fill(3.5,fV0Cuts[3],1); tCuts->GetXaxis()->SetBinLabel(4,"d0");\r
-  tCuts->Fill(4.5,fV0Cuts[4],1); tCuts->GetXaxis()->SetBinLabel(5,"d0xd0");\r
-  tCuts->Fill(5.5,fV0Cuts[5],1); tCuts->GetXaxis()->SetBinLabel(6,"qt");\r
-  tCuts->Fill(6.5,fV0Cuts[6],1); tCuts->GetXaxis()->SetBinLabel(7,"min eta");\r
-  tCuts->Fill(7.5,fV0Cuts[7],1); tCuts->GetXaxis()->SetBinLabel(8,"max eta");\r
-  tCuts->Fill(8.5,fV0Cuts[8],1); tCuts->GetXaxis()->SetBinLabel(9,"PID sigmas");\r
-  tCuts->Fill(9.5,fV0Cuts[9],1); tCuts->GetXaxis()->SetBinLabel(10,"ctau");\r
-  tCuts->Fill(10.5,fV0Cuts[10],1); tCuts->GetXaxis()->SetBinLabel(11,"dlxy");\r
-  tQAEvents->Add(tCuts);\r
-  fQAList->Add(tQAEvents);\r
-}\r
-//=======================================================================\r
-void AliAnalysisTaskFlowStrange::AddQACandidates()\r
-{\r
+  TList *tList=new TList();\r
+  tList->SetName("EventSpy");\r
+  tList->SetOwner();\r
+  if(fQAlevel>0) {\r
+    tH2D = new TH2D("VTXZ","VTXZ;Global||SPD;SPD",60,-25,+25,60,-25,+25); tList->Add( tH2D );\r
+    tH2D = new TH2D("CCCC","CCCC;V0M;TRK",60,-10,110,60,-10,110);         tList->Add( tH2D );\r
+    tH2D = new TH2D("REFM","REFM;TPC;GLOBAL",100,0,3000,100,0,3000);      tList->Add( tH2D );\r
+  }\r
+  fList->Add(tList);\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddMakeQSpy() {\r
+  if(fSkipFlow) return;\r
+  TH1D *tH1D;\r
+  TH2D *tH2D;\r
+  TList *tList=new TList();\r
+  tList->SetName("MakeQSpy");\r
+  tList->SetOwner();\r
+  tH1D = new TH1D("RFPTPC","TPC Refrence Multiplicity;multiplicity",3000,0,3000);     tList->Add( tH1D );\r
+  tH1D = new TH1D("RFPVZE","VZERO Reference Multiplicity;multiplicity",3000,0,30000); tList->Add( tH1D );\r
+  tH2D = new TH2D("TPCAllPhiEta","TPCall;Phi;Eta",180,0,TMath::TwoPi(),80,-0.9,+0.9); tList->Add( tH2D );\r
+  tH2D = new TH2D("VZEAllPhiEta","VZEall;Phi;Eta",20,0,TMath::TwoPi(),40,-4.0,+6.0);  tList->Add( tH2D );\r
+  tH1D = new TH1D("TPCPSI","TPCPSI;PSI",72,0,TMath::Pi()); tList->Add( tH1D );\r
+  tH1D = new TH1D("TPCPSIA","TPCPSIA;PSIA",72,0,TMath::Pi()); tList->Add( tH1D );\r
+  tH1D = new TH1D("TPCPSIB","TPCPSIB;PSIB",72,0,TMath::Pi()); tList->Add( tH1D );\r
+  tH1D = new TH1D("VZEPSI","VZEPSI;PSI",72,0,TMath::Pi()); tList->Add( tH1D );\r
+  tH1D = new TH1D("VZEPSIA","VZEPSIA;PSIA",72,0,TMath::Pi()); tList->Add( tH1D );\r
+  tH1D = new TH1D("VZEPSIB","VZEPSIB;PSIB",72,0,TMath::Pi()); tList->Add( tH1D );\r
+  fList->Add(tList);\r
+  if(!fSkipFlow) {\r
+    tList=new TList(); tList->SetName("TPCRFPall"); tList->SetOwner(); AddTPCRFPSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("TPCRFPsel"); tList->SetOwner(); AddTPCRFPSpy(tList); fList->Add(tList);\r
+  }\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddQACandidates() {\r
   // function to add histogramming for candidates\r
+  if(fSkipSelection) return;\r
+\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(1):\r
-    nMass = 92;\r
-    dMinMass = 1.075;\r
-    dMaxMass = 1.167;\r
-    break;\r
-  case(90):\r
-    nMass = 100;\r
-    dMinMass = 0.0;\r
-    dMaxMass = 1.0;\r
-    break;\r
+\r
+  //reconstruction\r
+  if(fReadESD) {\r
+    tList=new TList(); tList->SetName("TrkAll"); tList->SetOwner(); AddTracksSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("TrkSel"); tList->SetOwner(); AddTracksSpy(tList); fList->Add(tList);\r
+    tH2D = new TH2D("NPAIR", "NPAIR;NPOS;NNEG",1000,0,5000,1000,0,5000); tList->Add(tH2D);\r
+    tH2D = new TH2D("PtIPXY","PtIPXY;Pt;IPxy", 100,0,10,200,-10,+10); tList->Add(tH2D);\r
   }\r
-  double dArrayPt[29] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,\r
-                        1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,\r
-                        2.5, 3.0, 3.5, 4.0, 5.0, 6.0, 8.0, 10., 12. };\r
-  tList=new TList();\r
-  tList->SetName("Candidates");\r
-  tList->SetOwner();\r
-  tH2D = new TH2D("V0MASS","V0MASS;pT;Mass",28,dArrayPt,nMass,dMinMass,dMaxMass); tList->Add(tH2D);\r
-  tH2D = new TH2D("V0PhiEta","V0PhiEta;Phi;Eta",100,0,TMath::TwoPi(),100,-1.0,+1.0); tList->Add(tH2D);\r
-  fQAList->Add(tList);\r
-\r
-  if(fDoExtraQA) {\r
-    printf("Extra QA enabled\n");\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
-\r
-  if(fMCmatch>0) { // only for MCanalysis\r
-    printf("MC mode enabled\n");\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
-void AliAnalysisTaskFlowStrange::MyUserExec(Option_t *)\r
-{\r
-  // user exec\r
+  //candidates\r
+  tList=new TList(); tList->SetName("RecAll"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);\r
+  tH2D = new TH2D("V0SADC","V0S AFTER DAUGHTER CUTS;V0ALL;V0IMW",100,0,1000,100,0,1000); tList->Add(tH2D);\r
+  tList=new TList(); tList->SetName("RecSel"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);\r
+  //daughters\r
+  tList=new TList(); tList->SetName("TrkDau"); tList->SetOwner(); AddTracksSpy(tList); fList->Add(tList);\r
+  if(fQAlevel>1) {\r
+    // IN-OUT\r
+    tList=new TList(); tList->SetName("RecAllIP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("RecAllOP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("RecSelIP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("RecSelOP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);\r
+  }\r
+  //match\r
+  if(fReadMC) {\r
+    tList=new TList(); tList->SetName("RecMth"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);\r
+    tH1D = new TH1D("MCOrigin", "MCOrigin;Rad2",1000,0,100); tList->Add(tH1D);\r
+    tList=new TList(); tList->SetName("TrkMth"); tList->SetOwner(); AddTracksSpy(tList); fList->Add(tList);\r
+  }\r
+  //stack\r
+  if(fReadMC) {\r
+    tList=new TList(); tList->SetName("MCTK0sGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("MCTLdaGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("MCTPhiGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("MCTXiGenAcc");  tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("MCTK0s"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);\r
+    tList=new TList(); tList->SetName("MCTLda"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);\r
+  }\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::Exec(Option_t* option) {\r
+  // bypassing ::exec (needed because of AMPT)\r
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(0);\r
+  if(fAvoidExec) {\r
+    AliAnalysisTaskFlowStrange::UserExec(option);\r
+  } else {\r
+    AliAnalysisTaskSE::Exec(option);\r
+  }\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::UserExec(Option_t *option) {\r
+  // bridge\r
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(1);\r
+  AliAnalysisTaskFlowStrange::MyUserExec(option);\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::NotifyRun() {\r
+  if(fQAlevel>5) AddVZEQA();\r
+  if(fVZEsave) AddVZEROResponse();\r
+  if(fVZEload) LoadVZEROResponse();\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::AcceptAAEvent(AliESDEvent *tESD) {\r
+  Double_t acceptEvent=kTRUE;\r
+  Double_t tTPCVtxZ = tESD->GetPrimaryVertexTPC()->GetZ();\r
+  if(tESD->GetPrimaryVertexTPC()->GetNContributors()<=0) return kFALSE;\r
+  Double_t tSPDVtxZ = tESD->GetPrimaryVertexSPD()->GetZ();\r
+  if(tESD->GetPrimaryVertexSPD()->GetNContributors()<=0) return kFALSE;\r
+  // EventCuts\r
+  AliCentrality *cent = tESD->GetCentrality();\r
+  Double_t cc1, cc2;\r
+  cc1 = cent->GetCentralityPercentile("V0M");\r
+  cc2 = cent->GetCentralityPercentile("TRK");\r
+  TString mycent = fCentMethod;\r
+  if(fCentMethod.Contains("V0MTRK")) {\r
+    acceptEvent = TMath::Abs(cc1-cc2)>5.0?kFALSE:acceptEvent; // a la Alex\r
+    mycent = "V0M";\r
+  }\r
+  fThisCent = cent->GetCentralityPercentile( mycent );\r
+  acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;\r
+  acceptEvent = TMath::Abs(tTPCVtxZ-tSPDVtxZ)>0.5?kFALSE:acceptEvent;\r
+  acceptEvent = TMath::Abs(tTPCVtxZ)>10.0?kFALSE:acceptEvent;\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("CCCC"))->Fill( cc1, cc2 );\r
+  // EndOfCuts\r
+  return acceptEvent;\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::AcceptAAEvent(AliAODEvent *tAOD) {\r
+  Double_t acceptEvent=kTRUE;\r
+  //=>Pile-up rejection (hardcoded)\r
+  Double_t tVtxZ = tAOD->GetPrimaryVertex()->GetZ();\r
+  if(tAOD->GetPrimaryVertex()->GetNContributors()<=0) return kFALSE;\r
+  Double_t tSPDVtxZ = tAOD->GetPrimaryVertexSPD()->GetZ();\r
+  if(tAOD->GetPrimaryVertexSPD()->GetNContributors()<=0) return kFALSE;\r
+  Int_t tpc = RefMultTPC();\r
+  Int_t glo = RefMultGlobal();\r
+  if(fExtraEventRejection) {\r
+    TString name = tAOD->GetPrimaryVertex()->GetTitle();\r
+    if( !name.Contains("VertexerTracks") ) return kFALSE;\r
+    if( ( Float_t(tpc) < -40.3+1.22*glo ) || ( Float_t(tpc)>(32.1+1.59*glo) ) ) return kFALSE;\r
+  }\r
+  // EventCuts\r
+  AliCentrality *cent = tAOD->GetHeader()->GetCentralityP();\r
+  Double_t cc1, cc2;\r
+  cc1 = cent->GetCentralityPercentile("V0M");\r
+  cc2 = cent->GetCentralityPercentile("TRK");\r
+  TString mycent = fCentMethod;\r
+  if(fCentMethod.Contains("V0MTRK")) {\r
+    acceptEvent = TMath::Abs(cc1-cc2)>5.0?kFALSE:acceptEvent;\r
+    mycent = "V0M";\r
+  }\r
+  fThisCent = cent->GetCentralityPercentile( mycent );\r
+  acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;\r
+  acceptEvent = TMath::Abs(tVtxZ-tSPDVtxZ)>0.5?kFALSE:acceptEvent;\r
+  acceptEvent = TMath::Abs(tVtxZ)>10.0?kFALSE:acceptEvent;\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("VTXZ"))->Fill( tVtxZ, tSPDVtxZ );\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("CCCC"))->Fill( cc1, cc2 );\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("REFM"))->Fill( tpc, glo );\r
+  // EndOfCuts\r
+  return acceptEvent;\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::AcceptPPEvent(AliAODEvent *tAOD) {\r
+  Double_t acceptEvent=kTRUE;\r
+  Double_t tVtxZ = tAOD->GetPrimaryVertex()->GetZ();\r
+  if(tAOD->GetPrimaryVertex()->GetNContributors()<=0) return kFALSE;\r
+  Double_t tSPDVtxZ = tAOD->GetPrimaryVertexSPD()->GetZ();\r
+  if(tAOD->GetPrimaryVertexSPD()->GetNContributors()<=0) return kFALSE;\r
+  // EventCuts\r
+  AliCentrality *cent = tAOD->GetHeader()->GetCentralityP();\r
+  Double_t cc1, cc2;\r
+  cc1 = cent->GetCentralityPercentile("V0M");\r
+  cc2 = cent->GetCentralityPercentile("TRK");\r
+  fThisCent = GetReferenceMultiplicity();\r
+  //for pp i use fCentPerXXX to select on multiplicity\r
+  acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;\r
+  acceptEvent = TMath::Abs(tVtxZ-tSPDVtxZ)>0.5?kFALSE:acceptEvent;\r
+  acceptEvent = TMath::Abs(tVtxZ)>10.0?kFALSE:acceptEvent;\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("VTXZ"))->Fill( tVtxZ, tSPDVtxZ );\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("CCCC"))->Fill( cc1, cc2 );\r
+  // EndOfCuts\r
+  return acceptEvent;\r
+}\r
+//=======================================================================\r
+Int_t AliAnalysisTaskFlowStrange::GetReferenceMultiplicity() { //toberefined\r
+  AliAODEvent *tAOD = (AliAODEvent *) InputEvent();\r
+  if(!tAOD) return -1;\r
+  AliAODTrack *track;\r
+  Int_t rawN = tAOD->GetNumberOfTracks();\r
+  Int_t ref=0;\r
+  for(Int_t id=0; id!=rawN; ++id) {\r
+    track = tAOD->GetTrack(id);\r
+    if(!track->TestFilterBit(fRFPFilterBit)) continue;\r
+    ++ref;\r
+  }\r
+  return ref;\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::AcceptPAEvent(AliAODEvent *tAOD) {\r
+  //if(aod->GetHeader()->GetEventNumberESDFile() == 0) return; //rejecting first chunk NOT NEEDED ANYMORE\r
+  Int_t bc2 = tAOD->GetHeader()->GetIRInt2ClosestInteractionMap();\r
+  if(bc2!=0) return kFALSE;\r
+  Int_t bc1 = tAOD->GetHeader()->GetIRInt1ClosestInteractionMap();\r
+  if(bc1!=0) return kFALSE;\r
+  Short_t isPileup = tAOD->IsPileupFromSPD(5);\r
+  if(isPileup!=0) return kFALSE;\r
+  if(tAOD->GetHeader()->GetRefMultiplicityComb08()<0) return kFALSE;\r
+\r
+  const AliAODVertex* spdVtx = tAOD->GetPrimaryVertexSPD();\r
+  if(!spdVtx) return kFALSE;\r
+  if(spdVtx->GetNContributors()<=0) return kFALSE;\r
+\r
+  const AliAODVertex* tpcVtx=NULL;\r
+  Int_t nVertices = tAOD->GetNumberOfVertices();\r
+  for(Int_t iVertices = 0; iVertices < nVertices; iVertices++){\r
+    const AliAODVertex* vertex = tAOD->GetVertex(iVertices);\r
+    if (vertex->GetType() != AliAODVertex::kMainTPC) continue;\r
+    tpcVtx = vertex;\r
+  }\r
+  if(!tpcVtx) return kFALSE;\r
+  if(tpcVtx->GetNContributors()<=0) return kFALSE;\r
+  Double_t tTPCVtxZ = tpcVtx->GetZ();\r
+  Double_t tSPDVtxZ = spdVtx->GetZ();\r
+  if (TMath::Abs(tSPDVtxZ - tTPCVtxZ)>2.0) return kFALSE;\r
+  if(plpMV(tAOD)) return kFALSE;\r
+\r
+  Double_t acceptEvent=kTRUE;\r
+  // EventCuts\r
+  AliCentrality *cent = tAOD->GetHeader()->GetCentralityP();\r
+  Double_t cc1, cc2;\r
+  cc1 = cent->GetCentralityPercentile("V0M");\r
+  cc2 = cent->GetCentralityPercentile("TRK");\r
+  if(fCentMethod.Contains("V0MTRK")) fCentMethod = "V0M";\r
+  fThisCent = cent->GetCentralityPercentile( fCentMethod );\r
+  acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;\r
+  acceptEvent = TMath::Abs(tTPCVtxZ)>10.0?kFALSE:acceptEvent;\r
+  // EndOfCuts\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );\r
+  if(fQAlevel>0) ((TH2D*)((TList*)fList->FindObject("EventSpy"))->FindObject("CCCC"))->Fill( cc1, cc2 );\r
+  return acceptEvent;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::MyUserExec(Option_t *) {\r
+  // MAIN ROUTINE\r
+  TStopwatch tTime;\r
+  tTime.Start();\r
+  fCandidates->SetLast(-1);\r
+  AliESDEvent *tESD=dynamic_cast<AliESDEvent*>(InputEvent());\r
   AliAODEvent *tAOD=dynamic_cast<AliAODEvent*>(InputEvent());\r
+  //=>check event\r
   Bool_t acceptEvent=kFALSE;\r
-  fCandidates->SetLast(-1);\r
-  if(tAOD) {\r
-    ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("Events"))->Fill(0);\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,0x0);\r
-    } else {\r
-      if(TMath::Abs(tVtxZ)>10.0) tDSelection = kFALSE; // Cut on VtxZ mandatory!\r
+  if(fReadESD) {\r
+    if(!tESD) return;\r
+    acceptEvent = fRunOnpp?kFALSE:fRunOnpA?kFALSE:AcceptAAEvent(tESD);\r
+  } else {\r
+    if(!tAOD) return;\r
+    acceptEvent = fRunOnpp?AcceptPPEvent(tAOD):fRunOnpA?AcceptPAEvent(tAOD):AcceptAAEvent(tAOD);\r
+  }\r
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(2);\r
+  //=>does the event clear?\r
+  if(!acceptEvent) return;\r
+  if(!fSkipFlow) {\r
+    MakeQVectors();\r
+    if(fPsi2<-0.1) {\r
+      ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(4);\r
+      return;\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
+  SaveVZEROResponse();\r
+  if(fQAlevel>5 && !fReadESD) {\r
+    SaveVZEROQA();\r
+  }\r
+  //=>great, lets do our stuff!\r
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(3);\r
+  //=>load candidates\r
+  if(!fSkipSelection) {\r
+    if(fReadESD) {\r
+      ReadFromESD(tESD);\r
+    } else {\r
+      if(fSpecie<10) ReadFromAODv0(tAOD);\r
+      else ChargeParticles(tAOD);\r
     }\r
+    if(fUseFP) AddCandidates();\r
+    //=>flow\r
+    //=>done\r
+  }\r
+  tTime.Stop();\r
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("RealTime"))->Fill( TMath::Log( tTime.RealTime() ) );\r
+  PostData(1,fList);\r
+  if(fUseFP) {\r
+    PostData(2,fTPCevent);\r
+    PostData(3,fVZEevent);\r
   }\r
-  if(!acceptEvent) return;\r
-  // QA filling\r
-  ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("Events"))->Fill(1);\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
-    AliFlowTrackSimple *pTrack = fFlowEventVZE->GetTrack(i);\r
-    mult += pTrack->Weight();\r
-  }\r
-  ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("RFPVZE"))->Fill( mult );\r
-  ((TH1D*)((TList*)fQAList->FindObject("Event"))->FindObject("POI"))->Fill( fCandidates->GetEntriesFast() );\r
-  AddCandidates();\r
-\r
-  PostData(1,fFlowEventTPC);\r
-  PostData(2,fFlowEventVZE);\r
-  PostData(3,fQAList);\r
-  return;\r
 }\r
 //=======================================================================\r
-void AliAnalysisTaskFlowStrange::AddCandidates()\r
-{\r
-  // adds candidates to flow events (untaging if necessary)\r
-  if(fDebug) printf("I received %d candidates\n",fCandidates->GetEntriesFast());\r
-  for(int iCand=0; iCand!=fCandidates->GetEntriesFast(); ++iCand ) {\r
-    AliFlowCandidateTrack *cand = dynamic_cast<AliFlowCandidateTrack*>(fCandidates->At(iCand));\r
-    if(!cand) continue;\r
-    if(fDebug) printf(" >Checking at candidate %d with %d daughters: mass %f\n",\r
-                     iCand,cand->GetNDaughters(),cand->Mass());\r
-    // untagging ===>\r
-    for(int iDau=0; iDau!=cand->GetNDaughters(); ++iDau) {\r
-      if(fDebug) printf("  >Daughter %d with fID %d", iDau, cand->GetIDDaughter(iDau));\r
-      for(int iRPs=0; iRPs!=fFlowEventTPC->NumberOfTracks(); ++iRPs ) {\r
-        AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEventTPC->GetTrack( iRPs ));\r
-        if (!iRP) continue;\r
-        if( !iRP->InRPSelection() ) continue;\r
-        if( cand->GetIDDaughter(iDau) == iRP->GetID() ) {\r
-          if(fDebug) printf(" was in RP set");\r
-          iRP->SetForRPSelection(kFALSE);\r
-          fFlowEventTPC->SetNumberOfRPs( fFlowEventTPC->GetNumberOfRPs() -1 );\r
+void AliAnalysisTaskFlowStrange::ReadFromESD(AliESDEvent *tESD) {\r
+  AliStack *stack=NULL;\r
+  if(fReadMC) {\r
+    AliMCEvent *mcevent=NULL;\r
+    mcevent = MCEvent();\r
+    if(mcevent) stack = mcevent->Stack();\r
+  }\r
+\r
+  Int_t num = tESD->GetNumberOfTracks();\r
+  AliESDtrack *myTrack;\r
+  Int_t plist[3000], nlist[3000], np=0, nn=0;\r
+  Double_t pd0[3000], nd0[3000];\r
+  for (Int_t i=0; i!=num; ++i) {\r
+    myTrack = (AliESDtrack*) tESD->GetTrack(i);\r
+    if(!myTrack) continue;\r
+    LoadTrack(myTrack);\r
+    FillTrackSpy("TrkAll");\r
+    if(!AcceptDaughter()) continue;\r
+    FillTrackSpy("TrkSel");\r
+    ((TH2D*)((TList*)fList->FindObject("TrkSel"))->FindObject("PtIPXY" ))->Fill( myTrack->Pt(), fDaughterImpactParameterXY );\r
+    if( myTrack->Charge()>0 ) {\r
+      pd0[np] = fDaughterImpactParameterXY;\r
+      plist[np++] = i;\r
+    } else {\r
+      nd0[nn] = fDaughterImpactParameterXY;\r
+      nlist[nn++] = i;\r
+    }\r
+  }\r
+  ((TH1D*)((TList*)fList->FindObject("TrkSel"))->FindObject("NPAIR" ))->Fill( np,nn );\r
+  const AliESDVertex *vtx = tESD->GetPrimaryVertex();\r
+  AliESDtrack *pT, *nT;\r
+  for(int p=0; p!=np; ++p) {\r
+    pT = (AliESDtrack*) tESD->GetTrack( plist[p] );\r
+    for(int n=0; n!=nn; ++n) {\r
+      nT = (AliESDtrack*) tESD->GetTrack( nlist[n] );\r
+      fDecayProductIPXY = pd0[p]*nd0[n];\r
+      AliExternalTrackParam pETP(*pT), nETP(*nT);\r
+      Double_t xa, xb;\r
+      pETP.GetDCA(&nETP,tESD->GetMagneticField(),xa,xb);\r
+      fDecayDCAdaughters = pETP.PropagateToDCA(&nETP,tESD->GetMagneticField());\r
+      AliESDv0 vertex( nETP,nlist[n], pETP,plist[p] );\r
+      fDecayCosinePointingAngleXY = CosThetaPointXY( &vertex, vtx );\r
+      fDecayRadXY = DecayLengthXY( &vertex, vtx );\r
+      fDecayPt = vertex.Pt();\r
+      fDecayPhi = vertex.Phi();\r
+      fDecayEta = vertex.Eta();\r
+      Double_t pmx, pmy, pmz, nmx, nmy, nmz;\r
+      vertex.GetNPxPyPz(nmx,nmy,nmz);\r
+      vertex.GetPPxPyPz(pmx,pmy,pmz);\r
+      TVector3 mom1(pmx,pmy,pmz), mom2(nmx,nmy,nmz), mom(vertex.Px(),vertex.Py(),vertex.Pz());\r
+      Double_t qlpos = mom1.Dot(mom)/mom.Mag();\r
+      Double_t qlneg = mom2.Dot(mom)/mom.Mag();\r
+      fDecayQt = mom1.Perp(mom);\r
+      fDecayAlpha = (qlpos-qlneg)/(qlpos+qlneg);\r
+      Double_t mpi = 0.13957018;\r
+      if(fSpecie==0) {\r
+        Double_t eppi = TMath::Sqrt( mpi*mpi + pmx*pmx + pmy*pmy + pmz*pmz );\r
+        Double_t enpi = TMath::Sqrt( mpi*mpi + nmx*nmx + nmy*nmy + nmz*nmz );\r
+        fDecayMass = TMath::Sqrt( mpi*mpi + mpi*mpi + 2*(eppi*enpi - pmx*nmx - pmy*nmy - pmz*nmz ) );\r
+        fDecayRapidity = vertex.RapK0Short();\r
+      } else {\r
+        Double_t mpr = 0.938272013;\r
+        Double_t epi, epr;\r
+        if(fDecayAlpha>0) {\r
+          epr = TMath::Sqrt( mpr*mpr + pmx*pmx + pmy*pmy + pmz*pmz );\r
+          epi = TMath::Sqrt( mpi*mpi + nmx*nmx + nmy*nmy + nmz*nmz );\r
+        } else {\r
+          epi = TMath::Sqrt( mpi*mpi + pmx*pmx + pmy*pmy + pmz*pmz );\r
+          epr = TMath::Sqrt( mpr*mpr + nmx*nmx + nmy*nmy + nmz*nmz );\r
         }\r
+        fDecayMass = TMath::Sqrt( mpi*mpi + mpr*mpr + 2*(epi*epr - pmx*nmx - pmy*nmy - pmz*nmz ) );\r
+        fDecayRapidity = vertex.RapLambda();\r
       }\r
-      if(fDebug) printf("\n");\r
-    }\r
-    // <=== untagging\r
-    cand->SetForPOISelection(kTRUE);\r
-    fFlowEventTPC->InsertTrack( ((AliFlowTrack*) cand) );\r
-    fFlowEventVZE->InsertTrack( ((AliFlowTrack*) cand) );\r
-  }\r
-  if(fDebug) printf("TPCevent %d | VZEevent %d\n",\r
-                   fFlowEventTPC->NumberOfTracks(),\r
-                   fFlowEventVZE->NumberOfTracks() );\r
-}\r
-\r
-//=======================================================================\r
-void AliAnalysisTaskFlowStrange::ChargedParticleAnalysis(AliAODEvent *tAOD)\r
-{\r
-  if(fMCmatch>0) fBayesianPID->SetMC(kTRUE);\r
-  fBayesianPID->SetDetResponse(tAOD,999);\r
-  for(int iRPs=0; iRPs!=fFlowEventTPC->NumberOfTracks(); ++iRPs ) {\r
-    AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEventTPC->GetTrack( iRPs ));\r
-    if(!iRP) continue;\r
-    Int_t ntracks = tAOD->GetNTracks();\r
-    AliAODTrack *iT = NULL;\r
-    for(Int_t it=0; it!=ntracks; ++it) {\r
-      iT = (AliAODTrack*) tAOD->GetTrack(it);\r
-      if(iT->GetID() == iRP->GetID()) break;\r
-      iT = NULL;\r
-    }\r
-    if(!iT) continue;\r
-    fBayesianPID->ComputeProb(iT,tAOD);\r
-    Float_t *prob = fBayesianPID->GetProb();\r
-    Float_t tofMismProb = fBayesianPID->GetTOFMismProb();\r
-    if( fBayesianPID->GetCurrentMask(1) && tofMismProb<0.5 ) {\r
-      iRP->SetMass( prob[3] );\r
-      iRP->SetForPOISelection(kTRUE);\r
-      iRP->SetForRPSelection(kFALSE);\r
-      fFlowEventVZE->InsertTrack( ((AliFlowTrack*) iRP) );\r
-      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
+      Double_t energy = TMath::Sqrt( fDecayMass*fDecayMass + vertex.Px()*vertex.Px() + vertex.Py()*vertex.Py() + vertex.Pz()*vertex.Pz() );\r
+      Double_t gamma = energy/fDecayMass;\r
+      fDecayDecayLength = DecayLength( &vertex, vtx )/gamma;\r
+      Double_t dPHI = fDecayPhi;\r
+      Double_t dDPHI = dPHI - fPsi2;\r
+      if( dDPHI < 0 ) dDPHI += TMath::TwoPi();\r
+      if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;\r
+      if(fQAlevel>1) {\r
+        if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("RecAllOP");\r
+        else FillCandidateSpy("RecAllIP");\r
+      }\r
+      FillCandidateSpy("RecAll");\r
+      ((TH2D*)((TList*)fList->FindObject("RecAll"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );\r
+      ((TH2D*)((TList*)fList->FindObject("RecAll"))->FindObject("XPOSXNEG"))->Fill( xa, xb );\r
+      if(!AcceptCandidate()) continue;\r
+      if(fDecayMass<fMinMass) continue;\r
+      if(fDecayMass>fMaxMass) continue;\r
+      // PID missing\r
+      if(fQAlevel>1) {\r
+        if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("RecSelOP");\r
+        else FillCandidateSpy("RecSelIP");\r
+      }\r
+      FillCandidateSpy("RecSel");\r
+      ((TH2D*)((TList*)fList->FindObject("RecSel"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );\r
+      ((TH2D*)((TList*)fList->FindObject("RecSel"))->FindObject("XPOSXNEG"))->Fill( xa, xb );\r
+\r
+      fDecayIDneg = nT->GetID();\r
+      fDecayIDpos = pT->GetID();\r
+      MakeTrack();\r
+      LoadTrack(pT); FillTrackSpy("TrkDau");\r
+      LoadTrack(nT); FillTrackSpy("TrkDau");\r
+\r
+      //===== BEGIN OF MCMATCH\r
+      if(stack) {\r
+        bool matched = false;\r
+        Int_t labelpos = pT->GetLabel();\r
+        Int_t labelneg = nT->GetLabel();\r
+        Double_t rOri=-1;\r
+        if( labelpos>0 && labelneg>0 ) {\r
+          TParticle *mcpos = stack->Particle( labelpos );\r
+          TParticle *mcneg = stack->Particle( labelneg );\r
+          Int_t pdgRecPos = mcpos->GetPdgCode();\r
+          Int_t pdgRecNeg = mcneg->GetPdgCode();\r
+          if( pdgRecPos==211&&pdgRecNeg==-211 ) if(mcpos->GetMother(0)>0) {\r
+            if( mcpos->GetMother(0)==mcneg->GetMother(0) ) {\r
+              TParticle *mcmot = stack->Particle( mcpos->GetMother(0) );\r
+              rOri = TMath::Sqrt( mcmot->Vx()*mcmot->Vx() + mcmot->Vy()*mcmot->Vy() );\r
+              if( TMath::Abs(mcmot->GetPdgCode())==310) {\r
+                if(mcmot->GetNDaughters()==2) matched=true;\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
+        if(matched) {\r
+          FillCandidateSpy("RecMth");\r
+          ((TH2D*)((TList*)fList->FindObject("RecMth"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );\r
+          ((TH2D*)((TList*)fList->FindObject("RecMth"))->FindObject("XPOSXNEG"))->Fill( xa, xb );\r
+          ((TH1D*)((TList*)fList->FindObject("RecMth"))->FindObject("MCOrigin"))->Fill( rOri );\r
+          LoadTrack(pT); FillTrackSpy("TrkMth");\r
+          LoadTrack(nT); FillTrackSpy("TrkMth");\r
         }\r
       }\r
-      // <<=== MATCHED TO MC ===\r
+      //===== END OF MCMATCH\r
     }\r
   }\r
 }\r
 //=======================================================================\r
-void AliAnalysisTaskFlowStrange::ReadFromAODv0(AliAODEvent *tAOD)\r
-{\r
-  fCutsRFPTPC->SetEvent(tAOD,MCEvent());\r
-  fCutsRFPVZE->SetEvent(tAOD,MCEvent());\r
-  fCutsPOI->SetEvent(tAOD,MCEvent());\r
-  fFlowEventTPC->Fill(fCutsRFPTPC,fCutsPOI);\r
-  fFlowEventVZE->Fill(fCutsRFPVZE,fCutsPOI);\r
-  fPsi2 = (fFlowEventVZE->GetQ()).Phi()/2;\r
-\r
-  for(Int_t i=0; i!=fFlowEventTPC->NumberOfTracks(); i++) {\r
-    AliFlowTrackSimple *pTrack = (AliFlowTrackSimple*) fFlowEventTPC->GetTrack(i);\r
-    if(!pTrack) continue;\r
-    if(!pTrack->InRPSelection()) continue;\r
-    ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("TPCPhiEta"))->Fill( pTrack->Phi(), pTrack->Eta(), pTrack->Weight() );\r
-  }\r
-  for(Int_t i=0; i!=fFlowEventVZE->NumberOfTracks(); i++) {\r
-    AliFlowTrackSimple *pTrack = (AliFlowTrackSimple*) fFlowEventVZE->GetTrack(i);\r
-    if(!pTrack) continue;\r
-    if(!pTrack->InRPSelection()) continue;\r
-    ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("VZEPhiEta"))->Fill( pTrack->Phi(), pTrack->Eta(), pTrack->Weight() );\r
-  }\r
-\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
-    Double_t dVZEQx = (fFlowEventVZE->GetQ(2)).Px() / (fFlowEventVZE->GetQ(2)).GetMult();\r
-    Double_t dVZEQy = (fFlowEventVZE->GetQ(2)).Py() / (fFlowEventVZE->GetQ(2)).GetMult();\r
-    ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("VZEQxQy"))->Fill( dVZEQx, dVZEQy );\r
-    ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("TPCQxQy"))->Fill( (fFlowEventTPC->GetQ(2)).Px() / (fFlowEventTPC->GetQ(2)).GetMult(),\r
-                                                                                 (fFlowEventTPC->GetQ(2)).Py() / (fFlowEventTPC->GetQ(2)).GetMult() );\r
-    // TPC Q\r
-    const int ngr=24;\r
-    double dArrayPt[25] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,\r
-                          1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,\r
-                          2.5, 3.0, 3.5, 4.0, 5.0 };\r
-    double dTPCPt[ngr];\r
-    double dTPCQx[ngr];\r
-    double dTPCQy[ngr];\r
-    double dTPCEta[ngr];\r
-    double dTPCM[ngr];\r
-    for(int i=0; i!=ngr; ++i) {\r
-      dTPCPt[i] = 0;\r
-      dTPCQx[i] = 0;\r
-      dTPCQy[i] = 0;\r
-      dTPCEta[i] = 0;\r
-      dTPCM[i] = 0;\r
-    }\r
-    for(Int_t i=0; i!=fFlowEventTPC->NumberOfTracks(); i++) {\r
-      AliFlowTrackSimple *pTrack = (AliFlowTrackSimple*) fFlowEventTPC->GetTrack(i);\r
-      if(!pTrack) continue;\r
-      if(!pTrack->InRPSelection()) continue;\r
-      Double_t dPt  = pTrack->Pt();\r
-      int npt=-1;\r
-      for(int pt=0; pt!=ngr; ++pt)\r
-       if( (dPt > dArrayPt[pt])&&(dPt < dArrayPt[pt+1]) ) {\r
-         npt = pt;\r
-         break;\r
-       }\r
-      if(npt<0) continue;\r
-      Double_t dPhi = pTrack->Phi();\r
-      Double_t dWeight = pTrack->Weight();\r
-      dTPCPt[npt] += dWeight*dPt;\r
-      dTPCQx[npt] += dWeight*TMath::Cos(2*dPhi);\r
-      dTPCQy[npt] += dWeight*TMath::Sin(2*dPhi);\r
-      dTPCEta[npt] += dWeight*pTrack->Eta();\r
-      dTPCM[npt] += dWeight;\r
+void AliAnalysisTaskFlowStrange::ReadStack(TClonesArray* mcArray) {\r
+  if(!mcArray) return;\r
+  AliAODMCParticle *myMCTrack;\r
+  for(int i=0; i!=mcArray->GetEntriesFast(); ++i) {\r
+    myMCTrack = dynamic_cast<AliAODMCParticle*>(mcArray->At( i ));\r
+    if(!myMCTrack) continue;\r
+    //==== BEGIN TRACK CUTS\r
+    if(myMCTrack->Pt()<0.2)   continue;\r
+    if(myMCTrack->Eta()<-0.8) continue;\r
+    if(myMCTrack->Eta()>+0.8) continue;\r
+    //==== END TRACK CUTS\r
+    switch( TMath::Abs(myMCTrack->PdgCode()) ) {\r
+    case (310): //k0s\r
+      FillMCParticleSpy( "MCTK0s", myMCTrack );\r
+      if( myMCTrack->IsPrimary() )\r
+       FillMCParticleSpy( "MCTK0sGenAcc", myMCTrack );\r
+      break;\r
+    case (3122): //lda\r
+      FillMCParticleSpy( "MCTLda", myMCTrack );\r
+      if( myMCTrack->IsPrimary() )\r
+       FillMCParticleSpy( "MCTLdaGenAcc", myMCTrack );\r
+      break;\r
+    case (333): //phi\r
+      if( myMCTrack->IsPrimary() )\r
+       FillMCParticleSpy( "MCTPhiGenAcc", myMCTrack );\r
+      break;\r
+    case (3312): //xi\r
+      if( myMCTrack->IsPrimary() )\r
+       FillMCParticleSpy( "MCTXiGenAcc", myMCTrack );\r
+      break;\r
     }\r
-    for(int i=0; i!=ngr; ++i)\r
-      if( dTPCM[i]>0 ) {\r
-       ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("TPCPtQx"))->Fill( dTPCPt[i]/dTPCM[i], dTPCQx[i]/dTPCM[i] );\r
-       ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("TPCPtQy"))->Fill( dTPCPt[i]/dTPCM[i], dTPCQy[i]/dTPCM[i] );\r
-       ((TH2D*)((TList*)fQAList->FindObject("Event"))->FindObject("TPCPtEta"))->Fill( dTPCPt[i]/dTPCM[i], dTPCEta[i]/dTPCM[i] );\r
-      }\r
-    // End of TPC Q\r
-    const AliAODVertex* trkVtx = tAOD->GetPrimaryVertex();\r
-    Double_t cov[6]={0};\r
-    trkVtx->GetCovarianceMatrix(cov);\r
-    ((TH3D*)((TList*)fQAList->FindObject("Event"))->FindObject("PRIMVERTEX"))->Fill( TMath::Sqrt( cov[0] ),\r
-                                                                                    TMath::Sqrt( cov[2] ),\r
-                                                                                    TMath::Sqrt( cov[5] ) );\r
   }\r
-\r
-  if(fSpecie>80) {\r
-    ChargedParticleAnalysis(tAOD);\r
-    return;\r
+}\r
+//=======================================================================\r
+Double_t AliAnalysisTaskFlowStrange::CosThetaPointXY(AliESDv0 *me, const AliVVertex *vtx) {\r
+  TVector3 mom( me->Px(), me->Py(), 0 );\r
+  TVector3 fli( me->Xv()-vtx->GetX(), me->Yv()-vtx->GetY(), 0 );\r
+  Double_t ctp = mom.Dot(fli) / mom.Mag() / fli.Mag();\r
+  return ctp;\r
+}\r
+//=======================================================================\r
+Double_t AliAnalysisTaskFlowStrange::CosThetaPointXY(AliAODv0 *me, const AliVVertex *vtx) {\r
+  TVector3 mom( me->Px(), me->Py(), 0 );\r
+  TVector3 fli( me->Xv()-vtx->GetX(), me->Yv()-vtx->GetY(), 0 );\r
+  Double_t ctp = mom.Dot(fli) / mom.Mag() / fli.Mag();\r
+  return ctp;\r
+}\r
+//=======================================================================\r
+Double_t AliAnalysisTaskFlowStrange::DecayLengthXY(AliESDv0 *me, const AliVVertex *vtx) {\r
+  Double_t dx = me->Xv()-vtx->GetX();\r
+  Double_t dy = me->Yv()-vtx->GetY();\r
+  Double_t dxy = TMath::Sqrt( dx*dx + dy*dy );\r
+  return dxy;\r
+}\r
+//=======================================================================\r
+Double_t AliAnalysisTaskFlowStrange::DecayLengthXY(AliAODv0 *me, const AliVVertex *vtx) {\r
+  Double_t dx = me->Xv()-vtx->GetX();\r
+  Double_t dy = me->Yv()-vtx->GetY();\r
+  Double_t dxy = TMath::Sqrt( dx*dx + dy*dy );\r
+  return dxy;\r
+}\r
+//=======================================================================\r
+Double_t AliAnalysisTaskFlowStrange::DecayLength(AliESDv0 *me, const AliVVertex *vtx) {\r
+  Double_t dx = me->Xv()-vtx->GetX();\r
+  Double_t dy = me->Yv()-vtx->GetY();\r
+  Double_t dz = me->Zv()-vtx->GetZ();\r
+  Double_t dxy = TMath::Sqrt( dx*dx + dy*dy + dz*dz );\r
+  return dxy;\r
+}\r
+//=======================================================================\r
+Double_t AliAnalysisTaskFlowStrange::DecayLength(AliAODv0 *me, const AliVVertex *vtx) {\r
+  Double_t dx = me->Xv()-vtx->GetX();\r
+  Double_t dy = me->Yv()-vtx->GetY();\r
+  Double_t dz = me->Zv()-vtx->GetZ();\r
+  Double_t dxy = TMath::Sqrt( dx*dx + dy*dy + dz*dz );\r
+  return dxy;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::ReadFromAODv0(AliAODEvent *tAOD) {\r
+  TClonesArray* mcArray=NULL;\r
+  if(fReadMC) {\r
+    mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));\r
+    ReadStack(mcArray);\r
   }\r
+\r
   Int_t nV0s = tAOD->GetNumberOfV0s();\r
   AliAODv0 *myV0;\r
-  Double_t dMASS=0.0;\r
+  Int_t v0all=0, v0imw=0;\r
   for (Int_t i=0; i!=nV0s; ++i) {\r
     myV0 = (AliAODv0*) tAOD->GetV0(i);\r
     if(!myV0) continue;\r
-    if(myV0->Pt()<0.1) continue; // skipping low momentum\r
-    Int_t pass = PassesAODCuts(myV0,tAOD);\r
-    if(pass==0) continue;\r
-    if(fSpecie==0) {\r
-      dMASS = myV0->MassK0Short();\r
+    if(!fOnline) if(myV0->GetOnFlyStatus() ) continue;\r
+    if(fOnline) if(!myV0->GetOnFlyStatus() ) continue;\r
+    AliAODTrack *iT, *jT;\r
+    AliAODVertex *vtx = tAOD->GetPrimaryVertex();\r
+    Double_t pos[3],cov[6];\r
+    vtx->GetXYZ(pos);\r
+    vtx->GetCovarianceMatrix(cov);\r
+    const AliESDVertex vESD(pos,cov,100.,100);\r
+    // TESTING CHARGE\r
+    int iPos, iNeg;\r
+    iT=(AliAODTrack*) myV0->GetDaughter(0);\r
+    if(iT->Charge()>0) {\r
+      iPos = 0; iNeg = 1;\r
     } else {\r
-      dMASS = myV0->MassLambda();\r
-      if(pass==2) dMASS = myV0->MassAntiLambda();\r
+      iPos = 1; iNeg = 0;\r
     }\r
-    MakeTrack(dMASS, myV0->Pt(), myV0->Phi(), myV0->Eta(),\r
-              ((AliAODTrack*) myV0->GetDaughter(0))->GetID(),\r
-              ((AliAODTrack*) myV0->GetDaughter(1))->GetID());\r
-  }\r
-  return;\r
-}\r
-//=======================================================================\r
-Int_t AliAnalysisTaskFlowStrange::PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAOD)\r
-{\r
-  if (myV0->GetOnFlyStatus() ) return 0;\r
-  //the following is needed in order to evualuate track-quality\r
-  AliAODTrack *iT, *jT;\r
-  AliAODVertex *vV0s = myV0->GetSecondaryVtx();\r
-  Double_t pos[3],cov[6];\r
-  vV0s->GetXYZ(pos);\r
-  vV0s->GetCovarianceMatrix(cov);\r
-  const AliESDVertex vESD(pos,cov,100.,100);\r
-  // TESTING CHARGE\r
-  int iPos, iNeg;\r
-  iT=(AliAODTrack*) myV0->GetDaughter(0);\r
-  if(iT->Charge()>0) {\r
-    iPos = 0; iNeg = 1;\r
-  } else {\r
-    iPos = 1; iNeg = 0;\r
-  }\r
-  // END OF TEST\r
-\r
-  iT=(AliAODTrack*) myV0->GetDaughter(iPos); // positive\r
-  AliESDtrack ieT( iT );\r
-  ieT.SetTPCClusterMap( iT->GetTPCClusterMap() );\r
-  ieT.SetTPCSharedMap( iT->GetTPCSharedMap() );\r
-  ieT.SetTPCPointsF( iT->GetTPCNclsF() );\r
-  ieT.RelateToVertex(&vESD, tAOD->GetMagneticField(), 100);\r
-  if (!fCutsDau->IsSelected( &ieT ) ) return 0;\r
-\r
-  jT=(AliAODTrack*) myV0->GetDaughter(iNeg); // negative\r
-  AliESDtrack jeT( jT );\r
-  jeT.SetTPCClusterMap( jT->GetTPCClusterMap() );\r
-  jeT.SetTPCSharedMap( jT->GetTPCSharedMap() );\r
-  jeT.SetTPCPointsF( jT->GetTPCNclsF() );\r
-  jeT.RelateToVertex(&vESD, tAOD->GetMagneticField(), 100);\r
-  if (!fCutsDau->IsSelected( &jeT ) ) return 0;\r
-\r
-  Double_t pvertex[3];\r
-  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
-  Double_t dD0P=ieT.GetD(pvertex[0],pvertex[1],tAOD->GetMagneticField());\r
-  Double_t dD0M=jeT.GetD(pvertex[0],pvertex[1],tAOD->GetMagneticField());\r
-  Double_t dD0D0=dD0P*dD0M;\r
-  Double_t dQT=myV0->PtArmV0();\r
-  Double_t dALPHA=myV0->AlphaV0(); // AlphaV0 -> AODRecoDecat::Alpha -> return 1.-2./(1.+QlProng(0)/QlProng(1));\r
-  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
-  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
-  if(TMath::Abs(dD0P) <fV0Cuts[3]) passes = 0;\r
-  if(TMath::Abs(dD0M) <fV0Cuts[3]) passes = 0;\r
-  if(dD0D0>fV0Cuts[4]) passes = 0;\r
-  if(dETA <fV0Cuts[6]) passes = 0;\r
-  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(dCT>ctaucut) passes = 0;\r
-  if(dDLXY<fV0Cuts[10]) passes = 0;\r
-\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(fDoExtraQA) {\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
-      if( (iT->GetTPCmomentum()<15) &&\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
-      }\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
-      }\r
-      break;\r
+    // END OF TEST\r
+\r
+    iT=(AliAODTrack*) myV0->GetDaughter(iPos); // positive\r
+    AliESDtrack ieT( iT );\r
+    ieT.SetTPCClusterMap( iT->GetTPCClusterMap() );\r
+    ieT.SetTPCSharedMap( iT->GetTPCSharedMap() );\r
+    ieT.SetTPCPointsF( iT->GetTPCNclsF() );\r
+    ieT.PropagateToDCA(&vESD, tAOD->GetMagneticField(), 100);\r
+    LoadTrack(&ieT,iT->Chi2perNDF());\r
+    Float_t ip[2];\r
+    ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);\r
+    fDaughterImpactParameterXY = ip[0];\r
+    fDaughterImpactParameterZ = ip[1];\r
+    Double_t dD0P = fDaughterImpactParameterXY; //ieT.GetD(pos[0], pos[1], tAOD->GetMagneticField());\r
+    if(!AcceptDaughter()) continue;\r
+\r
+    jT=(AliAODTrack*) myV0->GetDaughter(iNeg); // negative\r
+    AliESDtrack jeT( jT );\r
+    jeT.SetTPCClusterMap( jT->GetTPCClusterMap() );\r
+    jeT.SetTPCSharedMap( jT->GetTPCSharedMap() );\r
+    jeT.SetTPCPointsF( jT->GetTPCNclsF() );\r
+    jeT.PropagateToDCA(&vESD, tAOD->GetMagneticField(), 100);\r
+    LoadTrack(&jeT,jT->Chi2perNDF());\r
+    jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);\r
+    fDaughterImpactParameterXY = ip[0];\r
+    fDaughterImpactParameterZ = ip[1];\r
+    Double_t dD0N = fDaughterImpactParameterXY; //jeT.GetD(pos[0], pos[1], tAOD->GetMagneticField());\r
+    if(!AcceptDaughter()) continue;\r
+    if( fExcludeTPCEdges ) {\r
+      if( IsAtTPCEdge(iT->Phi(),iT->Pt(),+1,tAOD->GetMagneticField()) ) continue;\r
+      if( IsAtTPCEdge(jT->Phi(),jT->Pt(),-1,tAOD->GetMagneticField()) ) continue;\r
     }\r
-  }\r
-  // === MATCHED TO MC ===>>\r
-  // AliAODRecoDecay::MatchToMC()\r
-  if((passes>0)&&(fMCmatch>0)) {\r
-    TClonesArray* mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));\r
-    Int_t mcpasses=0;\r
+    Double_t xa, xb;\r
+    ieT.GetDCA(&jeT,tAOD->GetMagneticField(),xa,xb);\r
+    /*\r
+    // cutting out population close to TPC edges :: strange excess saw in 2010\r
+    if( fExcludeTPCEdges ) {\r
+    Double_t phimod = myV0->Phi();\r
+    int sectors[6] = {5,6,9,10,11,12};\r
+    for(int ii=0; ii!=6; ++ii)\r
+    if( (phimod<(sectors[ii]+1)*TMath::Pi()/9.0) && (phimod>sectors[ii]*TMath::Pi()/9.0) )\r
+    return 0;\r
+    }\r
+    */\r
+    if(fSpecie==0)\r
+      fDecayRapidity = myV0->RapK0Short();\r
+    else\r
+      fDecayRapidity = myV0->RapLambda();\r
+    fDecayDCAdaughters = myV0->DcaV0Daughters();\r
+    fDecayCosinePointingAngleXY = CosThetaPointXY( myV0, vtx );\r
+    fDecayRadXY = DecayLengthXY( myV0, vtx );\r
+    fDecayPt = myV0->Pt();\r
+    fDecayPhi = myV0->Phi();\r
+    fDecayEta = myV0->Eta();\r
+    fDecayProductIPXY = dD0P*dD0N;\r
+    fDecayQt = myV0->PtArmV0();\r
+    fDecayAlpha = myV0->AlphaV0(); // AlphaV0 -> AODRecoDecat::Alpha -> return 1.-2./(1.+QlProng(0)/QlProng(1));\r
+    if(myV0->ChargeProng(iPos)<0) fDecayAlpha = -fDecayAlpha; // protects for a change in convention\r
+    fDecayPt = myV0->Pt();\r
+    fDecayEta = myV0->Eta();\r
+    if( fSpecie==0 ) {\r
+      fDecayMass = myV0->MassK0Short();\r
+    } else {\r
+      if(fDecayAlpha>0) fDecayMass = myV0->MassLambda();\r
+      else fDecayMass = myV0->MassAntiLambda();\r
+    }\r
+    v0all++;\r
+    if(fDecayMass<fMinMass) continue;\r
+    if(fDecayMass>fMaxMass) continue;\r
+    v0imw++;\r
+    Double_t energy = TMath::Sqrt( fDecayMass*fDecayMass + myV0->Px()*myV0->Px() + myV0->Py()*myV0->Py() + myV0->Pz()*myV0->Pz() );\r
+    Double_t gamma = energy/fDecayMass;\r
+    fDecayDecayLength = DecayLength( myV0, vtx )/gamma;\r
+    Double_t dPHI = fDecayPhi;\r
+    Double_t dDPHI = dPHI - fPsi2;\r
+    if( dDPHI < 0 ) dDPHI += TMath::TwoPi();\r
+    if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;\r
+    if(fQAlevel>1) {\r
+      if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("RecAllOP");\r
+      else FillCandidateSpy("RecAllIP");\r
+    }\r
+    FillCandidateSpy("RecAll");\r
+    ((TH2D*)((TList*)fList->FindObject("RecAll"))->FindObject("D0PD0N"))->Fill( dD0P, dD0N );\r
+    ((TH2D*)((TList*)fList->FindObject("RecAll"))->FindObject("XPOSXNEG"))->Fill( xa, xb );\r
+    if(!AcceptCandidate()) continue;\r
+    // PID for lambda::proton\r
+    //if( fSpecie>0 ) {\r
+    //  if(fDecayAlpha>0) {\r
+    //    if( !PassesPIDCuts(&ieT) ) continue; //positive track\r
+    //  } else {\r
+    //    if( !PassesPIDCuts(&jeT) ) continue; //negative track\r
+    //  }\r
+    //}\r
+    if(fQAlevel>1) {\r
+      if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("RecSelOP");\r
+      else FillCandidateSpy("RecSelIP");\r
+    }\r
+    FillCandidateSpy("RecSel");\r
+    ((TH2D*)((TList*)fList->FindObject("RecSel"))->FindObject("D0PD0N"))->Fill( dD0P, dD0N );\r
+    ((TH2D*)((TList*)fList->FindObject("RecSel"))->FindObject("XPOSXNEG"))->Fill( xa, xb );\r
+    fDecayIDneg = iT->GetID();\r
+    fDecayIDpos = jT->GetID();\r
+    MakeTrack();\r
+    LoadTrack(&ieT,iT->Chi2perNDF());\r
+    ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);\r
+    fDaughterImpactParameterXY = ip[0];\r
+    fDaughterImpactParameterZ = ip[1];\r
+    FillTrackSpy("TrkDau");\r
+    LoadTrack(&jeT,jT->Chi2perNDF()); \r
+    jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);\r
+    fDaughterImpactParameterXY = ip[0];\r
+    fDaughterImpactParameterZ = ip[1];\r
+    FillTrackSpy("TrkDau");\r
+    //===== BEGIN OF MCMATCH                                                                                                                         \r
     if(mcArray) {\r
-      TString sPDG="NONE";\r
-      TString sMOTHER = "NONE";\r
-      Double_t ptTruth=-1, ptMom=-1;\r
-      Int_t abc=4; // 0:reject   1:truth   2:another decay   3:nonv0 t2   4:nonv0 t1\r
-      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("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
-                   if(iGrandMa) {\r
-                     Int_t iGrandMaPDG = iGrandMa->GetPdgCode();\r
-                     ptMom = iGrandMa->Pt();\r
-                     ptTruth = iTMom->Pt();\r
-                     if(pdgDatabase->GetParticle(iGrandMaPDG))\r
-                       sMOTHER = (pdgDatabase->GetParticle(iGrandMaPDG))->GetName();\r
-                   }\r
-                  } else {\r
-                    sMOTHER = "PRIMARY";\r
-                  }\r
-                } else {\r
-                  ((TH2D*)((TList*)fQAList->FindObject("QAMC"))->FindObject("MCRADS"))->Fill(0.0,rads);\r
-                }\r
-              }\r
+      bool matched = false;\r
+      Int_t labelpos = iT->GetLabel();\r
+      Int_t labelneg = jT->GetLabel();\r
+      Double_t rOri=-1;\r
+      if( labelpos>0 && labelneg>0 ) {\r
+        AliAODMCParticle *mcpos = (AliAODMCParticle*) mcArray->At( labelpos );\r
+        AliAODMCParticle *mcneg = (AliAODMCParticle*) mcArray->At( labelneg );\r
+        Int_t pdgRecPos = mcpos->GetPdgCode();\r
+        Int_t pdgRecNeg = mcneg->GetPdgCode();\r
+        if( pdgRecPos==211&&pdgRecNeg==-211 ) if(mcpos->GetMother()>0) {\r
+          if( mcpos->GetMother()==mcneg->GetMother() ) {\r
+            AliAODMCParticle *mcmot = (AliAODMCParticle*) mcArray->At( mcpos->GetMother() );\r
+            rOri = TMath::Sqrt( mcmot->Xv()*mcmot->Xv() + mcmot->Yv()*mcmot->Yv() );\r
+            if( TMath::Abs(mcmot->GetPdgCode())==310) {\r
+              if(mcmot->GetNDaughters()==2) matched=true;\r
             }\r
           }\r
         }\r
       }\r
-      Double_t dMCMASS;\r
-      if(fSpecie==0) {\r
-        dMCMASS = myV0->MassK0Short();\r
-        if(dMCMASS>0.588) dMCMASS=0.587999;\r
-        if(dMCMASS<0.412) dMCMASS=0.412001;\r
-      } else {\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
+      if(matched) {\r
+        FillCandidateSpy("RecMth");\r
+        ((TH2D*)((TList*)fList->FindObject("RecMth"))->FindObject("D0PD0N"))->Fill( dD0P,dD0N );\r
+        ((TH2D*)((TList*)fList->FindObject("RecMth"))->FindObject("XPOSXNEG"))->Fill( xa, xb );\r
+        ((TH1D*)((TList*)fList->FindObject("RecMth"))->FindObject("MCOrigin"))->Fill( rOri );\r
+        LoadTrack(&ieT,iT->Chi2perNDF());\r
+        ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);\r
+        fDaughterImpactParameterXY = ip[0];\r
+        fDaughterImpactParameterZ = ip[1];\r
+        FillTrackSpy("TrkMth");\r
+        LoadTrack(&jeT,jT->Chi2perNDF());\r
+        jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);\r
+        fDaughterImpactParameterXY = ip[0];\r
+        fDaughterImpactParameterZ = ip[1];\r
+        FillTrackSpy("TrkMth");\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) mcpasses=1;\r
+    }\r
+    //===== END OF MCMATCH\r
+  }\r
+  ((TH2D*)((TList*)fList->FindObject("RecAll"))->FindObject("V0SADC"))->Fill( v0all,v0imw );\r
+  return;\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::PassesPIDCuts(AliESDtrack *myTrack, AliPID::EParticleType pid) {\r
+  Bool_t pass=kTRUE;\r
+  if(fPIDResponse) {\r
+    fDaughterNSigmaPID = fPIDResponse->NumberOfSigmasTPC(myTrack,pid);\r
+    if( TMath::Abs(fDaughterNSigmaPID) > fDaughterMaxNSigmaPID )\r
+      pass = kFALSE;\r
+  }\r
+  return pass;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::ChargeParticles(AliAODEvent *tAOD) {\r
+  //benchmark purposes (for the ultimate measurement for LHC10h see Alex, Francesco)\r
+  if(!tAOD) return;\r
+  // (for the moment) only compatible with SPVZE (no untagging)\r
+  for(int i=0; i!=tAOD->GetNumberOfTracks(); ++i) {\r
+    AliAODTrack *t = tAOD->GetTrack( i );\r
+    if(!t) continue;\r
+    if( !t->TestFilterBit(1024) ) continue;\r
+    fDecayMass=0.0; // using mass as nsigmas control plot\r
+    if(fPIDResponse) { // PID\r
+      switch(fSpecie) { // TPC PID only\r
+      case(kPION):\r
+        fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kPion);\r
+        break;\r
+      case(kKAON):\r
+        fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kKaon);\r
+        break;\r
+      case(kPROTON):\r
+        fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kProton);\r
+        break;\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
-  if(passes&&fDoExtraQA) {\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
-  if(passes&&fDoQA) {\r
-    ((TH2D*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0MASS"))->Fill( dPT, dMASS );\r
-    ((TH2D*)((TList*)fQAList->FindObject("Candidates"))->FindObject("V0PhiEta"))->Fill( dPHI, dETA );\r
-  }\r
-  return passes;\r
-}\r
-//=======================================================================\r
-void AliAnalysisTaskFlowStrange::Terminate(Option_t *)\r
-{\r
+    }\r
+    Bool_t pass = kTRUE;\r
+    if( TMath::Abs(fDecayMass) > 3.0 ) pass=kFALSE;\r
+    if( t->Eta()<-0.8 || t->Eta()>+0.8 ) pass=kFALSE;\r
+    if( t->Pt()<0.2 || t->Pt()>20.0 ) pass=kFALSE;\r
+    if( t->GetTPCsignal()<10.0 ) pass=kFALSE;\r
+    fDecayPt=t->Pt();\r
+    fDecayPhi=t->Phi();\r
+    fDecayEta=t->Eta();\r
+    fDecayIDpos=-1;\r
+    fDecayIDneg=-1;\r
+\r
+    FillCandidateSpy("RecAll");\r
+    if(!pass) continue;\r
+\r
+    AliESDtrack et( t );\r
+    et.SetTPCClusterMap( t->GetTPCClusterMap() );\r
+    et.SetTPCSharedMap( t->GetTPCSharedMap() );\r
+    et.SetTPCPointsF( t->GetTPCNclsF() );\r
+    Float_t ip[2];\r
+    LoadTrack(&et,t->Chi2perNDF()); \r
+    AliAODVertex *vtx = tAOD->GetPrimaryVertex();\r
+    Double_t pos[3];\r
+    vtx->GetXYZ(pos);\r
+    et.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);\r
+    fDaughterImpactParameterXY = ip[0];\r
+    fDaughterImpactParameterZ = ip[1];\r
+    FillTrackSpy("TrkDau");\r
+    FillCandidateSpy("RecSel");\r
+\r
+    MakeTrack();\r
+  }\r
+  return;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::Terminate(Option_t *) {\r
   //terminate\r
 }\r
 //=======================================================================\r
-void AliAnalysisTaskFlowStrange::MakeTrack( Double_t mass, Double_t pt, Double_t phi,\r
-                                           Double_t eta, Int_t iid, Int_t jid )\r
-{\r
+void AliAnalysisTaskFlowStrange::MakeTrack() {\r
   // create track for flow tasks\r
-  if(fCandidates->GetLast()+1>=fCandidates->GetSize()) {\r
-    fCandidates->Expand( 2*fCandidates->GetSize() );\r
+  if(fCandidates->GetLast()+5>fCandidates->GetSize()) {\r
+    fCandidates->Expand( fCandidates->GetSize()+20 );\r
   }\r
   Bool_t overwrite = kTRUE;\r
   AliFlowCandidateTrack *oTrack = (static_cast<AliFlowCandidateTrack*> (fCandidates->At( fCandidates->GetLast()+1 )));\r
@@ -955,12 +1147,12 @@ void AliAnalysisTaskFlowStrange::MakeTrack( Double_t mass, Double_t pt, Double_t
   } else { // overwrites\r
     oTrack->ClearMe();\r
   }\r
-  oTrack->SetMass(mass);\r
-  oTrack->SetPt(pt);\r
-  oTrack->SetPhi(phi);\r
-  oTrack->SetEta(eta);\r
-  oTrack->AddDaughter(iid);\r
-  oTrack->AddDaughter(jid);\r
+  oTrack->SetMass(fDecayMass);\r
+  oTrack->SetPt(fDecayPt);\r
+  oTrack->SetPhi(fDecayPhi);\r
+  oTrack->SetEta(fDecayEta);\r
+  oTrack->AddDaughter(fDecayIDpos);\r
+  oTrack->AddDaughter(fDecayIDneg);\r
   oTrack->SetForPOISelection(kTRUE);\r
   oTrack->SetForRPSelection(kFALSE);\r
   if(overwrite) {\r
@@ -971,17 +1163,707 @@ void AliAnalysisTaskFlowStrange::MakeTrack( Double_t mass, Double_t pt, Double_t
   return;\r
 }\r
 //=======================================================================\r
-void AliAnalysisTaskFlowStrange::SetCommonConstants(Int_t massBins, Double_t minMass, Double_t maxMass)\r
-{\r
-  // setter for mass bins\r
-  fMassBins = massBins;\r
-  fMinMass = minMass;\r
-  fMaxMass = maxMass;\r
+void AliAnalysisTaskFlowStrange::AddCandidates() {\r
+  // adds candidates to flow events (untaging if necessary)\r
+  if(fDebug) printf("FlowEventTPC %d tracks | %d RFP | %d POI\n",fTPCevent->NumberOfTracks(),fTPCevent->GetNumberOfRPs(),fTPCevent->GetNumberOfPOIs());\r
+  if(fDebug) printf("FlowEventVZE %d tracks | %d RFP | %d POI\n",fVZEevent->NumberOfTracks(),fVZEevent->GetNumberOfRPs(),fVZEevent->GetNumberOfPOIs());\r
+  if(fDebug) printf("I received %d candidates\n",fCandidates->GetEntriesFast());\r
+  Int_t untagged=0;\r
+  Int_t poi=0;\r
+  for(int iCand=0; iCand!=fCandidates->GetEntriesFast(); ++iCand ) {\r
+    AliFlowCandidateTrack *cand = static_cast<AliFlowCandidateTrack*>(fCandidates->At(iCand));\r
+    if(!cand) continue;\r
+    if(fDebug) printf(" >Checking at candidate %d with %d daughters: mass %f\n",\r
+                      iCand,cand->GetNDaughters(),cand->Mass());\r
+    // untagging ===>\r
+    for(int iDau=0; iDau!=cand->GetNDaughters(); ++iDau) {\r
+      if(fDebug) printf("  >Daughter %d with fID %d", iDau, cand->GetIDDaughter(iDau));\r
+      for(int iRPs=0; iRPs!=fTPCevent->NumberOfTracks(); ++iRPs ) {\r
+        AliFlowTrack *iRP = static_cast<AliFlowTrack*>(fTPCevent->GetTrack( iRPs ));\r
+        if(!iRP) continue;\r
+        if(!iRP->InRPSelection()) continue;\r
+        if(cand->GetIDDaughter(iDau) == iRP->GetID()) {\r
+          if(fDebug) printf(" was in RP set");\r
+          ++untagged;\r
+          iRP->SetForRPSelection(kFALSE);\r
+          fTPCevent->SetNumberOfRPs( fTPCevent->GetNumberOfRPs() -1 );\r
+        }\r
+      }\r
+      if(fDebug) printf("\n");\r
+    }\r
+    // <=== untagging \r
+    poi++;\r
+    cand->SetForPOISelection(kTRUE);\r
+    fTPCevent->InsertTrack( ((AliFlowTrack*) cand) );\r
+    fVZEevent->InsertTrack( ((AliFlowTrack*) cand) );\r
+  }\r
+  fTPCevent->SetNumberOfPOIs( poi );\r
+  fVZEevent->SetNumberOfPOIs( poi );\r
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("POI"))->Fill( poi );\r
+  ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("UNTAG"))->Fill( untagged );\r
+  if(fDebug) printf("FlowEventTPC %d tracks | %d RFP | %d POI\n",fTPCevent->NumberOfTracks(),fTPCevent->GetNumberOfRPs(),fTPCevent->GetNumberOfPOIs());\r
+  if(fDebug) printf("FlowEventVZE %d tracks | %d RFP | %d POI\n",fVZEevent->NumberOfTracks(),fVZEevent->GetNumberOfRPs(),fVZEevent->GetNumberOfPOIs());\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::PushBackFlowTrack(AliFlowEvent *flowevent, Double_t pt, Double_t phi, Double_t eta, Double_t w, Int_t id) {\r
+  AliFlowTrack rfp;\r
+  rfp.SetPt(pt);\r
+  rfp.SetPhi(phi);\r
+  rfp.SetEta(eta);\r
+  rfp.SetWeight(w);\r
+  rfp.SetForRPSelection(kTRUE);\r
+  rfp.SetForPOISelection(kFALSE);\r
+  rfp.SetID(id);\r
+  flowevent->InsertTrack( &rfp );\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::IsAtTPCEdge(Double_t phi,Double_t pt,Int_t charge,Double_t b) {\r
+  // Origin: Alex Dobrin\r
+  // Implemented by Carlos Perez\r
+  TF1 cutLo("cutLo", "-0.01/x+pi/18.0-0.015", 0, 100);\r
+  TF1 cutHi("cutHi", "0.55/x/x+pi/18.0+0.03", 0, 100);\r
+  Double_t phimod = phi;\r
+  if(b<0) phimod = TMath::TwoPi()-phimod;  //for negatve polarity field\r
+  if(charge<0) phimod = TMath::TwoPi()-phimod; //for negatve charge\r
+  phimod += TMath::Pi()/18.0;\r
+  phimod = fmod(phimod, TMath::Pi()/9.0);\r
+  if( phimod<cutHi.Eval(pt) && phimod>cutLo.Eval(pt) )\r
+    return kTRUE;\r
+\r
+  return kFALSE;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::MakeQVectors() {\r
+  //computes event plane and updates fPsi2\r
+  //if there is a problem fPsi->-1\r
+  fPsi2=-1;\r
+  Double_t vzeqax, vzeqay, vzeqaw, vzeqbx, vzeqby, vzeqbw;\r
+  Double_t tpcqax, tpcqay, tpcqaw, tpcqbx, tpcqby, tpcqbw;\r
+  //=>loading event\r
+  MakeQVZE(InputEvent(),vzeqax,vzeqay,vzeqaw,vzeqbx,vzeqby,vzeqbw);\r
+  if(fReadESD) MakeQTPC(dynamic_cast<AliESDEvent*> (InputEvent()),tpcqax,tpcqay,tpcqaw,tpcqbx,tpcqby,tpcqbw);\r
+  else MakeQTPC(dynamic_cast<AliAODEvent*> (InputEvent()),tpcqax,tpcqay,tpcqaw,tpcqbx,tpcqby,tpcqbw);\r
+  //=>computing psi\r
+  Double_t qx, qy;\r
+  //VZERO\r
+  qx=qy=0;\r
+  Double_t psivzea,psivzeb,psivze,vzew;\r
+  psivzea = ( TMath::Pi()+TMath::ATan2(-vzeqay,-vzeqax) )/2.0;\r
+  psivzeb = ( TMath::Pi()+TMath::ATan2(-vzeqby,-vzeqbx) )/2.0;\r
+  qx = vzeqaw*vzeqax + vzeqbw*vzeqbx;\r
+  qy = vzeqaw*vzeqay + vzeqbw*vzeqby;\r
+  vzew = vzeqaw + vzeqbw;\r
+  psivze = ( TMath::Pi()+TMath::ATan2(-qy,-qx) )/2.0;\r
+  //TPC\r
+  qx=qy=0;\r
+  Double_t psitpca,psitpcb,psitpc,tpcw;\r
+  psitpca = ( TMath::Pi()+TMath::ATan2(-tpcqay,-tpcqax) )/2.0;\r
+  psitpcb = ( TMath::Pi()+TMath::ATan2(-tpcqby,-tpcqbx) )/2.0;\r
+  qx = tpcqaw*tpcqax + tpcqbw*tpcqbx;\r
+  qy = tpcqaw*tpcqay + tpcqbw*tpcqby;\r
+  tpcw = tpcqaw + tpcqbw;\r
+  psitpc = ( TMath::Pi()+TMath::ATan2(-qy,-qx) )/2.0;\r
+  //=>does the event clear?\r
+  switch(fWhichPsi) {\r
+  case(1): //VZERO\r
+    if( (vzeqaw<2)||(vzeqbw<2) ) return;\r
+    fPsi2 = psivze;\r
+    break;\r
+  case(2): //TPC\r
+    if( (tpcqaw<2)||(tpcqbw<2) ) return;\r
+    fPsi2 = psitpc;\r
+    break;\r
+  }\r
+  //=>great! recording\r
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSI"))->Fill( psivze );\r
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSIA"))->Fill( psivzea );\r
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSIB"))->Fill( psivzeb );\r
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("RFPVZE"))->Fill( vzew );\r
+  //------\r
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSI"))->Fill( psitpc );\r
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSIA"))->Fill( psitpca );\r
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSIB"))->Fill( psitpcb );\r
+  ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("RFPTPC"))->Fill( tpcw );\r
+  return;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::MakeQVZE(AliVEvent *tevent,\r
+                                          Double_t &qxa,Double_t &qya,Double_t &qwa,\r
+                                          Double_t &qxb,Double_t &qyb,Double_t &qwb) {\r
+  //=>cleaning\r
+  if(fUseFP) fVZEevent->ClearFast();\r
+  //=>external weights\r
+  Double_t extW[64];\r
+  for(int i=0;i!=64;++i) extW[i]=1;\r
+  if((!fVZEsave)&&(fVZEResponse)) {\r
+    Int_t ybinmin = fVZEResponse->GetYaxis()->FindBin(fCentPerMin+1e-6);\r
+    Int_t ybinmax = fVZEResponse->GetYaxis()->FindBin(fCentPerMax-1e-6);\r
+    for(int i=0;i!=64;++i) extW[i] = fVZEResponse->Integral(i+1,i+1,ybinmin,ybinmax);\r
+    Double_t ring[8];\r
+    for(int j=0; j!=8; ++j) {\r
+      ring[j]=0;\r
+      for(int i=0;i!=8;++i) ring[j] += extW[j*8+i];\r
+    }\r
+    for(int i=0;i!=64;++i) extW[i] = ring[i/8]/extW[i];\r
+  }\r
+  //=>computing\r
+  qxa=qya=qwa=qxb=qyb=qwb=0;\r
+  Int_t rfp=0;\r
+  Double_t eta, phi, w;\r
+  //v0c -> qa\r
+  for(int id=0;id!=32;++id) {\r
+    eta = -3.45+0.5*(id/8);\r
+    phi = TMath::PiOver4()*(0.5+id%8);\r
+    w = tevent->GetVZEROEqMultiplicity(id)*extW[id];\r
+    qxa += w*TMath::Cos(2*phi);\r
+    qya += w*TMath::Sin(2*phi);\r
+    qwa += w;\r
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta, w );\r
+    rfp++;\r
+    if(fUseFP) PushBackFlowTrack(fVZEevent,0,phi,eta,w,0);\r
+  }\r
+  //v0a -> qb\r
+  for(int id=32;id!=64;++id) {\r
+    eta = +4.8-0.6*((id/8)-4);\r
+    phi = TMath::PiOver4()*(0.5+id%8);\r
+    w = tevent->GetVZEROEqMultiplicity(id)*extW[id];\r
+    qxb += w*TMath::Cos(2*phi);\r
+    qyb += w*TMath::Sin(2*phi);\r
+    qwb += w;\r
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta, w );\r
+    rfp++;\r
+    if(fUseFP) PushBackFlowTrack(fVZEevent,0,phi,eta,w,0);\r
+  }\r
+  if(fUseFP) fVZEevent->SetNumberOfRPs(rfp);\r
+  if(fDebug>0&&fUseFP) printf("Inserted tracks in FlowEventVZE %d ==> %.1f\n",fVZEevent->NumberOfTracks(),qwa+qwb);\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddTPCRFPSpy(TList *me) {\r
+  TH1D *tH1D;\r
+  tH1D = new TH1D("PT",   "PT",           50,0,5);     me->Add(tH1D);\r
+  tH1D = new TH1D("PHI",  "PHI", 90,0,TMath::TwoPi()); me->Add(tH1D);\r
+  tH1D = new TH1D("ETA",  "ETA",          40,-1,+1);   me->Add(tH1D);\r
+  tH1D = new TH1D("TPCS", "TPC Signal",   100,0,500);  me->Add(tH1D);\r
+  tH1D = new TH1D("IPXY", "IPXY",         100,-2,+2);  me->Add(tH1D);\r
+  tH1D = new TH1D("IPZ",  "IPZ",          100,-2,+2);  me->Add(tH1D);\r
+  // TPC\r
+  tH1D = new TH1D("TPCNCLS", "NCLS", 170,-0.5,+169.5);   me->Add(tH1D);\r
+  tH1D = new TH1D("TPCSHCL", "NSCLS / NCLS", 100,0,1);   me->Add(tH1D);\r
+  tH1D = new TH1D("TPCFICL", "NCLS1I / NCLS",100,0,1);   me->Add(tH1D);\r
+  tH1D = new TH1D("TPCXRNF", "XROW / NFCLS", 100,0,1.5); me->Add(tH1D);\r
+  tH1D = new TH1D("TPCRCHI", "CHI2 / NCLS",  50,0,5);    me->Add(tH1D);\r
+  // ITS\r
+  tH1D = new TH1D("ITSNCLS", "NCLS",   7,-0.5,+6.5); me->Add(tH1D);\r
+  tH1D = new TH1D("ITSRCHI", "CHI2 / NCLS", 50,0,5); me->Add(tH1D);\r
+\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::PassesRFPTPCCuts(AliESDtrack *track, Double_t aodchi2cls, Float_t aodipxy, Float_t aodipz) {\r
+  if(track->GetKinkIndex(0)>0) return kFALSE;\r
+  if( (track->GetStatus()&AliESDtrack::kTPCrefit)==0 ) return kFALSE;\r
+  Double_t pt = track->Pt();\r
+  Double_t phi = track->Phi();\r
+  Double_t eta = track->Eta();\r
+  Double_t tpcs = track->GetTPCsignal();\r
+  Float_t ipxy, ipz;\r
+  track->GetImpactParameters(ipxy,ipz);\r
+  Int_t cls = track->GetTPCclusters(0);\r
+  Double_t xrows, findcls, chi2;\r
+  findcls = track->GetTPCNclsF();\r
+  xrows = track->GetTPCCrossedRows();\r
+  chi2 = track->GetTPCchi2();\r
+  Double_t rchi2 = chi2/cls;\r
+  if(!fReadESD) {\r
+    rchi2 = aodchi2cls;\r
+    ipxy = aodipxy;\r
+    ipz = aodipz;\r
+  }\r
+  Double_t xrnfcls = xrows/findcls;\r
+  Double_t scls, cls1i, itschi2;\r
+  Int_t itscls;\r
+  cls1i = track->GetTPCNclsIter1();\r
+  scls = track->GetTPCnclsS();\r
+  itscls = track->GetITSclusters(0);\r
+  itschi2 = track->GetITSchi2();\r
+  Double_t shcl = scls/cls;\r
+  Double_t ficl = cls1i/cls;\r
+  Double_t itsrchi2 = itscls/itschi2;\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("PT"))->Fill( pt );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("PHI"))->Fill( phi );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ETA"))->Fill( eta );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCS"))->Fill( tpcs );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("IPXY"))->Fill( ipxy );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("IPZ"))->Fill( ipz );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCNCLS"))->Fill( cls );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCSHCL"))->Fill( shcl );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCFICL"))->Fill( ficl );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCXRNF"))->Fill( xrnfcls );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCRCHI"))->Fill( rchi2 );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ITSNCLS"))->Fill( itscls );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ITSRCHI"))->Fill( itsrchi2 );\r
+  if(pt<fRFPminPt) return kFALSE; //0.2\r
+  if(pt>fRFPmaxPt) return kFALSE; //5.0\r
+  if(eta<fRFPminEta) return kFALSE; //-0.8\r
+  if(eta>fRFPmaxEta) return kFALSE; //+0.8\r
+  if(tpcs<fRFPTPCsignal) return kFALSE; //10.0\r
+  if( TMath::Sqrt(ipxy*ipxy/fRFPmaxIPxy/fRFPmaxIPxy+ipz*ipz/fRFPmaxIPz/fRFPmaxIPz)>1 ) return kFALSE; //2.4 3.2\r
+  if(cls<fRFPTPCncls) return kFALSE; //70\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("PT"))->Fill( pt );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("PHI"))->Fill( phi );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ETA"))->Fill( eta );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCS"))->Fill( tpcs );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("IPXY"))->Fill( ipxy );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("IPZ"))->Fill( ipz );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCNCLS"))->Fill( cls );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCSHCL"))->Fill( shcl );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCFICL"))->Fill( ficl );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCXRNF"))->Fill( xrnfcls );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCRCHI"))->Fill( rchi2 );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ITSNCLS"))->Fill( itscls );\r
+  ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ITSRCHI"))->Fill( itsrchi2 );\r
+  return kTRUE;\r
 }\r
 //=======================================================================\r
-void AliAnalysisTaskFlowStrange::SetCuts(Double_t cuts[11]) {\r
-  // defines cuts to be used\r
-  // fV0Cuts[11] dl3d dca ctp d0 d0d0 qt minEta maxEta PID ct dlxy\r
-  for(int i=0; i!=11; ++i) fV0Cuts[i] = cuts[i];\r
+void AliAnalysisTaskFlowStrange::MakeQTPC(AliAODEvent *tAOD,\r
+                                          Double_t &qxa,Double_t &qya,Double_t &qwa,\r
+                                          Double_t &qxb,Double_t &qyb,Double_t &qwb) {\r
+  //=>cleaning\r
+  if(fUseFP) fTPCevent->ClearFast();\r
+  qxa=qya=qwa=qxb=qyb=qwb=0;\r
+  Int_t rfp=0;\r
+  Double_t eta, phi, w;\r
+  //=>aod stuff\r
+  AliAODVertex *vtx = tAOD->GetPrimaryVertex();\r
+  Double_t pos[3],cov[6];\r
+  vtx->GetXYZ(pos);\r
+  vtx->GetCovarianceMatrix(cov);\r
+  const AliESDVertex vESD(pos,cov,100.,100);\r
+  AliAODTrack *track;\r
+  //=>looping\r
+  Int_t rawN = tAOD->GetNumberOfTracks();\r
+  for(Int_t id=0; id!=rawN; ++id) {\r
+    track = tAOD->GetTrack(id);\r
+    //=>cuts\r
+    if(!track->TestFilterBit(fRFPFilterBit)) continue;\r
+    if( fExcludeTPCEdges )\r
+      if( IsAtTPCEdge( track->Phi(), track->Pt(), track->Charge(), tAOD->GetMagneticField() ) )        continue;\r
+    AliESDtrack etrack( track );\r
+    etrack.SetTPCClusterMap( track->GetTPCClusterMap() );\r
+    etrack.SetTPCSharedMap( track->GetTPCSharedMap() );\r
+    etrack.SetTPCPointsF( track->GetTPCNclsF() );\r
+    Float_t ip[2];\r
+    etrack.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);\r
+    if(!PassesRFPTPCCuts(&etrack,track->Chi2perNDF(),ip[0],ip[1])) continue;\r
+    //=>collecting info\r
+    phi = track->Phi();\r
+    eta = track->Eta();\r
+    w = 1;\r
+    //=>subevents\r
+    if(eta<0) {\r
+      qxa += w*TMath::Cos(2*phi);\r
+      qya += w*TMath::Sin(2*phi);\r
+      qwa += w;\r
+    } else {\r
+      qxb += w*TMath::Cos(2*phi);\r
+      qyb += w*TMath::Sin(2*phi);\r
+      qwb += w;\r
+    }\r
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta, w );\r
+    rfp++;\r
+    if(fUseFP) PushBackFlowTrack(fTPCevent,track->Pt(),phi,eta,w,track->GetID());\r
+  }\r
+  if(fUseFP) fTPCevent->SetNumberOfRPs(rfp);\r
+  if(fDebug) printf("Inserted tracks in FlowEventTPC %d ==> %.1f\n",fTPCevent->NumberOfTracks(),qwa+qwb);\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::MakeQTPC(AliESDEvent *tESD,\r
+                                          Double_t &qxa,Double_t &qya,Double_t &qwa,\r
+                                          Double_t &qxb,Double_t &qyb,Double_t &qwb) {\r
+  //=>cleaning\r
+  if(fUseFP) fTPCevent->ClearFast();\r
+  qxa=qya=qwa=qxb=qyb=qwb=0;\r
+  Int_t rfp=0;\r
+  Double_t eta, phi, w;\r
+  //=>looping\r
+  AliESDtrack *track;\r
+  Int_t rawN = tESD->GetNumberOfTracks();\r
+  for(Int_t id=0; id!=rawN; ++id) {\r
+    track = tESD->GetTrack(id);\r
+    //=>cuts\r
+    if( fExcludeTPCEdges )\r
+      if( IsAtTPCEdge( track->Phi(), track->Pt(), track->Charge(), tESD->GetMagneticField() ) )        continue;\r
+    if(!PassesFilterBit(track)) continue;\r
+    if(!PassesRFPTPCCuts(track)) continue;\r
+    //=>collecting info\r
+    phi = track->Phi();\r
+    eta = track->Eta();\r
+    w = 1;\r
+    //=>subevents\r
+    if(eta<0) {\r
+      qxa += w*TMath::Cos(2*phi);\r
+      qya += w*TMath::Sin(2*phi);\r
+      qwa += w;\r
+    } else {\r
+      qxb += w*TMath::Cos(2*phi);\r
+      qyb += w*TMath::Sin(2*phi);\r
+      qwb += w;\r
+    }\r
+    ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta, w );\r
+    rfp++;\r
+    if(fUseFP) PushBackFlowTrack(fTPCevent,track->Pt(),phi,eta,w,track->GetID());\r
+  }\r
+  if(fUseFP) fTPCevent->SetNumberOfRPs(rfp);\r
+  if(fDebug) printf("Inserted tracks in FlowEventTPC %d ==> %.1f\n",fTPCevent->NumberOfTracks(),qwa+qwb);\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddMCParticleSpy(TList *me) {\r
+  TH1D *tH1D;\r
+  tH1D = new TH1D("Pt",   "Pt",   100,0.0,20);  me->Add(tH1D);\r
+  tH1D = new TH1D("Phi",  "Phi",  100,0,TMath::TwoPi()); me->Add(tH1D);\r
+  tH1D = new TH1D("Eta",  "Eta",  100,-1,+1);   me->Add(tH1D);\r
+  tH1D = new TH1D("Rad2", "Rad2", 1000,0,+100); me->Add(tH1D);\r
+  return;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::FillMCParticleSpy(TString listName, AliAODMCParticle *p) {\r
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Pt" ))->Fill( p->Pt() );\r
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Eta" ))->Fill( p->Eta() );\r
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Phi" ))->Fill( p->Phi() );\r
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Rad2" ))->Fill( TMath::Sqrt( p->Xv()*p->Xv() +\r
+                                                                                                p->Yv()*p->Yv() ) );\r
+  return;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::FillMCParticleSpy(TString listName, TParticle *p) {\r
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Pt" ))->Fill( p->Pt() );\r
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Eta" ))->Fill( p->Eta() );\r
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Phi" ))->Fill( p->Phi() );\r
+  ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Rad2" ))->Fill( TMath::Sqrt( p->Vx()*p->Vx() +\r
+                                                                                                p->Vy()*p->Vy() ) );\r
+  return;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddCandidatesSpy(TList *me) {\r
+  TH2D *tH2D;\r
+  tH2D = new TH2D("PhiEta",  "PhiEta;Phi;Eta", 100,0,TMath::TwoPi(),100,-1,+1); me->Add(tH2D);\r
+  tH2D = new TH2D("PtRAP",   "PtRAP;Pt;Y",          100,0,20,100,-2.0,+2.0);  me->Add(tH2D);\r
+  tH2D = new TH2D("PtDCA",   "PtDCA;Pt;DCA",        100,0,20,100,0,10);       me->Add(tH2D);\r
+  tH2D = new TH2D("PtCTP",   "PtCTP;Pt;CTP",        100,0,20,100,-1,+1);      me->Add(tH2D);\r
+  //tH2D = new TH2D("PtCTP",   "PtCTP;Pt;CTP",        100,0,10,100,0.90,+1);    me->Add(tH2D);\r
+  tH2D = new TH2D("PtD0D0",  "PtD0D0;Pt;D0D0",      100,0,20,100,-5,+5);      me->Add(tH2D);\r
+  tH2D = new TH2D("PtRad2",  "PtRad2;Pt;RadXY",     100,0,20,100,0,+50);      me->Add(tH2D);\r
+  tH2D = new TH2D("PtDL",    "PtDL;Pt;DL",          100,0,20,100,0,+50);      me->Add(tH2D);\r
+  tH2D = new TH2D("PtMASS",  "PtMASS;Pt;MASS", 100,0,20,fMassBins,fMinMass,fMaxMass); me->Add(tH2D);\r
+  tH2D = new TH2D("APPOS",   "APPOS;alphaPOS;QtPOS",100,-2,+2,100,0,0.3);     me->Add(tH2D);\r
+  tH2D = new TH2D("D0PD0N",  "D0PD0N;D0P;D0N",      200,-10,+10,200,-10,+10); me->Add(tH2D);\r
+  tH2D = new TH2D("XPOSXNEG","XPOSXNEG;XPOS;XNEG",  200,-50,+50,200,-50,+50); me->Add(tH2D);\r
+  return;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::FillCandidateSpy(TString listName) {\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PhiEta"))->Fill( fDecayPhi, fDecayEta );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtRAP" ))->Fill( fDecayPt, fDecayRapidity );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtDCA" ))->Fill( fDecayPt, fDecayDCAdaughters );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtCTP" ))->Fill( fDecayPt, fDecayCosinePointingAngleXY );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtD0D0"))->Fill( fDecayPt, fDecayProductIPXY );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtRad2"))->Fill( fDecayPt, fDecayRadXY );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtDL"  ))->Fill( fDecayPt, fDecayDecayLength );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtMASS"))->Fill( fDecayPt, fDecayMass );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("APPOS" ))->Fill( fDecayAlpha, fDecayQt );\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::AcceptCandidate() {\r
+  if(fDecayEta<fDecayMinEta) return kFALSE;\r
+  if(fDecayEta>fDecayMaxEta) return kFALSE;\r
+  if(fDecayPt<fDecayMinPt) return kFALSE;\r
+  if(fDecayProductIPXY>fDecayMaxProductIPXY) return kFALSE;\r
+  if(fDecayDCAdaughters>fDecayMaxDCAdaughters) return kFALSE;\r
+  if(fDecayCosinePointingAngleXY<fDecayMinCosinePointingAngleXY) return kFALSE;\r
+  if(fDecayRadXY<fDecayMinRadXY) return kFALSE;\r
+  if(fDecayDecayLength>fDecayMaxDecayLength*2.6842) return kFALSE;\r
+  if(TMath::Abs(fDecayRapidity)>fDecayMaxRapidity) return kFALSE;\r
+  if(fSpecie==0) {\r
+    if(fDecayAPCutPie) {\r
+      if(fDecayQt/TMath::Abs(fDecayAlpha)<fDecayMinQt) return kFALSE;\r
+    } else {\r
+      if(fDecayQt<fDecayMinQt) return kFALSE;\r
+    }\r
+  }\r
+  if(fSpecie==1) if(fDecayAlpha>0) return kFALSE;\r
+  if(fSpecie==2) if(fDecayAlpha<0) return kFALSE;\r
+  return kTRUE;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddTracksSpy(TList *me) {\r
+  TH2D *tH2D;\r
+  tH2D = new TH2D("PHIETA",       "PHIETA;PHI;ETA",               100,0,TMath::TwoPi(),100,-2,2); me->Add(tH2D);\r
+  tH2D = new TH2D("IPXYIPZ",      "IPXYIPZ;IPXY;IPZ",             1000,-20,+20,1000,-20,+20); me->Add(tH2D);\r
+  tH2D = new TH2D("PTTPCNCLS",    "PTTPCNCLS;PT;NCLS",            100,0,20,170,0,170);  me->Add(tH2D);\r
+  tH2D = new TH2D("POSTPCNCLCHI2","POSTPCNCLCHI2;NCLS;CHI2/NCLS", 170,0,170,100,0,8);   me->Add(tH2D);\r
+  tH2D = new TH2D("POSTPCNFCLNXR","POSTPCNFCLNXR;NFCLS;NXR",      170,0,170,170,0,170); me->Add(tH2D);\r
+  tH2D = new TH2D("POSTPCNCLNFCL","POSTPCNCLNFCL;NCLS;NFCLS",     170,0,170,170,0,170); me->Add(tH2D);\r
+  tH2D = new TH2D("POSTPCNCLNSCL","POSTPCNCLNSCL;NCLS;NSCLS",     170,0,170,170,0,170); me->Add(tH2D);\r
+  tH2D = new TH2D("NEGTPCNCLCHI2","NEGTPCNCLCHI2;NCLS;CHI2/NCLS", 170,0,170,100,0,8);   me->Add(tH2D);\r
+  tH2D = new TH2D("NEGTPCNFCLNXR","NEGTPCNFCLNXR;NFCLS;NXR",      170,0,170,170,0,170); me->Add(tH2D);\r
+  tH2D = new TH2D("NEGTPCNCLNFCL","NEGTPCNCLNFCL;NCLS;NFCLS",     170,0,170,170,0,170); me->Add(tH2D);\r
+  tH2D = new TH2D("NEGTPCNCLNSCL","NEGTPCNCLNSCL;NCLS;NSCLS",     170,0,170,170,0,170); me->Add(tH2D);\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::FillTrackSpy(TString listName) {\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PHIETA" ))->Fill( fDaughterPhi, fDaughterEta );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "IPXYIPZ" ))->Fill( fDaughterImpactParameterXY, fDaughterImpactParameterZ );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTTPCNCLS" ))->Fill( fDaughterPt, fDaughterNClsTPC );\r
+  TString ch="NEG";\r
+  if(fDaughterCharge>0) ch="POS";\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLCHI2",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterChi2PerNClsTPC );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNFCLNXR",ch.Data()) ))->Fill( fDaughterNFClsTPC, fDaughterXRows );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLNFCL",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterNFClsTPC );\r
+  ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLNSCL",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterNSClsTPC );\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::LoadTrack(AliESDtrack *myTrack, Double_t aodChi2NDF) {\r
+  fDaughterCharge = myTrack->Charge();\r
+  fDaughterXRows = myTrack->GetTPCCrossedRows();\r
+  fDaughterNFClsTPC = myTrack->GetTPCNclsF();\r
+  fDaughterNSClsTPC = myTrack->GetTPCnclsS();\r
+  fDaughterNClsTPC = myTrack->GetTPCclusters(0);\r
+  if(fReadESD) {\r
+    if(fDaughterNClsTPC>0) fDaughterChi2PerNClsTPC = myTrack->GetTPCchi2()/fDaughterNClsTPC;\r
+  } else {\r
+    fDaughterChi2PerNClsTPC = aodChi2NDF;\r
+  }\r
+  myTrack->GetImpactParameters(fDaughterImpactParameterXY,fDaughterImpactParameterZ);\r
+  fDaughterStatus = myTrack->GetStatus();\r
+  fDaughterPhi = myTrack->Phi();\r
+  fDaughterEta = myTrack->Eta();\r
+  fDaughterPt = myTrack->Pt();\r
+  fDaughterKinkIndex = myTrack->GetKinkIndex(0);\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::AcceptDaughter() {\r
+  if(fDaughterKinkIndex>0) return kFALSE;\r
+  if( (fDaughterStatus&AliESDtrack::kTPCrefit)==0 ) return kFALSE;\r
+  if(fDaughterNFClsTPC<1) return kFALSE;\r
+  if(fDaughterPt<fDaughterMinPt) return kFALSE;\r
+  if(fDaughterEta<fDaughterMinEta) return kFALSE;\r
+  if(fDaughterEta>fDaughterMaxEta) return kFALSE;\r
+  if(fDaughterNClsTPC<fDaughterMinNClsTPC) return kFALSE;\r
+  if(fDaughterChi2PerNClsTPC>fDaughterMaxChi2PerNClsTPC) return kFALSE;\r
+  if(TMath::Abs(fDaughterImpactParameterXY)<fDaughterMinImpactParameterXY) return kFALSE;\r
+  if(fDaughterXRows<fDaughterMinXRowsOverNClsFTPC*fDaughterNFClsTPC) return kFALSE;\r
+  return kTRUE;\r
+}\r
+//=======================================================================\r
+Double_t AliAnalysisTaskFlowStrange::GetWDist(const AliVVertex* v0, const AliVVertex* v1) {\r
+  // calculate sqrt of weighted distance to other vertex\r
+  if (!v0 || !v1) {\r
+    printf("One of vertices is not valid\n");\r
+    return 0;\r
+  }\r
+  static TMatrixDSym vVb(3);\r
+  double dist = -1;\r
+  double dx = v0->GetX()-v1->GetX();\r
+  double dy = v0->GetY()-v1->GetY();\r
+  double dz = v0->GetZ()-v1->GetZ();\r
+  double cov0[6],cov1[6];\r
+  v0->GetCovarianceMatrix(cov0);\r
+  v1->GetCovarianceMatrix(cov1);\r
+  vVb(0,0) = cov0[0]+cov1[0];\r
+  vVb(1,1) = cov0[2]+cov1[2];\r
+  vVb(2,2) = cov0[5]+cov1[5];\r
+  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];\r
+  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;\r
+  vVb.InvertFast();\r
+  if (!vVb.IsValid()) {printf("Singular Matrix\n"); return dist;}\r
+  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz\r
+    +    2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;\r
+  return dist>0 ? TMath::Sqrt(dist) : -1;\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::plpMV(const AliVEvent *event) {\r
+  // check for multi-vertexer pile-up\r
+  const AliAODEvent *aod = (const AliAODEvent*)event;\r
+  const AliESDEvent *esd = (const AliESDEvent*)event;\r
+  //\r
+  const int    kMinPlpContrib = 5;\r
+  const double kMaxPlpChi2 = 5.0;\r
+  const double kMinWDist = 15;\r
+  //\r
+  if (!aod && !esd) {\r
+    printf("Event is neither of AOD nor ESD\n");\r
+    exit(1);\r
+  }\r
+  //\r
+  const AliVVertex* vtPrm = 0;\r
+  const AliVVertex* vtPlp = 0;\r
+  int nPlp = 0;\r
+  //\r
+  if (aod) {\r
+    if ( !(nPlp=aod->GetNumberOfPileupVerticesTracks()) ) return kFALSE;\r
+    vtPrm = aod->GetPrimaryVertex();\r
+    if (vtPrm == aod->GetPrimaryVertexSPD()) return kTRUE; // there are pile-up vertices but no primary\r
+  }\r
+  else {\r
+    if ( !(nPlp=esd->GetNumberOfPileupVerticesTracks())) return kFALSE;\r
+    vtPrm = esd->GetPrimaryVertexTracks();\r
+    if (((AliESDVertex*)vtPrm)->GetStatus()!=1) return kTRUE; // there are pile-up vertices but no primary\r
+  }\r
+  //int bcPrim = vtPrm->GetBC();\r
+  //\r
+  for (int ipl=0;ipl<nPlp;ipl++) {\r
+    vtPlp = aod ? (const AliVVertex*)aod->GetPileupVertexTracks(ipl) : (const AliVVertex*)esd->GetPileupVertexTracks(ipl);\r
+    //\r
+    if (vtPlp->GetNContributors() < kMinPlpContrib) continue;\r
+    if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;\r
+    //  int bcPlp = vtPlp->GetBC();\r
+    //  if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2) return kTRUE; // pile-up from other BC\r
+    //\r
+    double wDst = GetWDist(vtPrm,vtPlp);\r
+    if (wDst<kMinWDist) continue;\r
+    //\r
+    return kTRUE; // pile-up: well separated vertices\r
+  }\r
+  //\r
+  return kFALSE;\r
+  //\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::MakeFilterBits() {\r
+  //FilterBit 1\r
+  fFB1 = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();\r
+  //FilterBit1024\r
+  fFB1024 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);\r
+  fFB1024->SetMinNCrossedRowsTPC(120);\r
+  fFB1024->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);\r
+  fFB1024->SetMaxChi2PerClusterITS(36);\r
+  fFB1024->SetMaxFractionSharedTPCClusters(0.4);\r
+  fFB1024->SetMaxChi2TPCConstrainedGlobal(36);\r
+  fFB1024->SetEtaRange(-0.9,0.9);\r
+  fFB1024->SetPtRange(0.15, 1e10);\r
+}\r
+//=======================================================================\r
+Bool_t AliAnalysisTaskFlowStrange::PassesFilterBit(AliESDtrack *track) {\r
+  Bool_t ret=kFALSE;\r
+  switch(fRFPFilterBit) {\r
+    case(1024):\r
+      ret = fFB1024->AcceptTrack(track);\r
+      break;\r
+    default:\r
+      ret = fFB1->AcceptTrack(track);\r
+  }\r
+  return ret;\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::LoadVZEROResponse() {\r
+  if(fVZEsave) return;\r
+  AliVEvent *event = InputEvent();\r
+  if(!event) return;\r
+  Int_t thisrun = event->GetRunNumber();\r
+  if(fVZEResponse) {\r
+    TString run = fVZEResponse->GetTitle();\r
+    if( run.Atoi() == thisrun ) return;\r
+    fVZEResponse = NULL;\r
+  }\r
+  //==>loading\r
+  fVZEResponse = dynamic_cast<TH2D*> (fVZEload->FindObject( Form("%d",thisrun) ));\r
+  printf("New VZE calibration: run %d -> Entries %.0f\n",thisrun,fVZEResponse->GetEntries());\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddVZEQA() {\r
+  AliVEvent *event = InputEvent();\r
+  if(!event) return;\r
+  Int_t thisrun = event->GetRunNumber();\r
+\r
+  fVZEQA = new TList();\r
+  fVZEQA->SetName( Form("VZEQA%d",thisrun) );\r
+  fVZEQA->SetOwner();\r
+  if(fQAlevel>0) {\r
+    TProfile2D *prof = new TProfile2D("LINP","LINP;VZEcell;VZEmult;SPDtrkl", 64,0,64,500,0,700,0,10000); fVZEQA->Add( prof );\r
+    prof = new TProfile2D("MULP","MULP;VZEcell;CENTR;VZEmult", 64,0,64,100,0,100,0,10000); fVZEQA->Add( prof );\r
+    TH3D *tH3D = new TH3D("EQU","EQU;VZEeqmult;VZEmult",100,0,700,100,0,700,64,0,64); fVZEQA->Add( tH3D );\r
+    //tH3D = new TH3D("LIN","LIN;SPDtrkl;VZEmult;VZEcell",2000,0,2000,200,0,700,64,0,64); fVZEQA->Add( tH3D );\r
+  }\r
+  fList->Add(fVZEQA);\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::SaveVZEROQA() {\r
+  if(!fVZEQA) return;\r
+  AliAODEvent *event = dynamic_cast<AliAODEvent*> (InputEvent());\r
+  AliVVZERO *vzero = event->GetVZEROData();\r
+  //AliAODHeader *header = event->GetHeader();\r
+  AliAODTracklets *tracklets = event->GetTracklets();\r
+  if(!event) return;\r
+  if(!vzero) return;\r
+  if(!tracklets) return;\r
+  Double_t mult, eqmult;\r
+  Int_t trkl;\r
+  for(int id=0; id!=64; ++id) {\r
+    trkl = tracklets->GetNumberOfTracklets();\r
+    mult = vzero->GetMultiplicity(id);\r
+    eqmult = event->GetVZEROEqMultiplicity(id);\r
+    ((TProfile2D*) fVZEQA->FindObject( "LINP" ))->Fill(id,mult,trkl,1);\r
+    ((TProfile2D*) fVZEQA->FindObject( "MULP" ))->Fill(id,fThisCent,mult,1);\r
+    //((TH3D*) fVZEQA->FindObject("LIN"))->Fill(trkl,mult,id);\r
+    ((TH3D*) fVZEQA->FindObject("EQU"))->Fill(eqmult,mult,id);\r
+  }\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::AddVZEROResponse() {\r
+  fVZEResponse = NULL;\r
+  AliVEvent *event = InputEvent();\r
+  if(!event) return;\r
+  Int_t thisrun = event->GetRunNumber();\r
+  fVZEResponse = new TH2D( Form("%d",thisrun), Form("%d;cell;CC",thisrun), 64,0,64, 50, 0, 100);\r
+  fList->Add(fVZEResponse);\r
+}\r
+//=======================================================================\r
+void AliAnalysisTaskFlowStrange::SaveVZEROResponse() {\r
+  if(!fVZEResponse) return;\r
+  AliVEvent *event = InputEvent();\r
+  if(!event) return;\r
+  Double_t w;\r
+  for(int id=0; id!=64; ++id) {\r
+    w = event->GetVZEROEqMultiplicity(id);\r
+    fVZEResponse->Fill(id,fThisCent,w);\r
+  }\r
+}\r
+//=======================================================================\r
+Int_t AliAnalysisTaskFlowStrange::RefMultTPC() {\r
+  AliAODEvent *ev = dynamic_cast<AliAODEvent*> (InputEvent());\r
+  if(!ev) return -1;\r
+  Int_t found = 0;\r
+  for(int i=0; i!=ev->GetNumberOfTracks(); ++i) {\r
+    AliAODTrack *t = ev->GetTrack( i );\r
+    if(!t) continue;\r
+    if( !t->TestFilterBit(1) ) continue;\r
+    if( t->Eta()<-0.8 || t->Eta()>+0.8 ) continue;\r
+    if( t->Pt()<0.2 || t->Pt()>5.0 ) continue;\r
+    if( t->GetTPCNcls()<70 ) continue;\r
+    if( t->GetTPCsignal()<10.0 ) continue;\r
+    if( t->Chi2perNDF()<0.2 ) continue;    \r
+    ++found;\r
+  }\r
+  return found;\r
+}\r
+//=======================================================================\r
+Int_t AliAnalysisTaskFlowStrange::RefMultGlobal() {\r
+  AliAODEvent *ev = dynamic_cast<AliAODEvent*> (InputEvent());\r
+  if(!ev) return -1;\r
+  Int_t found = 0;\r
+  for(int i=0; i!=ev->GetNumberOfTracks(); ++i) {\r
+    AliAODTrack *t = ev->GetTrack( i );\r
+    if(!t) continue;\r
+    if( !t->TestFilterBit(16) ) continue;\r
+    if( t->Eta()<-0.8 || t->Eta()>+0.8 ) continue;\r
+    if( t->Pt()<0.2 || t->Pt()>5.0 ) continue;\r
+    if( t->GetTPCNcls()<70 ) continue;\r
+    if( t->GetTPCsignal()<10.0 ) continue;\r
+    if( t->Chi2perNDF()<0.1 ) continue;    \r
+    Double_t b[3], bcov[3];\r
+    if( !t->PropagateToDCA(ev->GetPrimaryVertex(),ev->GetMagneticField(),100,b,bcov) ) continue;\r
+    if( b[0]>+0.3 || b[0]<-0.3 || b[1]>+0.3 || b[1]<-0.3) continue;\r
+    ++found;\r
+  }\r
+  return found;\r
 }\r
 \r
index 7fc9daa..224a0b3 100644 (file)
 #include "AliAnalysisTaskSE.h"\r
 \r
 class TList;\r
+class TH2D;\r
 class TObjArray;\r
+class TClonesArray;\r
+class AliAODMCParticle;\r
 class AliESDtrackCuts;\r
 class AliFlowEventCuts;\r
 class AliPIDResponse;\r
@@ -24,72 +27,255 @@ class AliESDEvent;
 class AliAODEvent;\r
 class AliAODv0;\r
 class AliESDv0;\r
+class AliVVertex;\r
 class AliFlowBayesianPID;\r
+class AliAODVertex;\r
 \r
 class AliAnalysisTaskFlowStrange : public AliAnalysisTaskSE {\r
-  public:\r
-    AliAnalysisTaskFlowStrange();\r
-    AliAnalysisTaskFlowStrange(const Char_t *name, AliFlowEventCuts *cutsEvent,\r
-                               AliFlowTrackCuts *cutsRFPTPC, AliFlowTrackCuts *cutsRFPVZE,\r
-                              AliESDtrackCuts *cutsDau);\r
-    virtual ~AliAnalysisTaskFlowStrange();\r
-    virtual void UserCreateOutputObjects();\r
-    virtual void Exec(Option_t*);\r
-    virtual void UserExec(Option_t *);\r
-    virtual void Terminate(Option_t *);\r
-    void MyUserExec(Option_t *);\r
-    void SetDebug() {fDebug = kTRUE;}\r
-    void SetQA(Bool_t qa) {fDoQA = qa;}\r
-    void SetExtraQA(Bool_t qa) {fDoExtraQA = qa;}\r
-    void SetpA(Bool_t pa) {fRunOnpA = pa;}\r
-    void Setpp(Bool_t pp) {fRunOnpp = pp;}\r
-    void SetCalibration(TList *cal) {fCalib = cal;}\r
-    void SetCuts(Double_t cuts[11]);\r
-    void SetK0L0(Int_t specie) {fSpecie=specie;}\r
-    void SetCommonConstants(Int_t massBins, Double_t minMass, Double_t maxMass);\r
-    void SetMCmatch(Int_t match) {fMCmatch=match;}\r
-    void SetUseEventSelection(Bool_t value) {fUseEventSelection=value;}\r
-\r
-  private:\r
-    AliAnalysisTaskFlowStrange(const AliAnalysisTaskFlowStrange& analysisTask);\r
-    AliAnalysisTaskFlowStrange& operator=(const AliAnalysisTaskFlowStrange& analysisTask);\r
-    void AddQAEvents();\r
-    void AddQACandidates();\r
-\r
-    void ReadFromAODv0(AliAODEvent *tAOD);\r
-    Int_t PassesAODCuts(AliAODv0 *myV0, AliAODEvent *tAOD);\r
-    void ChargedParticleAnalysis(AliAODEvent *tAOD);\r
-    void AddCandidates();\r
-    void MakeTrack( Double_t mass, Double_t pt, Double_t phi,\r
-                   Double_t eta, Int_t iid, Int_t jid );\r
-    AliPIDResponse *fPIDResponse;     //! PID response object\r
-    AliFlowBayesianPID *fBayesianPID;  //! Bayesian PID object\r
-    Bool_t fDebug; // true if we want to inspect the main steps of the task\r
-    Bool_t fUseEventSelection; // true if we want to use AliFlowEventCuts\r
-    Bool_t fDoQA;  // true if we want to produce QA plots\r
-    Bool_t fDoExtraQA; // full QA\r
-    Bool_t fRunOnpA; // Make task compatible with pA event selection\r
-    Bool_t fRunOnpp; // Make task compatible with pp event selection\r
-    TList *fCalib; // calibration list\r
-    Double_t fPsi2;// best estimation of Psi2\r
-    Int_t fSpecie; // K0=>0 L0=>1\r
-    Int_t fMCmatch; // for studies regarding background and efficiency\r
-    Double_t fV0Cuts[11]; // v0 cuts: dl dca ctp d0 d0d0 qt minEta maxEta PID ct dlxy\r
-    Int_t fMassBins;   // to configure FLOWCOMMON\r
-    Double_t fMinMass; // to configure FLOWCOMMON\r
-    Double_t fMaxMass; // to configure FLOWCOMMON\r
-    AliFlowEventCuts *fCutsEvent; // event cuts\r
-    AliFlowTrackCuts *fCutsRFPTPC; // RFP cuts\r
-    AliFlowTrackCuts *fCutsRFPVZE; // RFP cuts\r
-    AliFlowTrackCuts* fCutsPOI; // POI cuts\r
-    AliESDtrackCuts  *fCutsDau; // Track quality cuts for the daughters\r
-    AliFlowEvent  *fFlowEventTPC;  //flow event TPC\r
-    AliFlowEvent  *fFlowEventVZE;  //flow event VZE\r
-    TObjArray *fCandidates; // Array of selected candidates\r
-\r
-    TList *fQAList; // stores the final list of output histograms\r
-\r
-  ClassDef(AliAnalysisTaskFlowStrange, 4);\r
-};\r
+ public:\r
+  enum Especie {kKZE=0,kLDA=1,kLDABAR=2,kLDAALL=3,kCHARGED=90,kPION=91,kKAON=92,kPROTON=93};\r
+  AliAnalysisTaskFlowStrange();\r
+  AliAnalysisTaskFlowStrange(const Char_t *name);\r
+  virtual ~AliAnalysisTaskFlowStrange();\r
+  virtual void UserCreateOutputObjects();\r
+  virtual void Exec(Option_t*);\r
+  virtual void UserExec(Option_t *);\r
+  virtual void Terminate(Option_t *);\r
+  virtual void NotifyRun();\r
+\r
+  void MyUserExec(Option_t *);\r
+  void SetDebug(Int_t val=1) {fDebug = val;}\r
+  void SetQAlevel(Int_t qa) {fQAlevel = qa;}\r
+\r
+  void SetMass(Int_t n, Double_t m, Double_t M) {fMassBins=n;fMinMass=m;fMaxMass=M;}\r
+\r
+  void SetpA() {fRunOnpA = kTRUE;  fRunOnpp = kFALSE;}\r
+  void Setpp() {fRunOnpA = kFALSE; fRunOnpp = kTRUE; }\r
+  void SetK0L0(Int_t specie) {fSpecie=specie;}\r
+  void SetOnline(Bool_t val) {fOnline=val;}\r
+  void SetHomemade(Bool_t val) {fHomemade=val;}\r
+  void SetExcludeTPCEdges(Bool_t value) {fExcludeTPCEdges=value;}\r
+  void SetCentralityRange(TString val, Int_t m, Int_t M) {fCentMethod=val; fCentPerMin=m; fCentPerMax=M;}\r
+  void SetReadESD(Bool_t val) {fReadESD=val;}\r
+  void SetReadMC(Bool_t val) {fReadMC=val;}\r
+  void SetAvoidExec(Bool_t val) {fAvoidExec=val;}\r
+  void SetSkipSelection(Bool_t val) {fSkipSelection=val;}\r
+  void SetSkipFlow(Bool_t val) {fSkipFlow=val;}\r
+  void SetUseFlowPackage(Bool_t val) {fUseFP=val;}\r
+  void SetExtraEventRejection(Bool_t val) {fExtraEventRejection=val;}\r
+\r
+  void SetWhichPsi(Int_t val) {fWhichPsi=val;}\r
+  void SetStoreVZEResponse(Bool_t val) {fVZEsave=val;}\r
+  void LoadVZEResponse(TList *val) {fVZEload=val;}\r
+  \r
+  void SetRFPFilterBit(Int_t val) {fRFPFilterBit=val;}\r
+  void SetRFPMinPt(Double_t val) {fRFPminPt=val;}\r
+  void SetRFPMaxPt(Double_t val) {fRFPmaxPt=val;}\r
+  void SetRFPMinEta(Double_t val) {fRFPminEta=val;}\r
+  void SetRFPMaxEta(Double_t val) {fRFPmaxEta=val;}\r
+  void SetRFPTPCSignal(Double_t val) {fRFPTPCsignal=val;}\r
+  void SetRFPMaxIPxy(Double_t val) {fRFPmaxIPxy=val;}\r
+  void SetRFPMaxIPz(Double_t val) {fRFPmaxIPz=val;}\r
+  void SetRFPMinTPCCls(Int_t val) {fRFPTPCncls=val;}\r
+\r
+  void SetDauMinNClsTPC(Int_t val) {fDaughterMinNClsTPC=val;}\r
+  void SetDauMinXRows(Int_t val) {fDaughterMinXRows=val;}\r
+  void SetDauMaxChi2PerNClsTPC(Double_t val) {fDaughterMaxChi2PerNClsTPC=val;}\r
+  void SetDauMinXRowsOverNClsFTPC(Double_t val) {fDaughterMinXRowsOverNClsFTPC=val;}\r
+  void SetDauMinEta(Double_t val) {fDaughterMinEta=val;}\r
+  void SetDauMaxEta(Double_t val) {fDaughterMaxEta=val;}\r
+  void SetDauMinPt(Double_t val) {fDaughterMinPt=val;}\r
+  void SetDauMinImpactParameterXY(Double_t val) {fDaughterMinImpactParameterXY=val;}\r
+  void SetDauMaxNSigmaPID(Double_t val) {fDaughterMaxNSigmaPID=val;}\r
+\r
+  void SetMaxRapidity(Double_t val) {fDecayMaxRapidity=val;}\r
+  void SetMinEta(Double_t val) {fDecayMinEta=val;}\r
+  void SetMaxEta(Double_t val) {fDecayMaxEta=val;}\r
+  void SetMinPt(Double_t val) {fDecayMinPt=val;}\r
+  void SetMaxDCAdaughters(Double_t val) {fDecayMaxDCAdaughters=val;}\r
+  void SetMinCosinePointingAngleXY(Double_t val) {fDecayMinCosinePointingAngleXY=val;}\r
+  void SetMinQt(Double_t val, Bool_t val2=kTRUE) {fDecayMinQt=val; fDecayAPCutPie=val2;}\r
+  void SetMinRadXY(Double_t val) {fDecayMinRadXY=val;}\r
+  void SetMaxDecayLength(Double_t val) {fDecayMaxDecayLength=val;}\r
+  void SetMaxProductIPXY(Double_t val) {fDecayMaxProductIPXY=val;}\r
+\r
+ private:\r
+  AliAnalysisTaskFlowStrange(const AliAnalysisTaskFlowStrange& analysisTask);\r
+  AliAnalysisTaskFlowStrange& operator=(const AliAnalysisTaskFlowStrange& analysisTask);\r
+  void AddQAEvents();\r
+  void AddQACandidates();\r
+\r
+  void AddEventSpy();\r
+  Bool_t AcceptAAEvent(AliESDEvent *tESD);\r
+  Bool_t AcceptAAEvent(AliAODEvent *tAOD);\r
+  Bool_t AcceptPPEvent(AliAODEvent *tAOD);\r
+  Bool_t AcceptPAEvent(AliAODEvent *tAOD);\r
+  Int_t GetReferenceMultiplicity();\r
+\r
+  void ReadStack(TClonesArray* mcArray);\r
+  void ReadFromESD(AliESDEvent *tESD);\r
+  void ReadFromAODv0(AliAODEvent *tAOD);\r
+\r
+  void ChargeParticles(AliAODEvent *tAOD);\r
+\r
+  void ComputePsi2(AliVEvent *event);\r
+  void AddMakeQSpy();\r
+  void MakeQVZE(AliVEvent *event,Double_t &qxa,Double_t &qya,Double_t &qwa,Double_t &qxb,Double_t &qyb,Double_t &qwb);\r
+  void MakeQTPC(AliESDEvent *event,Double_t &qxa,Double_t &qya,Double_t &qwa,Double_t &qxb,Double_t &qyb,Double_t &qwb);\r
+  void MakeQTPC(AliAODEvent *event,Double_t &qxa,Double_t &qya,Double_t &qwa,Double_t &qxb,Double_t &qyb,Double_t &qwb);\r
+  void AddTPCRFPSpy(TList *val);\r
+  Bool_t PassesRFPTPCCuts(AliESDtrack *myTrack, Double_t aodChi2NDF=0, Float_t aodipxy=0, Float_t aodipz=0);\r
+  void MakeQVectors();\r
+\r
+  void AddCandidates();\r
+  void ReadEventPlanesFromAOD(AliAODEvent *tAOD);\r
+\r
+  Double_t CosThetaPointXY(AliESDv0 *me, const AliVVertex *vtx);\r
+  Double_t CosThetaPointXY(AliAODv0 *me, const AliVVertex *vtx);\r
+  Double_t DecayLengthXY(AliESDv0 *me, const AliVVertex *vtx);\r
+  Double_t DecayLengthXY(AliAODv0 *me, const AliVVertex *vtx);\r
+  Double_t DecayLength(AliESDv0 *me, const AliVVertex *vtx);\r
+  Double_t DecayLength(AliAODv0 *me, const AliVVertex *vtx);\r
+\r
+  void AddMCParticleSpy(TList *val);\r
+  void FillMCParticleSpy(TString listName, AliAODMCParticle *par);\r
+  void FillMCParticleSpy(TString listName, TParticle *par);\r
+\r
+  void AddCandidatesSpy(TList *val);\r
+  void FillCandidateSpy(TString listName);\r
+\r
+  void AddTracksSpy(TList *val);\r
+  void FillTrackSpy(TString listName);\r
+\r
+  void MakeFilterBits();\r
+  Bool_t PassesFilterBit(AliESDtrack *me);\r
+\r
+  void LoadTrack(AliESDtrack *myTrack, Double_t aodChi2NDF=0);\r
+  Bool_t AcceptDaughter();\r
+  Bool_t AcceptCandidate();\r
+  Bool_t PassesPIDCuts(AliESDtrack *myTrack, AliPID::EParticleType pid=AliPID::kProton);\r
 \r
+  Bool_t IsAtTPCEdge(Double_t phi,Double_t pt,Int_t charge,Double_t b);\r
+\r
+  void MakeTrack();\r
+  void PushBackFlowTrack(AliFlowEvent *event, Double_t pt, Double_t phi, Double_t eta, Double_t we, Int_t id);\r
+\r
+  Double_t GetWDist(const AliVVertex* v0, const AliVVertex* v1);\r
+  Bool_t plpMV(const AliVEvent *event);\r
+\r
+  void LoadVZEROResponse();\r
+  void AddVZEROResponse();\r
+  void SaveVZEROResponse();\r
+  void AddVZEQA();\r
+  void SaveVZEROQA();\r
+\r
+  Int_t RefMultTPC();\r
+  Int_t RefMultGlobal();\r
+\r
+  AliPIDResponse *fPIDResponse; //! PID response object\r
+  AliESDtrackCuts *fFB1;        // filterbit cut equivalent\r
+  AliESDtrackCuts *fFB1024;     // filterbit cut equivalent\r
+  AliFlowEvent   *fTPCevent;    // flow event (needed here due to ev selection)\r
+  AliFlowEvent   *fVZEevent;    // flow event (needed here due to ev selection)\r
+  TObjArray      *fCandidates;  // array of selected candidates\r
+  TList          *fList;        // stores the final list of output histograms\r
+\r
+  Int_t fDebug;   // debug level\r
+  Int_t fQAlevel; // QA plots\r
+\r
+  Bool_t fReadESD;       // move back to ESD\r
+  Bool_t fReadMC;        // read MC files\r
+  Bool_t fAvoidExec;     // avoids Exec\r
+  Bool_t fSkipSelection; // skip decay finder\r
+  Bool_t fSkipFlow;      // skip flow-wise code\r
+  Bool_t fUseFP;         // flow package?\r
+  Bool_t fRunOnpA;       // make task compatible with pA event selection\r
+  Bool_t fRunOnpp;       // make task compatible with pp event selection\r
+  Bool_t fExtraEventRejection; // to reject pile up\r
+  TString  fCentMethod; // CC\r
+  Int_t    fCentPerMin; // CC\r
+  Int_t    fCentPerMax; // CC\r
+  Double_t fThisCent;   // CC\r
+\r
+  Bool_t fExcludeTPCEdges; // exclude TPC edges from single track selection\r
+\r
+  Int_t  fSpecie;   // K0=>0 L0=>1\r
+  Bool_t fOnline;   // change into online v0 finder\r
+  Bool_t fHomemade; // homemade v0 finder\r
+\r
+  Int_t fWhichPsi;  // detector for Psi2\r
+  Bool_t  fVZEsave; // make vze response\r
+  TList  *fVZEload; // adress to calibration file\r
+  TH2D   *fVZEResponse; // vze response vs centrality class\r
+  TList  *fVZEQA;   // adress to qalist\r
+  Double_t fPsi2;   // best estimation of Psi2\r
+\r
+  Int_t    fMassBins; // opens\r
+  Double_t fMinMass;  // mass\r
+  Double_t fMaxMass;  // window\r
+\r
+  Int_t fRFPFilterBit;    // RFP TPC\r
+  Double_t fRFPminPt;     // RFP TPC\r
+  Double_t fRFPmaxPt;     // RFP TPC\r
+  Double_t fRFPminEta;    // RFP TPC\r
+  Double_t fRFPmaxEta;    // RFP TPC\r
+  Double_t fRFPTPCsignal; // RFP TPC\r
+  Double_t fRFPmaxIPxy;   // RFP TPC\r
+  Double_t fRFPmaxIPz;    // RFP TPC\r
+  Int_t fRFPTPCncls;      // RFP TPC\r
+\r
+  Double_t fDecayMass;                  // DECAY\r
+  Double_t fDecayPhi;                   // DECAY\r
+  Double_t fDecayEta;                   // DECAY\r
+  Double_t fDecayPt;                    // DECAY\r
+  Double_t fDecayDCAdaughters;          // DECAY\r
+  Double_t fDecayCosinePointingAngleXY; // DECAY\r
+  Double_t fDecayRadXY;                 // DECAY\r
+  Double_t fDecayDecayLength;           // DECAY\r
+  Double_t fDecayQt;                    // DECAY\r
+  Double_t fDecayAlpha;                 // DECAY\r
+  Double_t fDecayRapidity;              // DECAY\r
+  Double_t fDecayProductIPXY;           // DECAY\r
+  Int_t    fDecayIDneg;                 // DECAY\r
+  Int_t    fDecayIDpos;                 // DECAY\r
+\r
+  Double_t fDecayMinEta;                   // DECAY CUTS\r
+  Double_t fDecayMaxEta;                   // DECAY CUTS\r
+  Double_t fDecayMinPt;                    // DECAY CUTS\r
+  Double_t fDecayMaxDCAdaughters;          // DECAY CUTS\r
+  Double_t fDecayMinCosinePointingAngleXY; // DECAY CUTS\r
+  Double_t fDecayMinQt;                    // DECAY CUTS\r
+  Bool_t   fDecayAPCutPie;                 // DECAY CUTS\r
+  Double_t fDecayMinRadXY;                 // DECAY CUTS\r
+  Double_t fDecayMaxDecayLength;           // DECAY CUTS\r
+  Double_t fDecayMaxProductIPXY;           // DECAY CUTS\r
+  Double_t fDecayMaxRapidity;              // DECAY CUTS\r
+\r
+  Double_t fDaughterPhi;               // DAUGHTER\r
+  Double_t fDaughterEta;               // DAUGHTER\r
+  Double_t fDaughterPt;                // DAUGHTER\r
+  Int_t    fDaughterNClsTPC;           // DAUGHTER\r
+  Int_t    fDaughterCharge;            // DAUGHTER\r
+  Int_t    fDaughterNFClsTPC;          // DAUGHTER\r
+  Int_t    fDaughterNSClsTPC;          // DAUGHTER\r
+  Double_t fDaughterChi2PerNClsTPC;    // DAUGHTER\r
+  Double_t fDaughterXRows;             // DAUGHTER\r
+  Float_t  fDaughterImpactParameterXY; // DAUGHTER\r
+  Float_t  fDaughterImpactParameterZ;  // DAUGHTER\r
+  UInt_t   fDaughterStatus;            // DAUGHTER\r
+  Double_t fDaughterNSigmaPID;         // DAUGHTER\r
+  Int_t    fDaughterKinkIndex;         // DAUGHTER\r
+\r
+  Double_t fDaughterMinEta;               // DAUGHTER CUTS\r
+  Double_t fDaughterMaxEta;               // DAUGHTER CUTS\r
+  Double_t fDaughterMinPt;                // DAUGHTER CUTS\r
+  Int_t    fDaughterMinNClsTPC;           // DAUGHTER CUTS\r
+  Int_t    fDaughterMinXRows;             // DAUGHTER CUTS\r
+  Double_t fDaughterMaxChi2PerNClsTPC;    // DAUGHTER CUTS\r
+  Double_t fDaughterMinXRowsOverNClsFTPC; // DAUGHTER CUTS\r
+  Double_t fDaughterMinImpactParameterXY; // DAUGHTER CUTS\r
+  Double_t fDaughterMaxNSigmaPID;         // DAUGHTER CUTS\r
+\r
+  ClassDef(AliAnalysisTaskFlowStrange, 5);\r
+};\r
 #endif\r
index eef318c..5a3fb70 100644 (file)
-// ONE PRECONF WAGON\r
-void AddTaskFlowStrange(int trigger, float centrMin, float centrMax, int set, TString folderName="myFolder", TString suffixName="mySuffix", \r
-                       int specie=0, char* MULT="V0M", int harmonic=2, int matchMC=-1, bool doQC=true, bool doSPTPC=true, bool doSPVZE=true,\r
-                       bool doQA=false, bool useFlowEventCuts=true,\r
-                       bool runpp=false, bool runpA=false, bool doExtraQA=false, TString calibfile="alien:///alice/cern.ch/user/c/cperez/calib/calibPbPb2010.root") {\r
-  Double_t c[11];\r
-  switch(set) {\r
-  case(0): // Filtering cuts //\r
-    c[0]=0; c[1]=+1; c[2]=+0.500; c[3]=0;    c[4]=1e+6; c[5]=0;    c[6]=-1;   c[7]=+1;   c[8]=1e+6; c[9]=1e+6; c[10]=0;\r
-    break;\r
-  case(1): // Topological cuts // \r
-    c[0]=0; c[1]=+1; c[2]=+0.998; c[3]=+0.1; c[4]=0;    c[5]=+0.2; c[6]=-0.8; c[7]=+0.8; c[8]=+3.0; c[9]=+3.0; c[10]=5;\r
-    break;\r
-  default:\r
-    return;\r
-  }\r
-  AddTaskFlowStrange(trigger, centrMin, centrMax, folderName, suffixName, specie,\r
-                    c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],\r
-                    MULT, harmonic, matchMC, doQC, doSPTPC, doSPVZE, doQA, useFlowEventCuts,\r
-                    runpp, runpA, doExtraQA, calibfile);\r
-}\r
-// ALL CENTRALITIES\r
-void AddTaskFlowStrange(int trigger, TString folderName="myFolder", TString suffix="mySuffix", int specie=0,\r
-                        double cut0, double cut1, double cut2, double cut3, double cut4, double cut5, double cut6, double cut7, double cut8,\r
-                        double cut9, double cut10, char* MULT="V0M", int harmonic=2, int matchMC=-1,\r
-                        bool doQC=true, bool doSPTPC=true, bool doSPVZE=true, bool doQA=false, bool useFlowEventCuts=true,\r
-                       bool runpp=false, bool runpA=false, bool doExtraQA=false, TString calibfile="alien:///alice/cern.ch/user/c/cperez/calib/calibPbPb2010.root") {\r
-  int centMin[8] = {00,05,10,20,30,40,50,60};\r
-  int centMax[8] = {05,10,20,30,40,50,60,80};\r
-  TString particle="none";\r
-  if(specie==0) particle="kze";\r
-  if(specie==1) particle="lda";\r
-  if(specie==90) particle="kch";\r
-  TString name;\r
-  for(int i=0; i!=8; ++i) {\r
-    name = Form("%s%02d%02d%s",particle.Data(),centMin[i],centMax[i],suffix.Data());\r
-    AddTaskFlowStrange(trigger, centMin[i], centMax[i], folderName, name, specie,\r
-                      cut0, cut1, cut2, cut3, cut4, cut5, cut6, cut7, cut8, cut9, cut10, MULT, harmonic, matchMC,\r
-                      doQC, doSPTPC, doSPVZE, doQA, useFlowEventCuts,\r
-                      runpp, runpA, doExtraQA, calibfile);\r
+UInt_t gbTrigger;\r
+Bool_t gbReadESD;\r
+Bool_t gbReadMC;\r
+Int_t gbMatchMC;\r
+Bool_t gbAvoidExec;\r
+Bool_t gbExtraEventCut=kFALSE;\r
+TString gbCentMethod;\r
+Int_t gbCentPerMin,gbCentPerMax;\r
+Bool_t gbRunPP;\r
+Bool_t gbRunPA;\r
+Int_t gbSpecie;\r
+Bool_t gbHomemade;\r
+Bool_t gbOnline;\r
+Int_t gbMinNClsTPC;\r
+Int_t gbMinXRows;\r
+Double_t gbMaxChi2PerNClsTPC;\r
+Double_t gbMinXRowsOverNClsFTPC;\r
+Double_t gbMinEta;\r
+Double_t gbMaxEta;\r
+Double_t gbMinPt;\r
+Double_t gbMinImpactParameterXY;\r
+Double_t gbMaxNSigmaPID;\r
+Double_t gbMaxRapidity;\r
+Double_t gbMaxDCAdaughters;\r
+Double_t gbMinCosinePointingAngleXY;\r
+Double_t gbMinQt;\r
+Bool_t   gbQtPie=kTRUE;\r
+Double_t gbMinRadXY;\r
+Double_t gbMaxDecayLength;\r
+Double_t gbMaxProductIPXY;\r
+Int_t gbDebug=0;\r
+Int_t gbQA;\r
+TString gbFolder="FlowStrange";\r
+TString gbSuffix="kze";\r
+TString gbStamp;\r
+Int_t gbRFPFilterBit=1;\r
+Double_t gbRFPminPt=0.2;\r
+Double_t gbRFPmaxPt=5.0;\r
+Double_t gbRFPminEta=-0.8;\r
+Double_t gbRFPmaxEta=+0.8;\r
+Double_t gbRFPTPCsignal=10;\r
+Double_t gbRFPmaxIPxy=2.4;\r
+Double_t gbRFPmaxIPz=3.2;\r
+Int_t gbRFPTPCncls=70;\r
+\r
+Bool_t gbAllCC=0;\r
+Bool_t gbSkipSelection=0;\r
+Bool_t gbSkipFlow=0;\r
+Int_t gbWhichPsi=2;\r
+Bool_t gbFlowPackage=1;\r
+Bool_t gbSPVZE=1;//1\r
+Bool_t gbSPTPC=1;\r
+Bool_t gbQCTPC=1;//1\r
+Int_t gbHarmonic=2;\r
+TString gbVZEload="";\r
+Bool_t gbVZEsave=0;\r
+\r
+\r
+void AddTaskFlowStrange(TString configFile) {\r
+  SFT_ReadConfig(configFile);\r
+  if(gbAllCC) {\r
+    int centMin[9] = {00,05,10,20,30,40,50,60,70};\r
+    int centMax[9] = {05,10,20,30,40,50,60,70,80};\r
+    int ncent=9;\r
+    if(gbRunPP) {\r
+      ncent=3;\r
+      centMin[0]=10; centMax[0]=30;\r
+      centMin[1]=30; centMax[1]=50;\r
+      centMin[2]=0; centMax[2]=100;\r
+    } else if(gbRunPA) {\r
+      ncent=4;\r
+      centMin[0]=00; centMax[0]=20;\r
+      centMin[1]=20; centMax[1]=40;\r
+      centMin[2]=40; centMax[2]=60;\r
+      centMin[3]=60; centMax[3]=80;\r
+    } else {\r
+    }\r
+    TString antSuffix = gbSuffix;\r
+    for(int cc=0; cc!=ncent; ++cc) {\r
+      gbCentPerMin = centMin[cc];\r
+      gbCentPerMax = centMax[cc];\r
+      gbSuffix = Form("%s%d%d",antSuffix.Data(),gbCentPerMin,gbCentPerMax);\r
+      AddTaskFlowStrange();\r
+    }\r
+  } else {\r
+    AddTaskFlowStrange();\r
   }\r
 }\r
-// ONE WAGON\r
-void AddTaskFlowStrange(int trigger, float centrMin, float centrMax, TString folderName="myFolder", TString suffixName="mySuffix", int specie=0, \r
-                       double cut0, double cut1, double cut2, double cut3, double cut4, double cut5, double cut6, double cut7, double cut8,\r
-                       double cut9, double cut10, char* MULT="V0M", int harmonic=2, int matchMC=-1, \r
-                       bool doQC=true, bool doSPTPC=true, bool doSPVZE=true, bool doQA=false, bool useFlowEventCuts=true, \r
-                       bool runpp=false, bool runpA=false, bool doExtraQA=false, TString calibfile="alien:///alice/cern.ch/user/c/cperez/calib/calibPbPb2010.root") {\r
+void AddTaskFlowStrange() {\r
+  SFT_PrintConfig();\r
+\r
   TString fileName = AliAnalysisManager::GetCommonFileName();\r
   fileName.ReplaceAll(".root","");\r
-\r
-  //-E-V-E-N-T- -c-u-t-s--------------------------------------------------------\r
-  AliFlowEventCuts* cutsEvent = new AliFlowEventCuts(Form("event_cuts_%s",suffixName.Data()));\r
-  cutsEvent->SetCentralityPercentileRange(centrMin,centrMax);\r
-  if(MULT=="V0M")\r
-    cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kV0);\r
-  else\r
-    cutsEvent->SetCentralityPercentileMethod(AliFlowEventCuts::kTPConly);\r
-  cutsEvent->SetRefMultMethod(AliFlowEventCuts::kSPDtracklets);\r
-  cutsEvent->SetNContributorsRange(2);\r
-  cutsEvent->SetPrimaryVertexZrange(-10.0,+10.0);\r
-  cutsEvent->SetCutTPCmultiplicityOutliers();\r
-\r
-  //-R-P---c-u-t-s--------------------------------------------------------------\r
-  AliFlowTrackCuts *cutsRPTPC = AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts();\r
-  cutsRPTPC->SetParamType( AliFlowTrackCuts::kGlobal );\r
-  cutsRPTPC->SetAODfilterBit(1); // for AOD compatibility\r
-  AliFlowTrackCuts *cutsRPVZE = AliFlowTrackCuts::GetStandardVZEROOnlyTrackCuts();\r
-\r
-  //-D-A-U-G-H-T-E-R-S---c-u-t-s------------------------------------------------\r
-  AliESDtrackCuts* cutsDaughter = new AliESDtrackCuts(Form("daughter_cuts_%s",suffixName.Data()) );\r
-  cutsDaughter->SetPtRange(0.2,12.0);\r
-  cutsDaughter->SetEtaRange(-0.8, 0.8 );\r
-  cutsDaughter->SetMinNClustersTPC(70);\r
-  cutsDaughter->SetMaxChi2PerClusterTPC(4.0);\r
-  cutsDaughter->SetRequireTPCRefit(kTRUE);\r
-  cutsDaughter->SetAcceptKinkDaughters(kFALSE);\r
+  gbStamp = gbFolder + gbSuffix;\r
 \r
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
   AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();\r
 \r
   //-----------------STRANGE TASK----------------------------\r
-  AliAnalysisTaskFlowStrange *taskSel = new AliAnalysisTaskFlowStrange(Form("Strange_%s",suffixName.Data()),\r
-                                                                      cutsEvent, cutsRPTPC, cutsRPVZE,\r
-                                                                      cutsDaughter );\r
-  taskSel->SelectCollisionCandidates(trigger);\r
-  Double_t cuts[11];\r
-  cuts[0]=cut0; cuts[1]=cut1; cuts[2]=cut2; cuts[3]=cut3; cuts[4]=cut4; cuts[5]=cut5; cuts[6]=cut6; cuts[7]=cut7; cuts[8]=cut8; cuts[9]=cut9; cuts[10]=cut10;\r
-  taskSel->SetCuts(cuts);\r
-  taskSel->SetQA(doQA);\r
-  taskSel->SetK0L0(specie);\r
-  taskSel->SetMCmatch(matchMC);\r
-  taskSel->SetUseEventSelection(useFlowEventCuts);\r
-  taskSel->SetCommonConstants( SFT_MassBins(specie), SFT_MinMass(specie), SFT_MaxMass(specie) );\r
-  taskSel->SetExtraQA( doExtraQA );\r
-  taskSel->Setpp( runpp );\r
-  taskSel->SetpA( runpA );\r
-  TFile *filecal = TFile::Open( calibfile.Data() );\r
-  if( (!filecal) || ( filecal && !filecal->IsOpen()) ){\r
-    printf("AddTaskStrange -> no complementary calibration file needed? Very good.\n");\r
-  } else {\r
-    TList *myCalib = (TList*)filecal->Get("calibration");\r
-    if(myCalib) taskSel->SetCalib(myCalib);\r
+  AliAnalysisTaskFlowStrange *taskSel = new AliAnalysisTaskFlowStrange(Form("FS_%s",gbStamp.Data()) );\r
+  taskSel->SelectCollisionCandidates(gbTrigger);\r
+  taskSel->SetReadESD(gbReadESD);\r
+  taskSel->SetReadMC(gbReadMC);\r
+  taskSel->SetAvoidExec(gbAvoidExec);\r
+  taskSel->SetSkipSelection(gbSkipSelection);\r
+  taskSel->SetSkipFlow(gbSkipFlow);\r
+  taskSel->SetExtraEventRejection(gbExtraEventCut);\r
+  taskSel->SetCentralityRange(gbCentMethod,gbCentPerMin,gbCentPerMax);\r
+  if(gbRunPP) taskSel->Setpp();\r
+  if(gbRunPA) taskSel->SetpA();\r
+  taskSel->SetDebug(gbDebug);\r
+  taskSel->SetK0L0(gbSpecie);\r
+  taskSel->SetOnline( gbOnline );\r
+  taskSel->SetMass( SFT_MassBins(gbSpecie),\r
+                    SFT_MinMass(gbSpecie),\r
+                    SFT_MaxMass(gbSpecie) );\r
+\r
+  taskSel->SetWhichPsi(gbWhichPsi);\r
+  taskSel->SetRFPFilterBit(gbRFPFilterBit);\r
+  taskSel->SetRFPMinPt(gbRFPminPt);\r
+  taskSel->SetRFPMaxPt(gbRFPmaxPt);\r
+  taskSel->SetRFPMinEta(gbRFPminEta);\r
+  taskSel->SetRFPMaxEta(gbRFPmaxEta);\r
+  taskSel->SetRFPTPCSignal(gbRFPTPCsignal);\r
+  taskSel->SetRFPMaxIPxy(gbRFPmaxIPxy);\r
+  taskSel->SetRFPMaxIPz(gbRFPmaxIPz);\r
+  taskSel->SetRFPMinTPCCls(gbRFPTPCncls);\r
+\r
+  taskSel->SetDauMinNClsTPC(gbMinNClsTPC);\r
+  taskSel->SetDauMaxChi2PerNClsTPC(gbMaxChi2PerNClsTPC);\r
+  taskSel->SetDauMinXRowsOverNClsFTPC(gbMinXRowsOverNClsFTPC);\r
+  taskSel->SetDauMinEta(gbMinEta);\r
+  taskSel->SetDauMaxEta(gbMaxEta);\r
+  taskSel->SetDauMinPt(gbMinPt);\r
+  taskSel->SetDauMinImpactParameterXY(gbMinImpactParameterXY);\r
+  taskSel->SetDauMaxNSigmaPID(gbMaxNSigmaPID);\r
+\r
+  taskSel->SetMaxRapidity(gbMaxRapidity);\r
+  taskSel->SetMaxDCAdaughters(gbMaxDCAdaughters);\r
+  taskSel->SetMinCosinePointingAngleXY(gbMinCosinePointingAngleXY);\r
+  taskSel->SetMinQt(gbMinQt,gbQtPie);\r
+  taskSel->SetMinRadXY(gbMinRadXY);\r
+  taskSel->SetMaxDecayLength(gbMaxDecayLength);\r
+  taskSel->SetMaxProductIPXY(gbMaxProductIPXY);\r
+  taskSel->SetMinEta(gbMinEta);\r
+  taskSel->SetMaxEta(gbMaxEta);\r
+  taskSel->SetMinPt(gbMinPt);\r
+  taskSel->SetUseFlowPackage(gbFlowPackage);\r
+\r
+  taskSel->SetQAlevel(gbQA);\r
+  if(gbVZEload.Length()>4) {\r
+    TFile *ocalib = TFile::Open(gbVZEload);\r
+    if(ocalib->IsOpen()) {\r
+      TList *vzero = ocalib->Get("VZECALIB");\r
+      taskSel->LoadVZEResponse(vzero);\r
+    } else {\r
+      printf("ADDTASKFLOWSTRANGE COULD NOT OPEN %s. NO VZE CALIBRATION LOADED!\n",gbVZEload.Data());\r
+    }\r
   }\r
-  AliAnalysisDataContainer *cOutHist = mgr->CreateContainer(Form("OutHistos_%s",suffixName.Data()),\r
+\r
+  taskSel->SetStoreVZEResponse(gbVZEsave);\r
+  AliAnalysisDataContainer *cOutHist = mgr->CreateContainer(Form("FS_OH_%s",gbStamp.Data()),\r
                                                            TList::Class(),\r
                                                            AliAnalysisManager::kOutputContainer,\r
                                                            Form("%s.root:Selector_%s",fileName.Data(),\r
-                                                                folderName.Data()));\r
-  AliAnalysisDataContainer *exc_TPC = mgr->CreateContainer( Form("TPCEventWithCandidates_%s",suffixName.Data()),\r
+                                                                gbFolder.Data()));\r
+  AliAnalysisDataContainer *exc_TPC = mgr->CreateContainer( Form("FS_TPC_%s",gbStamp.Data()),\r
                                                             AliFlowEventSimple::Class(),\r
                                                             AliAnalysisManager::kExchangeContainer );\r
-  AliAnalysisDataContainer *exc_VZE = mgr->CreateContainer( Form("VZEEventWithCandidates_%s",suffixName.Data()),\r
+  AliAnalysisDataContainer *exc_VZE = mgr->CreateContainer( Form("FS_VZE_%s",gbStamp.Data()),\r
                                                             AliFlowEventSimple::Class(),\r
                                                             AliAnalysisManager::kExchangeContainer );\r
   mgr->AddTask(taskSel);\r
   mgr->ConnectInput (taskSel,0,cinput1);\r
-  mgr->ConnectOutput(taskSel,1,exc_TPC);\r
-  mgr->ConnectOutput(taskSel,2,exc_VZE);\r
-  mgr->ConnectOutput(taskSel,3,cOutHist);\r
-\r
-  if( (!doQC) && (!doSPVZE) && (!doSPVZE) ) return;\r
+  mgr->ConnectOutput(taskSel,1,cOutHist);\r
+  mgr->ConnectOutput(taskSel,2,exc_TPC);\r
+  mgr->ConnectOutput(taskSel,3,exc_VZE);\r
 \r
-  //-------------------FLOW TASKS----------------------------\r
-  AliFlowTrackSimpleCuts *filter[12], *filterhf[12][2]; // MASS BANDS\r
-  for(int mb=0; mb!=12; ++mb) {\r
+  if(!gbFlowPackage) return;\r
+  if( (!gbQCTPC) && (!gbSPVZE) && (!gbSPTPC) ) return;\r
+  //-------------------FLOWPACKAGE TASKS----------------------------\r
+  AliFlowTrackSimpleCuts *filter[20], *filterhf[20][2]; // MASS BANDS\r
+  for(int mb=0; mb!=SFT_MassBands(gbSpecie); ++mb) {\r
     filter[mb] = new AliFlowTrackSimpleCuts( Form("Filter_MB%d",mb) );\r
     filter[mb]->SetEtaMin( -0.8 ); filter[mb]->SetEtaMax( +0.8 );\r
-    filter[mb]->SetMassMin( SFT_MassBandLowEdge(specie,mb) ); filter[mb]->SetMassMax( SFT_MassBandLowEdge(specie,mb+1) );\r
-\r
+    filter[mb]->SetMassMin( SFT_MassBandLowEdge(gbSpecie,mb) ); filter[mb]->SetMassMax( SFT_MassBandLowEdge(gbSpecie,mb+1) );\r
+    //half window for POIs\r
     filterhf[mb][0] = new AliFlowTrackSimpleCuts( Form("Filterhf0_MB%d",mb) );\r
-    filterhf[mb][0]->SetEtaMin( 0.0 ); filterhf[mb][0]->SetEtaMax( +0.8 );\r
-    filterhf[mb][0]->SetMassMin( SFT_MassBandLowEdge(specie,mb) ); filterhf[mb][0]->SetMassMax( SFT_MassBandLowEdge(specie,mb+1) );\r
-\r
+    filterhf[mb][0]->SetEtaMin( +0.0 ); filterhf[mb][0]->SetEtaMax( +0.8 );\r
+    filterhf[mb][0]->SetMassMin( SFT_MassBandLowEdge(gbSpecie,mb) ); filterhf[mb][0]->SetMassMax( SFT_MassBandLowEdge(gbSpecie,mb+1) );\r
     filterhf[mb][1] = new AliFlowTrackSimpleCuts( Form("Filterhf1_MB%d",mb) );\r
-    filterhf[mb][1]->SetEtaMin( -0.8 ); filterhf[mb][1]->SetEtaMax( 0.0 );\r
-    filterhf[mb][1]->SetMassMin( SFT_MassBandLowEdge(specie,mb) ); filterhf[mb][1]->SetMassMax( SFT_MassBandLowEdge(specie,mb+1) );\r
-\r
-    if(doQC) {\r
-      SFT_AddQCmethod( Form("QCTPCMB%d",mb), folderName.Data(), suffixName.Data(), harmonic, exc_TPC, filter[mb]); // QC TPC\r
+    filterhf[mb][1]->SetEtaMin( -0.8 ); filterhf[mb][1]->SetEtaMax( -0.0 );\r
+    filterhf[mb][1]->SetMassMin( SFT_MassBandLowEdge(gbSpecie,mb) ); filterhf[mb][1]->SetMassMax( SFT_MassBandLowEdge(gbSpecie,mb+1) );\r
+    if(gbQCTPC) {\r
+      SFT_AddQCmethod( Form("QCTPCMB%d",mb), exc_TPC, filter[mb]); // QC TPC\r
     }\r
-    if(doSPTPC) {\r
-      SFT_AddSPmethod( Form("SPTPCMB%d",mb), folderName.Data(), suffixName.Data(), harmonic, exc_TPC, filterhf[mb][0], "Qa" ); // SP TPC Qa\r
-      SFT_AddSPmethod( Form("SPTPCMB%d",mb), folderName.Data(), suffixName.Data(), harmonic, exc_TPC, filterhf[mb][1], "Qb" ); // SP TPC Qb\r
+    if(gbSPTPC) {\r
+      SFT_AddSPmethod( Form("SPTPCMB%d",mb), exc_TPC, filterhf[mb][0], "Qa" ); // SP TPC Qa\r
+      SFT_AddSPmethod( Form("SPTPCMB%d",mb), exc_TPC, filterhf[mb][1], "Qb" ); // SP TPC Qb\r
+      SFT_AddSPmethod( Form("SPTPC2MB%d",mb), exc_TPC, filterhf[mb][0], "Qa", 0.2 ); // SP TPC Qa\r
+      SFT_AddSPmethod( Form("SPTPC2MB%d",mb), exc_TPC, filterhf[mb][1], "Qb", 0.2 ); // SP TPC Qb\r
+      SFT_AddSPmethod( Form("SPTPC4MB%d",mb), exc_TPC, filterhf[mb][0], "Qa", 0.4 ); // SP TPC Qa\r
+      SFT_AddSPmethod( Form("SPTPC4MB%d",mb), exc_TPC, filterhf[mb][1], "Qb", 0.4 ); // SP TPC Qb\r
     }\r
-    if(doSPVZE) {\r
-      SFT_AddSPmethod( Form("SPVZEMB%d",mb), folderName.Data(), suffixName.Data(), harmonic, exc_VZE, filter[mb], "Qa" ); // SP VZE Qa\r
-      SFT_AddSPmethod( Form("SPVZEMB%d",mb), folderName.Data(), suffixName.Data(), harmonic, exc_VZE, filter[mb], "Qb" ); // SP VZE Qa\r
+    if(gbSPVZE) {\r
+      SFT_AddSPmethod( Form("SPVZEMB%d",mb), exc_VZE, filter[mb], "Qa" ); // SP VZE Qa\r
+      SFT_AddSPmethod( Form("SPVZEMB%d",mb), exc_VZE, filter[mb], "Qb" ); // SP VZE Qa\r
     }\r
   }\r
 }\r
 // ADDING QC METHOD\r
-void SFT_AddQCmethod(char *name, TString myFolder, char *thecuts, int harmonic, \r
-                AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL) {\r
+void SFT_AddQCmethod(char *name, AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL) {\r
   TString fileName = AliAnalysisManager::GetCommonFileName();\r
-  myFolder.Append( Form("v%d",harmonic) );\r
-  TString myName = Form("%sv%d_%s",name,harmonic,thecuts);\r
+  TString myFolder = Form("%sv%d",gbFolder.Data(),gbHarmonic);\r
+  TString myName = Form("%sv%d_%s",name,gbHarmonic,gbSuffix.Data());\r
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
   AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer( Form("Filter_%s", myName.Data()),\r
                                                                AliFlowEventSimple::Class(),\r
@@ -168,26 +226,24 @@ void SFT_AddQCmethod(char *name, TString myFolder, char *thecuts, int harmonic,
                                                           Form("%s:FlowStrange_QC_%s",fileName.Data(),myFolder.Data()) );\r
   AliAnalysisTaskQCumulants *tskQC = new AliAnalysisTaskQCumulants( Form("TaskQCumulants_%s",myName.Data()),kFALSE );\r
   tskQC->SetApplyCorrectionForNUA(kTRUE);\r
-  tskQC->SetHarmonic(harmonic);\r
+  tskQC->SetHarmonic(gbHarmonic);\r
   tskQC->SetBookOnlyBasicCCH(kTRUE);\r
   mgr->AddTask(tskQC);\r
   mgr->ConnectInput( tskQC,0,flowEvent2);\r
   mgr->ConnectOutput(tskQC,1,outQC);\r
 }\r
 // ADDING SP METHOD\r
-void SFT_AddSPmethod(char *name, TString myFolder, char *thecuts, int harmonic,\r
-                AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL,\r
-                 char *Qvector) {\r
+void SFT_AddSPmethod(char *name, AliAnalysisDataContainer *flowEvent, AliFlowTrackSimpleCuts *cutsPOI=NULL, char *Qvector, Double_t gap=0.0) {\r
   TString fileName = AliAnalysisManager::GetCommonFileName();\r
-  myFolder.Append( Form("v%d",harmonic) );\r
-  TString myNameSP = Form("%sv%d%s_%s",name,harmonic,Qvector,thecuts);\r
+  TString myFolder = Form("%sv%d",gbFolder.Data(),gbHarmonic);\r
+  TString myNameSP = Form("%sv%d%s_%s",name,gbHarmonic,Qvector,gbSuffix.Data());\r
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
   AliAnalysisDataContainer *flowEvent2 = mgr->CreateContainer( Form("Filter_%s", myNameSP.Data()),\r
                                                                AliFlowEventSimple::Class(),\r
                                                                AliAnalysisManager::kExchangeContainer );\r
   AliAnalysisTaskFilterFE *tskFilter = new AliAnalysisTaskFilterFE( Form("TaskFilter_%s",myNameSP.Data()),\r
                                                                     NULL, cutsPOI);\r
-  tskFilter->SetSubeventEtaRange( -5.0, 0.0, 0.0, +5.0 );\r
+  tskFilter->SetSubeventEtaRange( -5.0, -gap, +gap, +5.0 );\r
   mgr->AddTask(tskFilter);\r
   mgr->ConnectInput( tskFilter,0,flowEvent);\r
   mgr->ConnectOutput(tskFilter,1,flowEvent2);\r
@@ -195,9 +251,10 @@ void SFT_AddSPmethod(char *name, TString myFolder, char *thecuts, int harmonic,
                                                           Form("%s:FlowStrange_SP_%s",fileName.Data(),myFolder.Data()) );\r
   AliAnalysisTaskScalarProduct *tskSP = new AliAnalysisTaskScalarProduct( Form("TaskScalarProduct_%s",myNameSP.Data()),kFALSE);\r
   tskSP->SetApplyCorrectionForNUA(kTRUE);\r
-  tskSP->SetHarmonic(harmonic);\r
+  tskSP->SetHarmonic(gbHarmonic);\r
   tskSP->SetTotalQvector(Qvector);\r
-  tskSP->SetBookOnlyBasicCCH(kTRUE);\r
+  //tskSP->SetBookOnlyBasicCCH(kTRUE);\r
+  tskSP->SetBookOnlyBasicCCH(kFALSE);\r
   mgr->AddTask(tskSP);\r
   mgr->ConnectInput( tskSP,0,flowEvent2);\r
   mgr->ConnectOutput(tskSP,1,outSP);\r
@@ -206,34 +263,44 @@ void SFT_AddSPmethod(char *name, TString myFolder, char *thecuts, int harmonic,
 double SFT_MassBandLowEdge( int nv0, int mb ) {\r
   switch(nv0) {\r
   case(0):\r
-    double lowEdge[13]={ 0.412, 0.440, 0.468, 0.484, 0.492, 0.496, 0.500, 0.504, 0.508, 0.516, 0.532, 0.560, 0.588 };\r
-    break;\r
-  case(1):\r
-    double lowEdge[13]={ 1.075, 1.090, 1.100, 1.108, 1.112, 1.114, 1.116, 1.118, 1.120, 1.124, 1.132, 1.142, 1.167 };\r
+    double lowEdge[14]={0.398, 0.420, 0.444, 0.468, 0.486,\r
+                         0.490, 0.494, 0.498, 0.502, 0.506, \r
+                         0.524, 0.548, 0.572, 0.598};\r
+    //0.492, 0.502, 0.526, 0.550, 0.574, 0.598};\r
     break;\r
   default:\r
-    double lowEdge[13]={ 0.000, 0.100, 0.200, 0.300, 0.400, 0.500, 0.600, 0.700, 0.800, 0.840, 0.860, 0.900, 1.000 };\r
+    double lowEdge[10]={1.084, 1.094, 1.104, 1.114, 1.118, 1.128, 1.138, 1.148, 1.158, 1.168};\r
+    break;\r
   }\r
+  if(nv0>10&&mb==0) return -5;\r
+  if(nv0>10&&mb==1) return +5;\r
   return lowEdge[mb];\r
 }\r
 // MASSBAND HELPER\r
 int SFT_MassBands( int nv0 ) {\r
-  return 12;\r
+  int bands=1;\r
+  switch(nv0) {\r
+  case(0):\r
+    bands = 13;\r
+    break;\r
+  default:\r
+    bands = 9;\r
+  }\r
+  if(nv0>10) bands=1;\r
+  return bands;\r
 }\r
 // MASSBAND HELPER\r
 int SFT_MassBins( int nv0 ) {\r
-  int bins=88;\r
+  int bins=100;\r
   switch(nv0) {\r
-  case(0):\r
-    bins=88;\r
-    break;\r
-  case(1):\r
-    bins=92;\r
+  case(0)://kZERO\r
+    bins=100;\r
     break;\r
-  default:\r
-    bins=13;\r
+  default://LAMBDA\r
+    bins=112;\r
     break;\r
   }\r
+  if(nv0>10) bins=100;//CHARGED\r
   return bins;\r
 }\r
 // MASSBAND HELPER\r
@@ -244,3 +311,177 @@ double SFT_MinMass( int nv0 ) {
 double SFT_MaxMass( int nv0 ) {\r
   return SFT_MassBandLowEdge( nv0, SFT_MassBands(nv0) );\r
 }\r
+void SFT_PrintConfig() {\r
+  printf("***********************************\n");\r
+  printf("* STRANGE FLOW TASK CONFIGURATION *\n");\r
+  printf("* SUFFIX  %8s                *\n", gbSuffix.Data() );\r
+  printf("* TRIGGER  %8d               *\n", gbTrigger );\r
+  printf("* RUNPP  %3d                      *\n", gbRunPP );\r
+  printf("* RUNPA  %3d                      *\n", gbRunPA );\r
+  printf("* AVOIDEXEC  %3d                  *\n", gbAvoidExec );\r
+  printf("* ESD  %3d                        *\n", gbReadESD );\r
+  printf("* MC  %3d                         *\n", gbReadMC );\r
+  printf("* EXTRAEVENTCUT  %3d              *\n", gbExtraEventCut );\r
+  printf("* CENTMETHOD  %8s                 *\n", gbCentMethod.Data() );\r
+  printf("* CENTPERMIN  %3d                 *\n", gbCentPerMin );\r
+  printf("* CENTPERMAX  %3d                 *\n", gbCentPerMax );\r
+  printf("* SPECIE  %3d                     *\n", gbSpecie );\r
+  printf("* HOMEMADE  %3d                   *\n", gbHomemade );\r
+  printf("* ONLINE  %3d                     *\n", gbOnline );\r
+  printf("* MINNCLSTTPC  %3d                *\n", gbMinNClsTPC );\r
+  printf("* MINXROWS  %3d                   *\n", gbMinXRows );\r
+  printf("* MAXCHI2NCLSTPC  %+9.6f      *\n", gbMaxChi2PerNClsTPC );\r
+  printf("* MINXROWSNFCLSTPC  %+9.6f    *\n", gbMinXRowsOverNClsFTPC );\r
+  printf("* MINETA  %+9.6f              *\n", gbMinEta );\r
+  printf("* MAXETA  %+9.6f              *\n", gbMaxEta );\r
+  printf("* MINPT  %+9.6f               *\n", gbMinPt );\r
+  printf("* MIND0XY  %+9.6f             *\n", gbMinImpactParameterXY );\r
+  printf("* MAXSIGMAPID  %+9.6f         *\n", gbMaxNSigmaPID );\r
+  printf("* MAXY  %+9.6f                *\n", gbMaxRapidity );\r
+  printf("* MAXDCA  %+9.6f              *\n", gbMaxDCAdaughters );\r
+  printf("* MINCTP  %+9.6f              *\n", gbMinCosinePointingAngleXY );\r
+  printf("* MINQT  %+9.6f               *\n", gbMinQt );\r
+  printf("* QTPIE  %+9.6f               *\n", gbQtPie );\r
+  printf("* MINRADXY  %+9.6f            *\n", gbMinRadXY );\r
+  printf("* MAXDL  %+9.6f               *\n", gbMaxDecayLength );\r
+  printf("* D0D0XY  %+9.6f              *\n", gbMaxProductIPXY );\r
+  printf("* DEBUG  %3d                      *\n", gbDebug );\r
+  printf("* QA  %3d                         *\n", gbQA );\r
+  printf("* SKIPSELECTION  %3d              *\n", gbSkipSelection );\r
+  printf("* SKIPFLOW  %3d                   *\n", gbSkipFlow );\r
+  printf("* USEFP  %3d                      *\n", gbFlowPackage );\r
+  printf("* SPVZE  %3d                      *\n", gbSPVZE );\r
+  printf("* SPTPC  %3d                      *\n", gbSPTPC );\r
+  printf("* QCTPC  %3d                      *\n", gbQCTPC );\r
+  printf("* RFFILTERBIT  %3d                *\n", gbRFPFilterBit );\r
+  printf("* RFMINPT  %+9.6f             *\n", gbRFPminPt );\r
+  printf("* RFMAXPT  %+9.6f             *\n", gbRFPmaxPt );\r
+  printf("* RFMINETA  %+9.6f            *\n", gbRFPminEta );\r
+  printf("* RFMAXETA  %+9.6f            *\n", gbRFPmaxEta );\r
+  printf("* RFTPCSIGNAL  %+9.6f         *\n", gbRFPTPCsignal );\r
+  printf("* RFMAXIPXY  %+9.6f           *\n", gbRFPmaxIPxy );\r
+  printf("* RFMAXIPZ  %+9.6f            *\n", gbRFPmaxIPz );\r
+  printf("* RFTPCNCLS  %3d                  *\n", gbRFPTPCncls );\r
+  printf("* VZELOAD  %8s            *\n", gbVZEload.Data() );\r
+  printf("* VZESAVE  %3d                    *\n", gbVZEsave );\r
+  printf("***********************************\n");\r
+}\r
+void SFT_ReadConfig(TString ipf) {\r
+  printf("Reading %s\n",ipf.Data());\r
+  ifstream input(ipf.Data());\r
+  TString varname;\r
+  Double_t vardouble;\r
+  Int_t varint;\r
+  UInt_t varuint;\r
+  Bool_t varbool;\r
+  for(;input.good();) {\r
+    input >> varname;\r
+    if(!input.good()) {\r
+      break;\r
+    } else if(!varname.CompareTo("SUFFIX")) {\r
+      input >> gbSuffix;\r
+    } else if(!varname.CompareTo("TRIGGER")) {\r
+      input >> gbTrigger;\r
+    } else if(!varname.CompareTo("RUNPP")) {\r
+      input >> gbRunPP;\r
+    } else if(!varname.CompareTo("RUNPA")) {\r
+      input >> gbRunPA;\r
+    } else if(!varname.CompareTo("AVOIDEXEC")) {\r
+      input >> gbAvoidExec;\r
+    } else if(!varname.CompareTo("ESD")) {\r
+      input >> gbReadESD;\r
+    } else if(!varname.CompareTo("MC")) {\r
+      input >> gbReadMC;\r
+    } else if(!varname.CompareTo("EXTRAEVENTCUT")) {\r
+      input >> gbExtraEventCut;\r
+    } else if(!varname.CompareTo("CENTMETHOD")) {\r
+      input >> gbCentMethod;\r
+    } else if(!varname.CompareTo("CENTPERMIN")) {\r
+      input >> gbCentPerMin;\r
+    } else if(!varname.CompareTo("CENTPERMAX")) {\r
+      input >> gbCentPerMax;\r
+    } else if(!varname.CompareTo("SPECIE")) {\r
+      input >> gbSpecie;\r
+    } else if(!varname.CompareTo("HOMEMADE")) {\r
+      input >> gbHomemade;\r
+    } else if(!varname.CompareTo("ONLINE")) {\r
+      input >> gbOnline;\r
+    } else if(!varname.CompareTo("MINNCLSTTPC")) {\r
+      input >> gbMinNClsTPC;\r
+    } else if(!varname.CompareTo("MINXROWS")) {\r
+      input >> gbMinXRows;\r
+    } else if(!varname.CompareTo("MAXCHI2NCLSTPC")) {\r
+      input >> gbMaxChi2PerNClsTPC;\r
+    } else if(!varname.CompareTo("MINXROWSNFCLSTPC")) {\r
+      input >> gbMinXRowsOverNClsFTPC;\r
+    } else if(!varname.CompareTo("MINETA")) {\r
+      input >> gbMinEta;\r
+    } else if(!varname.CompareTo("MAXETA")) {\r
+      input >> gbMaxEta;\r
+    } else if(!varname.CompareTo("MINPT")) {\r
+      input >> gbMinPt;\r
+    } else if(!varname.CompareTo("MIND0XY")) {\r
+      input >> gbMinImpactParameterXY;\r
+    } else if(!varname.CompareTo("MAXSIGMAPID")) {\r
+      input >> gbMaxNSigmaPID;\r
+    } else if(!varname.CompareTo("MAXY")) {\r
+      input >> gbMaxRapidity;\r
+    } else if(!varname.CompareTo("MAXDCA")) {\r
+      input >> gbMaxDCAdaughters;\r
+    } else if(!varname.CompareTo("MINCTP")) {\r
+      input >> gbMinCosinePointingAngleXY;\r
+    } else if(!varname.CompareTo("MINQT")) {\r
+      input >> gbMinQt;\r
+    } else if(!varname.CompareTo("QTPIE")) {\r
+      input >> gbQtPie;\r
+    } else if(!varname.CompareTo("MINRADXY")) {\r
+      input >> gbMinRadXY;\r
+    } else if(!varname.CompareTo("MAXDL")) {\r
+      input >> gbMaxDecayLength;\r
+    } else if(!varname.CompareTo("D0D0XY")) {\r
+      input >> gbMaxProductIPXY;\r
+    } else if(!varname.CompareTo("DEBUG")) {\r
+      input >> gbDebug;\r
+    } else if(!varname.CompareTo("QA")) {\r
+      input >> gbQA;\r
+    } else if(!varname.CompareTo("SKIPSELECTION")) {\r
+      input >> gbSkipSelection;\r
+    } else if(!varname.CompareTo("SKIPFLOW")) {\r
+      input >> gbSkipFlow;\r
+    } else if(!varname.CompareTo("USEFP")) {\r
+      input >> gbFlowPackage;\r
+    } else if(!varname.CompareTo("SPVZE")) {\r
+      input >> gbSPVZE;\r
+    } else if(!varname.CompareTo("SPTPC")) {\r
+      input >> gbSPTPC;\r
+    } else if(!varname.CompareTo("QCTPC")) {\r
+      input >> gbQCTPC;\r
+    } else if(!varname.CompareTo("RFFILTERBIT")) {\r
+      input >> gbRFPFilterBit;\r
+    } else if(!varname.CompareTo("RFMINPT")) {\r
+      input >> gbRFPminPt;\r
+    } else if(!varname.CompareTo("RFMAXPT")) {\r
+      input >> gbRFPmaxPt;\r
+    } else if(!varname.CompareTo("RFMINETA")) {\r
+      input >> gbRFPminEta;\r
+    } else if(!varname.CompareTo("RFMAXETA")) {\r
+      input >> gbRFPmaxEta;\r
+    } else if(!varname.CompareTo("RFTPCSIGNAL")) {\r
+      input >> gbRFPTPCsignal;\r
+    } else if(!varname.CompareTo("RFMAXIPXY")) {\r
+      input >> gbRFPmaxIPxy;\r
+    } else if(!varname.CompareTo("RFMAXIPZ")) {\r
+      input >> gbRFPmaxIPz;\r
+    } else if(!varname.CompareTo("RFTPCNCLS")) {\r
+      input >> gbRFPTPCncls;\r
+    } else if(!varname.CompareTo("VZELOAD")) {\r
+      input >> gbVZEload;\r
+    } else if(!varname.CompareTo("VZESAVE")) {\r
+      input >> gbVZEsave;\r
+    } else if(!varname.CompareTo("ALLCC")) {\r
+      input >> gbAllCC;\r
+    } else {\r
+      printf("I dont understand %s\n",varname.Data());\r
+    }\r
+  }\r
+}\r