Updates in Lc->V0bachelor analysis (Annalisa)
authorfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Apr 2013 23:07:23 +0000 (23:07 +0000)
committerfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Apr 2013 23:07:23 +0000 (23:07 +0000)
PWGHF/vertexingHF/AliAODRecoCascadeHF.cxx
PWGHF/vertexingHF/AliAODRecoCascadeHF.h
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelor.cxx
PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelor.h
PWGHF/vertexingHF/AliCFTaskVertexingHF.h
PWGHF/vertexingHF/AliCFVertexingHF.cxx
PWGHF/vertexingHF/AliCFVertexingHFLctoV0bachelor.cxx
PWGHF/vertexingHF/AliCFVertexingHFLctoV0bachelor.h
PWGHF/vertexingHF/AliRDHFCutsLctoV0.cxx
PWGHF/vertexingHF/macros/AddTaskCFVertexingHFLctoV0bachelor.C
PWGHF/vertexingHF/macros/makeTFile4CutsLctoV0bachelor.C

index e56d53a..0ef3fe6 100644 (file)
@@ -133,7 +133,7 @@ Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
     AliAODRecoDecayHF2Prong *the2Prong = Get2Prong();
     lab2Prong = the2Prong->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong);
   } else {
-    AliAODv0 *theV0 = Getv0();
+    AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
     lab2Prong = theV0->MatchToMC(pdgabs2prong,mcArray,2,pdgDg2prong);
   }
 
