]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG3/vertexingHF/AliAnalysisTaskSESignificance.cxx
Add selection on track filter mask in D meson tasks
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAnalysisTaskSESignificance.cxx
index 3f7e741e63bccf2bf9b821b61e413421b7560b60..ef7ffb27f6d5c3f3507b7006daddbee65e6b395d 100644 (file)
@@ -73,6 +73,7 @@ AliAnalysisTaskSESignificance::AliAnalysisTaskSESignificance():
   fRDCuts(0),
   fNPtBins(0),
   fReadMC(kFALSE),
+  fUseSelBit(kFALSE),
   fBFeedDown(kBoth),
   fDecChannel(0),
   fPDGmother(0),
@@ -100,6 +101,7 @@ AliAnalysisTaskSESignificance::AliAnalysisTaskSESignificance(const char *name, T
   fRDCuts(rdCuts),
   fNPtBins(0),
   fReadMC(kFALSE),
+  fUseSelBit(kFALSE),
   fBFeedDown(kBoth),
   fDecChannel(decaychannel),
   fPDGmother(0),
@@ -114,11 +116,16 @@ AliAnalysisTaskSESignificance::AliAnalysisTaskSESignificance(const char *name, T
 
   SetPDGCodes();
   SetDsChannel(kPhi);
-  SetMassLimits(0.15,fPDGmother); //check range
+  if (fDecChannel!=2) SetMassLimits(0.15,fPDGmother); //check range
+  else {
+    Float_t min = 0.13;
+    Float_t max = 0.19;
+    SetMassLimits(min, max);
+  }
   fNPtBins=fRDCuts->GetNPtBins();
 
   fNVars=fRDCuts->GetNVarsForOpt();
-  if(fNVars>kMaxCutVar) AliFatal(Form("Too large number of cut variables, maximum is %d",kMaxCutVar))
+  if(fNVars>kMaxCutVar) AliFatal(Form("Too large number of cut variables, maximum is %d",kMaxCutVar));
   
   if(fDebug>1)fRDCuts->PrintAll();
    // Output slot #1 writes into a TList container
@@ -418,6 +425,7 @@ void AliAnalysisTaskSESignificance::UserCreateOutputObjects()
   fOutput->Add(fHistNEvents);
 
  
+  PostData(1,fOutput);    
   return;
 }
 
@@ -504,6 +512,40 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
   for (Int_t iProng = 0; iProng < nProng; iProng++) {
     fHistNEvents->Fill(6);
     d=(AliAODRecoDecayHF*)arrayProng->UncheckedAt(iProng);
+
+    AliAODRecoCascadeHF* DStarToD0pi = NULL;
+    AliAODRecoDecayHF2Prong* D0Particle = NULL;
+    fPDGDStarToD0pi[0] = 421; fPDGDStarToD0pi[1] = 211;
+    fPDGD0ToKpi[0] = 321; fPDGD0ToKpi[1] = 211;
+
+    Bool_t isSelBit=kTRUE;
+    if(fUseSelBit){
+      if(fDecChannel==0) {
+       isSelBit=d->HasSelectionBit(AliRDHFCuts::kDplusCuts);
+      }else{ 
+       if(fDecChannel==1) {
+         isSelBit=d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts);
+       }else{
+         if(fDecChannel==2) {
+           isSelBit=d->HasSelectionBit(AliRDHFCuts::kDstarCuts);
+         }else{
+           if(fDecChannel==3) {
+             isSelBit=d->HasSelectionBit(AliRDHFCuts::kDsCuts);
+           }else{
+             if(fDecChannel==5) isSelBit=d->HasSelectionBit(AliRDHFCuts::kLcCuts);
+           }
+         }
+       }
+      }
+    }
+    if(!isSelBit) continue; 
+
+    if (fDecChannel==2) {
+      DStarToD0pi = (AliAODRecoCascadeHF*)arrayProng->At(iProng);
+      if (!DStarToD0pi->GetSecondaryVtx()) continue;
+      D0Particle = (AliAODRecoDecayHF2Prong*)DStarToD0pi->Get2Prong();
+      if (!D0Particle) continue;
+    }
     
     Bool_t isFidAcc = fRDCuts->IsInFiducialAcceptance(d->Pt(),d->Y(fPDGmother));
     Int_t isSelected=fRDCuts->IsSelected(d,fSelectionlevel,aod);
@@ -512,33 +554,29 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
       Int_t labD = d->MatchToMC(fPDGmother,arrayMC,fNProngs,fPDGdaughters);
       if(labD>=0){
        AliAODMCParticle *partD = (AliAODMCParticle*)arrayMC->At(labD);
-       Int_t label=partD->GetMother();
-       AliAODMCParticle *mot = (AliAODMCParticle*)arrayMC->At(label);
-       while(label>=0){//get first mother
-         mot = (AliAODMCParticle*)arrayMC->At(label);
-         label=mot->GetMother();
-       }
-       Int_t pdgMotCode = mot->GetPdgCode();
-       
-       if(TMath::Abs(pdgMotCode)<=4){
-         fHistNEvents->Fill(6);
-         if(fBFeedDown==kBeautyOnly)isSelected=kFALSE; //from primary charm
-       }else{
+       Int_t pdgGranma = CheckOrigin(partD, arrayMC);
+       Int_t abspdgGranma = TMath::Abs(pdgGranma);
+       if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
+         //feed down particle
+         AliDebug(2,Form("Particle has a b-meson, or b-baryon mother (pdg code mother = %d )--> not coming from a c-quark, skipping...", pdgGranma));
          fHistNEvents->Fill(7);
          if(fBFeedDown==kCharmOnly) isSelected=kFALSE; //from beauty
        }
-       
+       else { 
+         //prompt particle
+         fHistNEvents->Fill(6);
+         if(fBFeedDown==kBeautyOnly)isSelected=kFALSE;
+       } 
       }
     }
     
