Addition of Lc->V0+bachelor analysis (Zaida)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 8 May 2010 14:22:14 +0000 (14:22 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 8 May 2010 14:22:14 +0000 (14:22 +0000)
14 files changed:
PWG3/vertexingHF/AliAODRecoCascadeHF.cxx
PWG3/vertexingHF/AliAODRecoCascadeHF.h
PWG3/vertexingHF/AliAnalysisTaskMEVertexingHF.cxx
PWG3/vertexingHF/AliAnalysisTaskMEVertexingHF.h
PWG3/vertexingHF/AliAnalysisTaskSEVertexingHF.cxx
PWG3/vertexingHF/AliAnalysisTaskSEVertexingHF.h
PWG3/vertexingHF/AliAnalysisVertexingHF.cxx
PWG3/vertexingHF/AliAnalysisVertexingHF.h
PWG3/vertexingHF/AliRDHFCutsLctoV0.cxx [new file with mode: 0644]
PWG3/vertexingHF/AliRDHFCutsLctoV0.h [new file with mode: 0644]
PWG3/vertexingHF/ConfigVertexingHF.C
PWG3/vertexingHF/ConfigVertexingHF_highmult.C
PWG3/vertexingHF/ConfigVertexingHF_pp2009.C
PWG3/vertexingHF/ReadAODVertexingHF.C

index 0009e183f917674c2f03a071341223283a5fa3cf..1a355e9ba09d54394ae48c34db65a2495c5befd6 100644 (file)
@@ -225,3 +225,69 @@ Bool_t AliAODRecoCascadeHF::SelectDstar(const Double_t *cutsDstar,
   return kTRUE;
 }
 //-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+Bool_t AliAODRecoCascadeHF::SelectLctoV0(const Double_t *cutsLctoV0, 
+                                        Bool_t okLck0sp, Bool_t okLcLpi) const 
+{
+  // cuts on Lambdac candidates to V0+bachelor
+  // (to be passed to AliAODRecoDecayHF3Prong::SelectLctoV0())
+  // 0 = inv. mass half width in K0s hypothesis [GeV]   
+  // 1 = inv. mass half width in Lambda hypothesis [GeV]   
+  // 2 = inv. mass V0 in K0s hypothesis half width [GeV]   
+  // 3 = inv. mass V0 in Lambda hypothesis half width [GeV]   
+  // 4 = pT min Bachelor track [GeV/c]
+  // 5 = pT min V0-Positive track [GeV/c]
+  // 6 = pT min V0-Negative track [GeV/c]
+  // 7 = dca cut on the V0 (cm)
+  // 8 = dca cut on the cascade (cm)
+
+//   if ( !Getv0() || !Getv0PositiveTrack() || !Getv0NegativeTrack() ) 
+//     { AliInfo(Form("Not adapted for ESDv0s, return true...")); return false; }
+
+  Double_t mLck0sp,mLcLpi;
+  okLck0sp=1; okLcLpi=1;
+  
+  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
+  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
+  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
+
+  // k0s + p
+  double mk0s = Getv0()->MassK0Short();
+  mLck0sp = InvMassLctoK0sP();
+
+  // lambda + pi 
+  double mlambda = Getv0()->MassLambda();
+  double malambda = Getv0()->MassAntiLambda();
+  mLcLpi = InvMassLctoLambdaPi();
+
+  // cut on Lc mass
+  //   with k0s p hypothesis
+  if(TMath::Abs(mLck0sp-mLcPDG)>cutsLctoV0[0]) okLck0sp = 0;
+  //   with Lambda pi hypothesis
+  if(TMath::Abs(mLcLpi-mLcPDG)>cutsLctoV0[1]) okLcLpi = 0;
+  
+  // cuts on the v0 mass
+  if(TMath::Abs(mk0s-mk0sPDG)>cutsLctoV0[2]) okLck0sp = 0;
+  if( TMath::Abs(mlambda-mLPDG)>cutsLctoV0[3] && 
+      TMath::Abs(malambda-mLPDG)>cutsLctoV0[3] ) okLcLpi = 0;
+  
+  if(!okLck0sp && !okLcLpi) return 0;
+  
+  // cuts on the minimum pt of the tracks 
+  if(TMath::Abs(GetBachelor()->Pt()) < cutsLctoV0[4]) return 0;
+  if(TMath::Abs(Getv0PositiveTrack()->Pt()) < cutsLctoV0[5]) return 0;
+  if(TMath::Abs(Getv0NegativeTrack()->Pt()) < cutsLctoV0[6]) return 0;
+  
+  // cut on the v0 dca
+  if(TMath::Abs(Getv0()->DcaV0Daughters()) > cutsLctoV0[7]) return 0;
+  
+  // cut on the cascade dca
+  if( TMath::Abs(GetDCA(0))>cutsLctoV0[8] ||
+      TMath::Abs(Getv0()->DcaPosToPrimVertex())>cutsLctoV0[8] ||
+      TMath::Abs(Getv0()->DcaNegToPrimVertex())>cutsLctoV0[8] ) return 0;
+  
+  return true; 
+
+}
+//-----------------------------------------------------------------------------
index a955cef862626f751ae0b88389b7e99e9f7602ad..6f6ab310224003d149b7b7f5534082a492a1ad51 100644 (file)
@@ -15,7 +15,9 @@
 #include <TRef.h>
 #include <TRefArray.h>
 #include <TClonesArray.h>
+#include <TClass.h>
 #include "AliAODVertex.h"