@@ -143,7 +143,7 @@ Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
 
   // loop on daughters and write labels
   for(Int_t i=0; i<ndg; i++) {
-    AliVTrack *trk = (AliVTrack*)GetDaughter(i);
+    AliVTrack *trk = dynamic_cast<AliVTrack*>(GetDaughter(i));
     Int_t lab = trk->GetLabel();
     if(lab==-1) { // this daughter is the 2prong
       lab=lab2Prong;
@@ -157,7 +157,7 @@ Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
     // debug printouts for Lc->V0 bachelor case
 
     if ( isV0 && (dgLabels[0]!=-1 && dgLabels[1]!=-1) ) {
-      AliAODv0 *theV0 = Getv0();
+      AliAODv0 *theV0 = dynamic_cast<AliAODv0*>(Getv0());
       Bool_t onTheFly = theV0->GetOnFlyStatus();
       
       if ( (pdgDg[1]==2212 && pdgDg[0]==310) ||
@@ -168,9 +168,9 @@ Int_t AliAODRecoCascadeHF::MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
       }
 
       if (pdgDg[0]==2212 && pdgDg[1]==310) {
-       AliAODMCParticle*k0s = (AliAODMCParticle*)mcArray->At(lab2Prong);
+       AliAODMCParticle*k0s = dynamic_cast<AliAODMCParticle*>(mcArray->At(lab2Prong));
        Int_t labK0 = k0s->GetMother();
-       AliAODMCParticle*k0bar = (AliAODMCParticle*)mcArray->At(labK0);
+       AliAODMCParticle*k0bar = dynamic_cast<AliAODMCParticle*>(mcArray->At(labK0));
        AliDebug(1,Form(" (onTheFly=%1d) LabelV0=%d (%d) -> LabelK0S=%d (%d -> %d %d)",onTheFly,labK0,k0bar->GetPdgCode(),lab2Prong,pdgabs2prong,pdgDg2prong[0],pdgDg2prong[1]));
        AliDebug(1,Form(" LabelLc=%d (%d) -> LabelBachelor=%d (%d) LabelV0=%d (%d)",
                        finalLabel,pdgabs,
@@ -437,3 +437,56 @@ Double_t AliAODRecoCascadeHF::CosV0PointingAngle() const
   return v0->CosPointingAngle(posVtx);
 
 }
+//-----------------------------------------------------------------------------
+Double_t AliAODRecoCascadeHF::CosV0PointingAngleXY() const 
+{
+  //
+  // Returns XY cosine of V0 pointing angle wrt primary vertex
+  //
+
+  AliAODv0 *v0 = (AliAODv0*)Getv0();
+
+  if (!v0) 
+    return -999.;
+
+  AliAODVertex *vtxPrimary = GetPrimaryVtx();
+  Double_t posVtx[3] = {0.,0.,0.};
+  vtxPrimary->GetXYZ(posVtx);
+  return v0->CosPointingAngleXY(posVtx);
+
+}
+//-----------------------------------------------------------------------------
+Double_t AliAODRecoCascadeHF::NormalizedV0DecayLength() const
+{
+  //
+  // Returns V0 normalized decay length wrt primary vertex
+  //
+
+  AliAODv0 *v0 = (AliAODv0*)Getv0();
+
+  if (!v0) 
+    return -1.;
+  //AliAODVertex *vtxPrimary = GetPrimaryVtx();
+  //Double_t posVtx[3] = {0.,0.,0.};
+  //vtxPrimary->GetXYZ(posVtx);
+  //return v0->NormalizedDecayLength(posVtx);
+  return v0->NormalizedDecayLength(GetPrimaryVtx());
+
+}
+//-----------------------------------------------------------------------------
+Double_t AliAODRecoCascadeHF::NormalizedV0DecayLengthXY() const
+{
+  //
+  // Returns transverse V0 normalized decay length wrt primary vertex
+  //
+  AliAODv0 *v0 = (AliAODv0*)Getv0();
+
+  if (!v0) 
+    return -1.;
+  //AliAODVertex *vtxPrimary = GetPrimaryVtx();
+  //Double_t posVtx[3] = {0.,0.,0.};
+  //vtxPrimary->GetXYZ(posVtx);
+  //return v0->NormalizedDecayLengthXY(posVtx);
+  return v0->NormalizedDecayLengthXY(GetPrimaryVtx());
+
+}
index c90b4e2..51c57b1 100644 (file)
@@ -88,8 +88,11 @@ class AliAODRecoCascadeHF : public AliAODRecoDecayHF2Prong {
                   TClonesArray *mcArray, Bool_t isV0=kFALSE) const;
 
   Double_t CosV0PointingAngle() const;
+  Double_t CosV0PointingAngleXY() const;
   Double_t DecayLengthV0() const;
   Double_t DecayLengthXYV0() const;
+  Double_t NormalizedV0DecayLength() const;
+  Double_t NormalizedV0DecayLengthXY() const;
 
  protected:
 
index fd5aac5..f488ca1 100644 (file)
@@ -358,7 +358,9 @@ void AliAnalysisTaskSELc2V0bachelor::UserExec(Option_t *)
     ((TH1F*)(fOutput->FindObject("hZ6")))->Fill(zVertex);
 
     // check on MC Lc Daughter
-    SearchLcDaughter(mcArray);
+    for (Int_t iii=0; iii<mcArray->GetEntries(); iii++) {
+      SearchLcDaughter(mcArray,iii);
+    }
 
   }
 
@@ -529,7 +531,7 @@ void AliAnalysisTaskSELc2V0bachelor::UserCreateOutputObjects() {
   if (fWriteVariableTree) {
     const char* nameoutput = GetOutputSlot(6)->GetContainer()->GetName();
     fVariablesTree = new TTree(nameoutput,"Candidates variables tree");
-    Int_t nVar = 71;
+    Int_t nVar = 80;
     fCandidateVariables = new Float_t [nVar];
     TString * fCandidateVariableNames = new TString[nVar];
     fCandidateVariableNames[0]="isLcByMC";
@@ -609,6 +611,20 @@ void AliAnalysisTaskSELc2V0bachelor::UserCreateOutputObjects() {
     fCandidateVariableNames[69]="nSigmaITSka"; // nSigmaITSka
     fCandidateVariableNames[70]="nSigmaITSpr"; // nSigmaITSpr
 
+    fCandidateVariableNames[71]="dcaLcptp"; // DCA Lc prong-to-prong
+
+    fCandidateVariableNames[72]="cosPAV0XY"; // cosPA XY x V0
+    fCandidateVariableNames[73]="cosPALcXY"; // cosPA XY x V0
+
+    fCandidateVariableNames[74]="decayLengthV0XY"; // decay length XY x V0
+    fCandidateVariableNames[75]="decayLengthLcXY"; // decay length XY x V0
+
+    fCandidateVariableNames[76]="normalizedDecayLengthV0"; // normalized decay length x V0
+    fCandidateVariableNames[77]="normalizedDecayLengthLc"; // normalized decay length x Lc
+
+    fCandidateVariableNames[78]="normalizedDecayLengthXYV0"; // normalized decay length XY x V0
+    fCandidateVariableNames[79]="normalizedDecayLengthXYLc"; // normalized decay length XY x Lc
+
     for(Int_t ivar=0; ivar<nVar; ivar++){
       fVariablesTree->Branch(fCandidateVariableNames[ivar].Data(),&fCandidateVariables[ivar],Form("%s/f",fCandidateVariableNames[ivar].Data()));
     }
@@ -1126,9 +1142,19 @@ void AliAnalysisTaskSELc2V0bachelor::FillLc2pK0Sspectrum(AliAODRecoCascadeHF *pa
     fCandidateVariables[69] = nSigmaITSpi;
     fCandidateVariables[70] = nSigmaITSka;
 
-    //AliInfo(Form(" partP: %2.1f %2.1f %2.1f",part->PxProng(0)/bachelor->Px(),part->PyProng(0)/bachelor->Px(),part->PzProng(0)/bachelor->Px())); // !=1, as expected
-    //AliInfo(Form(" V0posP: %2.1f %2.1f %2.1f",v0part->PxProng(0)/v0pos->Px(),v0part->PyProng(0)/v0pos->Px(),v0part->PzProng(0)/v0pos->Px())); // !=1, as expected
-    //AliInfo(Form(" V0negP: %2.1f %2.1f %2.1f",v0part->PxProng(1)/v0neg->Px(),v0part->PyProng(1)/v0neg->Px(),v0part->PzProng(1)/v0neg->Px())); // !=1, as expected
+    fCandidateVariables[71] = part->GetDCA();
+
+    fCandidateVariables[72] = part->CosV0PointingAngleXY();
+    fCandidateVariables[73] = part->CosPointingAngleXY();
+
+    fCandidateVariables[74] = part->DecayLengthXYV0();
+    fCandidateVariables[75] = part->DecayLengthXY();
+
+    fCandidateVariables[76] = part->NormalizedV0DecayLength();
+    fCandidateVariables[77] = part->NormalizedDecayLength();
+
+    fCandidateVariables[78] = part->NormalizedV0DecayLengthXY();
+    fCandidateVariables[79] = part->NormalizedDecayLengthXY();
 
     Double_t v0Momentum = (v0part->PxProng(0)+v0part->PxProng(1))*(v0part->PxProng(0)+v0part->PxProng(1));
     v0Momentum += (v0part->PyProng(0)+v0part->PyProng(1))*(v0part->PyProng(0)+v0part->PyProng(1));
@@ -1140,8 +1166,6 @@ void AliAnalysisTaskSELc2V0bachelor::FillLc2pK0Sspectrum(AliAODRecoCascadeHF *pa
     lcMomentum += (part->PzProng(0)+part->PzProng(1))*(part->PzProng(0)+part->PzProng(1));
     lcMomentum = TMath::Sqrt(lcMomentum);
 
-    //AliInfo(Form(" v0Momentum-ratio=%2.1f - lcMomentum-ratio=%2.1f",v0Momentum/v0part->P(),lcMomentum/part->P()));// ==1, as expected
-
     fVariablesTree->Fill();
   }
 
@@ -1339,39 +1363,6 @@ void AliAnalysisTaskSELc2V0bachelor::FillLc2pK0Sspectrum(AliAODRecoCascadeHF *pa
   return;
 }
 //-------------------------------------------------------------------------------
-Int_t AliAnalysisTaskSELc2V0bachelor::CheckOrigin(TClonesArray* arrayMC, AliAODMCParticle *mcPartCandidate) const {            
-  //
-  // checking whether the mother of the particles come from a charm or a bottom quark
-  //
-       
-  Int_t pdgGranma = 0;
-  Int_t abspdgGranma =0;
-  Bool_t isFromB=kFALSE;
-  Bool_t isQuarkFound=kFALSE;
-  Int_t mother = mcPartCandidate->GetMother();
-  Int_t istep = 0;
-  while (mother>0) {
-    istep++;
-    AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(arrayMC->At(mother));
-    if (mcGranma) {
-      pdgGranma = mcGranma->GetPdgCode();
-      abspdgGranma = TMath::Abs(pdgGranma);
-      if ( (abspdgGranma > 500  && abspdgGranma < 600 ) ||
-          (abspdgGranma > 5000 && abspdgGranma < 6000) ) isFromB=kTRUE;
-      else if (abspdgGranma==4 || abspdgGranma==5) isQuarkFound=kTRUE;
-      mother = mcGranma->GetMother();
-    } else {
-      AliError("Failed casting the mother particle!");
-      break;
-    }
-  }
-  
-  if (isFromB) return 5;
-  else return 4;
-
-}
-
-//-------------------------------------------------------------------------------
 void AliAnalysisTaskSELc2V0bachelor::MakeAnalysisForLc2prK0S(TClonesArray *arrayLctopKos,
                                                             TClonesArray *mcArray,
                                                             Int_t &nSelectedProd,
@@ -1401,41 +1392,69 @@ void AliAnalysisTaskSELc2V0bachelor::MakeAnalysisForLc2prK0S(TClonesArray *array
     ((TH1I*)(fOutput->FindObject("hCandidateSelection")))->Fill(0);
 
     // Lc candidates and K0s from Lc
-    AliAODRecoCascadeHF* lcK0spr = (AliAODRecoCascadeHF*)arrayLctopKos->At(iLctopK0s);
+    AliAODRecoCascadeHF* lcK0spr = dynamic_cast<AliAODRecoCascadeHF*>(arrayLctopKos->At(iLctopK0s));
+    if (!lcK0spr) {
+      AliDebug(2,Form("Cascade %d doens't exist, skipping",iLctopK0s));
+      continue;
+    }
+
     if (!lcK0spr->GetSecondaryVtx()) {
       AliInfo("No secondary vertex");
       continue;
     }
 
+    if (lcK0spr->GetNDaughters()!=2) {
+      AliDebug(2,Form("Cascade %d has not 2 daughters (nDaughters=%d)",iLctopK0s,lcK0spr->GetNDaughters()));
+      continue;
+    }
+
+    AliAODv0 * v0part = dynamic_cast<AliAODv0*>(lcK0spr->Getv0());
+    AliAODTrack * bachPart = dynamic_cast<AliAODTrack*>(lcK0spr->GetBachelor());
+    if (!v0part || !bachPart) {
+      AliDebug(2,Form("Cascade %d has no V0 or no bachelor object",iLctopK0s));
+      continue;
+    }
+
+
+    if (!v0part->GetSecondaryVtx()) {
+      AliDebug(2,Form("No secondary vertex for V0 by cascade %d",iLctopK0s));
+      continue;
+    }
+
+    if (v0part->GetNDaughters()!=2) {
+      AliDebug(2,Form("current V0 has not 2 daughters (onTheFly=%d, nDaughters=%d)",v0part->GetOnFlyStatus(),v0part->GetNDaughters()));
+      continue;
+    }
+
+    AliAODTrack * v0Pos = dynamic_cast<AliAODTrack*>(lcK0spr->Getv0PositiveTrack());
+    AliAODTrack * v0Neg = dynamic_cast<AliAODTrack*>(lcK0spr->Getv0NegativeTrack());
+    if (!v0Neg || !v0Neg) {
+      AliDebug(2,Form("V0 by cascade %d has no V0positive of V0negative object",iLctopK0s));
+      continue;
+    }
+
     ((TH1I*)(fOutput->FindObject("hCandidateSelection")))->Fill(1);
 
-    AliAODTrack * v0Pos = lcK0spr->Getv0PositiveTrack();
-    AliAODTrack * v0Neg = lcK0spr->Getv0NegativeTrack();
-    if (v0Pos->Charge() ==  v0Neg->Charge()) continue;
-  
+    if (v0Pos->Charge() == v0Neg->Charge()) continue;
+
     ((TH1I*)(fOutput->FindObject("hCandidateSelection")))->Fill(2);
 
     Int_t isLc = 0;
 
     if (fUseMCInfo) {
 
-      Bool_t isPrimary=kTRUE;
-  
       Int_t pdgCode=-2;
 
       // find associated MC particle for Lc -> p+K0 and K0S->pi+pi
       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 (mcLabelOld!=mcLabel) AliDebug(2,Form(" Changed MC label: oldONE=%d wrt rightONE=%d",mcLabelOld,mcLabel));
       if (mcLabel>=0) {
-       AliInfo(Form(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cascade number %d (total cascade number = %d)", iLctopK0s,nCascades));
-
-       AliAODMCParticle *partLc = (AliAODMCParticle*)mcArray->At(mcLabel);
-       Int_t checkOrigin = CheckOrigin(mcArray,partLc);
-       if (checkOrigin==5) isPrimary=kFALSE;
+       AliDebug(2,Form(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cascade number %d (total cascade number = %d)", iLctopK0s,nCascades));
 
+       AliAODMCParticle *partLc = dynamic_cast<AliAODMCParticle*>(mcArray->At(mcLabel));
        pdgCode = partLc->GetPdgCode();
-       if (pdgCode<0) AliInfo(Form(" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d", mcLabel, pdgCode));
+       if (pdgCode<0) AliDebug(2,Form(" ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ MClabel=%d ~~~~~~~~~~ pdgCode=%d", mcLabel, pdgCode));
        pdgCode = TMath::Abs(pdgCode);
        isLc = 1;
       } else {
@@ -1532,222 +1551,159 @@ Int_t AliAnalysisTaskSELc2V0bachelor::MatchToMC(AliAODRecoCascadeHF *lc2bacV0,
 
 }
 
-//-----------------------
-void AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC)
+//________________________________________________________________
+Int_t AliAnalysisTaskSELc2V0bachelor::SearchLcDaughter(TClonesArray *arrayMC, Int_t iii)
 {
-  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;
-  Int_t daughPdg1=0;
-  Int_t daughPdg2=0;
-  Int_t daughK0Pdg=0;
-  Int_t nDaughL=0;
-  Int_t daughK0s1pdg;
-  Int_t daughK0s2pdg;
-  Int_t daughL1pdg=0;
-  Int_t daughL2pdg=0;
+
+  Int_t indexToBeReturned=-999;
+
+  Int_t pdgLc=4122;
+  Int_t pdgLambda=3122;
+  Int_t pdgV0=310;
+  Int_t pdgK0=311;
+  Int_t pdgBachelor=2212;
+  Int_t pdgBachelorPi=211;
 
   TString fillthis="";
   fillthis="histMcStatLc";
 
-  for (Int_t iii=0; iii<arrayMC->GetEntries(); iii++) {
-    searchLc = (AliAODMCParticle*)arrayMC->At(iii);
-    searchLcpdg =  searchLc->GetPdgCode();
-    if (TMath::Abs(searchLcpdg) == 4122) {
-      ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(0);
-      nDaughLc= searchLc->GetNDaughters();
-
-      if (searchLcpdg == 4122) { // It is Lc+
-       ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(1);
-       if (nDaughLc!=2) continue;
-       if (searchLc->GetDaughter(0)<0 || searchLc->GetDaughter(1)) continue;
-       daugh1 = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(0));
-       daugh2 = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(1));
-       if (!daugh1 || !daugh2) continue;
-       daughPdg1=daugh1->GetPdgCode();
-       daughPdg2=daugh2->GetPdgCode();
-
-       if ( (daughPdg1==2212 && daughPdg2==-311) ||
-            (daughPdg2==2212 && daughPdg1==-311) ) { // Lc+ -> p K0bar
-         ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(2);
-
-         if (daughPdg1==-311) {
-           nDaughK0=daugh1->GetNDaughters();
-           if (nDaughK0!=1) {
-             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
-             continue;
-           }
-           daughK0 = (AliAODMCParticle*)arrayMC->At(daugh1->GetDaughter(0)); // K0S
-         } else { // if (daughPdg2==-311)
-           nDaughK0=daugh2->GetNDaughters();
-           if (nDaughK0!=1) {
-             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
-             continue;
-           }
-           daughK0 = (AliAODMCParticle*)arrayMC->At(daugh2->GetDaughter(0)); // K0S
-         }
-         if (!daughK0) {
-           //((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
-           continue;
-         }
-         AliInfo(" Found positive daughK0 ");
-         daughK0Pdg=daughK0->GetPdgCode();
-         if (daughK0Pdg!=310) {
-           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
-           continue;
-         }
-         ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(3);
-         nDaughK0s=daughK0->GetNDaughters();
-         if (nDaughK0s!=2) {
-           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(6);
-           continue;
-         }
-         if (daughK0->GetDaughter(0)<0 || daughK0->GetDaughter(1)<0) continue;
-         daughK0s1= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(0));
-         daughK0s2= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(1));
-         if (!daughK0s1 || !daughK0s2) continue;
-         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);
-
-       } //if ((daughPdg1==2212 && daughPdg2==-311)||(daughPdg2==2212 && daughPdg1==-311))
-
-       else if ( (daughPdg1==3122 && daughPdg2==211) ||
-                 (daughPdg2==3122 && daughPdg1==211) ) { // Lc+ -> pi+ Lambda
-         ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(7);
-
-         if (daughPdg1==3122)
-           daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(0)); // Lambda
-         else
-           daugh = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(1)); // Lambda
-         if (!daugh) continue;
-         AliInfo(" Found positive daughL ");
-         nDaughL=daugh->GetNDaughters();
-         if (nDaughL!=2) {
-           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(9);
-           continue;
-         }
-         if (daugh->GetDaughter(0)<0 || daugh->GetDaughter(1)<0) continue;
-         daughL1= (AliAODMCParticle*)arrayMC->At(daugh->GetDaughter(0));
-         daughL2= (AliAODMCParticle*)arrayMC->At(daugh->GetDaughter(1));
-         if (!daughL1 || !daughL2) continue;
-         daughL1pdg=daughL1->GetPdgCode();
-         daughL2pdg=daughL2->GetPdgCode();
-         if ( ((daughL1pdg==-211) && (daughL2pdg==2212)) ||
-              ((daughL2pdg==-211) && (daughL1pdg==2212)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(8);
-         else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(9);
-
-       }//else if ((daughPdg1==3122 && daughPdg2==211)||(daughPdg2==3122 && daughPdg1==211))
-
-      }//if (searchLcpdg == 4122)
-
-      if (searchLcpdg == -4122) { // It is Lc+
-
-       ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-1);
-
-       if (nDaughLc!=2) continue;
-       if (searchLc->GetDaughter(0)<0 || searchLc->GetDaughter(1)<0) continue;
-       daugh1 = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(0));
-       daugh2 = (AliAODMCParticle*)arrayMC->At(searchLc->GetDaughter(1));
-       if (!daugh1 || !daugh2) continue;
-       daughPdg1=daugh1->GetPdgCode();
-       daughPdg2=daugh2->GetPdgCode();
-       if ( (daughPdg1==-2212 && daughPdg2==311) ||
-            (daughPdg2==-2212 && daughPdg1==311) ) { // Lc- -> pbar K0
-         ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-2);
-
-         if (daughPdg1==311) {
-           nDaughK0=daugh1->GetNDaughters();
-           if (nDaughK0!=1) {
-             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-4);
-             continue;
-           }
-           daughK0 = (AliAODMCParticle*)arrayMC->At(daugh1->GetDaughter(0));
-
-         } else {
-           nDaughK0=daugh2->GetNDaughters();
-           if (nDaughK0!=1) {
-             ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-4);
-             continue;
-           }
-           daughK0 = (AliAODMCParticle*)arrayMC->At(daugh2->GetDaughter(0));
-
-         }
-         if (!daughK0) {
-            //((TH1F*)(fOutput->FindObject(fillthis)))->Fill(4);
-           continue;
-         }
-
-         AliInfo(" Found negative daughK0 ");
-         daughK0Pdg=daughK0->GetPdgCode();
-         if (daughK0Pdg!=310) {
-           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-4);
-           continue;
-         }
-         ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-3);
-         nDaughK0s=daughK0->GetNDaughters();
-         if (nDaughK0s!=2) {
-           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-6);
-           continue;
-         }
-         if (daughK0->GetDaughter(0)<0 || daughK0->GetDaughter(1)<0) continue;
-         daughK0s1= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(0));
-         daughK0s2= (AliAODMCParticle*)arrayMC->At(daughK0->GetDaughter(1));
-         if (!daughK0s1 || !daughK0s2) continue;
-         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);
-
-       }//if ((daughPdg1==-2212 && daughPdg2==-311)||(daughPdg2==-2212 && daughPdg1==-311))
-
-       else if ( (daughPdg1==-3122 && daughPdg2==-211) ||
-                 (daughPdg2==-3122 && daughPdg1==-211) ) {
-         ((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 (!daugh) continue;
-         AliInfo(" Found negative daughL ");
-         nDaughL=daugh->GetNDaughters();
-         if (nDaughL!=2) {
-           ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-9);
-           continue;
-         }
-         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)) ||
-              ((daughL2pdg==211) && (daughL1pdg==-2212)) ) ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-8);
-         else ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(-9);
-
-       }//else if ((daughPdg1==-3122 && daughPdg2==-211)||(daughPdg2==-3122 && daughPdg1==-211))
-
-      } // pdgLc==-4122
-    }// if (TMath::Abs(searchLcpdg) == 4122)
-  }// for (Int_t iii=0; iii<arrayMC->GetEntries(); iii++)
-  
-}
-//----------------------------------------------------
+  AliAODMCParticle *searchLc = dynamic_cast<AliAODMCParticle*>(arrayMC->At(iii));
+  if (TMath::Abs(searchLc->GetPdgCode()) != pdgLc) return -999;
+
+  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(0);
+  indexToBeReturned = 0;
+
+  ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*1);
+  indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*1;
+
+  Int_t nDaughLc = searchLc->GetNDaughters();
+  if (nDaughLc!=2) {
+    ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*10);
+    indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*10;
+    return indexToBeReturned;
+  }
+
+  Int_t index1=searchLc->GetDaughter(0);
+  Int_t index2=searchLc->GetDaughter(1);
+  if (index1<=0 || index2<=0) {
+    return -999;
+  }
+
+  AliAODMCParticle *daugh1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
+  AliAODMCParticle *daugh2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
+  if (!daugh1 || !daugh2) return -999;
+
+  Int_t daughPdg1 = TMath::Abs(daugh1->GetPdgCode());
+  Int_t daughPdg2 = TMath::Abs(daugh2->GetPdgCode());
+  if ( !( (daughPdg1==pdgBachelor && daughPdg2==pdgK0) ||
+         (daughPdg2==pdgBachelor && daughPdg1==pdgK0) ||
+         (daughPdg1==pdgLambda && daughPdg2==pdgBachelorPi) ||
+         (daughPdg2==pdgLambda && daughPdg1==pdgBachelorPi) ) ) {
+    ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*10);
+    indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*10;
+    return indexToBeReturned;
+  }
+
+  if (daughPdg1==pdgK0 || daughPdg1==pdgLambda) {
+    index1=searchLc->GetDaughter(1);
+    index2=searchLc->GetDaughter(0);
+  }
+  daugh1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
+  daugh2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
+  daughPdg1=TMath::Abs(daugh1->GetPdgCode());
+  daughPdg2=TMath::Abs(daugh2->GetPdgCode());
+
+  if ( daughPdg1==pdgBachelor && daughPdg2==pdgK0 ) { // Lc+ -> p K0bar
+
+    ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*2);
+    indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*2;
+
+    Int_t nDaughK0 = daugh2->GetNDaughters();
+    if (nDaughK0!=1) return -999;
+
+    Int_t indexK0daugh=daugh2->GetDaughter(0);
+    if (indexK0daugh<=0) return -999;
+
+    AliAODMCParticle *daughK0 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(indexK0daugh));
+    if (!daughK0) return -999;
+
+    Int_t daughK0Pdg=TMath::Abs(daughK0->GetPdgCode());
+    if (daughK0Pdg!=pdgV0) {
+      ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*4); // K0L
+      indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*4;
+      return indexToBeReturned;
+    }
+    ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*3); // K0S
+    indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*3;
+
+    Int_t nDaughK0S = daughK0->GetNDaughters();
+    if (nDaughK0S!=2) {
+      ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*5); // other decays for K0S
+      indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*5;
+      return indexToBeReturned;
+    }
+
+    index1=daughK0->GetDaughter(0);
+    index2=daughK0->GetDaughter(1);
+    if(index1<=0 || index2<=0) {
+      return -999;
+    }
+
+    AliAODMCParticle *daughK0s1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
+    AliAODMCParticle *daughK0s2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
+    if (!daughK0s1 || !daughK0s2) return -999;
+
+    Int_t daughK0s1pdg=TMath::Abs(daughK0s1->GetPdgCode());
+    Int_t daughK0s2pdg=TMath::Abs(daughK0s2->GetPdgCode());
+
+    if ( daughK0s1pdg==211 && daughK0s2pdg==211 ) {
+      ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*6); // K0S -> pi+ pi-
+      indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*6;
+    } else {
+      ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*5); // other decays for K0S
+    indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*5;
+    }
+
+  } //if (daughPdg1==pdgBachelor && daughPdg2==pdgK0)
+  else if ( daughPdg1==pdgBachelorPi && daughPdg2==pdgLambda ) { // Lc+ -> pi+ Lambda
+
+    ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*7);
+    indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*7;
 
