Updates for Lc->V0+bachelor analysis (Annalisa)
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Jul 2012 17:08:58 +0000 (17:08 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Jul 2012 17:08:58 +0000 (17:08 +0000)
PWGHF/vertexingHF/AliAODPidHF.cxx
PWGHF/vertexingHF/AliAODPidHF.h
PWGHF/vertexingHF/AliAODRecoCascadeHF.cxx
PWGHF/vertexingHF/AliAnalysisTaskSEHFQA.cxx
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelor.cxx
PWGHF/vertexingHF/AliRDHFCuts.h
PWGHF/vertexingHF/AliRDHFCutsLctoV0.cxx
PWGHF/vertexingHF/AliRDHFCutsLctoV0.h
PWGHF/vertexingHF/macros/makeTFile4CutsLctoV0bachelor.C

index eab5300..3cb36c1 100644 (file)
@@ -946,4 +946,40 @@ Int_t AliAODPidHF::GetnSigmaTOF(AliAODTrack *track,Int_t species, Double_t &nsig
   return 1;
 }
 
+//-----------------------
+Bool_t AliAODPidHF::IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut,
+                              TString detectors) {
+
+  if (detectors.Contains("ITS")) {
+
+    AliInfo("Nothing to be done");
+    /*
+    Double_t nsigma=0.;
+    if (GetnSigmaITS(track,labelTrack,nsigma)==1){
+      if(nsigma>nsigmaCut) return kTRUE;
+    }
+    */
+    return kFALSE;
+
+  } else if (detectors.Contains("TPC")) {
+
+    Double_t nsigma=0.;
+    if (GetnSigmaTPC(track,labelTrack,nsigma)==1){
+      if(nsigma>nsigmaCut) return kTRUE;
+    }
+    return kFALSE;
+
+  } else if (detectors.Contains("TOF")) {
+
+    if (!(CheckTOFPIDStatus(track))) return kFALSE;
+    Double_t nsigma=0.;
+    if (GetnSigmaTOF(track,labelTrack,nsigma)==1){
+      if(nsigma>nsigmaCut) return kTRUE;
+    }
+    return kFALSE;
+
+  }
+  return kFALSE;
+
+}
 //-----------------------------
index 56b9a26..98278c5 100644 (file)
@@ -110,6 +110,8 @@ class AliAODPidHF : public AliAODPid{
 
  Bool_t IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK);
 
+ Bool_t IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detector);
+
  void GetTPCBetheBlochParams(Double_t alephParameters[5]) const;
  void SetBetheBloch();
   // method for AliPIDCombined object
@@ -117,11 +119,12 @@ class AliAODPidHF : public AliAODPid{
  void SetPriorDistribution(AliPID::EParticleType type,TH1F *prior);
  void DrawPrior(AliPID::EParticleType type);
 
- protected:
-
  Int_t ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const;
  Int_t ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const;
  Int_t ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const;
+
+ protected:
+
  void BayesianProbabilityITS(AliAODTrack *track,Double_t *prob) const;
  void BayesianProbabilityTPC(AliAODTrack *track,Double_t *prob) const;
  void BayesianProbabilityTOF(AliAODTrack *track,Double_t *prob) const;
index 2c8cfe7..876b135 100644 (file)
@@ -126,7 +126,7 @@ Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
     AliError("No daughters available");
     return -1;
   }
-  
+
   Int_t lab2Prong = -1;
 
   if (!isV0) {
@@ -138,6 +138,7 @@ Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
   }
 
   if(lab2Prong<0) return -1;
+  if (isV0) AliDebug(1,Form(" LabelV0=%d (%d -> %d %d)",lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
 
   Int_t dgLabels[10]={0,0,0,0,0,0,0,0,0,0};
 
@@ -151,7 +152,23 @@ Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
     dgLabels[i] = lab;
   }
 
-  return AliAODRecoDecay::MatchToMC(pdgabs,mcArray,dgLabels,2,2,pdgDg);
+  Int_t finalLabel = AliAODRecoDecay::MatchToMC(pdgabs,mcArray,dgLabels,2,2,pdgDg);
+  if ( isV0 && (dgLabels[0]!=-1 || dgLabels[1]!=-1) ) {
+    if ( (pdgDg[0]==2212 && pdgDg[1]==310) ||
+        (pdgDg[0]==211 && pdgDg[1]==3122) ) {
+      AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
+                     finalLabel,pdgabs,
+                     dgLabels[0],pdgDg[0],dgLabels[1],pdgDg[1]));
+    } else if ( (pdgDg[1]==2212 && pdgDg[0]==310) ||
+               (pdgDg[1]==211 && pdgDg[0]==3122) ) {
+      AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
+                     finalLabel,pdgabs,
+                     dgLabels[1],pdgDg[1],dgLabels[0],pdgDg[0]));
+    }
+  }
+
+  return finalLabel;
+
 }
 //-----------------------------------------------------------------------------
 Bool_t AliAODRecoCascadeHF::SelectDstar(const Double_t *cutsDstar,
index 517add6..10eb247 100644 (file)
@@ -39,6 +39,7 @@
 #include "AliESDVertex.h"
 #include "AliVertexerTracks.h"
 #include "AliPID.h"
+#include "AliPIDResponse.h"
 #include "AliTPCPIDResponse.h"
 #include "AliAODHandler.h"
 #include "AliAODEvent.h"
@@ -720,10 +721,19 @@ void AliAnalysisTaskSEHFQA::UserCreateOutputObjects()
     hCentVsMultRPS->GetYaxis()->SetTitle("Centrality");
     fOutputFlowObs->Add(hCentVsMultRPS);
   }
-//  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-//  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
-//  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
-//  fCuts->GetPidHF()->SetPidResponse(pidResp);
+
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
+  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
+  if (fCuts->GetIsUsePID() && fDecayChannel==kLambdactoV0) {
+    fCuts->GetPidHF()->SetPidResponse(pidResp);
+    (dynamic_cast<AliRDHFCutsLctoV0*>(fCuts))->GetPidV0pos()->SetPidResponse(pidResp);
+    (dynamic_cast<AliRDHFCutsLctoV0*>(fCuts))->GetPidV0neg()->SetPidResponse(pidResp);
+    fCuts->GetPidHF()->SetOldPid(kFALSE);
+    (dynamic_cast<AliRDHFCutsLctoV0*>(fCuts))->GetPidV0pos()->SetOldPid(kFALSE);
+    (dynamic_cast<AliRDHFCutsLctoV0*>(fCuts))->GetPidV0neg()->SetOldPid(kFALSE);
+  }
+
   // Post the data
   PostData(1,fNEntries);
 
@@ -835,7 +845,7 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
        }
        break; 
       case kLambdactoV0:
-       arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadeHF");
+       arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadesHF");
        pdg=4122;
        if(fReadMC){
          pdgdaughters =new Int_t[3];
@@ -909,7 +919,7 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
       }
       break; 
       case kLambdactoV0:
