]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG3/vertexingHF/AliRDHFCutsDplustoKpipi.cxx
Added IsSelectedPID (Francesco)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliRDHFCutsDplustoKpipi.cxx
index b84fce523480b33d4d687d8138b070150a0c388a..84255bb969275a0d6d04f171a25bc283d69e2619 100644 (file)
 #include "AliAODTrack.h"
 #include "AliESDtrack.h"
 
+
 ClassImp(AliRDHFCutsDplustoKpipi)
 
 //--------------------------------------------------------------------------
-AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi() : 
-  AliRDHFCuts()
+AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi(const char* name) : 
+  AliRDHFCuts(name)
 {
   //
   // Default Constructor
@@ -65,7 +66,7 @@ AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi() :
                         kFALSE,
                         kTRUE};
   SetVarNames(nvars,varNames,isUpperCut);
-  Bool_t forOpt[12]={kTRUE,
+  Bool_t forOpt[12]={kFALSE,
                     kFALSE,
                     kFALSE,
                     kFALSE,
@@ -77,9 +78,25 @@ AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi() :
                     kTRUE,
                     kTRUE,
                     kFALSE};
-  SetVarsForOpt(6,forOpt);
+  SetVarsForOpt(5,forOpt);
   Float_t limits[2]={0,999999999.};
   SetPtBins(2,limits);
+  if(fPidHF)delete fPidHF;
+  fPidHF=new AliAODPidHF();
+  Double_t plim[2]={0.6,0.8};
+  Double_t nsigma[5]={2.,1.,2.,3.,0.};
+  
+  fPidHF->SetPLimit(plim);
+  fPidHF->SetAsym(kTRUE);
+  fPidHF->SetSigma(nsigma);
+  fPidHF->SetMatch(1);
+  fPidHF->SetTPC(1);
+  fPidHF->SetTOF(1);
+  fPidHF->SetITS(0);
+  fPidHF->SetTRD(0);
+  fPidHF->SetCompat(kTRUE);
+
+  
 }
 //--------------------------------------------------------------------------
 AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi(const AliRDHFCutsDplustoKpipi &source) :
@@ -102,6 +119,7 @@ AliRDHFCutsDplustoKpipi &AliRDHFCutsDplustoKpipi::operator=(const AliRDHFCutsDpl
 
   return *this;
 }
+//
 
 
 //---------------------------------------------------------------------------
@@ -117,20 +135,7 @@ void AliRDHFCutsDplustoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *var
   }
 
   AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
- /*
-  vars[0] = dd->GetDCA();
-  if(TMath::Abs(pdgdaughters[0])==211) {
-    vars[1] = dd->CosThetaStarD0();
-  } else {
-    vars[1] = dd->CosThetaStarD0bar();
-  }
-  vars[2] = dd->Prodd0d0();
-  vars[3] = dd->CosPointingAngle();
 
-  return;
-*/
-  //possibile generalizzazione
   Int_t iter=-1;
   if(fVarsForOpt[0]){
     iter++;
@@ -146,11 +151,15 @@ void AliRDHFCutsDplustoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *var
   }
   if(fVarsForOpt[2]){
     iter++;
+    Float_t minPtDau=1000000.0;
     for(Int_t iprong=0;iprong<3;iprong++){
       if(TMath::Abs(pdgdaughters[iprong])==211) {
-       vars[iter]=dd->PtProng(iprong);
+       if(dd->PtProng(iprong)<minPtDau){
+         minPtDau=dd->PtProng(iprong);
+       }
       }
     }
+    vars[iter]=minPtDau;
   }
   if(fVarsForOpt[3]){
     iter++;
@@ -162,15 +171,22 @@ void AliRDHFCutsDplustoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *var
   }
   if(fVarsForOpt[4]){
     iter++;
+    Float_t minImpParDau=1000000.0;
     for(Int_t iprong=0;iprong<3;iprong++){
       if(TMath::Abs(pdgdaughters[iprong])==211) {
-       vars[iter]=dd->Getd0Prong(iprong);
+       if(dd->Getd0Prong(iprong)<minImpParDau){
+         minImpParDau=dd->Getd0Prong(iprong);
+       }
       }
     }
+   vars[iter]=minImpParDau;
   }
   if(fVarsForOpt[5]){
     iter++;
-    vars[iter]=dd->GetDist12toPrim();
+    Float_t dist12 = dd->GetDist12toPrim();
+    Float_t dist23 = dd->GetDist23toPrim();
+    if(dist12<dist23)vars[iter]=dist12;
+    else vars[iter]=dist23;
   }
   if(fVarsForOpt[6]){
     iter++;
@@ -198,10 +214,55 @@ void AliRDHFCutsDplustoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *var
   }
   if(fVarsForOpt[11]){
     iter++;
-    vars[iter]=dd->GetDCA();
+    Float_t maxDCA=0;
+    for(Int_t iprong=0;iprong<3;iprong++){
+      if(dd->GetDCA(iprong)<maxDCA){
+       maxDCA=dd->GetDCA(iprong);
+      }
+    }
+    vars[iter]=maxDCA;
   }
   return;
 }