+#include "AliAODv0.h"
 #include "AliAODRecoDecayHF2Prong.h"
 
 class AliAODRecoCascadeHF : public AliAODRecoDecayHF2Prong {
@@ -34,11 +36,31 @@ class AliAODRecoCascadeHF : public AliAODRecoDecayHF2Prong {
   AliAODRecoCascadeHF& operator=(const AliAODRecoCascadeHF& source);
 
   // 2prong (D0 for Dstar)
-  AliAODRecoDecayHF2Prong* Get2Prong() const {return (AliAODRecoDecayHF2Prong*)GetDaughter(1);}
+  AliAODRecoDecayHF2Prong* Get2Prong() const {
+    if ( ! ((AliAODRecoDecay*)GetDaughter(1))->IsA()->InheritsFrom("AliAODRecoDecayHF2Prong") ){
+      AliWarning("Object is not of type AliAODRecoDecayHF2Prong");
+      return 0;
+    }
+    return (AliAODRecoDecayHF2Prong*)GetDaughter(1);
+  }
 
   // Bachelor (soft pion for Dstar)
   AliAODTrack* GetBachelor() const {return (AliAODTrack*)GetDaughter(0);}
 
+  // v0 (Ks or Lambda for Lambda_c)
+  AliAODv0* Getv0() const {
+    if ( ! ((AliAODRecoDecay*)GetDaughter(1))->IsA()->InheritsFrom("AliAODv0") ){
+       AliWarning("Object is not of type v0");
+       return 0;
+      }
+    return (AliAODv0*)GetDaughter(1);
+    }
+
+  // Get v0 positive track
+  AliAODTrack* Getv0PositiveTrack() const { return  (AliAODTrack*)Getv0()->GetDaughter(0);  }
+  // Get v0 negative track
+  AliAODTrack* Getv0NegativeTrack() const { return  (AliAODTrack*)Getv0()->GetDaughter(1);  }
+
   // D*->D0pi, D0->Kpi
   Double_t EDstar() const {return E(413);} 
   Double_t YDstar() const {return Y(413);} 
@@ -47,6 +69,15 @@ class AliAODRecoCascadeHF : public AliAODRecoDecayHF2Prong {
   Double_t InvMassDstarKpipi() const;
   Double_t DeltaInvMass() const {return (InvMassDstarKpipi()-InvMassD0());}
 
+  // Lc invariant mass
+  Double_t InvMassLctoK0sP() const {
+    UInt_t pdg[2]={2212,310}; return InvMass(2,pdg);
+  }
+  Double_t InvMassLctoLambdaPi() const {
+    UInt_t pdg[2]={211,3122}; return InvMass(2,pdg);
+  }
+  Bool_t SelectLctoV0(const Double_t *cutsLctoV0, Bool_t okLck0sp, Bool_t okLcLpi) const;
+
   Int_t MatchToMC(Int_t pdgabs,Int_t pdgabs2prong,
                   Int_t *pdgDg,Int_t *pdgDg2prong,
                   TClonesArray *mcArray) const;
index 34bea648e8e61324fc36fb6a1a13ab2147ec0d57..acc3f7539eebc22d06b5c62f3ebe9cdb9eb3240e 100644 (file)
@@ -50,6 +50,7 @@ fJPSItoEleTClArr(0),
 fCharm3ProngTClArr(0),
 fCharm4ProngTClArr(0),
 fDstarTClArr(0),
+fCascadesTClArr(0),
 fLikeSign2ProngTClArr(0),
 fLikeSign3ProngTClArr(0)
 {
@@ -128,6 +129,12 @@ void AliAnalysisTaskMEVertexingHF::UserCreateOutputObjects()
     AddAODBranch("TClonesArray", &fDstarTClArr);
   }
   
+  if(fvHF->GetCascades()){
+    fCascadesTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
+    fCascadesTClArr->SetName("CascadesHF");
+    AddAODBranch("TClonesArray", &fCascadesTClArr);
+  }
+
   if(fvHF->GetLikeSign()) {
     fLikeSign2ProngTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
     fLikeSign2ProngTClArr->SetName("LikeSign2Prong");
@@ -207,6 +214,7 @@ void AliAnalysisTaskMEVertexingHF::UserExec(Option_t *)
                       fCharm3ProngTClArr,
                       fCharm4ProngTClArr,
                       fDstarTClArr,
+                      fCascadesTClArr, 
                       fLikeSign2ProngTClArr,
                       fLikeSign3ProngTClArr);
 
index 4513241181af427fe2a66def6d86b1a76b3d1dbe..38f040cf8a95f3263914cf4d9bcad2b82bf74ac0 100644 (file)
@@ -42,6 +42,7 @@ class AliAnalysisTaskMEVertexingHF : public AliAnalysisTaskME {
   TClonesArray  *fCharm3ProngTClArr; //Array of D+,Ds,Lc\r
   TClonesArray  *fCharm4ProngTClArr; // Array of D0->Kpipipi\r
   TClonesArray  *fDstarTClArr;          // Array of D*->D0pi\r
+  TClonesArray  *fCascadesTClArr;       // Array of Cascades : V0 + track (lambda_c)\r
   TClonesArray  *fLikeSign2ProngTClArr; // Array of LikeSign2Prong\r
   TClonesArray  *fLikeSign3ProngTClArr; // Array of LikeSign3Prong\r
 \r
index 70aa71163be77d5db7535a7c100cbd06f5fcdc2d..7d7867d3650b65ffa78baece1e3c2b89c2b0cfbd 100644 (file)
@@ -50,6 +50,7 @@ fJPSItoEleTClArr(0),
 fCharm3ProngTClArr(0),
 fCharm4ProngTClArr(0),
 fDstarTClArr(0),
+fCascadesTClArr(0),
 fLikeSign2ProngTClArr(0),
 fLikeSign3ProngTClArr(0)
 {
@@ -68,6 +69,7 @@ fJPSItoEleTClArr(0),
 fCharm3ProngTClArr(0),
 fCharm4ProngTClArr(0),
 fDstarTClArr(0),
+fCascadesTClArr(0),
 fLikeSign2ProngTClArr(0),
 fLikeSign3ProngTClArr(0)
 {
@@ -171,6 +173,12 @@ void AliAnalysisTaskSEVertexingHF::UserCreateOutputObjects()
     AddAODBranch("TClonesArray", &fDstarTClArr, filename);
   }
 
+  if(fVHF->GetCascades()){
+    fCascadesTClArr = new TClonesArray("AliAODRecoCascadeHF", 0);
+    fCascadesTClArr->SetName("CascadesHF");
+    AddAODBranch("TClonesArray", &fCascadesTClArr, filename);
+  }
+
   if(fVHF->GetLikeSign()) {                      
     fLikeSign2ProngTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
     fLikeSign2ProngTClArr->SetName("LikeSign2Prong");
@@ -205,6 +213,7 @@ void AliAnalysisTaskSEVertexingHF::UserExec(Option_t */*option*/)
                       fCharm3ProngTClArr,
                       fCharm4ProngTClArr,
                       fDstarTClArr,
+                      fCascadesTClArr,
                        fLikeSign2ProngTClArr,
                        fLikeSign3ProngTClArr);
   
index 4d6bb5eed2bbde0b19872f19403ba2795afc1de0..cb704b6c3c99ac694c40310b8426f0cc8538ad6a 100644 (file)
@@ -50,6 +50,7 @@ class AliAnalysisTaskSEVertexingHF : public AliAnalysisTaskSE
   TClonesArray *fCharm3ProngTClArr;    // Array of D+,Ds,Lc
   TClonesArray *fCharm4ProngTClArr;    // Array of D0->Kpipipi
   TClonesArray *fDstarTClArr;          // Array of D*->D0pi
+  TClonesArray *fCascadesTClArr;       // Array of Cascades : V0 + track (lambda_c)
   TClonesArray *fLikeSign2ProngTClArr; // Array of LikeSign2Prong
   TClonesArray *fLikeSign3ProngTClArr; // Array of LikeSign3Prong 
   
index a31bfe93781d5f00aad15ed18bb9f9e79d88f25e..b3d9f172d3f88355c990fccfde79a0f68f8a2ebb 100644 (file)
 #include "AliRDHFCutsDplustoKpipi.h"
 #include "AliRDHFCutsDstoKKpi.h"
 #include "AliRDHFCutsLctopKpi.h"
+#include "AliRDHFCutsLctoV0.h"
 #include "AliRDHFCutsD0toKpipipi.h"
 #include "AliAnalysisFilter.h"
 #include "AliAnalysisVertexingHF.h"
 #include "AliMixedEvent.h"
+#include "AliESDv0.h"
+#include "AliAODv0.h"
 
 ClassImp(AliAnalysisVertexingHF)
 
@@ -75,6 +78,7 @@ fJPSItoEle(kTRUE),
 f3Prong(kTRUE),
 f4Prong(kTRUE),
 fDstar(kTRUE),
+fCascades(kTRUE),
 fLikeSign(kFALSE),
 fMixEvent(kFALSE),
 fTrackFilter(0x0),
@@ -84,10 +88,12 @@ fCutsJpsitoee(0x0),
 fCutsDplustoKpipi(0x0),
 fCutsDstoKKpi(0x0),
 fCutsLctopKpi(0x0),
+fCutsLctoV0(0x0),
 fCutsD0toKpipipi(0x0),
 fCutsD0fromDstar(0x0),
 fListOfCuts(0x0),
-fFindVertexForDstar(kTRUE)
+fFindVertexForDstar(kTRUE),
+fFindVertexForCascades(kTRUE)
 {
   // Default constructor
 
@@ -98,6 +104,7 @@ fFindVertexForDstar(kTRUE)
   SetLcCuts();
   SetDstarCuts();
   SetD0to4ProngsCuts();
+  SetLctoV0Cuts();
 }
 //--------------------------------------------------------------------------
 AliAnalysisVertexingHF::AliAnalysisVertexingHF(const AliAnalysisVertexingHF &source) : 
@@ -115,6 +122,7 @@ fJPSItoEle(source.fJPSItoEle),
 f3Prong(source.f3Prong),
 f4Prong(source.f4Prong),
 fDstar(source.fDstar),
+fCascades(source.fCascades),
 fLikeSign(source.fLikeSign),
 fMixEvent(source.fMixEvent),
 fTrackFilter(source.fTrackFilter),
@@ -124,10 +132,12 @@ fCutsJpsitoee(source.fCutsJpsitoee),
 fCutsDplustoKpipi(source.fCutsDplustoKpipi),
 fCutsDstoKKpi(source.fCutsDstoKKpi),
 fCutsLctopKpi(source.fCutsLctopKpi),
+fCutsLctoV0(source.fCutsLctoV0),
 fCutsD0toKpipipi(source.fCutsD0toKpipipi),
 fCutsD0fromDstar(source.fCutsD0fromDstar),
 fListOfCuts(source.fListOfCuts),
-fFindVertexForDstar(source.fFindVertexForDstar)
+fFindVertexForDstar(source.fFindVertexForDstar),
+fFindVertexForCascades(source.fFindVertexForCascades)
 {
   //
   // Copy constructor
@@ -137,6 +147,7 @@ fFindVertexForDstar(source.fFindVertexForDstar)
   for(Int_t i=0; i<12; i++) fDplusCuts[i]=source.fDplusCuts[i];
   for(Int_t i=0; i<14; i++) fDsCuts[i]=source.fDsCuts[i];
   for(Int_t i=0; i<12; i++) fLcCuts[i]=source.fLcCuts[i];
+  for(Int_t i=0; i<8; i++)  fLctoV0Cuts[i]=source.fLctoV0Cuts[i];
   for(Int_t i=0; i<5; i++)  fDstarCuts[i]=source.fDstarCuts[i];
   for(Int_t i=0; i<9; i++)  fD0to4ProngsCuts[i]=source.fD0to4ProngsCuts[i];
 }
@@ -159,6 +170,7 @@ AliAnalysisVertexingHF &AliAnalysisVertexingHF::operator=(const AliAnalysisVerte
   f3Prong = source.f3Prong;
   f4Prong = source.f4Prong;
   fDstar = source.fDstar;
+  fCascades = source.fCascades;
   fLikeSign = source.fLikeSign;
   fMixEvent = source.fMixEvent;
   fTrackFilter = source.fTrackFilter;
@@ -168,16 +180,19 @@ AliAnalysisVertexingHF &AliAnalysisVertexingHF::operator=(const AliAnalysisVerte
   fCutsDplustoKpipi = source.fCutsDplustoKpipi;
   fCutsDstoKKpi = source.fCutsDstoKKpi;
   fCutsLctopKpi = source.fCutsLctopKpi;
+  fCutsLctoV0 = source.fCutsLctoV0;
   fCutsD0toKpipipi = source.fCutsD0toKpipipi;
   fCutsD0fromDstar = source.fCutsD0fromDstar;
   fListOfCuts = source.fListOfCuts;
   fFindVertexForDstar = source.fFindVertexForDstar;
+  fFindVertexForCascades = source.fFindVertexForCascades;
 
   for(Int_t i=0; i<9; i++)  fD0toKpiCuts[i]=source.fD0toKpiCuts[i];
   for(Int_t i=0; i<9; i++)  fBtoJPSICuts[i]=source.fBtoJPSICuts[i];
   for(Int_t i=0; i<12; i++) fDplusCuts[i]=source.fDplusCuts[i];
   for(Int_t i=0; i<14; i++) fDsCuts[i]=source.fDsCuts[i];
   for(Int_t i=0; i<12; i++) fLcCuts[i]=source.fLcCuts[i];
+  for(Int_t i=0; i<8; i++)  fLctoV0Cuts[i]=source.fLctoV0Cuts[i];
   for(Int_t i=0; i<5; i++)  fDstarCuts[i]=source.fDstarCuts[i];
   for(Int_t i=0; i<9; i++)  fD0to4ProngsCuts[i]=source.fD0to4ProngsCuts[i];
 
@@ -194,6 +209,7 @@ AliAnalysisVertexingHF::~AliAnalysisVertexingHF() {
   if(fCutsDplustoKpipi) { delete fCutsDplustoKpipi; fCutsDplustoKpipi=0; }
   if(fCutsDstoKKpi) { delete fCutsDstoKKpi; fCutsDstoKKpi=0; }
   if(fCutsLctopKpi) { delete fCutsLctopKpi; fCutsLctopKpi=0; }
+  if(fCutsLctoV0) { delete fCutsLctoV0; fCutsLctoV0=0; }
   if(fCutsD0toKpipipi) { delete fCutsD0toKpipipi; fCutsD0toKpipipi=0; }
   if(fCutsD0fromDstar) { delete fCutsD0fromDstar; fCutsD0fromDstar=0; }
   if(fAODMap) { delete fAODMap; fAODMap=0; }
@@ -226,6 +242,10 @@ TList *AliAnalysisVertexingHF::FillListOfCuts() {
     AliRDHFCutsLctopKpi *cutsLctopKpi = new AliRDHFCutsLctopKpi(*fCutsLctopKpi);
     list->Add(cutsLctopKpi);
   }
+  if(fCutsLctoV0){
+    AliRDHFCutsLctoV0 *cutsLctoV0 = new AliRDHFCutsLctoV0(*fCutsLctoV0);
+    list->Add(cutsLctoV0);
+  }
   if(fCutsD0toKpipipi) {
     AliRDHFCutsD0toKpipipi *cutsD0toKpipipi = new AliRDHFCutsD0toKpipipi(*fCutsD0toKpipipi);
     list->Add(cutsD0toKpipipi);
@@ -248,6 +268,7 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
                                            TClonesArray *aodCharm3ProngTClArr,
                                            TClonesArray *aodCharm4ProngTClArr,
                                            TClonesArray *aodDstarTClArr,
+                                           TClonesArray *aodCascadesTClArr,
                                            TClonesArray *aodLikeSign2ProngTClArr,
                                            TClonesArray *aodLikeSign3ProngTClArr)
 {
@@ -290,6 +311,10 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
     printf("ERROR: no aodDstarTClArr");
     return;
   }
+  if(fCascades && !aodCascadesTClArr){
+    printf("ERROR: no aodCascadesTClArr ");
+    return;
+  }
   if(fLikeSign && !aodLikeSign2ProngTClArr) {
     printf("ERROR: no aodLikeSign2ProngTClArr");
     return;
@@ -300,7 +325,7 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
   }
 
   // delete candidates from previous event and create references
-  Int_t iVerticesHF=0,iD0toKpi=0,iJPSItoEle=0,i3Prong=0,i4Prong=0,iDstar=0,iLikeSign2Prong=0,iLikeSign3Prong=0;
+  Int_t iVerticesHF=0,iD0toKpi=0,iJPSItoEle=0,i3Prong=0,i4Prong=0,iDstar=0,iCascades=0,iLikeSign2Prong=0,iLikeSign3Prong=0;
   aodVerticesHFTClArr->Delete();
   iVerticesHF = aodVerticesHFTClArr->GetEntriesFast();
   TClonesArray &verticesHFRef = *aodVerticesHFTClArr;
@@ -324,6 +349,10 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
     aodDstarTClArr->Delete();
     iDstar = aodDstarTClArr->GetEntriesFast();
   }
+  if(fCascades) {
+    aodCascadesTClArr->Delete();
+    iCascades = aodCascadesTClArr->GetEntriesFast();
+  }
   if(fLikeSign) {                                
     aodLikeSign2ProngTClArr->Delete();                     
     iLikeSign2Prong = aodLikeSign2ProngTClArr->GetEntriesFast(); 
@@ -338,6 +367,7 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
   TClonesArray &aodCharm3ProngRef    = *aodCharm3ProngTClArr;
   TClonesArray &aodCharm4ProngRef    = *aodCharm4ProngTClArr;
   TClonesArray &aodDstarRef          = *aodDstarTClArr;
+  TClonesArray &aodCascadesRef       = *aodCascadesTClArr;
   TClonesArray &aodLikeSign2ProngRef = *aodLikeSign2ProngTClArr;
   TClonesArray &aodLikeSign3ProngRef = *aodLikeSign3ProngTClArr;
 
@@ -347,15 +377,18 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
   AliAODRecoDecayHF4Prong *io4Prong  = 0;
   AliAODRecoCascadeHF     *ioCascade = 0;
 
-  Int_t    iTrkP1,iTrkP2,iTrkN1,iTrkN2,iTrkSoftPi,trkEntries;
-  Double_t xdummy,ydummy,dcap1n1,dcap1n2,dcap2n1,dcap1p2,dcan1n2,dcap2n2,dcaCasc;
+  Int_t    iTrkP1,iTrkP2,iTrkN1,iTrkN2,iTrkSoftPi,trkEntries,iv0,nv0;
+  Double_t xdummy,ydummy,dcap1n1,dcap1n2,dcap2n1,dcap1p2,dcan1n2,dcap2n2,dcaV0,dcaCasc;
   Bool_t   okD0=kFALSE,okJPSI=kFALSE,ok3Prong=kFALSE,ok4Prong=kFALSE;
   Bool_t   okDstar=kFALSE,okD0fromDstar=kFALSE;
+  Bool_t   okCascades=kFALSE;
   AliESDtrack *postrack1 = 0;
   AliESDtrack *postrack2 = 0;
   AliESDtrack *negtrack1 = 0;
   AliESDtrack *negtrack2 = 0;
   AliESDtrack *trackPi   = 0;
+//   AliESDtrack *posV0track = 0;
+//   AliESDtrack *negV0track = 0;
   /*
   Double_t dcaMax = fD0toKpiCuts[1];
   if(dcaMax < fBtoJPSICuts[1]) dcaMax=fBtoJPSICuts[1];
@@ -378,11 +411,14 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
   trkEntries = (Int_t)event->GetNumberOfTracks();
   AliDebug(1,Form(" Number of tracks: %d",trkEntries));
 
-  if(trkEntries<2) {
+  nv0 = (Int_t)event->GetNumberOfV0s();
+  AliDebug(1,Form(" Number of V0s: %d",nv0));
+
+  if( trkEntries<2 && (trkEntries<1 || nv0<1) ) {
     AliDebug(1,Form(" Not enough tracks: %d",trkEntries));
     return;
   }
-    
+
   // event selection
   if(!fCutsD0toKpi->IsEventSelected(event)) return;
 
@@ -399,6 +435,7 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
     
   TObjArray *twoTrackArray1    = new TObjArray(2);
   TObjArray *twoTrackArray2    = new TObjArray(2);
+  TObjArray *twoTrackArrayV0   = new TObjArray(2);
   TObjArray *twoTrackArrayCasc = new TObjArray(2);
   TObjArray *threeTrackArray   = new TObjArray(3);
   TObjArray *fourTrackArray    = new TObjArray(4);
@@ -408,6 +445,8 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
 
   AliAODRecoDecayHF   *rd = 0;
   AliAODRecoCascadeHF *rc = 0;
+  AliAODv0            *V0 = 0;
+  AliESDv0         *esdV0 = 0;
 
   // LOOP ON  POSITIVE  TRACKS
   for(iTrkP1=0; iTrkP1<nSeleTrks; iTrkP1++) {
@@ -419,6 +458,161 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
 
     if(!TESTBIT(seleFlags[iTrkP1],kBitDispl)) continue;
 
+    // LOOP ON v0s here
+    // 
+    if(fCascades) 
+      for(iv0=0; iv0<nv0; iv0++){
+
+       AliDebug(1,Form("   loop on v0s for track number %d and v0 number %d",iTrkP1,iv0));     
+
+       // Get the V0 
+       if(fInputAOD) V0 = ((AliAODEvent*)event)->GetV0(iv0);
+       else {
+         esdV0 = ((AliESDEvent*)event)->GetV0(iv0);
+       }
+       if ( (!V0 || !V0->IsA()->InheritsFrom("AliAODv0") ) && 
+            (!esdV0 || !esdV0->IsA()->InheritsFrom("AliESDv0") ) )
+         continue;
+       
+
+       // Get the tracks that form the V0
+       //  ( parameters at primary vertex )
+       //   and define an AliExternalTrackParam out of them
+       AliExternalTrackParam * posV0track;
+       AliExternalTrackParam * negV0track;
+
+       if(fInputAOD){
+          AliAODTrack *posVV0track = (AliAODTrack*)(V0->GetDaughter(0));
+         AliAODTrack *negVV0track = (AliAODTrack*)(V0->GetDaughter(1));
+         if( !posVV0track || !negVV0track ) continue;
+         //
+         // Apply some basic V0 daughter criteria
+         //
+         // bachelor must not be a v0-track                                                                  
+         if (posVV0track->GetID() == postrack1->GetID() ||
+             negVV0track->GetID() == postrack1->GetID()) continue;
+         // reject like-sign v0                                                                              
+         if ( posVV0track->Charge() == negVV0track->Charge() ) continue;
+         // avoid ghost TPC tracks                                                                           
+         if(!(posVV0track->GetStatus() & AliESDtrack::kTPCrefit) ||
+            !(negVV0track->GetStatus() & AliESDtrack::kTPCrefit)) continue;
+         // Get AliExternalTrackParam out of the AliAODTracks
+         Double_t xyz[3], pxpypz[3], cv[21]; Short_t sign;
+         posVV0track->PxPyPz(pxpypz);                    posVV0track->XvYvZv(xyz);
+         posVV0track->GetCovarianceXYZPxPyPz(cv);        sign=posVV0track->Charge();
+         posV0track = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
+         negVV0track->PxPyPz(pxpypz);                    negVV0track->XvYvZv(xyz);
+         negVV0track->GetCovarianceXYZPxPyPz(cv);        sign=negVV0track->Charge();
+         negV0track = new AliExternalTrackParam(xyz,pxpypz,cv,sign);
+       }
+       else {
+         AliESDtrack *posVV0track = (AliESDtrack*)(event->GetTrack( esdV0->GetPindex() ));
+          AliESDtrack *negVV0track = (AliESDtrack*)(event->GetTrack( esdV0->GetNindex() ));
+         if( !posVV0track || !negVV0track ) continue;
+         //
+         // Apply some basic V0 daughter criteria
+         //
+         // bachelor must not be a v0-track                                                                  
+         if (posVV0track->GetID() == postrack1->GetID() ||
+             negVV0track->GetID() == postrack1->GetID()) continue;
+         // reject like-sign v0                                                                              
+         if ( posVV0track->Charge() == negVV0track->Charge() ) continue;
+         // avoid ghost TPC tracks                                                                           
+         if(!(posVV0track->GetStatus() & AliESDtrack::kTPCrefit) ||
+            !(negVV0track->GetStatus() & AliESDtrack::kTPCrefit)) continue;
+         //  reject kinks (only necessary on AliESDtracks)
+         if (posVV0track->GetKinkIndex(0)>0  || negVV0track->GetKinkIndex(0)>0) continue;
+         // Get AliExternalTrackParam out of the AliESDtracks  
+         posV0track = dynamic_cast<AliExternalTrackParam*>(posVV0track);
+         negV0track = dynamic_cast<AliExternalTrackParam*>(negVV0track);
+       }
+       if( !posV0track || !negV0track ){
+         AliDebug(1,Form(" Couldn't get the V0 daughters"));
+         continue;
+       }
+
+       // fill in the v0 two-external-track-param array
+       twoTrackArrayV0->AddAt(posV0track,0);
+       twoTrackArrayV0->AddAt(negV0track,1);
+
+       // Define the AODv0 from ESDv0 if reading ESDs
+       if(!fInputAOD) V0 = TransformESDv0toAODv0(esdV0,twoTrackArrayV0);
+
+       // Get the V0 dca
+       dcaV0 = V0->DcaV0Daughters();
+
+       // Define the V0 (neutral) track
+       AliNeutralTrackParam *trackV0;
+       if(fInputAOD) {
+         const AliVTrack *trackVV0 = dynamic_cast<const AliVTrack*>(V0);
+         if(!trackVV0) continue;
+         trackV0 = new AliNeutralTrackParam(trackVV0);
+       }
+       else{  
+         Double_t xyz[3], pxpypz[3];
+         esdV0->XvYvZv(xyz);
+         esdV0->PxPyPz(pxpypz);
+         Double_t cv[21]; for(int i=0; i<21; i++) cv[i]=0;
+         trackV0 = new AliNeutralTrackParam(xyz,pxpypz,cv,0);
+       }
+       if(!trackV0){
+         AliDebug(1, Form("Couldn't define the V0 as a neutral track !! \n"));
+         continue;
+       }
+       // Fill in the object array to create the cascade
+       twoTrackArrayCasc->AddAt(postrack1,0);
+       twoTrackArrayCasc->AddAt(trackV0,1);
+
+       // Compute the cascade vertex
+       AliAODVertex *vertexCasc = 0;
+       if(fFindVertexForCascades) {  
+         // DCA between the two tracks
+         dcaCasc = postrack1->GetDCA(trackV0,fBzkG,xdummy,ydummy);
+         // Vertexing+   
+         vertexCasc = ReconstructSecondaryVertex(twoTrackArrayCasc,dispersion,kFALSE);
+       } else {
+         // assume Cascade decays at the primary vertex
+         Double_t pos[3],cov[6],chi2perNDF;
+         fV1->GetXYZ(pos);
+         fV1->GetCovMatrix(cov);
+         chi2perNDF = fV1->GetChi2toNDF();
+         vertexCasc = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,2);
+         dcaCasc = 0.;
+       }
+       if(!vertexCasc) { 
+         twoTrackArrayCasc->Clear();
+         continue; 
+       }
+
+       // Create and store the Cascade if passed the cuts
+       ioCascade = MakeCascade(twoTrackArrayCasc,event,vertexCasc,V0,dcaCasc,okCascades);
+       if(okCascades && ioCascade) {
+         AliDebug(1,Form("Storing a cascade object... "));
+         // add the vertex and the cascade to the AOD
+         AliAODVertex *vCasc = new(verticesHFRef[iVerticesHF++])AliAODVertex(*vertexCasc);
+         rc = new(aodCascadesRef[iCascades++])AliAODRecoCascadeHF(*ioCascade);
+         rc->SetSecondaryVtx(vCasc);
+         vCasc->SetParent(rc);
+         rc->SetPrimaryVtxRef((AliAODVertex*)event->GetPrimaryVertex());
+         if(!fInputAOD) vCasc->AddDaughter(V0); // just to fill ref #0 ??
+         AddRefs(vCasc,rc,event,twoTrackArrayCasc); // add the track (proton)
+         vCasc->AddDaughter(V0); // fill the 2prong V0 
+       }
+
+       // Clean up 
+       twoTrackArrayV0->Clear();
+       twoTrackArrayCasc->Clear();
+       if(ioCascade) { delete ioCascade; ioCascade=NULL; }
+       if(vertexCasc) { delete vertexCasc; vertexCasc=NULL; }
+      }
+
+
+    // If there is less than 2 particles exit
+    if(trkEntries<2) {
+      AliDebug(1,Form(" Not enough tracks: %d",trkEntries));
+      return;
+    }
+
     if(postrack1->Charge()<0 && !fLikeSign) continue;
 
     // LOOP ON  NEGATIVE  TRACKS
@@ -886,6 +1080,10 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
     AliDebug(1,Form(" D*->D0pi in event = %d;\n",
                    (Int_t)aodDstarTClArr->GetEntriesFast()));
   }
+  if(fCascades){
+    AliDebug(1,Form(" cascades -> v0 + track in event = %d;\n",
+                   (Int_t)aodCascadesTClArr->GetEntriesFast()));
+  }
   if(fLikeSign) {
     AliDebug(1,Form(" Like-sign 2Prong in event = %d;\n",
                    (Int_t)aodLikeSign2ProngTClArr->GetEntriesFast()));
@@ -899,6 +1097,7 @@ void AliAnalysisVertexingHF::FindCandidates(AliVEvent *event,
   twoTrackArray1->Delete();  delete twoTrackArray1;
   twoTrackArray2->Delete();  delete twoTrackArray2;
   twoTrackArrayCasc->Delete();  delete twoTrackArrayCasc;
+  twoTrackArrayV0->Delete();  delete twoTrackArrayV0;
   threeTrackArray->Clear(); 
   threeTrackArray->Delete(); delete threeTrackArray;
   fourTrackArray->Delete();  delete fourTrackArray;
@@ -946,7 +1145,7 @@ void AliAnalysisVertexingHF::AddDaughterRefs(AliAODVertex *v,
   Int_t nDg = v->GetNDaughters();
   TObject *dg = 0;
   if(nDg) dg = v->GetDaughter(0);
-
+  
   if(dg) return; // daughters already added
 
   Int_t nTrks = trkArray->GetEntriesFast();
@@ -1020,6 +1219,69 @@ AliAODRecoCascadeHF* AliAnalysisVertexingHF::MakeCascade(
   
   return theCascade;
 }
+
+
+//----------------------------------------------------------------------------
+AliAODRecoCascadeHF* AliAnalysisVertexingHF::MakeCascade(
+                                  TObjArray *twoTrackArray,AliVEvent *event,
+                                  AliAODVertex *secVert,
+                                  AliAODv0 *v0,
+                                  Double_t dca,
+                                  Bool_t &okCascades) const
+{
+  //
+  // Make the cascade as a 2Prong decay and check if it passes 
+  // cascades reconstruction cuts
+  
+  //  AliDebug(2,Form("         building the cascade"));
+  okCascades= kFALSE; 
+  Bool_t dummy1,dummy2,dummy3;
+
+  // We use Make2Prong to construct the AliAODRecoCascadeHF
+  // (which inherits from AliAODRecoDecayHF2Prong) 
+  AliAODRecoCascadeHF *theCascade = 
+    (AliAODRecoCascadeHF*)Make2Prong(twoTrackArray,event,secVert,dca,
+                                    dummy1,dummy2,dummy3);
+  if(!theCascade) return 0x0;
+
+  // bachelor track and charge
+  AliESDtrack *trackBachelor = (AliESDtrack*)twoTrackArray->UncheckedAt(0);
+  theCascade->SetCharge(trackBachelor->Charge());
+
+  //--- selection cuts
+  //
+  AliAODRecoCascadeHF *tmpCascade = new AliAODRecoCascadeHF(*theCascade);  
+  tmpCascade->GetSecondaryVtx()->AddDaughter(trackBachelor);
+  tmpCascade->GetSecondaryVtx()->AddDaughter(v0);
+  AliAODVertex *primVertexAOD=0;
+  if(!fRecoPrimVtxSkippingTrks && !fRmTrksFromPrimVtx) {
+    // take event primary vertex
+    primVertexAOD = PrimaryVertex(); 
+    if(!primVertexAOD) primVertexAOD = (AliAODVertex*)event->GetPrimaryVertex(); 
+    tmpCascade->SetOwnPrimaryVtx(primVertexAOD);
+  }
+
+  // select Cascades
+  bool okLcksp=0, okLcLpi=0;
+  if(fCascades && fInputAOD){
+    if(fCutsLctoV0) {
+      okCascades = (bool)fCutsLctoV0->IsSelected(tmpCascade,AliRDHFCuts::kCandidate);
+      if(okCascades==1) okLcksp=1;
+      if(okCascades==2) okLcLpi=1;
+      if(okCascades==3) { okLcksp=1; okLcLpi=1;}
+    }
+    else okCascades = tmpCascade->SelectLctoV0(fLctoV0Cuts,okLcksp,okLcLpi);
+  }
+  else { AliDebug(2,Form("The cascade is contructed from ESDs, no cuts are applied")); okCascades=true; }// no cuts implemented from ESDs
+  tmpCascade->GetSecondaryVtx()->RemoveDaughters();
+  tmpCascade->UnsetOwnPrimaryVtx(); 
+  delete tmpCascade; tmpCascade=NULL;
+  if(primVertexAOD) {delete primVertexAOD; primVertexAOD=NULL;}
+  //---
+  
+  return theCascade;
+}
+
 //-----------------------------------------------------------------------------
 AliAODRecoDecayHF2Prong *AliAnalysisVertexingHF::Make2Prong(
                                   TObjArray *twoTrackArray,AliVEvent *event,
@@ -1572,6 +1834,11 @@ void AliAnalysisVertexingHF::PrintStatus() const {
     printf("  D0->Kpipipi cuts:\n");
     if(fCutsD0toKpipipi) fCutsD0toKpipipi->PrintAll();
   }
+  if(fCascades) {
+    printf("Reconstruct cascades candidates formed with v0s.\n");
+    printf("  Lc -> k0s P & Lc -> L Pi cuts:\n");
+    if(fCutsLctoV0) fCutsLctoV0->PrintAll();
+  }
 
   return;
 }
@@ -2058,6 +2325,37 @@ void AliAnalysisVertexingHF::SetLcCuts(const Double_t cuts[12])
 
   return;
 }
+
+//-----------------------------------------------------------------------------
+void AliAnalysisVertexingHF::SetLctoV0Cuts(Double_t cut0,Double_t cut1,
+                                          Double_t cut2,Double_t cut3,Double_t cut4,
+                                          Double_t cut5,Double_t cut6,
+                                          Double_t cut7,Double_t cut8)
+{
+  // Set the cuts for Lc->V0+bachelor selection
+  fLctoV0Cuts[0] = cut0;
+  fLctoV0Cuts[1] = cut1;
+  fLctoV0Cuts[2] = cut2;
+  fLctoV0Cuts[3] = cut3;
+  fLctoV0Cuts[4] = cut4;
+  fLctoV0Cuts[5] = cut5;
+  fLctoV0Cuts[6] = cut6;
+  fLctoV0Cuts[7] = cut7;
+  fLctoV0Cuts[8] = cut8;
+
+  return;
+}
+
+//-----------------------------------------------------------------------------
+void AliAnalysisVertexingHF::SetLctoV0Cuts(const Double_t cuts[8]) 
+{
+  // Set the cuts for Lc-> V0 + bachelor selection
+
+  for(Int_t i=0; i<8; i++) fLctoV0Cuts[i] = cuts[i];
+
+  return;
+}
+
 //-----------------------------------------------------------------------------
 void AliAnalysisVertexingHF::SetD0to4ProngsCuts(Double_t cut0,Double_t cut1,
                                    Double_t cut2,Double_t cut3,Double_t cut4,
@@ -2115,4 +2413,52 @@ Bool_t AliAnalysisVertexingHF::SingleTrkCuts(AliESDtrack *trk,
 
   return kFALSE;
 }
+
+
+//-----------------------------------------------------------------------------
+AliAODv0* AliAnalysisVertexingHF::TransformESDv0toAODv0(AliESDv0 *esdV0, TObjArray *twoTrackArrayV0){
+  //
+  // Transform ESDv0 to AODv0
+  //
+  //  this function takes the ESDv0 vertex, computes the DCA variables from the ESDv0
+  //  and creates an AODv0 out of them
+  //
+  double vertex[3]; esdV0->GetXYZ(vertex[0],vertex[1],vertex[2]);
+  AliAODVertex *vertexV0 = new AliAODVertex(vertex,esdV0->GetChi2V0(),AliAODVertex::kV0,2);
+
+  // create the v0 neutral track to compute the DCA to the primary vertex
+  Double_t xyz[3], pxpypz[3];
+  esdV0->XvYvZv(xyz);
+  esdV0->PxPyPz(pxpypz);
+  Double_t cv[21]; for(int i=0; i<21; i++) cv[i]=0;
+  AliNeutralTrackParam *trackesdV0 = new AliNeutralTrackParam(xyz,pxpypz,cv,0);
+  if(!trackesdV0) return 0;
+  Double_t d0z0[2],covd0z0[3];
+  trackesdV0->PropagateToDCA(PrimaryVertex(),fBzkG,kVeryBig,d0z0,covd0z0);
+  Double_t dcaV0ToPrimVertex = TMath::Sqrt(covd0z0[0]);
+  // get the v0 daughters to compute their DCA to the v0 vertex and get their momentum
+  Double_t dcaV0DaughterToPrimVertex[2];  
+  AliExternalTrackParam *posV0track = (AliExternalTrackParam*)twoTrackArrayV0->UncheckedAt(0);
+  AliExternalTrackParam *negV0track = (AliExternalTrackParam*)twoTrackArrayV0->UncheckedAt(1);
+  if( !posV0track || !negV0track) return 0;
+  posV0track->PropagateToDCA(PrimaryVertex(),fBzkG,kVeryBig,d0z0,covd0z0);
+  //  if ( covd0z0[0]<=0.) dcaV0DaughterToPrimVertex[0] = 0;
+  //  else 
+  dcaV0DaughterToPrimVertex[0] = TMath::Sqrt(covd0z0[0]);
+  negV0track->PropagateToDCA(PrimaryVertex(),fBzkG,kVeryBig,d0z0,covd0z0);  
+  //  if ( covd0z0[0]<=0.)dcaV0DaughterToPrimVertex[1] = 0;
+  //  else 
+  dcaV0DaughterToPrimVertex[1] = TMath::Sqrt(covd0z0[0]);
+  double dcaV0Daughters = esdV0->GetDcaV0Daughters();
+  double pmom[3];  double nmom[3];
+  esdV0->GetNPxPyPz(nmom[0],nmom[1],nmom[2]);
+  esdV0->GetPPxPyPz(pmom[0],pmom[1],pmom[2]);
+
+  AliAODv0 *aodV0 = new AliAODv0(vertexV0,dcaV0Daughters,dcaV0ToPrimVertex,pmom,nmom,dcaV0DaughterToPrimVertex);
+  aodV0->SetOnFlyStatus(esdV0->GetOnFlyStatus());
+
+  if(trackesdV0) delete trackesdV0;
+
+  return aodV0;
+}
 //-----------------------------------------------------------------------------
index 9faf59cdbaa5e07c189d8b1c4eefdb58546c6796..f7a5932311974f63c6cf269f1e560e4e20baf892 100644 (file)
@@ -26,10 +26,13 @@ class AliRDHFCutsJpsitoee;
 class AliRDHFCutsDplustoKpipi;
 class AliRDHFCutsDstoKKpi;
 class AliRDHFCutsLctopKpi;
+class AliRDHFCutsLctoV0;
 class AliRDHFCutsD0toKpipipi;
 class AliESDtrack;
 class AliVEvent;
 class AliAODVertex;
+class AliESDv0; 
+class AliAODv0; 
 
 //-----------------------------------------------------------------------------
 class AliAnalysisVertexingHF : public TNamed {
@@ -47,6 +50,7 @@ class AliAnalysisVertexingHF : public TNamed {
                      TClonesArray *aodCharm3ProngTClArr,
                      TClonesArray *aodCharm4ProngTClArr,
                      TClonesArray *aodDstarTClArr,
+                     TClonesArray *aodCascadesTClArr,
                      TClonesArray *aodLikeSign2ProngTClArr,
                      TClonesArray *aodLikeSign3ProngTClArr);
 
@@ -63,6 +67,8 @@ class AliAnalysisVertexingHF : public TNamed {
   void Set4ProngOff() { f4Prong=kFALSE; }
   void SetDstarOn() { fDstar=kTRUE; }
   void SetDstarOff() { fDstar=kFALSE; }
+  void SetCascadesOn() { fCascades=kTRUE; }
+  void SetCascadesOff() { fCascades=kFALSE; }
   void SetLikeSignOn() { fLikeSign=kTRUE; }
   void SetLikeSignOff() { fLikeSign=kFALSE; }
   void SetMixEventOn() { fMixEvent=kTRUE; }
@@ -73,12 +79,14 @@ class AliAnalysisVertexingHF : public TNamed {
   Bool_t Get3Prong() const { return f3Prong; }
   Bool_t Get4Prong() const { return f4Prong; }
   Bool_t GetDstar()  const { return fDstar; }
+  Bool_t GetCascades() const { return fCascades; }
   Bool_t GetLikeSign() const { return fLikeSign; }
   Bool_t GetMixEvent() const { return fMixEvent; }
   Bool_t GetInputAOD() const { return fInputAOD; }
   Bool_t GetRecoPrimVtxSkippingTrks() const {return fRecoPrimVtxSkippingTrks;}
   Bool_t GetRmTrksFromPrimVtx() const {return fRmTrksFromPrimVtx;}
   void SetFindVertexForDstar(Bool_t vtx=kTRUE) { fFindVertexForDstar=vtx; }
+  void SetFindVertexForCascades(Bool_t vtx=kTRUE) { fFindVertexForCascades=vtx; }
   void SetRecoPrimVtxSkippingTrks() 
     { fRecoPrimVtxSkippingTrks=kTRUE; fRmTrksFromPrimVtx=kFALSE;}
   void UnsetRecoPrimVtxSkippingTrks()
@@ -99,6 +107,8 @@ class AliAnalysisVertexingHF : public TNamed {
   AliRDHFCutsDstoKKpi* GetCutsDstoKKpi() const { return fCutsDstoKKpi; }
   void SetCutsLctopKpi(AliRDHFCutsLctopKpi* cuts) { fCutsLctopKpi = cuts; }
   AliRDHFCutsLctopKpi* GetCutsLctopKpi() const { return fCutsLctopKpi; }
+  void SetCutsLctoV0(AliRDHFCutsLctoV0* cuts) { fCutsLctoV0 = cuts; }
+  AliRDHFCutsLctoV0* GetCutsLctoV0() const { return fCutsLctoV0; }
   void SetCutsD0toKpipipi(AliRDHFCutsD0toKpipipi* cuts) { fCutsD0toKpipipi = cuts; }
   AliRDHFCutsD0toKpipipi* GetCutsD0toKpipipi() const { return fCutsD0toKpipipi; }
   void SetCutsD0fromDstar(AliRDHFCutsD0toKpi* cuts) { fCutsD0fromDstar = cuts; }
@@ -140,6 +150,11 @@ class AliAnalysisVertexingHF : public TNamed {
                 Double_t cut9=-1.1,Double_t cut10=0.,
                 Double_t cut11=10000000000.); 
   void SetLcCuts(const Double_t cuts[12]); 
+  void SetLctoV0Cuts(Double_t cut0=1000.,Double_t cut1=1000., 
+                    Double_t cut2=1000., Double_t cut3=1000.,
+                    Double_t cut4=0., Double_t cut5=0.,Double_t cut6=0.,
+                    Double_t cut7=0.,Double_t cut8=0.); 
+  void SetLctoV0Cuts(const Double_t cuts[9]); 
   void SetDstarCuts(Double_t cut0=1000., Double_t cut1=1000.,
                       Double_t cut2=-1., Double_t cut3=1000.,
                       Double_t cut4=1.6); 
@@ -155,6 +170,7 @@ class AliAnalysisVertexingHF : public TNamed {
   const Double_t *GetDplusCuts() const {return fDplusCuts;}
   const Double_t *GetDsCuts() const {return fDsCuts;}
   const Double_t *GetLcCuts() const {return fLcCuts;}
+  const Double_t *GetLctoV0Cuts() const {return fLctoV0Cuts;}
   const Double_t *GetDstarCuts() const {return fDstarCuts;}
   const Double_t *GetD0to4ProngsCuts() const {return fD0to4ProngsCuts;}
 
@@ -184,6 +200,7 @@ class AliAnalysisVertexingHF : public TNamed {
   Bool_t f3Prong;    // D+,Ds,Lc
   Bool_t f4Prong;    // D0->Kpipipi
   Bool_t fDstar;     // D*->D0pi
+  Bool_t fCascades;  // cascades, Lc --> v0+track
   Bool_t fLikeSign;  // Like-sign pairs
   Bool_t fMixEvent; // event mixing
 
@@ -196,6 +213,7 @@ class AliAnalysisVertexingHF : public TNamed {
   AliRDHFCutsDplustoKpipi *fCutsDplustoKpipi; // D+->Kpipi cuts
   AliRDHFCutsDstoKKpi *fCutsDstoKKpi; // Ds->KKpi cuts
   AliRDHFCutsLctopKpi *fCutsLctopKpi; // Lc->pKpi cuts
+  AliRDHFCutsLctoV0 *fCutsLctoV0; // Lc --> v0 + bachelor cuts
   AliRDHFCutsD0toKpipipi *fCutsD0toKpipipi; // D0->Kpipipi cuts
   AliRDHFCutsD0toKpi *fCutsD0fromDstar; // D0 from Dstar cuts
 
@@ -276,6 +294,19 @@ class AliAnalysisVertexingHF : public TNamed {
                         // 9 = cosThetaPoint
                         // 10 = Sum d0^2 (cm^2)
                         // 11 = dca cut (cm)
+
+   Double_t fLctoV0Cuts[9]; // cuts on Lambdac candidates to V0+bachelor
+                        // (to be passed to AliAODRecoDecayHF3Prong::SelectLctoV0())
+                        // 0 = inv. mass half width in K0s hypothesis [GeV]   
+                        // 1 = inv. mass half width in Lambda hypothesis [GeV]   
+                        // 2 = inv. mass V0 in K0s hypothesis half width [GeV]   
+                        // 3 = inv. mass V0 in Lambda hypothesis half width [GeV]   
+                        // 4 = pT min Bachelor track [GeV/c]
+                        // 5 = pT min V0-Positive track [GeV/c]
+                        // 6 = pT min V0-Negative track [GeV/c]
+                        // 7 = dca cut on the V0 (cm)
+                        // 8 = dca cut on the cascade (cm)
+
   Double_t fDstarCuts[5]; // cuts on D* candidates
                         // (to be passed to AliAODRecoCascadeHF::SelectDstar())
                         // 0 = inv. mass half width of D* [GeV]
@@ -298,6 +329,7 @@ class AliAnalysisVertexingHF : public TNamed {
 
   TList *fListOfCuts;    // pointer to list of cuts for output file
   Bool_t fFindVertexForDstar; // reconstruct a secondary vertex or assume it's from the primary vertex
+  Bool_t fFindVertexForCascades;  // reconstruct a secondary vertex or assume it's from the primary vertex
   //
   void AddRefs(AliAODVertex *v,AliAODRecoDecayHF *rd,const AliVEvent *event,
               const TObjArray *trkArray) const;
@@ -325,6 +357,11 @@ class AliAnalysisVertexingHF : public TNamed {
                                   AliAODRecoDecayHF2Prong *rd2Prong,
                                   Double_t dca,
                                   Bool_t &okDstar) const;
+  AliAODRecoCascadeHF* MakeCascade(TObjArray *twoTrackArray,AliVEvent *event,
+                                  AliAODVertex *secVert,
+                                  AliAODv0 *v0,
+                                  Double_t dca,
+                                  Bool_t &okCascades) const;
 
   AliAODVertex* PrimaryVertex(const TObjArray *trkArray=0x0,AliVEvent *event=0x0) const;
   AliAODVertex* ReconstructSecondaryVertex(TObjArray *trkArray,Double_t &dispersion,Bool_t useTRefArray=kTRUE) const;
@@ -334,8 +371,12 @@ class AliAnalysisVertexingHF : public TNamed {
                                   TObjArray &seleTrksArray,Int_t &nSeleTrks,
                                   UChar_t *seleFlags,Int_t *evtNumber);
   Bool_t SingleTrkCuts(AliESDtrack *trk,Bool_t &okDisplaced,Bool_t &okSoftPi) const;
+
+  AliAODv0* TransformESDv0toAODv0(AliESDv0 *esdv0, 
+                                 TObjArray *twoTrackArrayV0);
+
   //
-  ClassDef(AliAnalysisVertexingHF,16);  // Reconstruction of HF decay candidates
+  ClassDef(AliAnalysisVertexingHF,17);  // Reconstruction of HF decay candidates
 };
 
 
diff --git a/PWG3/vertexingHF/AliRDHFCutsLctoV0.cxx b/PWG3/vertexingHF/AliRDHFCutsLctoV0.cxx
new file mode 100644 (file)
index 0000000..3def598
--- /dev/null
@@ -0,0 +1,298 @@
+/**************************************************************************
+ * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////
+//
+// Class for cuts on AOD reconstructed Lc->pKpi
+//
+/////////////////////////////////////////////////////////////
+
+#include <TDatabasePDG.h>
+#include <Riostream.h>
+
+#include "AliRDHFCutsLctoV0.h"
+#include "AliAODRecoCascadeHF.h"
+#include "AliAODTrack.h"
+#include "AliESDtrack.h"
+#include "AliAODv0.h"
+#include "AliESDv0.h"
+
+ClassImp(AliRDHFCutsLctoV0)
+
+//--------------------------------------------------------------------------
+AliRDHFCutsLctoV0::AliRDHFCutsLctoV0(const char* name) : 
+AliRDHFCuts(name)
+{
+  //
+  // Default Constructor
+  //
+  Int_t nvars=9;
+  SetNVars(nvars);
+  TString varNames[9]={"inv. mass if K0s [GeV]",
+                      "inv. mass if Lambda [GeV]",
+                      "inv. mass V0 if K0s [GeV]",
+                      "inv. mass V0 if Lambda [GeV]",
+                      "pT min bachelor track [GeV/c]",
+                      "pT min V0-positive track [GeV/c]",
+                      "pT min V0-negative track [GeV/c]",
+                      "dca cascade cut (cm)",
+                      "dca V0 cut (cm)"}; 
+
+  Bool_t isUpperCut[9]={kTRUE,
+                       kTRUE, 
+                       kTRUE, 
+                       kTRUE,
+                       kFALSE,
+                       kFALSE,
+                       kFALSE,
+                       kTRUE,
+                       kTRUE};
+  SetVarNames(nvars,varNames,isUpperCut);
+  Bool_t forOpt[9]={kFALSE,
+                   kFALSE,
+                   kFALSE,
+                   kFALSE,
+                   kFALSE,
+                   kFALSE,
+                   kFALSE,
+                   kFALSE,
+                   kFALSE};
+  SetVarsForOpt(5,forOpt);
+  Float_t limits[2]={0,999999999.};
+  SetPtBins(2,limits);
+}
+//--------------------------------------------------------------------------
+AliRDHFCutsLctoV0::AliRDHFCutsLctoV0(const AliRDHFCutsLctoV0 &source) :
+  AliRDHFCuts(source)
+{
+  //
+  // Copy constructor
+  //
+
+}
+//--------------------------------------------------------------------------
+AliRDHFCutsLctoV0 &AliRDHFCutsLctoV0::operator=(const AliRDHFCutsLctoV0 &source)
+{
+  //
+  // assignment operator
+  //
+  if(&source == this) return *this;
+
+  AliRDHFCuts::operator=(source);
+
+  return *this;
+}
+
+
+//---------------------------------------------------------------------------
+void AliRDHFCutsLctoV0::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
+  // 
+  // Fills in vars the values of the variables 
+  //
+
+  if(nvars!=fnVarsForOpt) {
+    printf("AliRDHFCutsLctoV0::GetCutsVarsForOpt: wrong number of variables\n");
+    return;
+  }
+
+  AliAODRecoCascadeHF *dd = (AliAODRecoCascadeHF*)d;
+
+  // Get the v0 and all daughter tracks
+  AliAODTrack *bachelor_track = dd->GetBachelor();
+  AliAODv0 *v0 = dd->Getv0();
+  AliAODTrack *v0positive_track = dd->Getv0PositiveTrack();
+  AliAODTrack *v0negative_track = dd->Getv0NegativeTrack(); 
+
+  Int_t iter=-1;
+  // cut on cascade mass, if k0s + p
+  if(fVarsForOpt[0]){
+    iter++;
+    vars[iter]=dd->InvMassLctoK0sP();
+  }
+  // cut on cascade mass, if lambda + pi
+  if(fVarsForOpt[1]){
+    iter++;
+    vars[iter]=dd->InvMassLctoLambdaPi();
+  }
+
+  // cut on v0 mass if k0s
+  if(fVarsForOpt[2]){
+    iter++;
+    vars[iter]=v0->MassK0Short();
+  }
+
+  // cut on v0 mass if lambda
+  // ----------------------------- pb with anti-lambda?? --------->>>>>>>>
+  if(fVarsForOpt[3]){
+    iter++;
+    vars[iter]=v0->MassLambda();
+  }
+
+  // cut on v0-positive min pt
+  if(fVarsForOpt[4]){
+    iter++;
+    vars[iter]=v0positive_track->Pt();
+  }
+
+  // cut on v0-negative min pt
+  if(fVarsForOpt[5]){
+    iter++;
+    vars[iter]=v0negative_track->Pt();
+  }
+
+  // cut bachelor min pt
+  if(fVarsForOpt[6]){
+    iter++;
+    vars[iter]=bachelor_track->Pt();
+  }
+
+  // cut on v0 dca
+  if(fVarsForOpt[7]){
+    iter++;
+    vars[iter]=v0->GetDCA();
+  }
+
+  // cut on cascade dca
+  if(fVarsForOpt[8]){
+    iter++;
+    vars[iter]=dd->GetDCA();
+  }
+
+  return;
+}
+//---------------------------------------------------------------------------
+Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
+  //
+  // Apply selection
+  //
+
+  if(!fCutsRD){
+    cout<<"Cut matrice not inizialized. Exit..."<<endl;
+    return 0;
+  }
+  //PrintAll();
+  AliAODRecoCascadeHF* d=(AliAODRecoCascadeHF*)obj;
+
+  if(!d){
+    cout<<"AliAODRecoCascadeHF null"<<endl;
+    return 0;
+  }
+
+
+  // selection on daughter tracks 
+  if(selectionLevel==AliRDHFCuts::kAll || 
+     selectionLevel==AliRDHFCuts::kTracks) {
+    if(!AreDaughtersSelected(d)) return 0;
+  }
+
+
+  // Get the v0 and all daughter tracks
+  AliAODTrack *bachelor_track = d->GetBachelor();
+  AliAODv0 *v0 = d->Getv0();
+  AliAODTrack *v0positive_track = d->Getv0PositiveTrack();
+  AliAODTrack *v0negative_track = d->Getv0NegativeTrack(); 
+
+//   // If reading ESDv0, return false
+//   if ( !d->Getv0() || !d->Getv0PositiveTrack() || !d->Getv0NegativeTrack() )
+//     { AliInfo(Form("Not adapted for ESDv0s, return false...")); return false; }
+
+  Int_t returnvalue=1;
+
+  // selection on candidate
+  if(selectionLevel==AliRDHFCuts::kAll || 
+     selectionLevel==AliRDHFCuts::kCandidate) {
+
+    Double_t pt=d->Pt();
+    
+    Int_t ptbin=PtBin(pt);
+    
+    Double_t mLck0sp,mLcLpi;
+    Int_t okLck0sp=1,okLcLpi=1;
+
+    Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
+    Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
+    Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
+
+    // k0s + p
+    double mk0s = v0->MassK0Short();
+    mLck0sp = d->InvMassLctoK0sP();
+
+    // lambda + pi 
+    double mlambda = v0->MassLambda();
+    double malambda = v0->MassAntiLambda();
+    mLcLpi = d->InvMassLctoLambdaPi();
+
+    // cut on Lc mass
+    //   with k0s p hypothesis
+    if(TMath::Abs(mLck0sp-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) {
+      okLck0sp = 0;
+      AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to lambda_c into k0s+p cut",mLck0sp));
+    }
+    //   with Lambda pi hypothesis
+    if(TMath::Abs(mLcLpi-mLcPDG)>fCutsRD[GetGlobalIndex(1,ptbin)]) {
+      okLcLpi = 0;
+      AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to lambda_c into lambda+pi cut",mLcLpi));
+    }
+
+    // cuts on the v0 mass
+    if(TMath::Abs(mk0s-mk0sPDG)>fCutsRD[GetGlobalIndex(2,ptbin)]) { 
+      okLck0sp = 0;
+      AliDebug(4,Form(" v0 mass is %2.2e and does not correspond to k0s cut",mk0s));
+    }
+    if( TMath::Abs(mlambda-mLPDG)>fCutsRD[GetGlobalIndex(3,ptbin)] && 
+       TMath::Abs(malambda-mLPDG)>fCutsRD[GetGlobalIndex(3,ptbin)] ) {
+      okLcLpi = 0;
+      AliDebug(4,Form(" v0 mass is %2.2e and does not correspond to lambda cut",mlambda));
+    }
+
+    if(!okLck0sp && !okLcLpi) return 0;
+
+    // cuts on the minimum pt of the tracks 
+    if(TMath::Abs(bachelor_track->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)]) {
+      AliDebug(4,Form(" bachelor track Pt=%2.2e > %2.2e",bachelor_track->Pt(),fCutsRD[GetGlobalIndex(4,ptbin)]));
+      return 0;
+    }
+    if(TMath::Abs(v0positive_track->Pt()) < fCutsRD[GetGlobalIndex(5,ptbin)]) {
+      AliDebug(4,Form(" v0 positive track Pt=%2.2e > %2.2e",v0positive_track->Pt(),fCutsRD[GetGlobalIndex(5,ptbin)]));
+      return 0;
+    }
+    if(TMath::Abs(v0negative_track->Pt()) < fCutsRD[GetGlobalIndex(6,ptbin)]) {
+      AliDebug(4,Form(" v0 negative track Pt=%2.2e > %2.2e",v0negative_track->Pt(),fCutsRD[GetGlobalIndex(6,ptbin)]));
+      return 0;
+    }
+
+    // cut on the v0 dca
+    if(TMath::Abs(v0->DcaV0Daughters()) > fCutsRD[GetGlobalIndex(7,ptbin)]) {
+      AliDebug(4,Form(" v0 daughters DCA = %2.2e > %2.2e",v0->DcaV0Daughters(),fCutsRD[GetGlobalIndex(7,ptbin)]));
+      return 0;
+    }
+
+    // cut on the cascade dca
+    if( TMath::Abs(d->GetDCA(0))>fCutsRD[GetGlobalIndex(8,ptbin)] ||
+       TMath::Abs(v0->DcaPosToPrimVertex())>fCutsRD[GetGlobalIndex(8,ptbin)] ||
+       TMath::Abs(v0->DcaNegToPrimVertex())>fCutsRD[GetGlobalIndex(8,ptbin)] ) {
+      AliDebug(4,Form(" cascade tracks DCA at primary vertex don't pass the cut"));
+      return 0;
+    }
+
+    if(okLck0sp) returnvalue=1; //cuts passed as Lc -> k0s + p
+    if(okLcLpi) returnvalue=2; //cuts passed as Lc-> lambda + pi
+    if(okLck0sp && okLcLpi) returnvalue=3; //cuts passed as both  Lc -> k0s + p; Lc-> lambda + pi
+
+  }
+
+  return returnvalue;
+}
+//---------------------------------------------------------------------------
diff --git a/PWG3/vertexingHF/AliRDHFCutsLctoV0.h b/PWG3/vertexingHF/AliRDHFCutsLctoV0.h
new file mode 100644 (file)
index 0000000..12a3a5d
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef ALIRDHFCUTSLCTOV0_H
+#define ALIRDHFCUTSLCTOV0_H
+/* Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//***********************************************************
+// Class AliRDHFCutsLctoV0
+// class for cuts on AOD reconstructed Lc-> V0 + bachelor
+//***********************************************************
+
+#include "AliRDHFCuts.h"
+
+class AliRDHFCutsLctoV0 : public AliRDHFCuts 
+{
+ public:
+
+  AliRDHFCutsLctoV0(const char* name="CutsLctoV0");
+  
+  virtual ~AliRDHFCutsLctoV0(){;}
+
+  AliRDHFCutsLctoV0(const AliRDHFCutsLctoV0& source);
+  AliRDHFCutsLctoV0& operator=(const AliRDHFCutsLctoV0& source); 
+  virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters);
+
+  using AliRDHFCuts::IsSelected;
+  virtual Int_t IsSelected(TObject* obj,Int_t selectionLevel);
+  
+  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);}
+
+ protected:
+
+
+  ClassDef(AliRDHFCutsLctoV0,1);  // class for cuts on AOD reconstructed Lc->V0+bachelor
+};
+
+#endif
index 168028a6d9140a7d2568a01aa89f1884903ea23d..c88af252569d18b0a3a02518e8c23b85faa8ed4f 100644 (file)
@@ -13,6 +13,8 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   vHF->SetFindVertexForDstar(kFALSE);
   //--- secondary vertex with KF?
   //vHF->SetSecVtxWithKF();
+  //  vHF->SetCascadesOff();
+  vHF->SetFindVertexForCascades(kFALSE);
 
   //--- set cuts for single-track selection  
   //     displaced tracks
@@ -69,6 +71,11 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   cutsD0fromDstar->SetCuts(9,cutsArrayD0fromDstar);
   cutsD0fromDstar->AddTrackCuts(esdTrackCuts);
   vHF->SetCutsD0fromDstar(cutsD0fromDstar);
+  AliRDHFCutsLctoV0 *cutsLctoV0 = new AliRDHFCutsLctoV0("CutsLctoV0");
+  Float_t cutsArrayLctoV0[9]={4.0,4.0,2.0,2.0,0.0,0.0,0.0,1000.,1000.};
+  cutsLctoV0->SetCuts(9,cutsArrayLctoV0);
+  cutsLctoV0->AddTrackCuts(esdTrackCuts);
+  vHF->SetCutsLctoV0(cutsLctoV0);
   // 
   // to be removed:
   vHF->SetD0toKpiCuts(0.3,999999.,1.1,0.,0.,999999.,999999.,999999.,0.);
@@ -79,6 +86,7 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   vHF->SetD0to4ProngsCuts(0.2,0.04,0.00,0.01,0.02,0.8,0.,0.1,0.);
   vHF->SetDstarCuts(0.3, 0.1, 0.05, 100000000000.0, 0.5);
   vHF->SetD0fromDstarCuts(0.3,999999.,1.1,0.,0.,999999.,999999.,999999.,0.);
+  vHF->SetLctoV0Cuts(4.0,4.0,2.0,2.0,0.0,0.0,0.0,1000,1000);
   //--- set this if you want to reconstruct primary vertex candidate by
   //    candidate using other tracks in the event (for pp, broad 
   //    interaction region)
@@ -90,7 +98,7 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   //--- check the settings
   vHF->PrintStatus();
   //--- verbose
-  //AliLog::SetClassDebugLevel("AliAnalysisVertexingHF",2);
+  //  AliLog::SetClassDebugLevel("AliAnalysisVertexingHF",2);
 
  
   return vHF;
index db98aeba18ca92393b445e62145706e3fed91fb3..d964b73361bd8ea1c9b72a7f422437c2920e3e18 100644 (file)
@@ -13,6 +13,8 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   vHF->SetFindVertexForDstar(kFALSE);
   //--- secondary vertex with KF?
   //vHF->SetSecVtxWithKF();
+    vHF->SetCascadesOff();
+  vHF->SetFindVertexForCascades(kFALSE);
 
   //--- set cuts for single-track selection  
   //     displaced tracks
@@ -69,6 +71,11 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   cutsD0fromDstar->SetCuts(9,cutsArrayD0fromDstar);
   cutsD0fromDstar->AddTrackCuts(esdTrackCuts);
   vHF->SetCutsD0fromDstar(cutsD0fromDstar);
+  AliRDHFCutsLctoV0 *cutsLctoV0 = new AliRDHFCutsLctoV0("CutsLctoV0");
+  Float_t cutsArrayLctoV0[9]={4.0,4.0,2.0,2.0,0.0,0.0,0.0,1000.,1000.};
+  cutsLctoV0->SetCuts(9,cutsArrayLctoV0);
+  cutsLctoV0->AddTrackCuts(esdTrackCuts);
+  vHF->SetCutsLctoV0(cutsLctoV0);
   // 
   // to be removed:
   vHF->SetD0toKpiCuts(0.3,999999.,1.1,0.,0.,999999.,999999.,999999.,0.);
@@ -79,6 +86,7 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   vHF->SetD0to4ProngsCuts(0.2,0.04,0.00,0.01,0.02,0.8,0.,0.1,0.);
   vHF->SetDstarCuts(0.3, 0.1, 0.05, 100000000000.0, 0.5);
   vHF->SetD0fromDstarCuts(0.3,999999.,1.1,0.,0.,999999.,999999.,999999.,0.);
+  vHF->SetLctoV0Cuts(4.0,4.0,2.0,2.0,0.0,0.0,0.0,1000,1000);
   //--- set this if you want to reconstruct primary vertex candidate by
   //    candidate using other tracks in the event (for pp, broad 
   //    interaction region)
@@ -90,7 +98,7 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   //--- check the settings
   vHF->PrintStatus();
   //--- verbose
-  //AliLog::SetClassDebugLevel("AliAnalysisVertexingHF",2);
+  //  AliLog::SetClassDebugLevel("AliAnalysisVertexingHF",2);
 
  
   return vHF;
index 168028a6d9140a7d2568a01aa89f1884903ea23d..c88af252569d18b0a3a02518e8c23b85faa8ed4f 100644 (file)
@@ -13,6 +13,8 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   vHF->SetFindVertexForDstar(kFALSE);
   //--- secondary vertex with KF?
   //vHF->SetSecVtxWithKF();
+  //  vHF->SetCascadesOff();
+  vHF->SetFindVertexForCascades(kFALSE);
 
   //--- set cuts for single-track selection  
   //     displaced tracks
@@ -69,6 +71,11 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   cutsD0fromDstar->SetCuts(9,cutsArrayD0fromDstar);
   cutsD0fromDstar->AddTrackCuts(esdTrackCuts);
   vHF->SetCutsD0fromDstar(cutsD0fromDstar);
+  AliRDHFCutsLctoV0 *cutsLctoV0 = new AliRDHFCutsLctoV0("CutsLctoV0");
+  Float_t cutsArrayLctoV0[9]={4.0,4.0,2.0,2.0,0.0,0.0,0.0,1000.,1000.};
+  cutsLctoV0->SetCuts(9,cutsArrayLctoV0);
+  cutsLctoV0->AddTrackCuts(esdTrackCuts);
+  vHF->SetCutsLctoV0(cutsLctoV0);
   // 
   // to be removed:
   vHF->SetD0toKpiCuts(0.3,999999.,1.1,0.,0.,999999.,999999.,999999.,0.);
@@ -79,6 +86,7 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   vHF->SetD0to4ProngsCuts(0.2,0.04,0.00,0.01,0.02,0.8,0.,0.1,0.);
   vHF->SetDstarCuts(0.3, 0.1, 0.05, 100000000000.0, 0.5);
   vHF->SetD0fromDstarCuts(0.3,999999.,1.1,0.,0.,999999.,999999.,999999.,0.);
+  vHF->SetLctoV0Cuts(4.0,4.0,2.0,2.0,0.0,0.0,0.0,1000,1000);
   //--- set this if you want to reconstruct primary vertex candidate by
   //    candidate using other tracks in the event (for pp, broad 
   //    interaction region)
@@ -90,7 +98,7 @@ AliAnalysisVertexingHF* ConfigVertexingHF() {
   //--- check the settings
   vHF->PrintStatus();
   //--- verbose
-  //AliLog::SetClassDebugLevel("AliAnalysisVertexingHF",2);
+  //  AliLog::SetClassDebugLevel("AliAnalysisVertexingHF",2);
 
  
   return vHF;
index b427ab2c8fa69b98f938785938014611c7e76e5f..0bc4ba6c8d6661969f2e70d65ad03d2bd8ca8702 100644 (file)
@@ -25,6 +25,7 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
   hDeltaMassDstar->SetXTitle("M(Kpipi)-M(Kpi) [GeV]");
   hDeltaMassDstar->SetYTitle("Entries");
 
+
   // open input file and get the TTree
   TFile inFile(aodFileName,"READ");
   if (!inFile.IsOpen()) return;
@@ -52,6 +53,10 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
   TClonesArray *arrayDstar = 
     (TClonesArray*)aod->GetList()->FindObject("Dstar"); 
     
+  // load cascade (V0+track) candidates
+  TClonesArray *arrayCascades = 
+    (TClonesArray*)aod->GetList()->FindObject("CascadesHF"); 
+    
 
   Double_t cutsD0[9]=
   // cutsD0[0] = inv. mass half width [GeV]
@@ -85,8 +90,20 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
                      1.0, 
                      0.5};
 
-
-  Int_t nTotHF=0,nTotD0toKpi=0,nTotDstar=0,nTot3Prong=0;
+  Double_t cutsLctoV0[9]=// cuts on Lambdac candidates to V0+bachelor
+                        // (to be passed to AliAODRecoDecayHF3Prong::SelectLctoV0())
+                        // 0 = inv. mass half width in K0s hypothesis [GeV]   
+                        // 1 = inv. mass half width in Lambda hypothesis [GeV]   
+                        // 2 = inv. mass V0 in K0s hypothesis half width [GeV]   
+                        // 3 = inv. mass V0 in Lambda hypothesis half width [GeV]   
+                        // 4 = pT min Bachelor track [GeV/c]
+                        // 5 = pT min V0-Positive track [GeV/c]
+                        // 6 = pT min V0-Negative track [GeV/c]
+                        // 7 = dca cut on the V0 (cm)
+                        // 8 = dca cut on the cascade (cm)
+    {2.0,2.0,1.0,1.0,0.0,0.0,0.0,1000.,1000.};
+
+  Int_t nTotHF=0,nTotD0toKpi=0,nTotDstar=0,nTot3Prong=0,nTotCasc=0;
   AliAODVertex *vtx1=0;
 
   // loop over events
@@ -201,6 +218,14 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
       // print info
       //cout << iVtx << ": vertex z position: " << vtxHF->GetZ() << endl;
     }
+
+
+    // count cascade candidates
+    if (arrayCascades){
+      Int_t nCasc = arrayCascades->GetEntriesFast();
+      nTotCasc+=nCasc;
+      cout << "Number of Cascades: "<<nCasc<<endl;
+    }
     
   }
   
@@ -208,6 +233,7 @@ void ReadAODVertexingHF(const char *aodFileName="AliAOD.root",
   printf("\n Total D0->Kpi: %d\n",nTotD0toKpi);
   printf("\n Total D*->D0pi: %d\n",nTotDstar);
   printf("\n Total Charm->3Prong: %d\n",nTot3Prong);
+  if (arrayCascades) printf("\n Total Cascades: %d\n",nTotCasc);
 
   TCanvas *c1 = new TCanvas("c1","c1",0,0,800,700);
   c1->Divide(2,2);