-       arrayProng=(TClonesArray*)aod->GetList()->FindObject("CascadeHF");
+       arrayProng=(TClonesArray*)aod->GetList()->FindObject("CascadesHF");
        pdg=4122;
        if(fReadMC){
          pdgdaughters =new Int_t[3];
@@ -1394,7 +1404,28 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
        }
 
        if(fReadMC){ 
-         Int_t labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters);
+
+         Int_t labD = -1;
+         if (fDecayChannel==AliAnalysisTaskSEHFQA::kLambdactoV0 && (dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0()) {
+
+           Int_t pdgDgLctoV0bachelor[2]={310,2212};
+           Int_t pdgDgV0toDaughters[2]={211,211};
+           Int_t mcLabelK0S = (dynamic_cast<AliAODRecoCascadeHF*>(d))->MatchToMC(pdg,pdgDgLctoV0bachelor[0],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE); // Lc->K0S+p and cc
+           pdgDgLctoV0bachelor[0]=3122, pdgDgLctoV0bachelor[1]=211;
+           pdgDgV0toDaughters[0]=2212,  pdgDgV0toDaughters[1]=211;
+           Int_t mcLabelLambda = (dynamic_cast<AliAODRecoCascadeHF*>(d))->MatchToMC(pdg,pdgDgLctoV0bachelor[0],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE); // Lc->Lambda+pi and cc
+           if (mcLabelK0S!=-1 || mcLabelLambda!=-1) AliInfo(Form("mcLabelK0S=%d - mcLabelLambda=%d",mcLabelK0S,mcLabelLambda));
+
+           if (mcLabelK0S!=-1 && mcLabelLambda!=-1)
+             AliInfo("Strange: current Lc->V0+bachelor candidate has two MC different labels!");
+           else if (mcLabelK0S>-1 && mcLabelLambda==-1)
+             labD = mcLabelK0S;
+           else if (mcLabelLambda>-1 && mcLabelK0S==-1)
+             labD = mcLabelLambda;
+         }
+         else
+           labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters);
+
          if(labD>=0){
            AliAODMCParticle *partD = (AliAODMCParticle*)mcArray->At(labD);
            Int_t label=partD->GetMother();
@@ -1414,9 +1445,19 @@ void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
        else fNEntries->Fill(6); //count the candidates (data)
 
        for(Int_t id=0;id<ndaugh;id++){
-
          //other histograms to be filled when the cut object is given
-         AliAODTrack* track=(AliAODTrack*)d->GetDaughter(id);
+         AliAODTrack* track=0;
+
+         if (fDecayChannel==AliAnalysisTaskSEHFQA::kLambdactoV0 && (dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0()) {
+           if (id==0)
+             track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->GetBachelor();
+           else if (id==1)
+             track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0PositiveTrack();
+           else if (id==2)
+             track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0NegativeTrack();
+         }
+         else 
+           track=(AliAODTrack*)d->GetDaughter(id);
 
          //track quality
 
index 6987017..5d56172 100644 (file)
 //-------------------------------------------------------------------------
 //
 //                 Authors: A.De Caro(a,b), P. Pagano(b)
-//  (a) Centro Fermi - Roma and Salerno INFN-University - decaro@sa.infn.it
-//  (b) Salerno INFN-University - paola.pagano@sa.infn.it
+//  (a) Centro 'E.Fermi' - Roma
+//  (b) INFN and University of Salerno
 //
+//  Contatcs: decaro@sa.infn.it
+//            paola.pagano@sa.infn.it
 //-------------------------------------------------------------------------
 
 #include <TSystem.h>
@@ -679,8 +681,10 @@ void AliAnalysisTaskSELc2V0bachelor::MakeAnalysisForLc2prK0S(AliAODVertex */*vtx
 
   //Lc prong needed to MatchToMC method
 
-  Int_t pdgDgLctoK0spr[2]={2212,310}; // bachelor+V0
-  Int_t pdgDgK0stopipi[2]={211,211};
+  Int_t pdgCand = 4122;
+  Int_t pdgDgLctoV0bachelorOld[2]={2212,310};
+  Int_t pdgDgLctoV0bachelor[2]={310,2212};
+  Int_t pdgDgV0toDaughters[2]={211,211};
 
   // loop over cascades to search for candidates Lc->p+K0S
   Int_t nCascades= arrayLctopKos->GetEntriesFast();
@@ -706,7 +710,9 @@ void AliAnalysisTaskSELc2V0bachelor::MakeAnalysisForLc2prK0S(AliAODVertex */*vtx
       Int_t pdgCode=-2;
 
       // find associated MC particle for Lc -> p+K0 and K0S->pi+pi
-      Int_t mcLabel = MatchToMC(lcK0spr,pdgDgLctoK0spr,pdgDgK0stopipi,mcArray);
+      Int_t mcLabelOld = MatchToMC(lcK0spr,pdgDgLctoV0bachelorOld,pdgDgV0toDaughters,mcArray);
+      Int_t mcLabel = lcK0spr->MatchToMC(pdgCand,pdgDgLctoV0bachelor[0],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE);
+      if (mcLabelOld!=mcLabel) AliInfo(Form(" Changed MC label: oldONE=%d wrt rightONE=%d",mcLabelOld,mcLabel));
       if (mcLabel>=0) {
        AliInfo(Form(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cascade numero %d di %d", iLctopK0s,nCascades));
 
@@ -818,18 +824,17 @@ Int_t AliAnalysisTaskSELc2V0bachelor::MatchToMC(AliAODRecoCascadeHF *lc2bacV0,
 void AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC)
 {
  
-  AliAODMCParticle *searchLc;
-  AliAODMCParticle *daugh;
-  AliAODMCParticle *daugh1;
-  AliAODMCParticle *daugh2;
-  AliAODMCParticle *daughK0;
-  AliAODMCParticle *daughK0s;
-  AliAODMCParticle *daughK0s1;
-  AliAODMCParticle *daughK0s2;
-  AliAODMCParticle *daughL1;
-  AliAODMCParticle *daughL2;
-  Int_t nDaughLc=0;
+  AliAODMCParticle *searchLc=0;
+  AliAODMCParticle *daugh=0;
+  AliAODMCParticle *daugh1=0;
+  AliAODMCParticle *daugh2=0;
+  AliAODMCParticle *daughK0=0;
+  AliAODMCParticle *daughK0s1=0;
+  AliAODMCParticle *daughK0s2=0;
+  AliAODMCParticle *daughL1=0;
+  AliAODMCParticle *daughL2=0;
 
+  Int_t nDaughLc=0;
   Int_t nDaughK0=0;
   Int_t nDaughK0s=0;
   Int_t searchLcpdg=0;
@@ -861,43 +866,70 @@ void AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC)
        daughPdg2=daugh2->GetPdgCode();
        if ( (daughPdg1==2212 && daughPdg2==-311) ||
             (daughPdg2==2212 && daughPdg1==-311) ) { // Lc+ -> p K0bar
+         AliInfo(Form(" Ecco %d(%d) -> %d(%d) %d(%d)",
+                      iii,searchLcpdg,
+                      searchLc->GetDaughter(0),daughPdg1,
+                      searchLc->GetDaughter(1),daughPdg2));
          ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(2);
          if (daughPdg1==-311) {
-           daughK0 = (AliAODMCParticle*)arrayMC->At(daugh1->GetDaughter(0));
            nDaughK0=daugh1->GetNDaughters();
+           if (nDaughK0!=1) {
+             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
+             continue;
+           } else {
+             daughK0 = (AliAODMCParticle*)arrayMC->At(daugh1->GetDaughter(0)); // K0S
+           }
+         } else {
+           nDaughK0=daugh2->GetNDaughters();
+           if (nDaughK0!=1) {
+             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
+             continue;
+           } else {
+             daughK0 = (AliAODMCParticle*)arrayMC->At(daugh2->GetDaughter(0)); // K0S
+           }
          }
-         else {
-           daughK0 = (AliAODMCParticle*)arrayMC->At(daugh2->GetDaughter(0));
-           nDaughK0=daugh2->GetNDaughters();    
+         if (!daughK0) {
+           //((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
+           continue;
          }
-         if (nDaughK0==1) {
-           daughK0Pdg=daughK0->GetPdgCode();
-           if (daughK0Pdg!=310) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
-           else {
-             if (daughK0->GetDaughter(0)<0) continue; // it is very strange
-             daughK0s= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(0));
-             cout << " daughK0s = " << daughK0s << endl;
-             nDaughK0s=daughK0s->GetNDaughters();
-             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(3);
-             if (nDaughK0s!=2) continue;
-             daughK0s1= (AliAODMCParticle*)arrayMC->At(daughK0s->GetDaughter(0));
-             daughK0s2= (AliAODMCParticle*)arrayMC->At(daughK0s->GetDaughter(1));
-             daughK0s1pdg=daughK0s1->GetPdgCode();
-             daughK0s2pdg=daughK0s2->GetPdgCode();
-
-             if ( ((daughK0s1pdg== 211) && (daughK0s2pdg==-211)) ||
-                  ((daughK0s2pdg==-211) && (daughK0s1pdg== 211)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(5);
-             else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(6);
-           }//else (if (nDaughK0!=1))
-         } // if (nDaughK0==1)
-         else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
-       }//if ((daughPdg1==2212 && daughPdg2==311)||(daughPdg2==2212 && daughPdg1==311))
+         //cout << " positive daughK0 = " << daughK0 << endl;
+         AliInfo(" Found positive daughK0 ");
+         daughK0Pdg=daughK0->GetPdgCode();
+         if (daughK0Pdg!=310) {
+           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
+           continue;
+         } else {
+           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(3);
+           nDaughK0s=daughK0->GetNDaughters();
+           if (nDaughK0s!=2) {
+             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(6);
+             continue;
+           }
+           daughK0s1= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(0));
+           daughK0s2= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(1));
+           daughK0s1pdg=daughK0s1->GetPdgCode();
+           daughK0s2pdg=daughK0s2->GetPdgCode();
+
+           if ( ((daughK0s1pdg==211) && (daughK0s2pdg==-211)) ||
+                ((daughK0s2pdg==211) && (daughK0s1pdg==-211)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(5);
+           else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(6);
+         } // else if (daughK0Pdg==310)
+       }//if ((daughPdg1==2212 && daughPdg2==-311)||(daughPdg2==2212 && daughPdg1==-311))
 
        else if ( (daughPdg1==3122 && daughPdg2==211) ||
                  (daughPdg2==3122 && daughPdg1==211) ) { // Lc+ -> pi+ Lambda
+         AliInfo(Form(" Ecco %d(%d) -> %d(%d) %d(%d)",
+                      iii,searchLcpdg,
+                      searchLc->GetDaughter(0),daughPdg1,
+                      searchLc->GetDaughter(1),daughPdg2));
          ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(7);
-         if (daughPdg1==3122) daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(0));
-         else daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(1));
+         if (daughPdg1==3122)
+           daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(0)); // Lambda
+         else
+           daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(1)); // Lambda
+         if (!daugh) continue;
+         //cout << " positive daughL = " << daugh << endl;
+         AliInfo(" Found positive daughL ");
          nDaughL=daugh->GetNDaughters();
          if (nDaughL==2) {
            daughL1= (AliAODMCParticle*)arrayMC->At(daugh->GetDaughter(0));
@@ -905,7 +937,7 @@ void AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC)
            daughL1pdg=daughL1->GetPdgCode();
            daughL2pdg=daughL2->GetPdgCode();
            if ( ((daughL1pdg==-211) && (daughL2pdg==2212)) ||
-               ((daughL1pdg==2212) && (daughL2pdg==-211))) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(8);
+                ((daughL2pdg==-211) && (daughL1pdg==2212)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(8);
            else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(9);
          }//if (nDaughL==2) 
          else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(9);
@@ -917,7 +949,6 @@ void AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC)
 
       if (searchLcpdg == -4122) { // It is Lc+
        ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-1);
-
        if (nDaughLc!=2) continue;
        daugh1 = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(0));
        daughPdg1=daugh1->GetPdgCode();
@@ -926,48 +957,76 @@ void AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC)
        if ( (daughPdg1==-2212 && daughPdg2==311) ||
             (daughPdg2==-2212 && daughPdg1==311) ) { // Lc- -> pbar K0
          ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-2);
+         AliInfo(Form(" Ecco %d(%d) -> %d(%d) %d(%d)",
+                      iii,searchLcpdg,
+                      searchLc->GetDaughter(0),daughPdg1,
+                      searchLc->GetDaughter(1),daughPdg2));
          if (daughPdg1==311) {
-           daughK0 = (AliAODMCParticle*)arrayMC->At(daugh1->GetDaughter(0));
            nDaughK0=daugh1->GetNDaughters();
+           if (nDaughK0!=1) {
+             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-4);
+             continue;
+           } else {
+             daughK0 = (AliAODMCParticle*)arrayMC->At(daugh1->GetDaughter(0));
+           }
+         } else {
+           nDaughK0=daugh2->GetNDaughters();
+           if (nDaughK0!=1) {
+             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-4);
+             continue;
+           } else {
+             daughK0 = (AliAODMCParticle*)arrayMC->At(daugh2->GetDaughter(0));
+           }
+         }
+         if (!daughK0) {
+            //((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
+           continue;
          }