-
     if(isSelected&&isFidAcc) {
       fHistNEvents->Fill(2); // count selected with loosest cuts
       if(fDebug>1) printf("+++++++Is Selected\n");
     
       Int_t nVals=0;
       if(fDecChannel==3) SetPDGdaughterDstoKKpi();
-      fRDCuts->GetCutVarsForOpt(d,fVars,fNVars,fPDGdaughters);
+      fRDCuts->GetCutVarsForOpt(d,fVars,fNVars,fPDGdaughters,aod);
       Int_t ptbin=fRDCuts->PtBin(d->Pt());
       if(ptbin==-1) continue;
       TString mdvname=Form("multiDimVectorPtBin%d",ptbin);
@@ -564,7 +602,7 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
          FillD02p(d,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected);
          break;
        case 2:
-         FillDstar(d,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected);
+         FillDstar(DStarToD0pi,arrayMC,(Int_t)(ptbin*nHistpermv+addresses[ivals]),isSelected);
          break;
        case 3:
          if(isSelected&1){
@@ -586,7 +624,8 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
       if (fDecChannel==3 && isSelected&2){
        SetPDGdaughterDstopiKK();
        nVals=0;
-       fRDCuts->GetCutVarsForOpt(d,fVars,fNVars,fPDGdaughters);
+       fRDCuts->GetCutVarsForOpt(d,fVars,fNVars,fPDGdaughters,aod);
+       delete [] addresses;
        addresses = muvec->GetGlobalAddressesAboveCuts(fVars,(Float_t)d->Pt(),nVals);
        if(fDebug>1)printf("nvals = %d\n",nVals);
        for(Int_t ivals=0;ivals<nVals;ivals++){
@@ -699,10 +738,56 @@ void AliAnalysisTaskSESignificance::FillD02p(AliAODRecoDecayHF* d,TClonesArray *
   }
 }
 
-void AliAnalysisTaskSESignificance::FillDstar(AliAODRecoDecayHF* /*d*/,TClonesArray */*arrayMC*/,Int_t /*index*/,Int_t /*matchtoMC*/){
+void AliAnalysisTaskSESignificance::FillDstar(AliAODRecoCascadeHF* dstarD0pi,TClonesArray *arrayMC,Int_t index,Int_t isSel){
     //D* channel
 
-  AliInfo("Dstar channel not implemented\n");
+    AliInfo("Dstar selected\n");
+    
+    Double_t mass = dstarD0pi->DeltaInvMass();
+
+    if((isSel==1 || isSel==3) && fPartOrAndAntiPart>=0) fMassHist[index]->Fill(mass);
+    if(isSel>=2 && fPartOrAndAntiPart<=0) fMassHist[index]->Fill(mass);
+       
+    if(fReadMC) {
+       Int_t matchtoMC = -1; 
+       matchtoMC = dstarD0pi->MatchToMC(413,421,fPDGDStarToD0pi, fPDGD0ToKpi, arrayMC);
+
+       Int_t prongPdgDStarPlus=413,prongPdgDStarMinus=(-1)*413;
+       
+       if ((isSel==1 || isSel==3) && fPartOrAndAntiPart>=0) { 
+          //D*+
+         if(matchtoMC>=0) {
+             AliAODMCParticle *dMC = (AliAODMCParticle*)arrayMC->At(matchtoMC);
+            Int_t pdgMC = dMC->GetPdgCode();
+       
+            if (pdgMC==prongPdgDStarPlus) fSigHist[index]->Fill(mass);
+            else {
+               dstarD0pi->SetCharge(-1*dstarD0pi->GetCharge());
+               mass =  dstarD0pi->DeltaInvMass();
+               fRflHist[index]->Fill(mass);
+               dstarD0pi->SetCharge(-1*dstarD0pi->GetCharge());
+             } 
+           } 
+         else fBkgHist[index]->Fill(mass);
+        }
+    
+       if (isSel>=2 && fPartOrAndAntiPart<=0) { 
+           //D*-
+          if (matchtoMC>=0) {
+             AliAODMCParticle *dMC = (AliAODMCParticle*)arrayMC->At(matchtoMC);
+             Int_t pdgMC = dMC->GetPdgCode();
+       
+             if (pdgMC==prongPdgDStarMinus) fSigHist[index]->Fill(mass);
+             else {
+                dstarD0pi->SetCharge(-1*dstarD0pi->GetCharge());
+                mass = dstarD0pi->DeltaInvMass();
+                fRflHist[index]->Fill(mass);
+                dstarD0pi->SetCharge(-1*dstarD0pi->GetCharge());
+             }
+           } 
+           else fBkgHist[index]->Fill(mass);
+         }
+       }
 
 }
 
@@ -924,5 +1009,30 @@ void AliAnalysisTaskSESignificance::Terminate(Option_t */*option*/)
   
   return;
 }
-//-------------------------------------------
-
+//_________________________________________________________________________________________________
+Int_t AliAnalysisTaskSESignificance::CheckOrigin(const AliAODMCParticle* mcPart, const TClonesArray* mcArray)const{
+
+       //
+       // checking whether the very mother of the D0 is a charm or a bottom quark
+       //
+
+       Int_t pdgGranma = 0;
+       Int_t mother = 0;
+       mother = mcPart->GetMother();
+       Int_t istep = 0;
+       while (mother >0 ){
+               istep++;
+               AliDebug(2,Form("mother at step %d = %d", istep, mother));
+               AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(mcArray->At(mother));
+               if(!mcGranma) break;
+               pdgGranma = mcGranma->GetPdgCode();
+               AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma));
+               Int_t abspdgGranma = TMath::Abs(pdgGranma);
+               if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) {
+                       break;
+               }
+               mother = mcGranma->GetMother();
+       }
+       return pdgGranma;
+}
+//_________________________________________________________________________________________________