+    Int_t nDaughL = daugh2->GetNDaughters();
+    if (nDaughL!=2) {
+      ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*8);
+      indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*8;
+      return indexToBeReturned;
+    }
+
+    index1=daugh2->GetDaughter(0);
+    index2=daugh2->GetDaughter(1);
+    if(index1<=0 || index2<=0) {
+      return -999;
+    }
+
+    AliAODMCParticle *daughL1 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index1));
+    AliAODMCParticle *daughL2 = dynamic_cast<AliAODMCParticle*>(arrayMC->At(index2));
+    if (!daughL1 || !daughL2) return -999;
+
+    Int_t daughL1pdg=TMath::Abs(daughL1->GetPdgCode());
+    Int_t daughL2pdg=TMath::Abs(daughL2->GetPdgCode());
+    if ( (daughL1pdg==211 && daughL2pdg==2212) ||
+        (daughL2pdg==211 && daughL1pdg==2212) ) {
+      ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*9);
+      indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*9;
+    } else {
+      ((TH1F*)(fOutput->FindObject(fillthis)))->Fill(TMath::Nint(searchLc->Charge()/3.)*8);
+      indexToBeReturned = TMath::Nint(searchLc->Charge()/3.)*8;
+    }
+
+  } //else if (daughPdg1==pdgBachelorPi && daughPdg2==pdgLambda)
+
+  return indexToBeReturned;
+
+}
+//________________________________________________________________
 void AliAnalysisTaskSELc2V0bachelor::FillArmPodDistribution(AliAODv0 *vZero,
                                                      TString histoTitle,
                                                      TList *histoList) {
index 2ec9753..425725e 100644 (file)
@@ -55,21 +55,12 @@ class AliAnalysisTaskSELc2V0bachelor : public AliAnalysisTaskSE
                           TClonesArray *mcArray);
 
   void DefineHistograms();