+
+//---------------------------------------------------------------------------
+Int_t AliRDHFCutsDplustoKpipi::IsSelectedPID(AliAODRecoDecayHF *rd)
+{
+  //
+  // PID selection
+  // 
+  if(!fUsePID || !rd) return 1;
+  //if(fUsePID)printf("i am inside the pid \n");
+  Int_t nkaons=0;
+  Int_t nNotKaons=0;
+  Int_t sign= rd->GetCharge(); 
+  for(Int_t daught=0;daught<3;daught++){
+    AliAODTrack *track=(AliAODTrack*)rd->GetDaughter(daught);
+    Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion);
+    Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon);
+    Int_t isProton=fPidHF->MakeRawPid(track,AliPID::kProton);
+    
+    if(isProton>0 &&  isKaon<0  && isPion<0) return 0;
+    if(isKaon>0 && isPion<0) nkaons++;
+    if(isKaon<0) nNotKaons++;  
+    if(sign==track->Charge()){//pions
+      if(isPion<0)return 0;
+    }
+      else{//kaons
+       if(isKaon<0)return 0;
+      }
+    
+      
+  }
+  
+  if(nkaons>1)return 0;
+  if(nNotKaons==3)return 0;
+  
+  return 1;   
+}
+
+
+
 //---------------------------------------------------------------------------
 Int_t AliRDHFCutsDplustoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
   //
@@ -209,7 +270,7 @@ Int_t AliRDHFCutsDplustoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
   //
 
   if(!fCutsRD){
-    cout<<"Cut matrice not inizialized. Exit..."<<endl;
+    cout<<"Cut matrix not inizialized. Exit..."<<endl;
     return 0;
   }
   //PrintAll();
@@ -228,7 +289,19 @@ Int_t AliRDHFCutsDplustoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
      selectionLevel==AliRDHFCuts::kTracks) {
     if(!AreDaughtersSelected(d)) return 0;
   }
+  
+  // PID selection
+  Int_t returnvaluePID=1;  
+                                          
 
+  //if(selectionLevel==AliRDHFCuts::kAll || 
+  if(selectionLevel==AliRDHFCuts::kCandidate ||     
+ selectionLevel==AliRDHFCuts::kPID) {
+    returnvaluePID = IsSelectedPID(d);
+  }
+  if(returnvaluePID==0)return 0;
+  
+  
   // selection on candidate
   if(selectionLevel==AliRDHFCuts::kAll || 
      selectionLevel==AliRDHFCuts::kCandidate) {
@@ -247,23 +320,24 @@ Int_t AliRDHFCutsDplustoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
 
     
 
-    //2track cuts
-    if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)])return 0;
-    if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.)return 0;
-    
-    //sec vert
-    if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)])return 0;
+  //2track cuts
+  if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)])return 0;
+  if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.)return 0;
 
-    if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)])return 0;
-    
-    if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)])return 0;
-    if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])return 0;
-    Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
-    if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])return 0;
-    
-    //DCA
-    for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
-    
+  //sec vert
+  if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)])return 0;
+
+  if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)])return 0;
+
+  if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)])return 0;
+  if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])return 0;
+  Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
+  if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])return 0;
+
+  //DCA
+  for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
+  
+  return 1;
   }
   return 1;
 }