Added flag to separate prompt and secondary charm in MC (Giacomo, Chiara)
authordainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Jan 2011 21:45:34 +0000 (21:45 +0000)
committerdainese <dainese@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Jan 2011 21:45:34 +0000 (21:45 +0000)
PWG3/vertexingHF/AliAnalysisTaskSESignificance.cxx
PWG3/vertexingHF/AliAnalysisTaskSESignificance.h
PWG3/vertexingHF/macros/AddTaskSignificance.C

index 2b42b1c..61b6fdd 100644 (file)
@@ -71,6 +71,7 @@ AliAnalysisTaskSESignificance::AliAnalysisTaskSESignificance():
   fRDCuts(0),
   fNPtBins(0),
   fReadMC(kFALSE),
+  fBFeedDown(kBoth),
   fDecChannel(0),
   fSelectionlevel(0),
   fNBins(100),
@@ -90,6 +91,7 @@ AliAnalysisTaskSESignificance::AliAnalysisTaskSESignificance(const char *name, T
   fRDCuts(rdCuts),
   fNPtBins(0),
   fReadMC(kFALSE),
+  fBFeedDown(kBoth),
   fDecChannel(decaychannel),
   fSelectionlevel(selectionlevel),
   fNBins(100),
@@ -192,6 +194,14 @@ Bool_t AliAnalysisTaskSESignificance::CheckConsistency(){
   return result;
 }
 //_________________________________________________________________
+void AliAnalysisTaskSESignificance::SetBFeedDown(FeedDownEnum flagB){
+  if(fReadMC)fBFeedDown=flagB;
+  else {
+    if(flagB||flagB>2){AliInfo("B feed down not allowed without MC info\n");}
+    else fBFeedDown=flagB;
+  }
+}
+//_________________________________________________________________
 void  AliAnalysisTaskSESignificance::SetMassLimits(Float_t range, Int_t pdg){
   Float_t mass=0;
   Int_t abspdg=TMath::Abs(pdg);
@@ -220,7 +230,10 @@ void AliAnalysisTaskSESignificance::LocalInit()
   TList *mdvList =  new TList();
   mdvList->SetOwner();
   mdvList = fCutList;
-  
+  AliRDHFCutsDplustoKpipi *analysis = new AliRDHFCutsDplustoKpipi();
+  analysis=(AliRDHFCutsDplustoKpipi*)fRDCuts;
+  mdvList->Add(analysis);
+
   PostData(2,mdvList);
 
   return;
@@ -475,7 +488,27 @@ void AliAnalysisTaskSESignificance::UserExec(Option_t */*option*/)
     
     Bool_t isFidAcc = fRDCuts->IsInFiducialAcceptance(d->Pt(),d->Y(absPdgMom));
     Int_t isSelected=fRDCuts->IsSelected(d,fSelectionlevel,aod);
+
+    if(fReadMC&&fBFeedDown&&isSelected){
+      Int_t labD = d->MatchToMC(absPdgMom,arrayMC,nprongs,pdgdaughters);
+      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){
+         if(fBFeedDown==kBeautyOnly)isSelected=kFALSE; //from primary charm
+       }else{
+         if(fBFeedDown==kCharmOnly)isSelected=kFALSE; //from beauty
+       }
+      }
+    }
     
+
     if(isSelected&&isFidAcc) {
       fHistNEvents->Fill(2); // count selected with loosest cuts
       if(fDebug>1) printf("+++++++Is Selected\n");
index 5be7b89..ccf69b7 100644 (file)
@@ -24,6 +24,8 @@ class AliAnalysisTaskSESignificance : public AliAnalysisTaskSE
 {
  public:
 
+  enum FeedDownEnum {kBoth,kCharmOnly,kBeautyOnly};
+
   AliAnalysisTaskSESignificance();
   AliAnalysisTaskSESignificance(const char *name, TList *listMDV,AliRDHFCuts *RDCuts, Int_t decaychannel,Int_t selectionlevel=AliRDHFCuts::kAll);
  
@@ -31,6 +33,9 @@ class AliAnalysisTaskSESignificance : public AliAnalysisTaskSE
 
   Bool_t CheckConsistency();
   void SetReadMC(Bool_t readMC=kTRUE){fReadMC=readMC;}
+  void SetBFeedDown(FeedDownEnum flagB);//see enum
+  void SetDFromCharmOnly(){SetBFeedDown(kCharmOnly);}
+  void SetDFromBeautyOnly(){SetBFeedDown(kBeautyOnly);}
   void SetMassLimits(Float_t range,Int_t pdg);
   void SetMassLimits(Float_t lowlimit, Float_t uplimit);
   void SetNBins(Int_t nbins){fNBins=nbins;}
@@ -40,6 +45,7 @@ class AliAnalysisTaskSESignificance : public AliAnalysisTaskSE
   Float_t GetLowerMassLimit()const {return fLowmasslimit;}
   Int_t GetNBins()const {return fNBins;}
   Int_t GetFillWithPartAntiPartBoth()const {return fPartOrAndAntiPart;}
+  Int_t GetBFeedDown()const {return fBFeedDown;}
 
   // Implementation of interface methods
   virtual void UserCreateOutputObjects();
@@ -84,6 +90,7 @@ class AliAnalysisTaskSESignificance : public AliAnalysisTaskSE
   AliRDHFCuts *fRDCuts;//prong cut values
   Int_t fNPtBins; //number of pt bins
   Bool_t fReadMC;    //flag for access to MC
+  FeedDownEnum fBFeedDown; //flag to search for D from B decays
   Int_t fDecChannel; //decay channel identifier
   Int_t fSelectionlevel;//selection level: kALL,kTracks,kCandidate
   Int_t fNBins;  //number of bins in the mass histograms
index 89e0df5..743d93a 100644 (file)
@@ -119,6 +119,7 @@ AliAnalysisTaskSESignificance *AddTaskSignificance(TString filename="cuts4Signif
   AliAnalysisTaskSESignificance *sigTask = new AliAnalysisTaskSESignificance("SignificanceAnalysis",listMDV,analysiscuts,decCh,AliRDHFCuts::kAll);//AliRDHFCuts::kCandidate
   sigTask->SetReadMC(readMC);
   //sigTask->SetDoLikeSign(kTRUE);
+  //sigTask->SetBFeedDown(AliAnalysisTaskSESignificance::kBoth);
   sigTask->SetDebugLevel(3);
   sigTask->SetFillWithPartAntiPartBoth(flagOPartAntiPart);
   mgr->AddTask(sigTask);