-         else {
-           daughK0 = (AliAODMCParticle*)arrayMC->At(daugh2->GetDaughter(0));
-           nDaughK0 = daugh2->GetNDaughters();  
-         }     
-         if (nDaughK0==1) {
-           daughK0Pdg=daughK0->GetPdgCode();
-           if (daughK0Pdg!=310) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-4);
-           else {
-             if (daughK0->GetDaughter(0)<0) continue; // it is very strange
-
-             daughK0s= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(0));
-             nDaughK0s=daughK0s->GetNDaughters();
-             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-3);
-             if (nDaughK0s!=2) continue;
-             daughK0s1= (AliAODMCParticle*)arrayMC->At(daughK0s->GetDaughter(0));
-             daughK0s2= (AliAODMCParticle*)arrayMC->At(daughK0s->GetDaughter(1));
-             daughK0s1pdg=daughK0s1->GetPdgCode();
-             daughK0s2pdg=daughK0s2->GetPdgCode();
-             if ( ((daughK0s1pdg== 211) && (daughK0s2pdg==-211)) ||
-                  ((daughK0s2pdg==-211) && (daughK0s1pdg== 211)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-5);
-             else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-6);
-           }//else (if (nDaughK0!=1))
-         } // if (nDaughK0==1)
-         else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-4);
+         //cout << " negative daughK0 = " << daughK0 << endl;
+         AliInfo(" Found negative daughK0 ");
+         daughK0Pdg=daughK0->GetPdgCode();
+         if (daughK0Pdg!=310) {
+           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-4);
+           continue;
+         } else {
+           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-3);
+           nDaughK0s=daughK0->GetNDaughters();
+           if (nDaughK0s!=2) {
+             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-6);
+             continue;
+           }
+           daughK0s1= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(0));
+           daughK0s2= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(1));
+           daughK0s1pdg=daughK0s1->GetPdgCode();
+           daughK0s2pdg=daughK0s2->GetPdgCode();
+           if ( ((daughK0s1pdg==211) && (daughK0s2pdg==-211)) ||
+                ((daughK0s2pdg==211) && (daughK0s1pdg==-211)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-5);
+           else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-6);
+         } // else if (daughK0Pdg==310)
        }//if ((daughPdg1==-2212 && daughPdg2==-311)||(daughPdg2==-2212 && daughPdg1==-311))
 
-       else if ( (daughPdg1==-3122 && daughPdg2==-211) || (daughPdg2==-3122 && daughPdg1==-211) ) {
+       else if ( (daughPdg1==-3122 && daughPdg2==-211) ||
+                 (daughPdg2==-3122 && daughPdg1==-211) ) {
+         AliInfo(Form(" Ecco %d(%d) -> %d(%d) %d(%d)",
+                      iii,searchLcpdg,
+                      searchLc->GetDaughter(0),daughPdg1,
+                      searchLc->GetDaughter(1),daughPdg2));
          ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-7);
-         if (daughPdg1==-3122) daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(0));
-         else daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(1));
+         if (daughPdg1==-3122)
+           daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(0));
+         else
+           daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(1));
+         if (!daugh) continue;
+         //cout << " negative daughL = " << daugh << endl;
+         AliInfo(" Found negative daughL ");
          nDaughL=daugh->GetNDaughters();
          if (nDaughL==2) {
            daughL1 = (AliAODMCParticle*)arrayMC->At(daugh->GetDaughter(0));
            daughL2 = (AliAODMCParticle*)arrayMC->At(daugh->GetDaughter(1));
            daughL1pdg=daughL1->GetPdgCode();
            daughL2pdg= daughL2->GetPdgCode();
-           if ( ((daughL1pdg==  211) && (daughL2pdg==-2212)) ||
-               ((daughL1pdg==-2212) && (daughL2pdg==  211)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-8);
+           if ( ((daughL1pdg==211) && (daughL2pdg==-2212)) ||
+                ((daughL2pdg==211) && (daughL1pdg==-2212)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-8);
            else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-9);
          }//if (nDaughL==2) 
          else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-9);
@@ -1244,9 +1303,9 @@ void AliAnalysisTaskSELc2V0bachelor::DefineK0SHistos()
   
     nameSgn="histcosOAK0SpSgnvsp";
     nameBkg="histcosOAK0SpBkgvsp";