-  Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPartCandidate) const;
 
   void MakeAnalysisForLc2prK0S(TClonesArray *arrayLctopK0s,
                               TClonesArray *mcArray,
                               Int_t &nSelectedProd, AliRDHFCutsLctoV0 *cutsProd,
                               Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal);
  
-  Int_t MatchToMC(AliAODRecoCascadeHF *lc2bacV0,
-                 Int_t *pdgDgLc2bacV0, Int_t *pdgDgV0,
-                 TClonesArray *mcArray);
-
-  void SearchLcDaughter(TClonesArray *arrayMC);
-
-  void DefineK0SHistos();
-
   // set MC usage
   void SetMC(Bool_t theMCon) {fUseMCInfo = theMCon;}
   Bool_t GetMC() const {return fUseMCInfo;}
@@ -84,6 +75,14 @@ class AliAnalysisTaskSELc2V0bachelor : public AliAnalysisTaskSE
 
  private:
   
+  Int_t MatchToMC(AliAODRecoCascadeHF *lc2bacV0,
+                 Int_t *pdgDgLc2bacV0, Int_t *pdgDgV0,
+                 TClonesArray *mcArray);
+
+  Int_t SearchLcDaughter(TClonesArray *arrayMC, Int_t iii);
+
+  void DefineK0SHistos();
+
   AliAnalysisTaskSELc2V0bachelor(const AliAnalysisTaskSELc2V0bachelor &source);
   AliAnalysisTaskSELc2V0bachelor& operator=(const AliAnalysisTaskSELc2V0bachelor& source); 
   
