Kinematic D and fixes for MC
authorcbianchi <cbianchi@cern.ch>
Thu, 6 Mar 2014 15:24:35 +0000 (16:24 +0100)
committermvl <marco.van.leeuwen@cern.ch>
Thu, 6 Mar 2014 16:12:00 +0000 (17:12 +0100)
PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.cxx
PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.h
PWGJE/FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.cxx
PWGJE/FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.h
PWGJE/FlavourJetTasks/macros/AddTaskDFilterAndCorrelations.C
PWGJE/FlavourJetTasks/macros/AddTaskFlavourFilterAndJetCorrelations.C [deleted file]

index ef5762f..87dfaff 100644 (file)
@@ -356,28 +356,37 @@ void AliAnalysisTaskFlavourJetCorrelations::UserExec(Option_t *)
       Double_t candsparse[4]={charm->Eta(), charm->Phi(), charm->Pt(), 0};
       
       if(fCandidateType==kDstartoKpipi) {
-        Double_t deltamass= dstar->DeltaInvMass();
-        candsparse[3]=deltamass;
+        Printf("IsA %s", (dstar->IsA())->GetName());
+        if(fUseReco){
+           Double_t deltamass= dstar->DeltaInvMass();
+           candsparse[3]=deltamass;
+        } else candsparse[3] = 0.145; //for generated
         hnspDstandalone->Fill(candsparse);
       }
       if(fCandidateType==kD0toKpi){
-        AliAODRecoDecayHF* dzero=(AliAODRecoDecayHF*)charm;
-        Int_t isselected=fCuts->IsSelected(dzero,AliRDHFCuts::kAll,aodEvent);
-        
-        Double_t masses[2];
-        Int_t pdgdaughtersD0[2]={211,321};//pi,K 
-        Int_t pdgdaughtersD0bar[2]={321,211};//K,pi 
-        
-        masses[0]=dzero->InvMass(fNProngs,(UInt_t*)pdgdaughtersD0); //D0
-        masses[1]=dzero->InvMass(fNProngs,(UInt_t*)pdgdaughtersD0bar); //D0bar
-        if(isselected==1 || isselected==3) {
-           candsparse[3]=masses[0];
-           hnspDstandalone->Fill(candsparse);
-        }
-        if(isselected>=2){
-           candsparse[3]=masses[1];
+        if(fUseReco){
+           AliAODRecoDecayHF* dzero=(AliAODRecoDecayHF*)charm;
+           Int_t isselected=fCuts->IsSelected(dzero,AliRDHFCuts::kAll,aodEvent);
+           //not a further selection,just to get the value of isselected for the D0
+           Double_t masses[2];
+           Int_t pdgdaughtersD0[2]={211,321};//pi,K 
+           Int_t pdgdaughtersD0bar[2]={321,211};//K,pi 
+           
+           masses[0]=dzero->InvMass(fNProngs,(UInt_t*)pdgdaughtersD0); //D0
+           masses[1]=dzero->InvMass(fNProngs,(UInt_t*)pdgdaughtersD0bar); //D0bar
+           if(isselected==1 || isselected==3) {
+              candsparse[3]=masses[0];
+              hnspDstandalone->Fill(candsparse);
+           }
+           if(isselected>=2){
+              candsparse[3]=masses[1];
+              hnspDstandalone->Fill(candsparse);
+              
+           }
+        } else { //generated
+           Int_t pdg=((AliAODMCParticle*)charm)->GetPdgCode();
+           candsparse[3]=TDatabasePDG::Instance()->GetParticle(pdg)->Mass();
            hnspDstandalone->Fill(candsparse);
-           
         }
       }
    }
@@ -466,7 +475,7 @@ void AliAnalysisTaskFlavourJetCorrelations::UserExec(Option_t *)
         FlagFlavour(charm, jet);
         if (jet->TestFlavourTag(AliEmcalJet::kDStar)) hstat->Fill(4);
         
-        FillHistogramsRecoJetCorr(charm, jet);
+        FillHistogramsRecoJetCorr(charm, jet, aodEvent);
         
       }
       //retrieve side band background candidates for Dstar