-    TH2F* cosOpeningAngleK0SpSgnvsp= new TH2F(nameSgn.Data(),"#Lambda_{C}  Signal : K^{0}_{S} - p Opening Angle  vs p - MC ; Cos(Opening Angle);  p ",
+    TH2F* cosOpeningAngleK0SpSgnvsp= new TH2F(nameSgn.Data(),"#Lambda_{C} SGN : K^{0}_{S} - p Opening Angle  vs p - MC ; Cos(Opening Angle);  p ",
                                              200,-1.,1.,200,0.,20.);
-    TH2F* cosOpeningAngleK0SpBkgvsp= new TH2F(nameBkg.Data(),"#Lambda_{C}  Background : K^{0}_{S} - p Opening Angle  vs p - MC;  Cos(Opening Angle);  p ",
+    TH2F* cosOpeningAngleK0SpBkgvsp= new TH2F(nameBkg.Data(),"#Lambda_{C} BKG : K^{0}_{S} - p Opening Angle  vs p - MC;  Cos(Opening Angle);  p ",
                                              200,-1.,1.,200,0.,20.);
 
     TH2F* allcosOpeningAngleK0SpSgnvsp= (TH2F*)cosOpeningAngleK0SpSgnvsp->Clone(); 
@@ -1263,9 +1322,9 @@ void AliAnalysisTaskSELc2V0bachelor::DefineK0SHistos()
 
     nameSgn="histcosOAK0SpSgnvspOffline";
     nameBkg="histcosOAK0SpBkgvspOffline";
-    TH2F* cosOpeningAngleK0SpSgnvspOffline= new TH2F(nameSgn.Data(),"#Lambda_{C}  Signal : K^{0}_{S} - p Opening Angle  vs p  -  Offline  - MC ; Cos(Opening Angle);  p ",
+    TH2F* cosOpeningAngleK0SpSgnvspOffline= new TH2F(nameSgn.Data(),"#Lambda_{C} SGN : K^{0}_{S} - p Opening Angle  vs p  -  Offline  - MC ; Cos(Opening Angle);  p ",
                                                     200,-1.,1.,200,0.,20.);
-    TH2F* cosOpeningAngleK0SpBkgvspOffline= new TH2F(nameBkg.Data(),"#Lambda_{C}  Background : K^{0}_{S} - p Opening Angle  vs p  -  Offline  - MC;  Cos(Opening Angle);  p ",
+    TH2F* cosOpeningAngleK0SpBkgvspOffline= new TH2F(nameBkg.Data(),"#Lambda_{C} BKG : K^{0}_{S} - p Opening Angle  vs p  -  Offline  - MC;  Cos(Opening Angle);  p ",
                                                     200,-1.,1.,200,0.,20.);
     
 
@@ -1283,9 +1342,9 @@ void AliAnalysisTaskSELc2V0bachelor::DefineK0SHistos()
 
     nameSgn="histpK0SvspSgn";
     nameBkg="histpK0SvspBkg";
-    TH2F* momentumDistributionK0SvspSgn= new TH2F(nameSgn.Data(),"#Lambda_{C}  Signal : K^{0}_{S} vs p Total Momentum Distribution - MC; p_{p};  p_{K^{0}_{S}}   ",
+    TH2F* momentumDistributionK0SvspSgn= new TH2F(nameSgn.Data(),"#Lambda_{C} SGN : K^{0}_{S} vs p Total Momentum Distribution - MC; p_{p}; p_{K^{0}_{S}}",
                                                  200,0.,20.,200,0.,20.);
-    TH2F* momentumDistributionK0SvspBkg= new TH2F(nameBkg.Data(),"#Lambda_{C}  Background : K^{0}_{S} vs p Total Momentum Distribution - MC;  p_{p}; p_{K^{0}_{S}}   ",
+    TH2F* momentumDistributionK0SvspBkg= new TH2F(nameBkg.Data(),"#Lambda_{C} BKG : K^{0}_{S} vs p Total Momentum Distribution - MC; p_{p}; p_{K^{0}_{S}}",
                                                  200,0.,20.,200,0.,20.);
 
     TH2F* allmomentumDistributionK0SvspSgn= (TH2F*)momentumDistributionK0SvspSgn->Clone(); 
@@ -1300,9 +1359,9 @@ void AliAnalysisTaskSELc2V0bachelor::DefineK0SHistos()
 
     nameSgn="histpK0SvspOfflineSgn";
     nameBkg="histpK0SvspOfflineBkg";
-    TH2F* momentumDistributionK0SvspOfflineSgn= new TH2F(nameSgn.Data(),"#Lambda_{C}  Signal : K^{0}_{S} vs p Total Momentum Distribution - Offline  - MC; p_{p};  p_{K^{0}_{S}}   ",
+    TH2F* momentumDistributionK0SvspOfflineSgn= new TH2F(nameSgn.Data(),"#Lambda_{C} SGN : K^{0}_{S} vs p Total Momentum Distribution - Offline  - MC; p_{p};  p_{K^{0}_{S}}",
                                                         200,0.,20.,200,0.,20.);
-    TH2F* momentumDistributionK0SvspOfflineBkg= new TH2F(nameBkg.Data(),"#Lambda_{C}  Background : K^{0}_{S} vs p Total Momentum Distribution - Offline  - MC;  p_{p}; p_{K^{0}_{S}}   ",
+    TH2F* momentumDistributionK0SvspOfflineBkg= new TH2F(nameBkg.Data(),"#Lambda_{C} BKG : K^{0}_{S} vs p Total Momentum Distribution - Offline  - MC;  p_{p}; p_{K^{0}_{S}}",
                                                         200,0.,20.,200,0.,20.);
 
 
@@ -1358,12 +1417,12 @@ void AliAnalysisTaskSELc2V0bachelor::DefineK0SHistos()
 
     nameSgn="histoDCAtoPVvsinvmassK0sSgn";
     nameBkg="histoDCAtoPVvsinvmassK0sBkg";
-    TH2F *dcatoPVvspK0sSgn=new TH2F(nameSgn.Data(),"K^{0}_{S}: DCA to Primary Vertex vs  K^{0}_{S} invariant mass (sgn) ; M(K^{0}_{S}) [GeV/c^{2}]; DCA to Primary Vertex []; Entries",520,0.43,0.56,100,0.,10.0);
+    TH2F *dcatoPVvspK0sSgn=new TH2F(nameSgn.Data(),"K^{0}_{S}: DCA to Primary Vertex vs  K^{0}_{S} invariant mass (sgn); M(K^{0}_{S}) [GeV/c^{2}]; DCA to Primary Vertex []; Entries",520,0.43,0.56,100,0.,10.0);
     TH2F *dcatoPVvspK0sBkg=new TH2F(nameBkg.Data(),"K^{0}_{S}: DCA to Primary Vertex vs  K^{0}_{S} invariant mass (bkg); M(K^{0}_{S}) [GeV/c^{2}]; DCA to Primary Vertex []; Entries",520,0.43,0.56,100,0.,10.0);
     
     nameSgn="histoDCAtoPVvsinvmassK0sOfflineSgn";
     nameBkg="histoDCAtoPVvsinvmassK0sOfflineBkg";
-    TH2F *dcatoPVvspK0sOfflineSgn=new TH2F(nameSgn.Data(),"K^{0}_{S}: DCA to Primary Vertex vs  K^{0}_{S} invariant mass  -offline - (sgn) ; M(K^{0}_{S}) [GeV/c^{2}]; DCA to Primary Vertex []; Entries",520,0.43,0.56,100,0.,10.0);
+    TH2F *dcatoPVvspK0sOfflineSgn=new TH2F(nameSgn.Data(),"K^{0}_{S}: DCA to Primary Vertex vs  K^{0}_{S} invariant mass  -offline - (sgn); M(K^{0}_{S}) [GeV/c^{2}]; DCA to Primary Vertex []; Entries",520,0.43,0.56,100,0.,10.0);
     TH2F *dcatoPVvspK0sOfflineBkg=new TH2F(nameBkg.Data(),"K^{0}_{S}: DCA to Primary Vertex vs  K^{0}_{S} invariant mass  -offline - (bkg); M(K^{0}_{S}) [GeV/c^{2}]; DCA to Primary Vertex []; Entries",520,0.43,0.56,100,0.,10.0);
     
 
index fd805bf..821da04 100644 (file)
@@ -154,6 +154,7 @@ class AliRDHFCuts : public AliAnalysisCuts
   Bool_t  *GetIsUpperCut() const {return fIsUpperCut;}
   AliESDtrackCuts *GetTrackCuts() const {return fTrackCuts;}
   virtual AliESDtrackCuts *GetTrackCutsSoftPi() const {return 0;}
+  virtual AliESDtrackCuts *GetTrackCutsV0daughters() const {return 0;}
   virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) = 0;
   virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters,AliAODEvent * /*aod*/)
             {return GetCutVarsForOpt(d,vars,nvars,pdgdaughters);}
index c0524d8..f6a182b 100644 (file)
@@ -30,6 +30,8 @@
 #include "AliAODRecoCascadeHF.h"
 #include "AliAODTrack.h"
 #include "AliESDtrack.h"
+#include "AliESDVertex.h"
+#include "AliAODVertex.h"
 #include "AliAODv0.h"
 #include "AliESDv0.h"
 
@@ -41,8 +43,10 @@ ClassImp(AliRDHFCutsLctoV0)
 //--------------------------------------------------------------------------
   AliRDHFCutsLctoV0::AliRDHFCutsLctoV0(const char* name, Short_t /*v0channel*/) : 
   AliRDHFCuts(name),
-  fPidHFV0pos(new AliAODPidHF()),
-  fPidHFV0neg(new AliAODPidHF())
+  fPidSelectionFlag(0),
+  fPidHFV0pos(0),
+  fPidHFV0neg(0),
+  fV0daughtersCuts(0)
 {
   //
   // Default Constructor
@@ -102,14 +106,24 @@ ClassImp(AliRDHFCutsLctoV0)
 //--------------------------------------------------------------------------
 AliRDHFCutsLctoV0::AliRDHFCutsLctoV0(const AliRDHFCutsLctoV0 &source) :
   AliRDHFCuts(source),
-  fPidHFV0pos(new AliAODPidHF(*(source.fPidHFV0pos))),
-  fPidHFV0neg(new AliAODPidHF(*(source.fPidHFV0neg)))/*,
-                                                      fV0channel(source.fV0channel)*/
+  fPidSelectionFlag(0),
+  fPidHFV0pos(0),
+  fPidHFV0neg(0),
+  fV0daughtersCuts(0)/*
+                      fV0channel(source.fV0channel)*/
 {
   //
   // Copy constructor
   //
 
+  if (source.fPidHFV0pos) fPidHFV0pos = new AliAODPidHF(*(source.fPidHFV0pos));
+  else fPidHFV0pos = new AliAODPidHF();
+  if (source.fPidHFV0neg) fPidHFV0neg = new AliAODPidHF(*(source.fPidHFV0neg));
+  else fPidHFV0neg = new AliAODPidHF();
+
+  if (source.fV0daughtersCuts) fV0daughtersCuts = new AliESDtrackCuts(*(source.fV0daughtersCuts));
+  else fV0daughtersCuts = new AliESDtrackCuts();
+
 }
 //--------------------------------------------------------------------------
 AliRDHFCutsLctoV0 &AliRDHFCutsLctoV0::operator=(const AliRDHFCutsLctoV0 &source)
@@ -121,11 +135,15 @@ AliRDHFCutsLctoV0 &AliRDHFCutsLctoV0::operator=(const AliRDHFCutsLctoV0 &source)
   if (this != &source) {
 
     AliRDHFCuts::operator=(source);
+    fPidSelectionFlag = source.fPidSelectionFlag;
     delete fPidHFV0pos;
     fPidHFV0pos = new AliAODPidHF(*(source.fPidHFV0pos));
     delete fPidHFV0neg;
     fPidHFV0neg = new AliAODPidHF(*(source.fPidHFV0neg));
 
+    delete fV0daughtersCuts;
+    fV0daughtersCuts = new AliESDtrackCuts(*(source.fV0daughtersCuts));
+
     //fV0channel = source.fV0channel;
 
   }
@@ -149,6 +167,11 @@ AliRDHFCutsLctoV0::~AliRDHFCutsLctoV0() {
   fPidHFV0neg=0;
  }
 
+ if (fV0daughtersCuts) {
+  delete fV0daughtersCuts;
+  fV0daughtersCuts=0;
+ }
+
 }
 
 //---------------------------------------------------------------------------
@@ -251,37 +274,57 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
 
   AliAODRecoCascadeHF* d = (AliAODRecoCascadeHF*)obj;
   if (!d) {
-    cout<<"AliAODRecoCascadeHF null"<<endl;
+    AliDebug(2,"AliAODRecoCascadeHF null");
     return 0;
   }
 
-  // selection on daughter tracks 
-  if (selectionLevel==AliRDHFCuts::kAll || 
-      selectionLevel==AliRDHFCuts::kTracks) {
-    if (!AreDaughtersSelected(d)) return 0;
-  }
-
   // Get the bachelor track
   AliAODTrack *bachelorTrack = (AliAODTrack*)d->GetBachelor();
+  if (!bachelorTrack) {
+    AliDebug(2,"No bachelor object");
+    return 0;
+  }
   if (!(bachelorTrack->TestFilterMask(BIT(4)))) return 0;
 
-  // Get the V0 and all daughter tracks
+  // Get V0
   AliAODv0 *v0 = (AliAODv0*)d->Getv0();
+  if (!v0) {
+    AliDebug(2,"No v0 object");
+    return 0;
+  }
+
+  // Get the V0 daughter tracks
   AliAODTrack *v0positiveTrack = (AliAODTrack*)d->Getv0PositiveTrack();
   AliAODTrack *v0negativeTrack = (AliAODTrack*)d->Getv0NegativeTrack(); 
-
-  // If reading ESDv0, return false
-  if ( !d->Getv0() || !d->Getv0PositiveTrack() || !d->Getv0NegativeTrack() ) {
-    AliInfo(Form("Not adapted for ESDv0s, return false..."));
+  if (!v0positiveTrack || !v0negativeTrack ) {
+    AliDebug(2,"No V0 daughters' objects");
     return 0;
   }
 
+  // selection on daughter tracks 
+  if (selectionLevel==AliRDHFCuts::kAll || 
+      selectionLevel==AliRDHFCuts::kTracks) {
+
+    if (fIsCandTrackSPDFirst && d->Pt()<fMaxPtCandTrackSPDFirst) {
+      if (!bachelorTrack->HasPointOnITSLayer(0)) return 0;
+    }
+    if (fTrackCuts && fV0daughtersCuts) {
+      AliAODVertex *vAOD = (AliAODVertex*)d->GetPrimaryVtx();
+      Double_t pos[3]; vAOD->GetXYZ(pos);
+      Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
+      const AliESDVertex vESD(pos,cov,100.,100);
+      if ( !(IsDaughterSelected(bachelorTrack,&vESD,fTrackCuts)) ||
+          !(IsDaughterSelected(v0negativeTrack,&vESD,fV0daughtersCuts)) ||
+          !(IsDaughterSelected(v0positiveTrack,&vESD,fV0daughtersCuts)) ) return 0;
+    }
+  }
+
   Int_t returnvaluePID = 7;
 
   // selection on candidate
   if (selectionLevel==AliRDHFCuts::kAll || 
       selectionLevel==AliRDHFCuts::kCandidate || 
-      selectionLevel==AliRDHFCuts::kPID)
+      selectionLevel==AliRDHFCuts::kPID )
     returnvaluePID = IsSelectedPID(d);
 
   //if (fUsePID && returnvaluePID==0) return 0;
@@ -392,7 +435,7 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
   */
 
   Int_t returnvalueTot = 0;
-  if (fUsePID )
+  if ( fUsePID )
     returnvalueTot = CombinePIDCuts(returnvalue,returnvaluePID);
   else
     returnvalueTot = returnvalue;
@@ -429,31 +472,90 @@ Int_t AliRDHFCutsLctoV0::IsSelectedPID(AliAODRecoDecayHF* obj) {
 
   if (!bachelor || !v0Pos || !v0Neg) return 0;
 
-  // identify bachelor
-  Bool_t isBachelorID1 = fPidHF->IsProtonRaw(bachelor,"TPC") && fPidHF->IsProtonRaw(bachelor,"TOF"); // K0S case
-  //Bool_t isBachelorID2 = fPidHF->IsPionRaw(bachelor,"TPC") && fPidHF->IsPionRaw(bachelor,"TOF"); // LambdaBar case
-  //Bool_t isBachelorID4 = isBachelorID2; // Lambda case
-
-  // identify V0pos
-  //Bool_t isV0PosID1 = fPidHFV0pos->IsPionRaw(v0Pos,"TPC") && fPidHFV0pos->IsPionRaw(v0Pos,"TOF"); // K0S case
-  //Bool_t isV0PosID2 = isV0PosID1; // LambdaBar case
-  Bool_t isV0PosID4 = fPidHFV0pos->IsProtonRaw(v0Pos,"TPC") && fPidHFV0pos->IsProtonRaw(v0Pos,"TOF"); // Lambda case
+  Bool_t okLcK0Sp = kTRUE; // K0S case
+  Bool_t okLcLambdaBarPi = kTRUE; // LambdaBar case
+  Bool_t okLcLambdaPi = kTRUE; // Lambda case
 
-  // identify V0neg
-  //Bool_t isV0NegID1 = fPidHFV0neg->IsPionRaw(v0Neg,"TPC") && fPidHFV0neg->IsPionRaw(v0Neg,"TOF"); // K0S case
-  Bool_t isV0NegID2 = fPidHFV0neg->IsProtonRaw(v0Neg,"TPC") && fPidHFV0neg->IsProtonRaw(v0Neg,"TOF"); // LambdaBar case
-  //Bool_t isV0NegID4 = isV0NegID1; // Lambda case
-
-  Bool_t okLcK0Sp = isBachelorID1; // K0S case
-  Bool_t okLcLambdaBarPi = isV0NegID2; // LambdaBar case
-  Bool_t okLcLambdaPi = isV0PosID4; // Lambda case
+  CheckPID(bachelor,v0Neg,v0Pos,okLcK0Sp,okLcLambdaBarPi,okLcLambdaPi);
 
   Int_t returnvalue = okLcK0Sp+2*okLcLambdaBarPi+4*okLcLambdaPi;
 
   return returnvalue;
 }
 //-----------------------
+void AliRDHFCutsLctoV0::CheckPID(AliAODTrack *bachelor, AliAODTrack *v0Neg, AliAODTrack *v0Pos,
+                                Bool_t &isBachelorID1, Bool_t &isV0NegID2, Bool_t &isV0PosID4) {
+  // identification strategy
+
+  Int_t trackIDtof = -1;
+  Int_t trackIDtpc = -1;
 
+  switch (fPidSelectionFlag) {
+
+  case 0:
+
+    // identify bachelor
+    trackIDtof = fPidHF->ApplyPidTOFRaw(bachelor,4);
+    trackIDtpc = fPidHF->ApplyPidTPCRaw(bachelor,4);
+    AliDebug(1,Form(" fPidHF->ApplyPidTOFRaw(bachelor,4)=%d fPidHF->ApplyPidTPCRaw(bachelor,4)=%d",trackIDtof,trackIDtpc));
+    isBachelorID1 = (trackIDtof==4) && (trackIDtpc==4); // K0S case
+    //Bool_t isBachelorID2 = fPidHF->ApplyPidTPCRaw(bachelor,2) && fPidHF->ApplyPidTOFRaw(bachelor,2); // LambdaBar case
+    //Bool_t isBachelorID4 = isBachelorID2; // Lambda case
+
+    // identify V0neg
+    //Bool_t isV0NegID1 = fPidHFV0neg->ApplyPidTPCRaw(v0Neg,2) && fPidHFV0neg->ApplyPidTOFRaw(v0Neg,2); // K0S case
+    trackIDtof = fPidHFV0neg->ApplyPidTOFRaw(v0Neg,4);
+    trackIDtpc = fPidHFV0neg->ApplyPidTPCRaw(v0Neg,4);
+    AliDebug(1,Form(" fPidHFV0neg->ApplyPidTOFRaw(v0Neg,4)=%d fPidHFV0neg->ApplyPidTPCRaw(v0Neg,4)=%d",trackIDtof,trackIDtpc));
+    isV0NegID2 = (trackIDtof==4) && (trackIDtpc==4); // LambdaBar case
+    //Bool_t isV0NegID4 = isV0NegID1; // Lambda case
+
+    // identify V0pos
+    //Bool_t isV0PosID1 = fPidHFV0pos->ApplyPidTPCRaw(v0Pos,2) && fPidHFV0pos->ApplyPidTOFRaw(v0Pos,2); // K0S case
+    //Bool_t isV0PosID2 = isV0PosID1; // LambdaBar case
+    trackIDtof = fPidHFV0pos->ApplyPidTOFRaw(v0Pos,4);
+    trackIDtpc = fPidHFV0pos->ApplyPidTPCRaw(v0Pos,4);
+    AliDebug(1,Form(" fPidHFV0pos->ApplyPidTOFRaw(v0Pos,4)=%d fPidHFV0pos->ApplyPidTPCRaw(v0POS,4)=%d",trackIDtof,trackIDtpc));
+    isV0PosID4 = (trackIDtof==4) && (trackIDtpc==4); // Lambda case
+
+    break;
+  case 1:
+
+    // identify bachelor
+    trackIDtof = fPidHF->ApplyPidTOFRaw(bachelor,4);
+    trackIDtpc = fPidHF->ApplyPidTPCRaw(bachelor,4);
+    AliDebug(1,Form(" fPidHF->ApplyPidTOFRaw(bachelor,4)=%d fPidHFV0->ApplyPidTPCRaw(bachelor,4)=%d",trackIDtof,trackIDtpc));
+    isBachelorID1 = ( trackIDtof==4 );
+    Bool_t dummy1 = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (trackIDtpc==4) &&
+                     fPidHF->IsExcluded(bachelor,2,2.,"TPC") && fPidHF->IsExcluded(bachelor,3,2.,"TPC") ); // K0S case
+    isBachelorID1 = isBachelorID1 || dummy1;
+
+
+    // identify V0pos
+    trackIDtof = fPidHFV0pos->ApplyPidTOFRaw(v0Pos,4);
+    trackIDtpc = fPidHFV0pos->ApplyPidTPCRaw(v0Pos,4);
+    AliDebug(1,Form(" fPidHFV0pos->ApplyPidTOFRaw(v0Pos,4)=%d fPidHFV0pos->ApplyPidTPCRaw(v0Pos,4)=%d",trackIDtof,trackIDtpc));
+    isV0PosID4    = ( trackIDtof==4 );
+    Bool_t dummy4 = ( !(fPidHFV0pos->CheckTOFPIDStatus(v0Pos)) && (trackIDtpc==4) &&
+                     fPidHFV0pos->IsExcluded(v0Pos,2,2.,"TPC") && fPidHFV0pos->IsExcluded(v0Pos,3,2.,"TPC") ); // Lambda case
+    isV0PosID4 = isV0PosID4 || dummy4;
+
+
+    // identify V0neg
+    trackIDtof = fPidHFV0neg->ApplyPidTOFRaw(v0Neg,4);
+    trackIDtpc = fPidHFV0neg->ApplyPidTPCRaw(v0Neg,4);
+    AliDebug(1,Form(" fPidHFV0neg->ApplyPidTOFRaw(v0Neg,4)=%d fPidHFV0neg->ApplyPidTPCRaw(v0Neg,4)=%d",trackIDtof,trackIDtpc));
+    isV0NegID2    = ( trackIDtof==4 );
+    Bool_t dummy2 = ( !(fPidHFV0neg->CheckTOFPIDStatus(v0Neg)) && (trackIDtpc==4) &&
+                     fPidHFV0neg->IsExcluded(v0Neg,2,2.,"TPC") && fPidHFV0neg->IsExcluded(v0Neg,3,2.,"TPC") ); // LambdaBar case
+    isV0NegID2 = isV0NegID2 || dummy2;
+
+    break;
+
+  }
+
+}
+//----------------
 Int_t AliRDHFCutsLctoV0::CombinePIDCuts(Int_t returnvalue, Int_t returnvaluePID) const {
   // combine PID with topological cuts
 
@@ -595,17 +697,162 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj, Int_t selectionLevel, Int_t cu
 
   // selection on PID
   if (selectionLevel==AliRDHFCuts::kAll || 
-      selectionLevel==AliRDHFCuts::kPID)
+      selectionLevel==AliRDHFCuts::kCandidate || 
+      selectionLevel==AliRDHFCuts::kPID )
     returnvaluePID = IsSelectedPID(d);
 
-  //if (fUsePID && returnvaluePID==0) return 0;
-
-  Int_t returnvalueTot = /*0;
-  if (fUsePID)
-  returnvalueTot =*/ CombinePIDCuts(returnvalue,returnvaluePID);
-  /*else
-    returnvalueTot = returnvalue;*/
+  Int_t returnvalueTot = CombinePIDCuts(returnvalue,returnvaluePID);
 
   return returnvalueTot;
 
 }
+//----------------------------------
+void AliRDHFCutsLctoV0::SetStandardCutsPP2010() {
+
+ SetName("LctoV0ProductionCuts");
+ SetTitle("Production cuts for Lc->V0+bachelor analysis");
+
+  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
+  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
+  //default
+  esdTrackCuts->SetRequireTPCRefit(kTRUE);
+  esdTrackCuts->SetRequireITSRefit(kTRUE);
+  //esdTrackCuts->SetMinNClustersITS(4); // default is 5
+  esdTrackCuts->SetMinNClustersTPC(70);
+  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                        AliESDtrackCuts::kAny); 
+  // default is kBoth, otherwise kAny
+  esdTrackCuts->SetMinDCAToVertexXY(0.);
+  esdTrackCuts->SetPtRange(0.3,1.e10);
+  esdTrackCuts->SetEtaRange(-0.8,+0.8);
+  AddTrackCuts(esdTrackCuts);
+
+
+  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
+  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
+  //default
+  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
+  esdTrackCutsV0daughters->SetRequireITSRefit(kTRUE);
+  //esdTrackCutsV0daughters->SetMinNClustersITS(4); // default is 5
+  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
+  esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                             AliESDtrackCuts::kAny); 
+  // default is kBoth, otherwise kAny
+  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
+  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
+  AddTrackCutsV0daughters(esdTrackCutsV0daughters);
+
+  const Int_t nptbins=1;
+  Float_t* ptbins;
+  ptbins=new Float_t[nptbins+1];
+  ptbins[0]=0.;
+  ptbins[1]=99999999.;
+
+  SetPtBins(nptbins+1,ptbins);
+  SetPtBins(nptbins+1,ptbins);
+
+  const Int_t nvars=9 ;
+
+  Float_t** prodcutsval;
+  prodcutsval=new Float_t*[nvars];
+  for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
+  for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
+   prodcutsval[0][ipt2]=1.;    // inv. mass if K0S [GeV/c2]
+   prodcutsval[1][ipt2]=1.;    // inv. mass if Lambda [GeV/c2]
+   prodcutsval[2][ipt2]=0.05;  // inv. mass V0 if K0S [GeV/c2]
+   prodcutsval[3][ipt2]=0.05;  // inv. mass V0 if Lambda [GeV/c2]
+   prodcutsval[4][ipt2]=0.3;   // pT min bachelor track [GeV/c] // AOD by construction
+   prodcutsval[5][ipt2]=0.;    // pT min V0-positive track [GeV/c]
+   prodcutsval[6][ipt2]=0.;    // pT min V0-negative track [GeV/c]
+   prodcutsval[7][ipt2]=1000.; // dca cascade cut [cm]
+   prodcutsval[8][ipt2]=1000.; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
+  }
+ SetCuts(nvars,nptbins,prodcutsval);
+
+ SetGlobalIndex(nvars,nptbins);
+ SetPtBins(nptbins+1,ptbins);
+
+
+  //pid settings
+  //1. bachelor: default one
+  AliAODPidHF* pidObjBachelor = new AliAODPidHF();
+  Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
+  pidObjBachelor->SetSigma(sigmasBac);
+  pidObjBachelor->SetAsym(kFALSE);
+  pidObjBachelor->SetMatch(1);
+  pidObjBachelor->SetTPC(kTRUE);
+  pidObjBachelor->SetTOF(kTRUE);
+  pidObjBachelor->SetTOFdecide(kFALSE);
+  SetPidHF(pidObjBachelor);
+
+  //2. V0pos
+  AliAODPidHF* pidObjV0pos = new AliAODPidHF();
+  Double_t sigmasV0pos[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
+  pidObjV0pos->SetSigma(sigmasV0pos);
+  pidObjV0pos->SetAsym(kFALSE);
+  pidObjV0pos->SetMatch(1);
+  pidObjV0pos->SetTPC(kTRUE);
+  pidObjV0pos->SetTOF(kTRUE);
+  pidObjV0pos->SetTOFdecide(kFALSE);
+  SetPidV0pos(pidObjV0pos);
+
+  //2. V0neg
+  AliAODPidHF* pidObjV0neg = new AliAODPidHF();
+  Double_t sigmasV0neg[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
+  pidObjV0neg->SetSigma(sigmasV0neg);
+  pidObjV0neg->SetAsym(kFALSE);
+  pidObjV0neg->SetMatch(1);
+  pidObjV0neg->SetTPC(kTRUE);
+  pidObjV0neg->SetTOF(kTRUE);
+  pidObjV0neg->SetTOFdecide(kFALSE);
+  SetPidV0neg(pidObjV0neg);
+
+  SetUsePID(kFALSE);//(kTRUE);
+
+  PrintAll();
+
+ for(Int_t iiv=0;iiv<nvars;iiv++){
+  delete [] prodcutsval[iiv];
+ }
+ delete [] prodcutsval;
+ prodcutsval=NULL;
+ delete [] ptbins;
+ ptbins=NULL;
+
+
+ delete pidObjBachelor;
+ pidObjBachelor=NULL;
+
+ delete pidObjV0pos;
+ pidObjV0pos=NULL;
+
+ delete pidObjV0neg;
+ pidObjV0neg=NULL;
+
+ return;
+}
+//------------------
+void AliRDHFCutsLctoV0::SetStandardCutsPbPb2010() {
+
+ SetName("LctoV0ProductionCuts");
+ SetTitle("Production cuts for Lc->V0+bachelor analysis");
+
+ SetStandardCutsPP2010();
+
+ return;
+}
+//------------------
+void AliRDHFCutsLctoV0::SetStandardCutsPbPb2011() {
+
+  // Default 2010 PbPb cut object
+  SetStandardCutsPbPb2010();
+
+  //
+  // Enable all 2011 PbPb run triggers
+  //  
+  SetTriggerClass("");
+  ResetMaskAndEnableMBTrigger();
+  EnableCentralTrigger();
+  EnableSemiCentralTrigger();
+
+}
index 01a040f..5a092be 100644 (file)
@@ -17,12 +17,17 @@ class AliRDHFCutsLctoV0 : public AliRDHFCuts
 {
  public:
 
-  enum {
+  enum ELctoV0channel {
     kLcToK0Spr=0x0001,
     kLcToLBarpi=0x0002,
     kLcToLpi=0x0004
   };
 
+ enum ELctoV0pidStrategy {
+  kTOFandTPC=0,
+  kTOForTPCveto=1
+ };
+
   AliRDHFCutsLctoV0(const char* name="CutsLctoV0", Short_t v0channel=0);
   
   virtual ~AliRDHFCutsLctoV0();
@@ -45,6 +50,13 @@ class AliRDHFCutsLctoV0 : public AliRDHFCuts
   Float_t GetMassCut(Int_t iPtBin=0) const { return (GetCuts() ? fCutsRD[GetGlobalIndex(0,iPtBin)] : 1.e6);}
   Float_t GetDCACut(Int_t iPtBin=0) const { return (GetCuts() ? fCutsRD[GetGlobalIndex(7,iPtBin)] : 1.e6);}
 
+  void SetPidSelectionFlag(Int_t a) {fPidSelectionFlag=a;}
+  Int_t GetPidSelectionFlag() {return fPidSelectionFlag;}
+
+  virtual void SetStandardCutsPP2010();
+  virtual void SetStandardCutsPbPb2010();
+  virtual void SetStandardCutsPbPb2011();
+
   void SetPidV0pos(AliAODPidHF* pidV0pos) {
     if (fPidHFV0pos) delete fPidHFV0pos;
     fPidHFV0pos = new AliAODPidHF(*pidV0pos);
@@ -57,15 +69,25 @@ class AliRDHFCutsLctoV0 : public AliRDHFCuts
   AliAODPidHF * GetPidV0pos() { return fPidHFV0pos; }
   AliAODPidHF * GetPidV0neg() { return fPidHFV0neg; }
 
+  void AddTrackCutsV0daughters(AliESDtrackCuts* v0daug) {
+    fV0daughtersCuts = new AliESDtrackCuts(*v0daug);
+  }
+  virtual AliESDtrackCuts *GetTrackCutsV0daughters() const {return fV0daughtersCuts;}
+
  protected:
 
+  void CheckPID(AliAODTrack *bachelor, AliAODTrack *v0Neg, AliAODTrack *v0Pos,
+               Bool_t &isBachelorID1, Bool_t &isV0NegID2, Bool_t &isV0PosID4);
+
  private:
 
+  Int_t fPidSelectionFlag;
   AliAODPidHF *fPidHFV0pos;
   AliAODPidHF *fPidHFV0neg;
+  AliESDtrackCuts *fV0daughtersCuts; // cuts for v0 daughters (AOD converted to ESD on the flight!)
   //UShort_t fV0channel;
 
-  ClassDef(AliRDHFCutsLctoV0,2);  // class for cuts on AOD reconstructed Lc->V0+bachelor
+  ClassDef(AliRDHFCutsLctoV0,3);  // class for cuts on AOD reconstructed Lc->V0+bachelor
 };
 
 #endif
index 1f236b3..1ba584a 100644 (file)
@@ -33,6 +33,23 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   esdTrackCuts->SetMinDCAToVertexXY(0.);
   esdTrackCuts->SetPtRange(0.3,1.e10);
 
+
+
+  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
+  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
+  //default
+  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
+  esdTrackCutsV0daughters->SetRequireITSRefit(kTRUE);
+  esdTrackCutsV0daughters->SetMinNClustersITS(4); // default is 5
+  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
+  esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                             AliESDtrackCuts::kAny); 
+  // default is kBoth, otherwise kAny
+  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
+  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
+
+
+
   AliRDHFCutsLctoV0* RDHFLctoV0An=new AliRDHFCutsLctoV0();
   RDHFLctoV0An->SetName("LctoV0AnalysisCuts");
   RDHFLctoV0An->SetTitle("Analysis cuts for Lc analysis");
@@ -44,6 +61,12 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   RDHFLctoV0Prod->AddTrackCuts(esdTrackCuts);
   RDHFLctoV0An->AddTrackCuts(esdTrackCuts);
 
+  RDHFLctoV0Prod->AddTrackCutsV0daughters(esdTrackCutsV0daughters);
+  RDHFLctoV0An->AddTrackCutsV0daughters(esdTrackCutsV0daughters);
+
+  RDHFLctoV0Prod->SetPidSelectionFlag(0); // TOF AND TPC
+  RDHFLctoV0An->SetPidSelectionFlag(0); // TOF AND TPC
+
   const Int_t nptbins=1;
   Float_t* ptbins;
   ptbins=new Float_t[nptbins+1];
@@ -58,13 +81,13 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   prodcutsval=new Float_t*[nvars];
   for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
   for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
-   prodcutsval[0][ipt2]=1.; // inv. mass if K0S [GeV/c2]
-   prodcutsval[1][ipt2]=1.; // inv. mass if Lambda [GeV/c2]
-   prodcutsval[2][ipt2]=0.05; // inv. mass V0 if K0S [GeV/c2]
-   prodcutsval[3][ipt2]=0.05; // inv. mass V0 if Lambda [GeV/c2]
-   prodcutsval[4][ipt2]=0.3; // pT min bachelor track [GeV/c] // AOD by construction
-   prodcutsval[5][ipt2]=0.;  // pT min V0-positive track [GeV/c]
-   prodcutsval[6][ipt2]=0.;  // pT min V0-negative track [GeV/c]
+   prodcutsval[0][ipt2]=1.;    // inv. mass if K0S [GeV/c2]
+   prodcutsval[1][ipt2]=1.;    // inv. mass if Lambda [GeV/c2]
+   prodcutsval[2][ipt2]=0.05;  // inv. mass V0 if K0S [GeV/c2]
+   prodcutsval[3][ipt2]=0.05;  // inv. mass V0 if Lambda [GeV/c2]
+   prodcutsval[4][ipt2]=0.3;   // pT min bachelor track [GeV/c] // AOD by construction
+   prodcutsval[5][ipt2]=0.;    // pT min V0-positive track [GeV/c]
+   prodcutsval[6][ipt2]=0.;    // pT min V0-negative track [GeV/c]
    prodcutsval[7][ipt2]=1000.; // dca cascade cut [cm]
    prodcutsval[8][ipt2]=1000.; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
   }
@@ -74,13 +97,13 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   anacutsval=new Float_t*[nvars];
   for(Int_t ic=0;ic<nvars;ic++){anacutsval[ic]=new Float_t[nptbins];}
   for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
-   anacutsval[0][ipt2]=0.25; // inv. mass if K0S [GeV/c2]
-   anacutsval[1][ipt2]=0.25; // inv. mass if Lambda [GeV/c2]
+   anacutsval[0][ipt2]=0.25;   // inv. mass if K0S [GeV/c2]
+   anacutsval[1][ipt2]=0.25;   // inv. mass if Lambda [GeV/c2]
    anacutsval[2][ipt2]=0.0075; // inv. mass V0 if K0S [GeV/c2]
    anacutsval[3][ipt2]=0.0030; // inv. mass V0 if Lambda [GeV/c2]
-   anacutsval[4][ipt2]=0.3; // pT min bachelor track [GeV/c] // AOD by construction
-   anacutsval[5][ipt2]=0.;  // pT min V0-positive track [GeV/c]
-   anacutsval[6][ipt2]=0.;  // pT min V0-negative track [GeV/c]
+   anacutsval[4][ipt2]=0.3;    // pT min bachelor track [GeV/c] // AOD by construction
+   anacutsval[5][ipt2]=0.;     // pT min V0-positive track [GeV/c]
+   anacutsval[6][ipt2]=0.;     // pT min V0-negative track [GeV/c]
    anacutsval[7][ipt2]=1000.; // dca cascade cut [cm]
    anacutsval[8][ipt2]=1.5;   // dca V0 cut [nSigma] // it's 1.5 x offline V0s
   }
@@ -110,7 +133,7 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   pidObjV0pos->SetTPC(kTRUE);
   pidObjV0pos->SetTOF(kTRUE);
   pidObjV0pos->SetTOFdecide(kFALSE);
-  RDHFLctoV0An->SetPidHF(pidObjV0pos);
+  RDHFLctoV0An->SetPidV0pos(pidObjV0pos);
 
   //2. V0neg
   AliAODPidHF* pidObjV0neg = new AliAODPidHF();
@@ -121,7 +144,7 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   pidObjV0neg->SetTPC(kTRUE);
   pidObjV0neg->SetTOF(kTRUE);
   pidObjV0neg->SetTOFdecide(kFALSE);
-  RDHFLctoV0An->SetPidHF(pidObjV0neg);
+  RDHFLctoV0An->SetPidV0neg(pidObjV0neg);
 
 
   // uncomment these lines for Baysian PID:
@@ -147,7 +170,7 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   RDHFLctoV0Prod->PrintAll();
   cout<<"This is the object I'm going to save:"<<endl;
   RDHFLctoV0An->PrintAll();
-  TFile* fout=new TFile("Lc2pK0SCuts.root","RECREATE"); 
+  TFile* fout=new TFile("LctoV0bachelorCuts.root","RECREATE"); 
   fout->cd();
   RDHFLctoV0Prod->Write();
   RDHFLctoV0An->Write();
@@ -184,8 +207,25 @@ void makeInputAliAnalysisTaskSESignificanceMaximization(){
   esdTrackCuts->SetEtaRange(-0.8,0.8);
   esdTrackCuts->SetPtRange(0.3,1.e10);
   
+  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
+  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
+  //default
+  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
+  esdTrackCutsV0daughters->SetRequireITSRefit(kTRUE);
+  esdTrackCutsV0daughters->SetMinNClustersITS(4); // default is 5
+  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
+  esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
+                                        AliESDtrackCuts::kAny); 
+  // default is kBoth, otherwise kAny
+  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
+  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
+
   RDHFLctoV0->AddTrackCuts(esdTrackCuts);
 
+  RDHFLctoV0->AddTrackCutsV0daughters(esdTrackCutsV0daughters);
+
+  RDHFLctoV0->SetPidSelectionFlag(0); // TOF AND TPC
+
   const Int_t nvars=9;
 
   const Int_t nptbins=1; //change this when adding pt bins!
@@ -319,7 +359,7 @@ void makeInputAliAnalysisTaskSESignificanceMaximization(){
   pidObjV0pos->SetTPC(kTRUE);
   pidObjV0pos->SetTOF(kTRUE);
   pidObjV0pos->SetTOFdecide(kFALSE);
-  RDHFLctoV0->SetPidHF(pidObjV0pos);
+  RDHFLctoV0->SetPidV0pos(pidObjV0pos);
 
   //2. V0neg
   AliAODPidHF* pidObjV0neg = new AliAODPidHF();
@@ -330,7 +370,7 @@ void makeInputAliAnalysisTaskSESignificanceMaximization(){
   pidObjV0neg->SetTPC(kTRUE);
   pidObjV0neg->SetTOF(kTRUE);
   pidObjV0neg->SetTOFdecide(kFALSE);
-  RDHFLctoV0->SetPidHF(pidObjV0neg);
+  RDHFLctoV0->SetPidV0neg(pidObjV0neg);
 
   //activate pileup rejection (for pp)
   //RDHFLctoV0->SetOptPileup(AliRDHFCuts::kRejectPileupEvent);