index a37353e..db62dee 100644 (file)
@@ -169,9 +169,8 @@ public:
        void SetKeepLctoLambdapi() {fLctoV0bachelorOption=4;}
        void SetKeepLctoV0bachelor() {fLctoV0bachelorOption=7;}
 
-       void SetCountAllLctoBachelor(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountAllLctoV0;}
        void SetCountLctoK0Sp(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountK0Sp;}
-       void SetCountLambdaBarpi(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountLambdapi;}
+       void SetCountLctoLambdapi(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountLambdapi;}
     
        void SetUseSelectionBit(Bool_t flag) { fUseSelectionBit=flag; }
        Bool_t GetUseSelectionBit() const { return fUseSelectionBit; }
index 86a4e03..46f20b6 100644 (file)
@@ -335,7 +335,7 @@ Int_t AliCFVertexingHF::CheckOrigin() const
        Int_t abspdgGranma =0;
        Bool_t isFromB=kFALSE;
        Bool_t isQuarkFound=kFALSE;
-       while (mother >0 ){
+       while (mother >=0 ){
                istep++;
                AliDebug(2,Form("mother at step %d = %d", istep, mother));
                AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(fmcArray->At(mother));
index 9f25c57..2030883 100644 (file)
@@ -98,9 +98,65 @@ Bool_t AliCFVertexingHFLctoV0bachelor::SetRecoCandidateParam(AliAODRecoDecayHF *
   
   if (fRecoCandidate->GetPrimaryVtx()) AliDebug(4,"fReco Candidate has a pointer to PrimVtx\n");
   
-  AliAODRecoCascadeHF* lcV0bachelor = (AliAODRecoCascadeHF*)fRecoCandidate;
-  if ( !(lcV0bachelor->Getv0()) ) {
-    AliDebug(1,"It is not a Lc->V0+bachelor candidate");
+  AliAODRecoCascadeHF* lcV0bachelor = dynamic_cast<AliAODRecoCascadeHF*>(fRecoCandidate);
+  if (!lcV0bachelor) {
+    AliDebug(2,"cascade doesn't exist, skipped!");
+    return bSignAssoc;
+  }
+
+  if (!lcV0bachelor->GetSecondaryVtx()) {
+    AliDebug(2,"No secondary vertex for cascade");
+    return bSignAssoc;
+  }
+
+  if (lcV0bachelor->GetNDaughters()!=2) {
+    AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",lcV0bachelor->GetNDaughters()));
+    return bSignAssoc;
+  }
+
+  AliVTrack *cascTrk0 = dynamic_cast<AliVTrack*>(lcV0bachelor->GetDaughter(0));
+  AliVTrack *cascTrk1 = dynamic_cast<AliVTrack*>(lcV0bachelor->GetDaughter(1));
+  if (!cascTrk0 || !cascTrk1) {
+    AliDebug(2,"At least one of V0daughters doesn't exist");
+    return bSignAssoc;
+  }
+
+  AliAODv0 * v0part = dynamic_cast<AliAODv0*>(lcV0bachelor->Getv0());
+  AliAODTrack * bachPart = dynamic_cast<AliAODTrack*>(lcV0bachelor->GetBachelor());
+  if (!v0part || !bachPart) {
+    AliDebug(2,"No V0 or no bachelor for current cascade");
+    return bSignAssoc;
+  }
+
+  if (bachPart->GetID()<0) {
+    AliDebug(2,Form("Bachelor has negative ID %d",bachPart->GetID()));
+    return bSignAssoc;
+  }
+
+  if (!v0part->GetSecondaryVtx()) {
+    AliDebug(2,"No secondary vertex for V0 by cascade");
+    return bSignAssoc;
+  }
+
+  if (v0part->GetNDaughters()!=2) {
+    AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0part->GetOnFlyStatus(),v0part->GetNDaughters()));
+    return bSignAssoc;
+  }
+
+  AliVTrack *trk0 = dynamic_cast<AliVTrack*>(v0part->GetDaughter(0));
+  AliVTrack *trk1 = dynamic_cast<AliVTrack*>(v0part->GetDaughter(1));
+  if (!trk0 || !trk1) {
+    AliDebug(2,"At least one of V0daughters doesn't exist");
+    return bSignAssoc;
+  }
+
+  if (trk0->GetLabel()<0 || trk1->GetLabel()<0) {
+    AliDebug(2,Form("At least one of V0daughters has label negative (%d %d)",trk0->GetLabel(),trk1->GetLabel()));
+    return bSignAssoc;
+  }
+
+ if (trk0->GetID()<0 || trk1->GetID()<0) {
+    AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",trk0->GetID(),trk1->GetID()));
     return bSignAssoc;
   }
 
@@ -122,11 +178,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::SetRecoCandidateParam(AliAODRecoDecayHF *
   if (mcLabelK0S!=-1 && mcLabelLambda!=-1)
     AliDebug(2,"Strange: current Lc->V0+bachelor candidate has two MC different labels!");
 
-  if (fGenLcOption==kCountAllLctoV0) {
-    if (mcLabelK0S!=-1) mcLabel=mcLabelK0S;
-    if (mcLabelLambda!=-1) mcLabel=mcLabelLambda;
-  }
-  else if (fGenLcOption==kCountK0Sp) {
+  if (fGenLcOption==kCountK0Sp) {
     if (mcLabelK0S!=-1) mcLabel=mcLabelK0S;
     if (mcLabelLambda!=-1) {
       mcLabel=-1;
@@ -187,7 +239,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::GetGeneratedValuesFromMCParticle(Double_t
 
   Int_t daughter0lc = fmcPartCandidate->GetDaughter(0);
   Int_t daughter1lc = fmcPartCandidate->GetDaughter(1);
-  if (daughter0lc<0 || daughter1lc<0) {
+  if (daughter0lc<=0 || daughter1lc<=0) {
     AliDebug(2,"Lc daughters are not in MC array");
     return bGenValues;
   }
@@ -236,18 +288,51 @@ Bool_t AliCFVertexingHFLctoV0bachelor::GetRecoValuesFromCandidate(Double_t *vect
   Bool_t bFillRecoValues = kFALSE;
 
   //Get the Lc and the V0 from Lc
-  AliAODRecoCascadeHF* lcV0bachelor = (AliAODRecoCascadeHF*)fRecoCandidate;
+  AliAODRecoCascadeHF* lcV0bachelor = dynamic_cast<AliAODRecoCascadeHF*>(fRecoCandidate);
 
-  AliAODTrack* bachelor = (AliAODTrack*)lcV0bachelor->GetBachelor();
-  AliAODv0* v0toDaughters = (AliAODv0*)lcV0bachelor->Getv0();
-  if (!lcV0bachelor || !bachelor || !v0toDaughters) {
+  if (!lcV0bachelor) {
+    AliDebug(2,"Current cascade doesn't exist, skipped");
+    return bFillRecoValues;
+  }
+
+  if (!lcV0bachelor->GetSecondaryVtx()) {
+    AliDebug(2,"No secondary vertex for cascade");
+    return bFillRecoValues;
+  }
+
+  if (lcV0bachelor->GetNDaughters()!=2) {
+    AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",lcV0bachelor->GetNDaughters()));
+    return bFillRecoValues;
+  }
+
+  AliAODTrack* bachelor = dynamic_cast<AliAODTrack*>(lcV0bachelor->GetBachelor());
+  AliAODv0* v0toDaughters = dynamic_cast<AliAODv0*>(lcV0bachelor->Getv0());
+  if (!bachelor || !v0toDaughters) {
     AliDebug(2,"No V0 or bachelor in this reco candidate, skipping!");
     return bFillRecoValues;
   }
 
+  if (!v0toDaughters->GetSecondaryVtx()) {
+    AliDebug(2,"No secondary vertex for V0 by cascade");
+    return bFillRecoValues;
+  }
+
+  if (v0toDaughters->GetNDaughters()!=2) {
+    AliDebug(2,Form("current V0 has not 2 daughters (onTheFly=%d, nDaughters=%d)",v0toDaughters->GetOnFlyStatus(),v0toDaughters->GetNDaughters()));
+    return bFillRecoValues;
+  }
+
   Bool_t onTheFlyStatus = v0toDaughters->GetOnFlyStatus();
-  AliAODTrack* v0positiveTrack = (AliAODTrack*)lcV0bachelor->Getv0PositiveTrack();
-  AliAODTrack* v0negativeTrack = (AliAODTrack*)lcV0bachelor->Getv0NegativeTrack();
+  AliAODTrack* v0positiveTrack;
+  AliAODTrack* v0negativeTrack;
+  if (onTheFlyStatus) {
+    v0positiveTrack = dynamic_cast<AliAODTrack*>(lcV0bachelor->Getv0NegativeTrack());
+    v0negativeTrack = dynamic_cast<AliAODTrack*>(lcV0bachelor->Getv0PositiveTrack());
+  } else {
+    v0positiveTrack = dynamic_cast<AliAODTrack*>(lcV0bachelor->Getv0PositiveTrack());
+    v0negativeTrack = dynamic_cast<AliAODTrack*>(lcV0bachelor->Getv0NegativeTrack());
+  }
+
   if (!v0positiveTrack || !v0negativeTrack) {
     AliDebug(2,"No V0daughters in this reco candidate, skipping!");
     return bFillRecoValues;
@@ -335,7 +420,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
 
   Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
   Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
-  if (daughter0<0 || daughter1<0){
+  if (daughter0<=0 || daughter1<=0){
     AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
     return checkCD;
   }
@@ -373,7 +458,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
 
     Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
     Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
-    if (daughter1D0<0 || daughter1D1<0) {
+    if (daughter1D0<=0 || daughter1D1<=0) {
       AliDebug(2, Form("The Lambda MC particle doesn't have correct daughters, skipping!!"));
       return checkCD;
     }
@@ -413,7 +498,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
     }
 
     Int_t daughter = mcPartDaughter1->GetDaughter(0);
-    if (daughter<0) {
+    if (daughter<=0) {
       AliDebug(2, Form("The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
       return checkCD;
     }
@@ -436,7 +521,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::CheckMCChannelDecay() const
 
     Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
     Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
-    if (daughterD0<0 || daughterD1<0) {
+    if (daughterD0<=0 || daughterD1<=0) {
       AliDebug(2, Form("The K0S MC particle doesn't have correct daughters, skipping!!"));
       return checkCD;
     }
@@ -537,13 +622,13 @@ Double_t AliCFVertexingHFLctoV0bachelor::Ctau(AliAODMCParticle *mcPartCandidate)
 
   Int_t daughterD0 = mcPartCandidate->GetDaughter(0);
   Int_t daughterD1 = mcPartCandidate->GetDaughter(1);
-  if (daughterD0<0 || daughterD1<0) {
+  if (daughterD0<=0 || daughterD1<=0) {
     AliDebug(2, Form("The Lc MC particle doesn't have correct daughters, skipping!!"));
     return cTau;
   }
 
-  AliAODMCParticle *mcPartDaughter0 = (AliAODMCParticle*)fmcArray->At(mcPartCandidate->GetDaughter(0));
-  AliAODMCParticle *mcPartDaughter1 = (AliAODMCParticle*)fmcArray->At(mcPartCandidate->GetDaughter(1));
+  AliAODMCParticle *mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD0));
+  AliAODMCParticle *mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughterD1));
   if (!mcPartDaughter0 || !mcPartDaughter1) {
     AliDebug(2,"The candidate daughter particles not found in MC array");
     return cTau;
@@ -591,13 +676,14 @@ Bool_t AliCFVertexingHFLctoV0bachelor::SetLabelArray()
   Bool_t checkCD = kFALSE;
   
   if (fmcPartCandidate->GetNDaughters()!=2) {
-    AliDebug(2, Form("The MC particle doesn't have 2 daughters, skipping!!"));
+    AliDebug(2, Form("The MC particle have %d daughters (not 2), skipping!!",fmcPartCandidate->GetNDaughters()));
+    fmcPartCandidate->Print();
     return checkCD;
   }
 
   Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
   Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
-  if (daughter0<0 || daughter1<0){
+  if (daughter0<=0 || daughter1<=0){
     AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!"));
     return checkCD;
   }
@@ -642,7 +728,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::SetLabelArray()
 
     Int_t daughter1D0 = mcPartDaughter1->GetDaughter(0);
     Int_t daughter1D1 = mcPartDaughter1->GetDaughter(1);
-    if (daughter1D0<0 || daughter1D1<0) {
+    if (daughter1D0<=0 || daughter1D1<=0) {
       AliDebug(2, Form("The Lambda MC particle doesn't have correct daughters, skipping!!"));
       delete [] fLabelArray;
       fLabelArray = 0x0;
@@ -714,8 +800,15 @@ Bool_t AliCFVertexingHFLctoV0bachelor::SetLabelArray()
       daughter1 = daughterTemp; // the V0 label
     }
 
+    if (mcPartDaughter1->GetNDaughters()!=1) {
+      AliDebug(2, "The K0/K0bar MC particle doesn't decay in 1 particles, skipping!!");
+      delete [] fLabelArray;
+      fLabelArray = 0x0;
+      return checkCD;
+    }
+
     Int_t daughter = mcPartDaughter1->GetDaughter(0);
-    if (daughter<0) {
+    if (daughter<=0) {
       AliDebug(2, Form("The K0/K0bar MC particle doesn't have correct daughter, skipping!!"));
       delete [] fLabelArray;
       fLabelArray = 0x0;
@@ -746,7 +839,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::SetLabelArray()
 
     Int_t daughterD0 = mcPartDaughter->GetDaughter(0);
     Int_t daughterD1 = mcPartDaughter->GetDaughter(1);
-    if (daughterD0<0 || daughterD1<0) {
+    if (daughterD0<=0 || daughterD1<=0) {
       AliDebug(2, Form("The K0S MC particle doesn't have correct daughters, skipping!!"));
       delete [] fLabelArray;
       fLabelArray = 0x0;
@@ -810,7 +903,7 @@ Bool_t AliCFVertexingHFLctoV0bachelor::FillVectorFromMCarray(AliAODMCParticle *m
 
   if (TMath::Abs(mcPartDaughterK0->GetPdgCode())==311) {
     Int_t daughterK0 = mcPartDaughterK0->GetDaughter(0);
-    if (daughterK0<0) {
+    if (daughterK0<=0) {
       AliDebug(2, Form("The K0/K0bar particle doesn't have correct daughter, skipping!!"));
       return bGenValues;
     }
index 82138b1..e5fcba9 100644 (file)
@@ -42,8 +42,7 @@ class AliCFVertexingHFLctoV0bachelor : public AliCFVertexingHF{
 
   enum ELctoV0Sel {
     kCountK0Sp=0,
-    kCountLambdapi=1,
-    kCountAllLctoV0=2
+    kCountLambdapi=1
   };
 
   AliCFVertexingHFLctoV0bachelor();
index 24a17e7..12b58ab 100644 (file)
@@ -366,32 +366,69 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
     return 0;
   }
 
-  // Get the bachelor track
-  AliAODTrack *bachelorTrack = (AliAODTrack*)d->GetBachelor();
-  if (!bachelorTrack) {
-    AliDebug(2,"No bachelor object");
+  if (!d->GetSecondaryVtx()) {
+    AliDebug(2,"No secondary vertex for cascade");
     return 0;
   }
 
-  // not used
-  //if ( fUseTrackSelectionWithFilterBits &&
-  //!(bachelorTrack->TestFilterMask(BIT(4))) ) return 0;
+  if (d->GetNDaughters()!=2) {
+    AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
+    return 0;
+  }
+
+  AliVTrack *cascTrk0 = dynamic_cast<AliVTrack*>(d->GetDaughter(0));
+  AliVTrack *cascTrk1 = dynamic_cast<AliVTrack*>(d->GetDaughter(1));
+  if (!cascTrk0 || !cascTrk1) {
+    AliDebug(2,"At least one of V0daughters doesn't exist");
+    return 0;
+  }
+
+  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
+  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
+  if (!v0 || !bachelorTrack) {
+    AliDebug(2,"No V0 or no bachelor for current cascade");
+    return 0;
+  }
+
+  if (bachelorTrack->GetID()<0) {
+    AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
+    return 0;
+  }
+
+  if (!v0->GetSecondaryVtx()) {
+    AliDebug(2,"No secondary vertex for V0 by cascade");
+    return 0;
+  }
 
-  // Get V0
-  AliAODv0 *v0 = (AliAODv0*)d->Getv0();
-  if (!v0) {
-    AliDebug(2,"No v0 object");
+  if (v0->GetNDaughters()!=2) {
+    AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
     return 0;
   }
 
+
   // Get the V0 daughter tracks
-  AliAODTrack *v0positiveTrack = (AliAODTrack*)d->Getv0PositiveTrack();
-  AliAODTrack *v0negativeTrack = (AliAODTrack*)d->Getv0NegativeTrack();
+  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
+  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
+  //AliVTrack *trk0 = dynamic_cast<AliVTrack*>(v0->GetDaughter(0));
+  //AliVTrack *trk1 = dynamic_cast<AliVTrack*>(v0->GetDaughter(1));
   if (!v0positiveTrack || !v0negativeTrack ) {
     AliDebug(2,"No V0 daughters' objects");
     return 0;
   }
 
+  if (v0positiveTrack->GetLabel()<0 || v0negativeTrack->GetLabel()<0) {
+    AliDebug(2,Form("At least one of V0daughters has label negative (%d %d)",v0positiveTrack->GetLabel(),v0negativeTrack->GetLabel()));
+    return 0;
+  }
+
+  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
+    AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
+    return 0;
+  }
+
+
+  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
+
   // selection on daughter tracks
   if (selectionLevel==AliRDHFCuts::kAll ||
       selectionLevel==AliRDHFCuts::kTracks) {
@@ -408,7 +445,7 @@ Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
           !(IsDaughterSelected(v0negativeTrack,&vESD,fV0daughtersCuts)) ||
           !(IsDaughterSelected(v0positiveTrack,&vESD,fV0daughtersCuts)) ) return 0;
     }
-    //if (!AreDaughtersSelected(d)) return 0;
+
   }
 
   Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
@@ -820,31 +857,69 @@ Int_t AliRDHFCutsLctoV0::IsSelectedSingleCut(TObject* obj, Int_t selectionLevel,
     return 0;
   }
 
-  // Get the v0 and all daughter tracks
-  AliAODTrack *bachelorTrack = (AliAODTrack*)d->GetBachelor();
-  if (!bachelorTrack) {
-    AliDebug(2,"No bachelor object");
+  if (!d->GetSecondaryVtx()) {
+    AliDebug(2,"No secondary vertex for cascade");
     return 0;
   }
 
-  // not used
-  //if ( fUseTrackSelectionWithFilterBits &&
-  //!(bachelorTrack->TestFilterMask(BIT(4))) ) return 0;
+  if (d->GetNDaughters()!=2) {
+    AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
+    return 0;
+  }
 
-  AliAODv0 *v0 = (AliAODv0*)d->Getv0();
-  if (!v0) {
-    AliDebug(2,"No v0 object");
+  AliVTrack *cascTrk0 = dynamic_cast<AliVTrack*>(d->GetDaughter(0));
+  AliVTrack *cascTrk1 = dynamic_cast<AliVTrack*>(d->GetDaughter(1));
+  if (!cascTrk0 || !cascTrk1) {
+    AliDebug(2,"At least one of V0daughters doesn't exist");
     return 0;
   }
 
+  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
+  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
+  if (!v0 || !bachelorTrack) {
+    AliDebug(2,"No V0 or no bachelor for current cascade");
+    return 0;
+  }
+
+  if (bachelorTrack->GetID()<0) {
+    AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
+    return 0;
+  }
+
+  if (!v0->GetSecondaryVtx()) {
+    AliDebug(2,"No secondary vertex for V0 by cascade");
+    return 0;
+  }
+
+  if (v0->GetNDaughters()!=2) {
+    AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
+    return 0;
+  }
+
+
   // Get the V0 daughter tracks
-  AliAODTrack *v0positiveTrack = (AliAODTrack*)d->Getv0PositiveTrack();
-  AliAODTrack *v0negativeTrack = (AliAODTrack*)d->Getv0NegativeTrack();
+  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
+  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
+  //AliVTrack *trk0 = dynamic_cast<AliVTrack*>(v0->GetDaughter(0));
+  //AliVTrack *trk1 = dynamic_cast<AliVTrack*>(v0->GetDaughter(1));
   if (!v0positiveTrack || !v0negativeTrack ) {
     AliDebug(2,"No V0 daughters' objects");
     return 0;
   }
 
+  if (v0positiveTrack->GetLabel()<0 || v0negativeTrack->GetLabel()<0) {
+    AliDebug(2,Form("At least one of V0daughters has label negative (%d %d)",v0positiveTrack->GetLabel(),v0negativeTrack->GetLabel()));
+    return 0;
+  }
+
+  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
+    AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
+    return 0;
+  }
+
+
+  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
+
   // selection on daughter tracks
   if (selectionLevel==AliRDHFCuts::kAll ||
       selectionLevel==AliRDHFCuts::kTracks) {
@@ -1131,7 +1206,7 @@ void AliRDHFCutsLctoV0::SetStandardCutsPP2010() {
 
   SetUsePID(kFALSE);//(kTRUE);
 
-  PrintAll();
+  //PrintAll();
 
  for(Int_t iiv=0;iiv<nvars;iiv++){
   delete [] prodcutsval[iiv];
@@ -1207,6 +1282,7 @@ void AliRDHFCutsLctoV0::PrintAll() const {
   printf("Recompute primary vertex %d\n",(Int_t)fRecomputePrimVertex);
   printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
   printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
+  printf("UseTrackSelectionWithFilterBits: %s\n",fUseTrackSelectionWithFilterBits ? "Yes" : "No");
   if(fOptPileup==1) printf(" -- Reject pileup event");
   if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
   if(fUseCentrality>0) {
@@ -1218,7 +1294,7 @@ void AliRDHFCutsLctoV0::PrintAll() const {
     printf("Centrality class considered: %.1f-%.1f, estimated with %s",fMinCentrality,fMaxCentrality,estimator.Data());
   }
   if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
-
+  /*
   if(fVarNames){
     cout<<"Array of variables"<<endl;
     for(Int_t iv=0;iv<fnVars;iv++){
@@ -1257,7 +1333,10 @@ void AliRDHFCutsLctoV0::PrintAll() const {
    }
    cout<<endl;
   }
+  */
+
   return;
+
 }
 
 //-------------------------
index 755b790..5d34a55 100644 (file)
@@ -51,7 +51,9 @@ const Double_t etamax =  0.9;
 
 AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "./LctoV0bachelorCuts.root",
                                                         Int_t configuration = AliCFTaskVertexingHF::kCheetah, Bool_t isKeepDfromB = kTRUE,
-                                                        Bool_t isKeepDfromBOnly = kFALSE, Int_t pdgCode = 4122, Char_t isSign = 0, TString usercomment = "username")
+                                                        Bool_t isKeepDfromBOnly = kFALSE, Int_t pdgCode = 4122, Char_t isSign = 2,
+                                                        Char_t lcToV0bachelorDecayMode = 0,
+                                                        TString usercomment = "username")
 {
 
 
@@ -69,26 +71,21 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
               
   gSystem->Sleep(2000);
 
-  // isSign = 0 --> K0S only
-  // isSign = 1 --> Lambda only
-  // isSign = 2 --> LambdaBar only
-  // isSign = 3 --> K0S and Lambda and LambdaBar
+  // isSign = 0 --> Lc+ only
+  // isSign = 1 --> Lc- only
+  // isSign = 2 --> Lc+ and Lc-
 
   TString expected;
   if (isSign == 0 && pdgCode < 0){
-    AliError(Form("Error setting PDG code (%d) and sign (0 --> K0S only): they are not compatible, returning"));
+    AliError(Form("Error setting PDG code (%d) and sign (0 --> Lc+ only): they are not compatible, returning",pdgCode));
     return 0x0;
   }
-  else if (isSign == 1 && pdgCode < 0){
-    AliError(Form("Error setting PDG code (%d) and sign (1 --> Lambda only): they are not compatible, returning"));
+  else if (isSign == 1 && pdgCode > 0){
+    AliError(Form("Error setting PDG code (%d) and sign (1 --> Lc- only): they are not compatible, returning",pdgCode));
     return 0x0;
   }
-  else if (isSign == 2 && pdgCode > 0){
-    AliError(Form("Error setting PDG code (%d) and sign (2 --> LambdaBar only): they are not compatible, returning"));
-    return 0x0;
-  }
-  else if (isSign > 3 || isSign < 0){
-    AliError(Form("Sign not valid (%d, possible values are 0, 1, 2, 3), returning"));
+  else if (isSign > 2 || isSign < 0){
+    AliError(Form("Sign not valid (%d, possible values are 0, 1, 2), returning",isSign));
     return 0x0;
   }
 
@@ -101,10 +98,10 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
 
   Double_t massV0min = 0.47;
   Double_t massV0max = 1.14;
-  if (isSign==0) {
+  if (lcToV0bachelorDecayMode==0) {
     massV0min = 0.47 ;
     massV0max = 0.53 ;
-  } else if (isSign==1 || isSign==2) {
+  } else if (lcToV0bachelorDecayMode==1) {
     massV0min = 1.09;
     massV0max = 1.14;
   }
@@ -114,8 +111,7 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
 
   const Int_t nbinpt          =  8; //bins in pt from 0 to 12 GeV
   const Int_t nbiny           = 24; //bins in y
-  Int_t nbininvMassV0         = 60; //bins in invMassV0
-  if (isSign==3) nbininvMassV0=134; //bins in invMassV0
+  const Int_t nbininvMassV0   = 60; //bins in invMassV0
   const Int_t nbinpointingV0  = 12; //bins in cosPointingAngleV0
   const Int_t nbinonFly       =  2; //bins in onFlyStatus x V0
 
@@ -488,7 +484,7 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
   //Particle-Level cuts:  
   AliCFParticleGenCuts* mcGenCuts = new AliCFParticleGenCuts("mcGenCuts","MC particle generation cuts");
   Bool_t useAbsolute = kTRUE;
-  if (isSign != 3 && isSign!=0) {
+  if (isSign != 2) {
     useAbsolute = kFALSE;
   }
   mcGenCuts->SetRequirePdgCode(pdgCode, useAbsolute);  // kTRUE set in order to include Lc-
@@ -555,6 +551,14 @@ AliCFTaskVertexingHF *AddTaskCFVertexingHFLctoV0bachelor(const char* cutFile = "
   task->SetFillFromGenerated(kFALSE);
   task->SetCFManager(man); //here is set the CF manager
   task->SetDecayChannel(22);//kLctoV0bachelor
+  switch (lcToV0bachelorDecayMode) {
+  case 0:
+    task->SetCountLctoK0Sp();
+    break;
+  case 1:
+    task->SetCountLctoLambdapi();
+    break;
+  }
   task->SetUseWeight(kFALSE);
   task->SetSign(isSign);
   task->SetCentralitySelection(kFALSE);
index 6e3b57c..57e084f 100644 (file)
@@ -26,6 +26,7 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   AliESDtrackCuts* esdTrackCutsProd=new AliESDtrackCuts();
   RDHFLctoV0Prod->AddTrackCuts(esdTrackCutsProd);
   RDHFLctoV0Prod->AddTrackCutsV0daughters(esdTrackCutsProd);
+  RDHFLctoV0Prod->SetUseTrackSelectionWithFilterBits(kFALSE);
   RDHFLctoV0Prod->SetPidSelectionFlag(2); // 0 -> TOF AND TPC
                                           // 1 -> if (TOF) TOF else TPC w veto
                                           // 2 -> if (p<1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else (p>=2.5) {if (TOF) -2s<TOF<3s AND TPC@3s}
@@ -42,7 +43,8 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   //                                      AliESDtrackCuts::kAny); 
   // default is kBoth, otherwise kAny
   esdTrackCuts->SetMinDCAToVertexXY(0.);
-  esdTrackCuts->SetPtRange(0.3,1.e10);
+  //esdTrackCuts->SetPtRange(0.3,1.e10);
+  esdTrackCuts->SetPtRange(0.,1.e10);
   esdTrackCuts->SetEtaRange(-0.8,0.8);
   esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
 
@@ -70,12 +72,16 @@ void makeInputAliAnalysisTaskSELctoV0bachelor(){
   RDHFLctoV0An->SetTitle("Analysis cuts for Lc analysis");
   RDHFLctoV0An->AddTrackCuts(esdTrackCuts);
   RDHFLctoV0An->AddTrackCutsV0daughters(esdTrackCutsV0daughters);
+  RDHFLctoV0An->SetUseTrackSelectionWithFilterBits(kFALSE);
   RDHFLctoV0An->SetPidSelectionFlag(2); // 0 -> TOF AND TPC
                                         // 1 -> if (TOF) TOF else TPC w veto
                                         // 2 -> if (p>1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else (p>=2.5) {if (TOF) -2s<TOF<3s AND TPC@3s}
                                         // 3 -> if (p>1) TPC@3s else if (1<=p<2.5) {if (TOF) TOF@3s AND TPC@3s} else if (2.5<=p<3) {if (TOF) -2s<TOF<3s AND TPC@3s} else (p>=3) {if (TOF) -2s<TOF<3s AND -3s<TPC<2s}
 
   const Int_t nptbins=9;
+  RDHFLctoV0Prod->SetNPtBins(nptbins);
+  RDHFLctoV0An->SetNPtBins(nptbins);
+
   Float_t* ptbins;
   ptbins=new Float_t[nptbins+1];
   ptbins[0]= 0.;