@@ -743,7 +752,7 @@ Bool_t  AliAnalysisTaskFlavourJetCorrelations::DefineHistoForAnalysis(){
 
 //_______________________________________________________________________________
 
-void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsRecoJetCorr(AliVParticle* candidate, AliEmcalJet *jet){
+void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsRecoJetCorr(AliVParticle* candidate, AliEmcalJet *jet,  AliAODEvent* aodEvent){
    
    Double_t ptD=candidate->Pt();
    Double_t ptjet=jet->Pt();
@@ -758,7 +767,8 @@ void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsRecoJetCorr(AliVPartic
    if(fUseReco){
       if(fCandidateType==kD0toKpi) {
         AliAODRecoDecayHF* dzero=(AliAODRecoDecayHF*)candidate;
-        FillHistogramsD0JetCorr(dzero,deltaphi,z,ptD,ptjet,deltaR, AODEvent());
+        
+        FillHistogramsD0JetCorr(dzero,deltaphi,z,ptD,ptjet,deltaR, aodEvent);
         
       }
       
@@ -788,7 +798,7 @@ void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsD0JetCorr(AliAODRecoDe
    TH3F* hPtJetWithD=(TH3F*)fmyOutput->FindObject("hPtJetWithD");
    THnSparseF* hsDphiz=(THnSparseF*)fmyOutput->FindObject("hsDphiz");
    Double_t point[7]={z,dPhi,ptj,ptD,masses[0],0, deltaR<fJetRadius ? 1 : 0};
-   
+   Printf("Candidate in FillHistogramsD0JetCorr IsA %s", (candidate->IsA())->GetName());   
    Int_t isselected=fCuts->IsSelected(candidate,AliRDHFCuts::kAll,aodEvent);
    if(isselected==1 || isselected==3) {
       
@@ -845,10 +855,9 @@ void AliAnalysisTaskFlavourJetCorrelations::FillHistogramsMCGenDJetCorr(Double_t
    if(fCandidateType==kD0toKpi) pdgmass=TDatabasePDG::Instance()->GetParticle(421)->Mass();
    if(fCandidateType==kDstartoKpipi) pdgmass=TDatabasePDG::Instance()->GetParticle(413)->Mass()-TDatabasePDG::Instance()->GetParticle(421)->Mass();
    point[4]=pdgmass;
-
+   hsDphiz->Fill(point,1.);
    if(deltaR<fJetRadius) {
      hPtJetWithD->Fill(ptjet,pdgmass,ptD); // candidates within a jet
-     hsDphiz->Fill(point,1.);
    }
    
 }
index 662df7a..2b34d86 100644 (file)
@@ -82,7 +82,7 @@ class AliAnalysisTaskFlavourJetCorrelations : public AliAnalysisTaskEmcalJet
   Bool_t SetD0WidthForDStar(Int_t nptbins,Float_t* width);
 
   //Bool_t   FillMCDJetInfo(AliPicoTrack *jetTrk,AliEmcalJet* jet, TClonesArray *mcArray,Double_t ptjet);
-  void FillHistogramsRecoJetCorr(AliVParticle* candidate, AliEmcalJet *jet);
+  void FillHistogramsRecoJetCorr(AliVParticle* candidate, AliEmcalJet *jet, AliAODEvent* aodEvent);
   void FillHistogramsD0JetCorr(AliAODRecoDecayHF* candidate, Double_t dPhi, Double_t z, Double_t ptD, Double_t ptj, Double_t deltaR, AliAODEvent* aodEvent);
 
   void FillHistogramsDstarJetCorr(AliAODRecoCascadeHF* dstar, Double_t dPhi, Double_t z, Double_t ptD, Double_t ptj,Double_t deltaR);
index aa73500..9cfe74b 100644 (file)
@@ -323,6 +323,8 @@ void AliAnalysisTaskSEDmesonsFilterCJ::UserExec(Option_t *){
       charmCand = (AliAODRecoDecayHF*)arrayDStartoD0pi->At(icharm); // D candidates
       if (!charmCand) continue;
       
+      TString smcTruth="S";
+      
       if (fCandidateType==kDstartoKpipi) dstar = (AliAODRecoCascadeHF*)charmCand;
       
       if (fUseMCInfo) { // Look in MC, try to simulate the z
@@ -336,6 +338,9 @@ void AliAnalysisTaskSEDmesonsFilterCJ::UserExec(Option_t *){
         if (mcLabel<=0) isMCBkg=kTRUE;
         else hstat->Fill(2);
         if (!isMCBkg) charmPart=(AliAODMCParticle*)mcArray->At(mcLabel);
+                
+        if (isMCBkg) smcTruth="B";
+
       }
       
       Double_t ptD = charmCand->Pt();
@@ -432,6 +437,44 @@ void AliAnalysisTaskSEDmesonsFilterCJ::UserExec(Option_t *){
            Double_t invmassDelta = dstar->DeltaInvMass();
            if (TMath::Abs(invmassDelta-(mPDGDstar-mPDGD0))<0.0021) hPtPion->Fill(track2->Pt());
         }
+        
+        if (fUseMCInfo){ //fill histograms of kinematics, using MC truth
+           //get histos
+           TH2F *halphaDD   = (TH2F*)fOutput->FindObject(Form("halphaDD%s",smcTruth.Data()));
+           TH2F *halphaDpis = (TH2F*)fOutput->FindObject(Form("halphaDpis%s",smcTruth.Data()));
+           TH2F *halphaDpi  = (TH2F*)fOutput->FindObject(Form("halphaDpi%s",smcTruth.Data()));
+           TH2F *halphaDK   = (TH2F*)fOutput->FindObject(Form("halphaDK%s",smcTruth.Data()));
+
+           TH2F *hdeltaRDD   = (TH2F*)fOutput->FindObject(Form("hdeltaRDD%s",smcTruth.Data()));
+           TH2F *hdeltaRDpis = (TH2F*)fOutput->FindObject(Form("hdeltaRDpis%s",smcTruth.Data()));
+           TH2F *hdeltaRDpi  = (TH2F*)fOutput->FindObject(Form("hdeltaRDpi%s",smcTruth.Data()));
+           TH2F *hdeltaRDK   = (TH2F*)fOutput->FindObject(Form("hdeltaRDK%s",smcTruth.Data()));
+
+           Double_t aD  = dstar->Phi(), 
+                    apis= track2->Phi();
+                    
+           AliAODRecoDecayHF2Prong* D0fromDstar=dstar->Get2Prong();
+           Double_t aD0 = D0fromDstar->Phi();
+           Int_t isD0= D0fromDstar->Charge()>0 ? kTRUE : kFALSE;
+           Double_t aK = isD0 ? D0fromDstar->PhiProng(0) : D0fromDstar->PhiProng(1),
+                    api= isD0 ? D0fromDstar->PhiProng(1) : D0fromDstar->PhiProng(0);
+           Double_t dRDD0  = DeltaR(dstar,D0fromDstar),
+                    dRDpis = DeltaR(dstar,track2),
+                    dRDpi  = DeltaR(dstar, isD0 ? (AliVParticle*)D0fromDstar->GetDaughter(1) : (AliVParticle*)D0fromDstar->GetDaughter(0)),
+                    dRDK   = DeltaR(dstar, isD0 ? (AliVParticle*)D0fromDstar->GetDaughter(0) : (AliVParticle*)D0fromDstar->GetDaughter(1));
+           
+           halphaDD->  Fill(aD-aD0,ptD);
+           halphaDpis->Fill(aD-apis,ptD);
+           halphaDpi-> Fill(aD-api,ptD);
+           halphaDK->  Fill(aD-aK,ptD);
+           
+           hdeltaRDD->  Fill(dRDD0,ptD);
+           hdeltaRDpis->Fill(dRDpis,ptD);
+           hdeltaRDpi-> Fill(dRDpi,ptD);
+           hdeltaRDK->  Fill(dRDK,ptD);
+           
+        }
+
       } //Dstar specific
       
       if (fCandidateType==kD0toKpi) { //D0->Kpi
@@ -444,6 +487,89 @@ void AliAnalysisTaskSEDmesonsFilterCJ::UserExec(Option_t *){
         // mass vs pt
         if (isSelected==1 || isSelected==3) hInvMassptD->Fill(masses[0],ptD);
         if (isSelected>=2) hInvMassptD->Fill(masses[1],ptD);
+                       
+        if (fUseMCInfo) {  //fill histograms of kinematics, using MC truth
+           
+           Double_t aD = charmCand->Phi();
+            Double_t adaugh[2]={charmCand->PhiProng(0),charmCand->PhiProng(1)};
+            AliAODTrack* p0=(AliAODTrack*)charmCand->GetDaughter(0); 
+            AliAODTrack* p1=(AliAODTrack*)charmCand->GetDaughter(1);
+            Float_t dR0 = DeltaR(charmCand, p0), dR1 = DeltaR(charmCand, p1);
+                   Bool_t isD0=kFALSE;
+           if(mcLabel==421)  isD0=kTRUE;
+           if(mcLabel==-421) isD0=kFALSE;
+           
+           if(isMCBkg) { //background
+              TH2F *halphaDpi  = (TH2F*)fOutput->FindObject(Form("halphaDpi%s",smcTruth.Data()));
+              TH2F *halphaDK   = (TH2F*)fOutput->FindObject(Form("halphaDK%s",smcTruth.Data()));
+
+              TH2F *hdeltaRDpi  = (TH2F*)fOutput->FindObject(Form("hdeltaRDpi%s",smcTruth.Data()));
+              TH2F *hdeltaRDK   = (TH2F*)fOutput->FindObject(Form("hdeltaRDK%s",smcTruth.Data()));
+              
+              
+              if (isSelected==1 || isSelected==3) { // selected as D0
+                 halphaDK->Fill(aD-adaugh[0],ptD);
+                 halphaDpi->Fill(aD-adaugh[1],ptD);
+
+                 hdeltaRDK->Fill(dR0,ptD);
+                 hdeltaRDpi->Fill(dR1,ptD);
+              
+              }
+              if (isSelected>=2) { //selected as D0bar
+                 halphaDpi->Fill(aD-adaugh[0],ptD);
+                 halphaDK->Fill(aD-adaugh[1],ptD);
+
+                 hdeltaRDpi->Fill(dR0,ptD);
+                 hdeltaRDK->Fill(dR1,ptD);
+              
+              }
+
+           }else{ //signal and reflections
+              TH2F *halphaDpiS  = (TH2F*)fOutput->FindObject("halphaDpiS");
+              TH2F *halphaDKS   = (TH2F*)fOutput->FindObject("halphaDKS");
+              TH2F *halphaDpiR  = (TH2F*)fOutput->FindObject("halphaDpiR");
+              TH2F *halphaDKR   = (TH2F*)fOutput->FindObject("halphaDKR");
+              
+              TH2F *hdeltaRDpiS  = (TH2F*)fOutput->FindObject("hdeltaRDpiS");
+              TH2F *hdeltaRDKS   = (TH2F*)fOutput->FindObject("hdeltaRDKS");
+              TH2F *hdeltaRDpiR  = (TH2F*)fOutput->FindObject("hdeltaRDpiR");
+              TH2F *hdeltaRDKR   = (TH2F*)fOutput->FindObject("hdeltaRDKR");
+              
+              if(isD0) { //D0
+                 halphaDKS->Fill(aD-adaugh[0],ptD);
+                 halphaDpiS->Fill(aD-adaugh[1],ptD);
+
+                 hdeltaRDKS->Fill(dR0,ptD);
+                 hdeltaRDpiS->Fill(dR1,ptD);
+                 if(isSelected>=2){ //selected as D0bar
+                    halphaDpiR->Fill(aD-adaugh[0],ptD);
+                    halphaDKR->Fill(aD-adaugh[1],ptD);
+
+                    hdeltaRDpiR->Fill(dR0,ptD);
+                    hdeltaRDKR->Fill(dR1,ptD);
+                 }
+              } else { //D0bar
+                 halphaDKS->Fill(aD-adaugh[1],ptD);
+                 halphaDpiS->Fill(aD-adaugh[0],ptD);
+
+                         hdeltaRDKS->Fill(dR1,ptD);
+                 hdeltaRDpiS->Fill(dR0,ptD);
+
+                 if(isSelected>=2){ //selected as D0bar
+                    halphaDpiR->Fill(aD-adaugh[1],ptD);
+                    halphaDKR->Fill(aD-adaugh[0],ptD);
+
+                            hdeltaRDpiR->Fill(dR1,ptD);
+                    hdeltaRDKR->Fill(dR0,ptD);
+                 }
+              }
+           
+           } //end signal and reflections
+           
+           
+        }// end MC
+
+        
       } //D0 specific
       
       charmCand = 0;
@@ -570,15 +696,18 @@ Bool_t AliAnalysisTaskSEDmesonsFilterCJ::DefineHistoForAnalysis()
    
    // Invariant mass related histograms
    const Int_t nbinsmass = 200;
-   TH2F *hInvMass = new TH2F("hInvMassptD", "D invariant mass distribution", nbinsmass, fMinMass, fMaxMass, 100, 0., 50.);
+   const Int_t ptbinsD=100;
+   Float_t ptmin=0.,ptmax=50.;
+   TH2F *hInvMass = new TH2F("hInvMassptD", "D invariant mass distribution", nbinsmass, fMinMass, fMaxMass, ptbinsD, ptmin, ptmax);
    hInvMass->SetStats(kTRUE);
    hInvMass->GetXaxis()->SetTitle("mass (GeV/c)");
    hInvMass->GetYaxis()->SetTitle("p_{T} (GeV/c)");
    fOutput->Add(hInvMass);
-   
-   if (fCandidateType==kDstartoKpipi) {
+   if ((fCandidateType==kDstartoKpipi) || fUseMCInfo){
       TH1F* hnSBCandEv=new TH1F("hnSBCandEv", "Number of side bands candidates per event (after cuts);# cand/ev", 100, 0.,100.);
       fOutput->Add(hnSBCandEv);
+   }
+   if (fCandidateType==kDstartoKpipi) {
       
       TH1F* hPtPion = new TH1F("hPtPion", "Primary pions candidates pt", 500, 0., 10.);
       hPtPion->SetStats(kTRUE);
@@ -587,5 +716,105 @@ Bool_t AliAnalysisTaskSEDmesonsFilterCJ::DefineHistoForAnalysis()
       fOutput->Add(hPtPion);
    }
    
+   const Int_t nbinsalpha=200;
+   Float_t minalpha=-TMath::Pi(), maxalpha=TMath::Pi();
+   const Int_t nbinsdeltaR= 200;
+   Float_t mindeltaR = 0., maxdeltaR = 10.;
+   if(fUseMCInfo){
+      if (fCandidateType==kDstartoKpipi){
+        TH2F* halphaDDS  =new TH2F("halphaDDS","Angle D^{*}-D^{0} (Signal);#varphi (D^{*}) - #varphi (D0);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDpisS=new TH2F("halphaDpisS","Angle D^{*}-#pi_{soft} (Signal);#varphi (D^{*}) - #varphi (#pi_{soft});p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDpiS =new TH2F("halphaDpiS","Angle D^{*}-#pi (Signal);#varphi (D^{*}) - #varphi (#pi);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDKS  =new TH2F("halphaDKS","Angle D^{*}-K (Signal);#varphi (D^{*}) - #varphi (K);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+
+        TH2F* halphaDDB  =new TH2F("halphaDDB","Angle D^{*}-D^{0} (Background);#varphi (D^{*}) - #varphi (D0);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDpisB=new TH2F("halphaDpisB","Angle D^{*}-#pi_{soft} (Background);#varphi (D^{*}) - #varphi (#pi_{soft});p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDpiB =new TH2F("halphaDpiB","Angle D^{*}-#pi (Background);#varphi (D^{*}) - #varphi (#pi);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDKB  =new TH2F("halphaDKB","Angle D^{*}-K (Background);#varphi (D^{*}) - #varphi (K);p_{T}^{D*}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        
+        TH2F* hdeltaRDDS  =new TH2F("hdeltaRDDS","Angle D^{*}-D^{0} (Signal);#varphi (D^{*}) - #varphi (D0);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDpisS=new TH2F("hdeltaRDpisS","Angle D^{*}-#pi_{soft} (Signal);#varphi (D^{*}) - #varphi (#pi_{soft});p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDpiS =new TH2F("hdeltaRDpiS","Angle D^{*}-#pi (Signal);#varphi (D^{*}) - #varphi (#pi);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDKS  =new TH2F("hdeltaRDKS","Angle D^{*}-K (Signal);#varphi (D^{*}) - #varphi (K);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+
+        TH2F* hdeltaRDDB  =new TH2F("hdeltaRDDB","Angle D^{*}-D^{0} (Background);#varphi (D^{*}) - #varphi (D0);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDpisB=new TH2F("hdeltaRDpisB","Angle D^{*}-#pi_{soft} (Background);#varphi (D^{*}) - #varphi (#pi_{soft});p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDpiB =new TH2F("hdeltaRDpiB","Angle D^{*}-#pi (Background);#varphi (D^{*}) - #varphi (#pi);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDKB  =new TH2F("hdeltaRDKB","Angle D^{*}-K (Background);#varphi (D^{*}) - #varphi (K);p_{T}^{D*}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+
+        fOutput->Add(halphaDDS);
+        fOutput->Add(halphaDpisS);
+        fOutput->Add(halphaDpiS);
+        fOutput->Add(halphaDKS);
+        fOutput->Add(halphaDDB);
+        fOutput->Add(halphaDpisB);
+        fOutput->Add(halphaDpiB);
+        fOutput->Add(halphaDKB);
+
+        fOutput->Add(hdeltaRDDS);
+        fOutput->Add(hdeltaRDpisS);
+        fOutput->Add(hdeltaRDpiS);
+        fOutput->Add(hdeltaRDKS);
+        fOutput->Add(hdeltaRDDB);
+        fOutput->Add(hdeltaRDpisB);
+        fOutput->Add(hdeltaRDpiB);
+        fOutput->Add(hdeltaRDKB);
+      }
+      
+      if (fCandidateType==kD0toKpi){
+        
+                TH2F* halphaDpiS=new TH2F("halphaDpiS","Angle D^{0}-#pi (Signal);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDKS =new TH2F("halphaDKS","Angle D^{0}-K (Signal);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+                TH2F* halphaDpiR=new TH2F("halphaDpiR","Angle D^{0}-#pi (Reflections);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDKR =new TH2F("halphaDKR","Angle D^{0}-K (Reflections);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        
+                TH2F* halphaDpiB=new TH2F("halphaDpiB","Angle D^{0}-#pi (Background);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        TH2F* halphaDKB =new TH2F("halphaDKB","Angle D^{0}-K (Background);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsalpha, minalpha, maxalpha, ptbinsD, ptmin, ptmax);
+        
+
+                TH2F* hdeltaRDpiS=new TH2F("hdeltaRDpiS","Angle D^{0}-#pi (Signal);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDKS =new TH2F("hdeltaRDKS","Angle D^{0}-K (Signal);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+                TH2F* hdeltaRDpiR=new TH2F("hdeltaRDpiR","Angle D^{0}-#pi (Reflections);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDKR =new TH2F("hdeltaRDKR","Angle D^{0}-K (Reflections);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        
+                TH2F* hdeltaRDpiB=new TH2F("hdeltaRDpiB","Angle D^{0}-#pi (Background);#varphi (D^{0}) - #varphi (#pi);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+        TH2F* hdeltaRDKB =new TH2F("hdeltaRDKB","Angle D^{0}-K (Background);#varphi (D^{0}) - #varphi (K);p_{T}^{D0}",nbinsdeltaR, mindeltaR, maxdeltaR, ptbinsD, ptmin, ptmax);
+
+        fOutput->Add(halphaDpiS);
+        fOutput->Add(halphaDKS);
+        fOutput->Add(halphaDpiR);
+        fOutput->Add(halphaDKR);
+        fOutput->Add(halphaDpiB);
+        fOutput->Add(halphaDKB);
+
+        fOutput->Add(hdeltaRDpiS);
+        fOutput->Add(hdeltaRDKS);
+        fOutput->Add(hdeltaRDpiR);
+        fOutput->Add(hdeltaRDKR);
+        fOutput->Add(hdeltaRDpiB);
+        fOutput->Add(hdeltaRDKB);
+
+      }
+   
+   }
    return kTRUE; 
 }
+
+//_______________________________________________________________________________
+
+Float_t AliAnalysisTaskSEDmesonsFilterCJ::DeltaR(AliVParticle *p1, AliVParticle *p2) const {
+   //Calculate DeltaR between p1 and p2: DeltaR=sqrt(Delataphi^2+DeltaEta^2)
+   
+   if(!p1 || !p2) return -1;
+   Double_t phi1=p1->Phi(),eta1=p1->Eta();
+   Double_t phi2 = p2->Phi(),eta2 = p2->Eta() ;
+   
+   Double_t dPhi=phi1-phi2;
+   if(dPhi<=-(TMath::Pi())/2) dPhi = dPhi+2*(TMath::Pi());
+   if(dPhi>(3*(TMath::Pi()))/2) dPhi = dPhi-2*(TMath::Pi());
+   
+   Double_t dEta=eta1-eta2;
+   Double_t deltaR=TMath::Sqrt(dEta*dEta + dPhi*dPhi );
+   return deltaR;
+   
+}
index 5ff17a2..adb0ced 100644 (file)
@@ -69,6 +69,8 @@ class AliAnalysisTaskSEDmesonsFilterCJ : public AliAnalysisTaskSE
 
   // Array of D0 width for the Dstar
   Bool_t SetD0WidthForDStar(Int_t nptbins, Float_t *width);
+  
+  Float_t DeltaR(AliVParticle *p1, AliVParticle *p2) const;
 
  private :
   
index 1b1667a..b40466d 100644 (file)
@@ -117,6 +117,7 @@ void *AddTaskDFilterAndCorrelations(
 
   // ------ input data ------
   AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
+  cinput0->SetName(Form("in%s%s",candname.Data(),suffix.Data()));
   
   // ----- output data -----
   
@@ -132,8 +133,8 @@ void *AddTaskDFilterAndCorrelations(
   
   AliAnalysisDataContainer *coutputFC3 = mgr->CreateContainer(nameContainerFC3, TClonesArray::Class(),AliAnalysisManager::kExchangeContainer, outputfileF.Data()); //
   
-  mgr->ConnectInput(taskFilter,0,mgr->GetCommonInputContainer());
-  mgr->ConnectInput(taskCorr,0,mgr->GetCommonInputContainer());
+  mgr->ConnectInput(taskFilter,0,cinput0);
+  mgr->ConnectInput(taskCorr,0,cinput0);
   
   mgr->ConnectOutput(taskFilter,1,coutputF0);
   mgr->ConnectOutput(taskFilter,2,coutputF1);
diff --git a/PWGJE/FlavourJetTasks/macros/AddTaskFlavourFilterAndJetCorrelations.C b/PWGJE/FlavourJetTasks/macros/AddTaskFlavourFilterAndJetCorrelations.C
deleted file mode 100644 (file)
index d8c7549..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-AliAnalysisTaskFlavourFilterAndJetCorrelations *AddTaskFlavourFilterAndJetCorrelations(
-  AliAnalysisTaskFlavourFilterAndJetCorrelations::ECandidateType cand = AliAnalysisTaskFlavourFilterAndJetCorrelations::kDstartoKpipi,
-  TString filename = "DStartoKpipiCuts.root",
-  Bool_t theMCon = kFALSE,
-  Bool_t reco = kTRUE /*must be true if theMCon is false*/,
-  TString jetArrname = "",
-  TString suffix = "",
-  Bool_t triggerOnLeadingJet = kFALSE,
-  Int_t leadingHadType = 0 /*0 = charged, 1 = neutral, 2 = both*/,
-  Float_t R = 0.4,
-  Float_t jptcut = 10.,
-  const char *cutType = "TPC",
-  Double_t percjetareacut = 1.)
-{
-  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-  if (!mgr) {
-    ::Error("AddTaskFlavourFilterAndJetCorrelations::AddTaskFlavourFilterAndJetCorrelations", "No analysis manager to connect to.");
-    return NULL;
-  } 
-
-  Bool_t useStdC = kFALSE;
-  TFile* filecuts=TFile::Open(filename);
-  if (!filecuts || (filecuts && !filecuts->IsOpen())) {
-    cout<<"Input file not found: use std cuts"<<endl;
-    useStdC = kTRUE;
-  }
-
-  AliRDHFCuts *analysiscuts = 0x0;
-  switch (cand) {
-  case 0 :
-    if (useStdC) {
-      analysiscuts = new AliRDHFCutsD0toKpi();
-      analysiscuts->SetStandardCutsPP2010();
-    } else
-      analysiscuts = (AliRDHFCutsD0toKpi*)filecuts->Get("D0toKpiCuts");
-    break;
-  case 1 :
-    if(useStdC) {
-      analysiscuts = new AliRDHFCutsDStartoKpipi();
-      analysiscuts->SetStandardCutsPP2010();
-    } else
-      analysiscuts = (AliRDHFCutsDStartoKpipi*)filecuts->Get("DStartoKpipiCuts");
-    analysiscuts->SetName("DStartoKpipiCuts");
-    break;
-  }
-  
-  if (!analysiscuts) { // mm let's see if everything is ok
-    AliFatal("Specific AliRDHFCuts not found");
-    return;
-  }
-
-  printf("CREATE TASK\n"); //CREATE THE TASK
-
-  // create the task
-  AliAnalysisTaskFlavourFilterAndJetCorrelations *task = new AliAnalysisTaskFlavourFilterAndJetCorrelations("AnaTaskFlavourFilterAndJetCorrelations", 
-     analysiscuts, cand);
-  task->SetJetsName(jetArrname);
-  task->SetMC(theMCon);
-  task->SetUseReco(reco);
-  task->SetTriggerOnLeadingJet(triggerOnLeadingJet);
-  task->SetJetAcceptanceType(cutType);
-  task->SetJetPtCut(jptcut);
-  task->SetPercAreaCut(percjetareacut);
-  
-  mgr->AddTask(task);
-
-  if(theMCon) {
-     suffix+="MC";
-     if(reco) suffix+="rec";  
-  }
-
-  // Create and connect containers for input/output
-  TString outputfile = AliAnalysisManager::GetCommonFileName();
-  outputfile += ":PWG3_D2H_DFilterAndEmcalJet";
-  outputfile += suffix;
-
-  TString candname="DStar"; 
-  if(cand==0)  candname="D0";
-  
-  TString nameContainer0="histogramsv12";
-  TString nameContainer1="hCorv12";
-  TString nameContainer2="cutsJv12";
-  
-  nameContainer0 += candname;
-  nameContainer1 += candname;
-  nameContainer2 += candname;
-  
-  nameContainer0 += suffix;
-  nameContainer1 += suffix;
-  nameContainer2 += suffix;
-
-  // ------ input data ------
-  AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
-
-  // ----- output data -----
-  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer(nameContainer0, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
-
-  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(nameContainer1, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
-  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(nameContainer2, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
-
-  mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
-    
-  mgr->ConnectOutput(task,1,coutput1);
-  mgr->ConnectOutput(task,2,coutput2);
-  mgr->ConnectOutput(task,3,coutput0);
-
-
-  Printf("Input and Output connected to the manager");
-  return task ;
-}