Initial commit of the tasks for the flavor jet analysis; targeted at D-meson+jet...
authormploskon <mploskon@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Apr 2013 12:48:05 +0000 (12:48 +0000)
committermploskon <mploskon@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Apr 2013 12:48:05 +0000 (12:48 +0000)
PWGJE/CMakelibPWGJEFlavourJetTasks.pkg [new file with mode: 0644]
PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.cxx [new file with mode: 0644]
PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.h [new file with mode: 0644]
PWGJE/FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.cxx [new file with mode: 0644]
PWGJE/FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.h [new file with mode: 0644]
PWGJE/FlavourJetTasks/macros/AddTaskFlavourJetCorrelations.C [new file with mode: 0644]
PWGJE/FlavourJetTasks/macros/AddTaskSEDmesonsFilterCJ.C [new file with mode: 0644]
PWGJE/FlavourJetTasks/macros/AddTasksFlavourJet.C [new file with mode: 0644]
PWGJE/FlavourJetTasks/macros/AnalysisTrainCorrJetsLocal.C [new file with mode: 0644]
PWGJE/PWGJEFlavourJetTasksLinkDef.h [new file with mode: 0644]

diff --git a/PWGJE/CMakelibPWGJEFlavourJetTasks.pkg b/PWGJE/CMakelibPWGJEFlavourJetTasks.pkg
new file mode 100644 (file)
index 0000000..cbdf279
--- /dev/null
@@ -0,0 +1,47 @@
+# -*- mode: Makefile -*-
+# $Id$
+#--------------------------------------------------------------------------------#
+# Variables Defined :                                                            #
+#                                                                                #
+# SRCS - C++ source files                                                        #
+# HDRS - C++ header files                                                        #
+# DHDR - ROOT Dictionary Linkdef header file                                     #
+# CSRCS - C source files                                                         #
+# CHDRS - C header files                                                         #
+# EINCLUDE - Include directories                                                 #
+# EDEFINE - Compiler definitions                                                 #
+# ELIBS - Extra libraries to link                                                #
+# ELIBSDIR - Extra library directories                                           #
+# PACKFFLAGS - Fortran compiler flags for package                                #
+# PACKCXXFLAGS - C++ compiler flags for package                                  #
+# PACKCFLAGS - C compiler flags for package                                      #
+# PACKSOFLAGS - Shared library linking flags                                     #
+# PACKLDFLAGS - Module linker flags                                              #
+# PACKBLIBS - Libraries to link (Executables only)                               #
+# EXPORT - Header files to be exported                                           #
+# CINTHDRS - Dictionary header files                                             #
+# CINTAUTOLINK - Set automatic dictionary generation                             #
+# ARLIBS - Archive Libraries and objects for linking (Executables only)          #
+# SHLIBS - Shared Libraries and objects for linking (Executables only)           #
+#--------------------------------------------------------------------------------#
+
+set ( SRCS 
+       FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.cxx
+       FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.cxx
+)
+
+set ( DHDR  PWGJEFlavourJetTasksLinkDef.h)
+
+string ( REPLACE ".cxx" ".h" EXPORT "${SRCS}" )
+
+string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
+
+set ( FASTJET_ROOT $ENV{FASTJET_ROOT} )
+
+if(FASTJET_ROOT)
+  set ( EDEFINE -isystem${FASTJET_ROOT}/include )
+else()
+  set ( EDEFINE -isystem${ALICE_ROOT}/JETAN/fastjet )
+endif(FASTJET_ROOT)
+
+set ( EINCLUDE JETAN/fastjet PWGJE/EMCALJetTasks PWGJE/FlavourJetTasks PWG/EMCAL PWGHF/vertexingHF EMCAL OADB STEER/ESD STEER/STEERBase )
diff --git a/PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.cxx b/PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.cxx
new file mode 100644 (file)
index 0000000..37417a9
--- /dev/null
@@ -0,0 +1,707 @@
+// $Id$
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, 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.                  *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////
+//
+// AliAnalysisTaskSE for Dmesons - jet correlations analysis
+//
+// Author: Xiaoming Zhang, xmzhang@lbl.gov
+///////////////////////////////////////////////////////////////
+
+#include <iostream>
+
+#include <TMath.h>
+#include <TVector3.h>
+#include <TLorentzVector.h>
+#include <TH1D.h>
+#include <TH2D.h>
+#include <TList.h>
+#include <TClonesArray.h>
+#include <TDatabasePDG.h>
+
+#include "AliVTrack.h"
+#include "AliVCluster.h"
+#include "AliEmcalJet.h"
+#include "AliAnalysisTaskEmcal.h"
+#include "AliAnalysisTaskEmcalJet.h"
+#include "AliAODRecoDecayHF2Prong.h"
+#include "AliAODRecoCascadeHF.h"
+#include "AliAnalysisTaskFlavourJetCorrelations.h"
+
+ClassImp(AliAnalysisTaskFlavourJetCorrelations)
+
+//_____________________________________________________________________________
+AliAnalysisTaskFlavourJetCorrelations::AliAnalysisTaskFlavourJetCorrelations() :
+AliAnalysisTaskEmcalJet(),
+fUsedDzeros(0),
+fUsedD0bars(0),
+fUsedDstars(0),
+fListControlHistos(0),
+fListAnDzeroHistos(0),
+fListAnDstarHistos(0)
+{
+//
+// Default constructor
+//
+}
+
+//_____________________________________________________________________________
+AliAnalysisTaskFlavourJetCorrelations::AliAnalysisTaskFlavourJetCorrelations(const char *name, Bool_t bIsHisto) :
+AliAnalysisTaskEmcalJet(name, bIsHisto),
+fUsedDzeros(0),
+fUsedD0bars(0),
+fUsedDstars(0),
+fListControlHistos(0),
+fListAnDzeroHistos(0),
+fListAnDstarHistos(0)
+{
+//
+// Constructor
+//
+
+  SetMakeGeneralHistograms(bIsHisto);
+  DefineOutput(2, TList::Class());
+  DefineOutput(3, TList::Class());
+  DefineOutput(4, TList::Class());
+}
+
+//_____________________________________________________________________________
+AliAnalysisTaskFlavourJetCorrelations::~AliAnalysisTaskFlavourJetCorrelations()
+{
+//
+// Default destructor
+//
+
+  if (fUsedDzeros) { delete fUsedDzeros; fUsedDzeros=0; }
+  if (fUsedD0bars) { delete fUsedD0bars; fUsedD0bars=0; }
+  if (fUsedDstars) { delete fUsedDstars; fUsedDstars=0; }
+
+  if (fListControlHistos) { delete fListControlHistos; fListControlHistos=0; }
+  if (fListAnDzeroHistos) { delete fListAnDzeroHistos; fListAnDzeroHistos=0; }
+  if (fListAnDstarHistos) { delete fListAnDstarHistos; fListAnDstarHistos=0; }
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlavourJetCorrelations::UserCreateOutputObjects()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::UserCreateOutputObjects
+//
+
+
+  AliAnalysisTaskEmcal::UserCreateOutputObjects();
+
+  if (!fListControlHistos) fListControlHistos = new TList(); fListControlHistos->SetOwner();
+  if (!fListAnDzeroHistos) fListAnDzeroHistos = new TList(); fListAnDzeroHistos->SetOwner();
+  if (!fListAnDstarHistos) fListAnDstarHistos = new TList(); fListAnDstarHistos->SetOwner();
+
+  MakeControlHistograms();
+  CreateDzeroHistograms();
+  CreateDstarHistograms();
+
+  PostData(2, fListControlHistos);
+  PostData(3, fListAnDzeroHistos);
+  PostData(4, fListAnDstarHistos);
+  return;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFlavourJetCorrelations::Run()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::Run
+//
+
+  const Int_t    nJetPtBin   = 7;
+  const Double_t dJetPtBin[] = { 0., 5., 10., 20., 30., 50., 80., 120. };
+//=============================================================================
+
+  AliEmcalJet *pJet = 0; 
+  for (Int_t iJet=0; iJet<fJets->GetEntriesFast(); iJet++) {
+    pJet = static_cast<AliEmcalJet*>(fJets->At(iJet)); if (!pJet) continue;
+    if (!AcceptJet(pJet)) { pJet=0; continue; }
+
+    Int_t iJetPtBin = TMath::BinarySearch(nJetPtBin,dJetPtBin,pJet->Pt());
+    if (iJetPtBin<0 || iJetPtBin>=nJetPtBin) continue;
+
+    if (fUsedDzeros) RunDzeroJet(pJet, iJetPtBin, kTRUE);
+    if (fUsedD0bars) RunDzeroJet(pJet, iJetPtBin, kFALSE);
+    if (fUsedDstars) RunDstarJet(pJet, iJetPtBin);
+    pJet = 0;
+  }
+
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlavourJetCorrelations::RunDzeroJet(AliEmcalJet const *pJet, const Int_t iJetPtBin, const Bool_t bIsD0)
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::RunDzeroJet
+//
+
+  Int_t nCands = 0;
+  if (bIsD0) nCands = fUsedDzeros->GetEntriesFast();
+  else nCands = fUsedD0bars->GetEntriesFast(); if (nCands==0) return;
+//=============================================================================
+
+  const Int_t nms = kDzeroMatchType;
+  const TString sMatched[nms] = { "MatchConeCandi", "MatchAreaCandi", "MatchConeProng", "MatchAreaProng" };
+//=============================================================================
+
+  Double_t dJetPt = pJet->Pt();
+  TVector3 vJet, vRec, vec0, vec1;
+  vJet.SetPtEtaPhi(dJetPt, pJet->Eta(), pJet->Phi());
+
+  Double_t dMag1    = vJet.Mag();
+  Double_t dMag2    = vJet.Mag2();
+  Double_t dJetArea = pJet->Area();
+//=============================================================================
+
+  Bool_t bIsMatch[nms], bIsUsed[nms];
+  for (Int_t i=0; i<nms; i++) { bIsMatch[i]=kFALSE; bIsUsed[i]=kFALSE; }
+
+  AliAODRecoDecayHF2Prong *candi = 0;
+  for (Int_t iCand=0; iCand<nCands; iCand++) {
+    if (bIsD0)
+      candi = dynamic_cast<AliAODRecoDecayHF2Prong*>(fUsedDzeros->At(iCand));
+    else
+      candi = dynamic_cast<AliAODRecoDecayHF2Prong*>(fUsedD0bars->At(iCand));
+    if (!candi) continue;
+    if (candi->Pt()>dJetPt) continue;
+//=============================================================================
+
+    Double_t dMassDzero = candi->InvMassD0();
+    Double_t dMassD0bar = candi->InvMassD0bar();
+    vRec.SetXYZ(candi->Px(), candi->Pt(), candi->Pz());
+    vec0.SetXYZ(candi->PxProng(0), candi->PyProng(0), candi->PzProng(0));
+    vec1.SetXYZ(candi->PxProng(1), candi->PyProng(1), candi->PzProng(1));
+
+    Double_t delRecoR = vRec.DeltaR(vJet);
+    Double_t delTrk0R = vec0.DeltaR(vJet);
+    Double_t delTrk1R = vec1.DeltaR(vJet);
+
+    bIsMatch[kMatchConeCandi] =  (delRecoR<fJetRadius);
+    bIsMatch[kMatchAreaCandi] =  (delRecoR<dJetArea);
+    bIsMatch[kMatchConeProng] = ((delTrk0R<fJetRadius) && (delTrk1R<fJetRadius));
+    bIsMatch[kMatchAreaProng] = ((delTrk0R<dJetArea)   && (delTrk1R<dJetArea));
+
+    Bool_t bNoMatch = kTRUE;
+    for (Int_t i=0; i<nms; i++) if (bIsMatch[i]) { bIsUsed[i]=kTRUE; bNoMatch=kFALSE; } if (bNoMatch) continue;
+//=============================================================================
+
+    Double_t dRecoFFs = vRec.Dot(vJet) / dMag2;
+    Double_t dRecoRel = vRec.Cross(vJet).Mag() / dMag1;
+    Double_t dRecoRho = 0.5 / TMath::Pi() / ((delRecoR<1e-12) ? 1e-12 : delRecoR);
+
+    Double_t dTrk0FFs = vec0.Dot(vJet) / dMag2;
+    Double_t dTrk0Rel = vec0.Cross(vJet).Mag() / dMag1;
+    Double_t dTrk0Rho = 0.5 / TMath::Pi() / ((delTrk0R<1e-12) ? 1e-12 : delTrk0R);
+
+    Double_t dTrk1FFs = vec1.Dot(vJet) / dMag2;
+    Double_t dTrk1Rel = vec1.Cross(vJet).Mag() / dMag1;
+    Double_t dTrk1Rho = 0.5 / TMath::Pi() / ((delTrk1R<1e-12) ? 1e-12 : delTrk1R);
+
+    for (Int_t i=0; i<nms; i++) if (bIsMatch[i]) {
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_InvM_JetPt_%s",sMatched[i].Data())))->Fill(dMassDzero,dJetPt);
+  
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Reco_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dRecoFFs,dMassDzero);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Reco_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dRecoRel,dMassDzero);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Reco_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delRecoR,dMassDzero,dRecoRho);
+
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Trks_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk0FFs,dMassDzero);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Trks_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk0Rel,dMassDzero);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Trks_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delTrk0R,dMassDzero,dTrk0Rho);
+  
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Trks_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk1FFs,dMassDzero);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Trks_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk1Rel,dMassDzero);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_Trks_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delTrk1R,dMassDzero,dTrk1Rho);
+
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hDzero_2ProngsRho_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delTrk0R,delTrk1R);
+//=============================================================================
+
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_InvM_JetPt_%s",sMatched[i].Data())))->Fill(dMassD0bar,dJetPt);
+
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Reco_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dRecoFFs,dMassD0bar);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Reco_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dRecoRel,dMassD0bar);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Reco_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delRecoR,dMassD0bar,dRecoRho);
+
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Trks_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk0FFs,dMassD0bar);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Trks_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk0Rel,dMassD0bar);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Trks_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delTrk0R,dMassD0bar,dTrk0Rho);
+
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Trks_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk1FFs,dMassD0bar);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Trks_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk1Rel,dMassD0bar);
+      ((TH2D*)fListAnDzeroHistos->FindObject(Form("hD0bar_Trks_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delTrk1R,dMassD0bar,dTrk1Rho);
+    }
+
+    candi = 0;
+  }
+
+  for (Int_t i=0; i<nms; i++) if (bIsUsed[i]) ((TH1D*)fListAnDzeroHistos->FindObject(Form("hDzero_UsedJetPt_%s",sMatched[i].Data())))->Fill(dJetPt);
+
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlavourJetCorrelations::RunDstarJet(AliEmcalJet const *pJet, const Int_t iJetPtBin)
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::RunDstarJet
+//
+
+  Int_t nCands = fUsedDstars->GetEntriesFast(); if (nCands==0) return;
+//=============================================================================
+
+  const Int_t nms = kDzeroMatchType;
+  const TString sMatched[nms] = { "MatchConeCandi", "MatchAreaCandi", "MatchConeProng", "MatchAreaProng" };
+//=============================================================================
+
+  Double_t dJetPt = pJet->Pt();
+  TVector3 vJet, vRec, vec0, vec1;
+  vJet.SetPtEtaPhi(dJetPt, pJet->Eta(), pJet->Phi());
+
+  Double_t dMag1    = vJet.Mag();
+  Double_t dMag2    = vJet.Mag2();
+  Double_t dJetArea = pJet->Area();
+//=============================================================================
+
+  Bool_t bIsMatch[nms], bIsUsed[nms];
+  for (Int_t i=0; i<nms; i++) { bIsMatch[i]=kFALSE; bIsUsed[i]=kFALSE; }
+
+//AliAODTrack             *bache = 0
+  AliAODRecoCascadeHF     *candi = 0;
+  AliAODRecoDecayHF2Prong *dZero = 0;
+  for (Int_t iCand=0; iCand<nCands; iCand++) {
+    candi = dynamic_cast<AliAODRecoCascadeHF*>(fUsedDstars->At(iCand)); if (!candi) continue;
+    dZero = candi->Get2Prong();   if (!dZero) continue;
+//  bache = candi->GetBachelor(); if (!bache) continue;
+    if (candi->Pt()>dJetPt) continue;
+//=============================================================================
+
+    Double_t dInvM = candi->DeltaInvMass();
+    vRec.SetXYZ(candi->Px(), candi->Pt(), candi->Pz());
+    vec0.SetXYZ(dZero->PxProng(0), dZero->PyProng(0), dZero->PzProng(0));
+    vec1.SetXYZ(dZero->PxProng(1), dZero->PyProng(1), dZero->PzProng(1));
+    Double_t delRecoR = vRec.DeltaR(vJet);
+    Double_t delTrk0R = vec0.DeltaR(vJet);
+    Double_t delTrk1R = vec1.DeltaR(vJet);
+
+    bIsMatch[kMatchConeCandi] =  (delRecoR<fJetRadius);
+    bIsMatch[kMatchAreaCandi] =  (delRecoR<dJetArea);
+    bIsMatch[kMatchConeProng] = ((delTrk0R<fJetRadius) && (delTrk1R<fJetRadius));
+    bIsMatch[kMatchAreaProng] = ((delTrk0R<dJetArea)   && (delTrk1R<dJetArea));
+
+    Bool_t bNoMatch = kTRUE;
+    for (Int_t i=0; i<nms; i++) if (bIsMatch[i]) { bIsUsed[i]=kTRUE; bNoMatch=kFALSE; } if (bNoMatch) continue;
+//=============================================================================
+
+    Double_t dRecoFFs = vRec.Dot(vJet) / dMag2;
+    Double_t dRecoRel = vRec.Cross(vJet).Mag() / dMag1;
+    Double_t dRecoRho = 0.5 / TMath::Pi() / ((delRecoR<1e-12) ? 1e-12 : delRecoR);
+    
+    Double_t dTrk0FFs = vec0.Dot(vJet) / dMag2;
+    Double_t dTrk0Rel = vec0.Cross(vJet).Mag() / dMag1;
+    Double_t dTrk0Rho = 0.5 / TMath::Pi() / ((delTrk0R<1e-12) ? 1e-12 : delTrk0R);
+    
+    Double_t dTrk1FFs = vec1.Dot(vJet) / dMag2;
+    Double_t dTrk1Rel = vec1.Cross(vJet).Mag() / dMag1;
+    Double_t dTrk1Rho = 0.5 / TMath::Pi() / ((delTrk1R<1e-12) ? 1e-12 : delTrk1R);
+    
+    for (Int_t i=0; i<nms; i++) if (bIsMatch[i]) {
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_InvM_JetPt_%s",sMatched[i].Data())))->Fill(dInvM,dJetPt);
+
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Reco_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dRecoFFs,dInvM);
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Reco_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dRecoRel,dInvM);
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Reco_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delRecoR,dInvM,dRecoRho);
+
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Trks_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk0FFs,dInvM);
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Trks_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk0Rel,dInvM);
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Trks_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delTrk0R,dInvM,dTrk0Rho);
+
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Trks_FFs_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk1FFs,dInvM);
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Trks_Rel_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(dTrk1Rel,dInvM);
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_Trks_Rho_InvM_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delTrk1R,dInvM,dTrk1Rho);
+
+      ((TH2D*)fListAnDstarHistos->FindObject(Form("hDstar_2ProngsRho_%s_JetPtBin%d",sMatched[i].Data(),iJetPtBin)))->Fill(delTrk0R,delTrk1R);
+    }
+
+    dZero = 0;
+    candi = 0;
+  }
+
+  for (Int_t i=0; i<nms; i++) if (bIsUsed[i]) ((TH1D*)fListAnDstarHistos->FindObject(Form("hDstar_UsedJetPt_%s",sMatched[i].Data())))->Fill(dJetPt);
+
+  return;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFlavourJetCorrelations::RetrieveEventObjects()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::RetrieveEventObjects
+//
+
+  if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects()) return kFALSE;
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFlavourJetCorrelations::IsEventSelected()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::IsEventSelected
+//
+
+  if (!AliAnalysisTaskEmcal::IsEventSelected()) return kFALSE;
+
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFlavourJetCorrelations::FillHistograms()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::FillHistograms
+//
+
+  if (!AliAnalysisTaskEmcal::FillHistograms()) return kFALSE;
+
+  if (!FillControlHistograms()) return kFALSE;
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFlavourJetCorrelations::FillGeneralHistograms()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::FillGeneralHistograms
+//
+
+  if (!AliAnalysisTaskEmcal::FillGeneralHistograms()) return kFALSE;
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlavourJetCorrelations::ExecOnce()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::ExecOnce
+//
+
+  AliAnalysisTaskEmcalJet::ExecOnce();
+
+  if (!fUsedDzeros) fUsedDzeros = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("AnaUsedDzero"));
+  if (!fUsedD0bars) fUsedD0bars = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("AnaUsedD0bar"));
+  if (!fUsedDstars) fUsedDstars = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("AnaUsedDstar"));
+
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlavourJetCorrelations::CreateDzeroHistograms()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::CreateDzeroHistograms
+//
+
+  if (!fListAnDzeroHistos) return;
+  Bool_t bStatusTmpH = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+
+  const Int_t nms = kDzeroMatchType;
+  const TString sMatched[nms] = { "MatchConeCandi", "MatchAreaCandi", "MatchConeProng", "MatchAreaProng" };
+  const Double_t dMass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
+
+  const Int_t    nMassBin = 200;
+  const Double_t dMassMin = dMass - 0.15;
+  const Double_t dMassMax = dMass + 0.15;
+
+  const Int_t    nJetPtBin   = 7;
+  const Double_t aJetPtBin[] = { 0., 5., 10., 20., 30., 50., 80., 120. };
+
+  const Int_t    nFFsBin   =   21;
+  const Double_t dFFsBin[] = { 0.0030, 0.0040, 0.0052, 0.0069, 0.0092, 0.0121, 0.0160,
+                               0.0212, 0.0280, 0.0371, 0.0490, 0.0648, 0.0856, 0.1132,
+                               0.1497, 0.1980, 0.2618, 0.3461, 0.4576, 0.6050, 0.8000, 1. };
+
+  const Int_t    nRelBin   =   12;
+  const Double_t dRelBin[] = { 0., 0.06, 0.12, 0.2084, 0.2802, 0.3769, 0.5069, 0.6817, 0.9169, 1.2331, 1.6585, 2.2306, 3. };
+
+  const Int_t    nRhoBin = 20;
+  const Double_t dRhoMin = 0.;
+  const Double_t dRhoMax = 1.;
+//=============================================================================
+
+  TH1D *h1 = 0;
+  TH2D *h2 = 0;
+  for (Int_t i=0; i<nms; i++) {
+    h1 = new TH1D(Form("hDzero_UsedJetPt_%s",sMatched[i].Data()), "", nJetPtBin, aJetPtBin);
+    h1->Sumw2(); fListAnDzeroHistos->Add(h1); h1=0;
+
+    h2 = new TH2D(Form("hDzero_InvM_JetPt_%s",sMatched[i].Data()), "", nMassBin, dMassMin, dMassMax, nJetPtBin, aJetPtBin);
+    h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+    h2 = new TH2D(Form("hD0bar_InvM_JetPt_%s",sMatched[i].Data()), "", nMassBin, dMassMin, dMassMax, nJetPtBin, aJetPtBin);
+    h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+    TString sName;
+    for (Int_t j=0; j<nJetPtBin; j++) {
+      sName = "hDzero_Reco_FFs_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nFFsBin, dFFsBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hDzero_Reco_Rel_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRelBin, dRelBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hDzero_Reco_Rho_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRhoBin, dRhoMin, dRhoMax, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hDzero_Trks_FFs_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nFFsBin, dFFsBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hDzero_Trks_Rel_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRelBin, dRelBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hDzero_Trks_Rho_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRhoBin, dRhoMin, dRhoMax, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hDzero_2ProngsRho";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRhoBin, dRhoMin, dRhoMax, nRhoBin, dRhoMin, dRhoMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+//=============================================================================
+
+      sName = "hD0bar_Reco_FFs_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nFFsBin, dFFsBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hD0bar_Reco_Rel_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRelBin, dRelBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hD0bar_Reco_Rho_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRhoBin, dRhoMin, dRhoMax, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hD0bar_Trks_FFs_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nFFsBin, dFFsBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hD0bar_Trks_Rel_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRelBin, dRelBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+
+      sName = "hD0bar_Trks_Rho_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRhoBin, dRhoMin, dRhoMax, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDzeroHistos->Add(h2); h2=0;
+    }
+  }
+
+  TH1::AddDirectory(bStatusTmpH);
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlavourJetCorrelations::CreateDstarHistograms()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::CreateDstarHistograms
+//
+
+  if (!fListAnDstarHistos) return;
+  Bool_t bStatusTmpH = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+
+  const Int_t nms = kDzeroMatchType;
+  const TString sMatched[nms] = { "MatchConeCandi", "MatchAreaCandi", "MatchConeProng", "MatchAreaProng" };
+  Double_t dMassDzero = TDatabasePDG::Instance()->GetParticle(421)->Mass();
+  Double_t dMassDstar = TDatabasePDG::Instance()->GetParticle(413)->Mass();
+  Double_t dMassDelta = dMassDstar - dMassDzero;
+
+  const Int_t    nMassBin = 200;
+  const Double_t dMassMin = dMassDelta - 0.015;
+  const Double_t dMassMax = dMassDelta + 0.015;
+
+  const Int_t    nJetPtBin   = 7;
+  const Double_t aJetPtBin[] = { 0., 5., 10., 20., 30., 50., 80., 120. };
+
+  const Int_t    nFFsBin   =   21;
+  const Double_t dFFsBin[] = { 0.0030, 0.0040, 0.0052, 0.0069, 0.0092, 0.0121, 0.0160,
+                               0.0212, 0.0280, 0.0371, 0.0490, 0.0648, 0.0856, 0.1132,
+                               0.1497, 0.1980, 0.2618, 0.3461, 0.4576, 0.6050, 0.8000, 1. };
+
+  const Int_t    nRelBin   =   12;
+  const Double_t dRelBin[] = { 0., 0.06, 0.12, 0.2084, 0.2802, 0.3769, 0.5069, 0.6817, 0.9169, 1.2331, 1.6585, 2.2306, 3. };
+
+  const Int_t    nRhoBin = 20;
+  const Double_t dRhoMin = 0.;
+  const Double_t dRhoMax = 1.;
+//=============================================================================
+
+  TH1D *h1 = 0;
+  TH2D *h2 = 0;
+  for (Int_t i=0; i<nms; i++) {
+    h1 = new TH1D(Form("hDstar_UsedJetPt_%s",sMatched[i].Data()), "", nJetPtBin, aJetPtBin);
+    h1->Sumw2(); fListAnDstarHistos->Add(h1); h1=0;
+
+    h2 = new TH2D(Form("hDstar_InvM_JetPt_%s",sMatched[i].Data()), "", nMassBin, dMassMin, dMassMax, nJetPtBin, aJetPtBin);
+    h2->Sumw2(); fListAnDstarHistos->Add(h2); h2=0;
+
+    TString sName;
+    for (Int_t j=0; j<nJetPtBin; j++) {
+      sName = "hDstar_Reco_FFs_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nFFsBin, dFFsBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDstarHistos->Add(h2); h2=0;
+
+      sName = "hDstar_Reco_Rel_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRelBin, dRelBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDstarHistos->Add(h2); h2=0;
+
+      sName = "hDstar_Reco_Rho_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRhoBin, dRhoMin, dRhoMax, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDstarHistos->Add(h2); h2=0;
+
+      sName = "hDstar_Trks_FFs_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nFFsBin, dFFsBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDstarHistos->Add(h2); h2=0;
+
+      sName = "hDstar_Trks_Rel_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRelBin, dRelBin, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDstarHistos->Add(h2); h2=0;
+
+      sName = "hDstar_Trks_Rho_InvM";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRhoBin, dRhoMin, dRhoMax, nMassBin, dMassMin, dMassMax);
+      h2->Sumw2(); fListAnDstarHistos->Add(h2); h2=0;
+
+      sName = "hDstar_2ProngsRho";
+      h2 = new TH2D(Form("%s_%s_JetPtBin%d",sName.Data(),sMatched[i].Data(),j), "", nRhoBin, dRhoMin, dRhoMax, nRhoBin, dRhoMin, dRhoMax);
+      h2->Sumw2(); fListAnDstarHistos->Add(h2); h2=0;
+    }
+  }
+
+  TH1::AddDirectory(bStatusTmpH);
+  return;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskFlavourJetCorrelations::FillControlHistograms()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::FillControlHistograms
+//
+
+  if (!fListControlHistos) return kFALSE;
+
+  if (fTracks) {
+    AliVTrack *pTrk = 0;
+    for (Int_t itrk=0; itrk<fTracks->GetEntriesFast(); itrk++) {
+      pTrk = static_cast<AliVTrack*>(fTracks->At(itrk)); if (!pTrk) continue;
+      if (!AcceptTrack(pTrk)) { pTrk = 0; continue; }
+
+      ((TH1D*)fListControlHistos->FindObject("hTrksPt"))->Fill(pTrk->Pt()); pTrk=0; 
+    }
+  }
+
+  if (fCaloClusters) {
+    AliVCluster *pCls = 0;
+    TLorentzVector vLorentz;
+    for (Int_t iClus=0; iClus<fCaloClusters->GetEntriesFast(); iClus++) {
+      pCls = static_cast<AliVCluster*>(fCaloClusters->At(iClus)); if (!pCls) continue;
+
+      pCls->GetMomentum(vLorentz, fVertex);
+      ((TH1D*)fListControlHistos->FindObject("hClusPt"))->Fill(vLorentz.Pt()); pCls=0;
+    }
+  }
+
+  if (fJets) {
+    AliEmcalJet* pJet = 0;
+    static Int_t sortedJets[9999] = { -1 };
+    if (GetSortedArray(sortedJets,fJets)) if (sortedJets[0]>=0) {
+      pJet = static_cast<AliEmcalJet*>(fJets->At(sortedJets[0])); 
+      if (pJet) ((TH1D*)fListControlHistos->FindObject("hLeadingJets_Pt"))->Fill(pJet->Pt());
+    } pJet = 0;
+
+    for (Int_t iJet=0; iJet<fJets->GetEntriesFast(); iJet++) {
+      pJet = static_cast<AliEmcalJet*>(fJets->At(iJet)); if (!pJet) continue;
+      if (!AcceptJet(pJet)) continue;
+
+      Double_t dPt   = pJet->Pt();
+      Double_t dArea = pJet->Area();
+      ((TH2D*)fListControlHistos->FindObject("hJets_Pt_Area"))->Fill(dPt,dArea);
+      ((TH2D*)fListControlHistos->FindObject("hJets_Eta_Phi"))->Fill(pJet->Eta(),pJet->Phi());
+      ((TH2D*)fListControlHistos->FindObject("hJets_LeadingPt"))->Fill(dPt,GetLeadingHadronPt(pJet));
+
+      if (fRho) {
+        ((TH2D*)fListControlHistos->FindObject("hJets_CorrPt_Area"))->Fill(dPt-fRhoVal*dArea,dArea);
+      } pJet = 0;
+    }
+  }
+
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskFlavourJetCorrelations::MakeControlHistograms()
+{
+//
+// AliAnalysisTaskFlavourJetCorrelations::MakeControlHistograms
+//
+
+  if (!fListControlHistos) return;
+  Bool_t bStatusTmpH = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+
+  TH1D *h1 = 0;
+  TH2D *h2 = 0;
+
+  if (!fTracksName.IsNull()) {
+    h1 = new TH1D("hTrksPt", "", fNbins/2, fMinBinPt, fMaxBinPt/2.);
+    h1->Sumw2(); fListControlHistos->Add(h1); h1=0;
+  }
+
+  if (!fCaloName.IsNull()) {
+    h1 = new TH1D("hClusPt", "", fNbins/2, fMinBinPt, fMaxBinPt/2.);
+    h1->Sumw2(); fListControlHistos->Add(h1); h1=0;
+  }
+
+  if (!fJetsName.IsNull()) {
+    h1 = new TH1D("hLeadingJets_Pt", "", fNbins, fMinBinPt, fMaxBinPt);
+    h1->Sumw2(); fListControlHistos->Add(h1); h1=0;
+
+    h2 = new TH2D("hJets_Pt_Area", "", fNbins, fMinBinPt, fMaxBinPt, 30, 0., 3.);
+    h2->Sumw2();  fListControlHistos->Add(h2); h2=0;
+
+    h2 = new TH2D("hJets_Eta_Phi", "", 50, -1., 1., 101, 0., 2.*TMath::Pi() + TMath::Pi()/200.);
+    h2->Sumw2(); fListControlHistos->Add(h2); h2=0;
+
+    h2 = new TH2D("hJets_LeadingPt", "", fNbins, fMinBinPt, fMaxBinPt, fNbins/2, fMinBinPt, fMaxBinPt/2.);
+    h2->Sumw2(); fListControlHistos->Add(h2); h2=0;
+
+    if (!fRhoName.IsNull()) {
+      h2 = new TH2D("hJets_CorrPt_Area", "", 2*fNbins, -1.*fMaxBinPt, fMaxBinPt, 30, 0., 3.);
+    }
+  }
+
+  TH1::AddDirectory(bStatusTmpH);
+  return;
+}
diff --git a/PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.h b/PWGJE/FlavourJetTasks/AliAnalysisTaskFlavourJetCorrelations.h
new file mode 100644 (file)
index 0000000..87ff071
--- /dev/null
@@ -0,0 +1,70 @@
+#ifndef ALIANALYSISTASKSERECOJETCORRELATIONS_H
+#define ALIANALYSISTASKSERECOJetCORRELATIONS_H
+
+// $Id$
+
+/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//*************************************************************************
+// Class AliAnalysisTaskFlavourJetCorrelations
+// AliAnalysisTaskSE for Dmesons - jet correlations analysis
+// Author: Xiaoming Zhang, xmzhang@lbl.gov
+//*************************************************************************
+
+#include "AliAnalysisTaskEmcalJet.h"
+
+class TList;
+class TClonesArray;
+
+class AliAnalysisTaskFlavourJetCorrelations : public AliAnalysisTaskEmcalJet {
+
+ public :
+
+  enum {
+    kMatchConeCandi,
+    kMatchAreaCandi,
+    kMatchConeProng,
+    kMatchAreaProng,
+    kDzeroMatchType
+  };
+
+  AliAnalysisTaskFlavourJetCorrelations();
+  AliAnalysisTaskFlavourJetCorrelations(const char *name, Bool_t bIsHisto=kTRUE);
+  virtual ~AliAnalysisTaskFlavourJetCorrelations();
+
+  virtual void UserCreateOutputObjects();
+
+ private :
+
+  AliAnalysisTaskFlavourJetCorrelations(const AliAnalysisTaskFlavourJetCorrelations &);
+  AliAnalysisTaskFlavourJetCorrelations& operator=(const AliAnalysisTaskFlavourJetCorrelations &);
+
+  virtual void   ExecOnce();
+  virtual Bool_t FillGeneralHistograms();
+  virtual Bool_t FillHistograms();
+  virtual Bool_t IsEventSelected();
+  virtual Bool_t RetrieveEventObjects();
+  virtual Bool_t Run();
+
+  void   MakeControlHistograms();
+  Bool_t FillControlHistograms();
+
+  void CreateDzeroHistograms();
+  void CreateDstarHistograms();
+
+  void RunDzeroJet(AliEmcalJet const *pJet, const Int_t iJetPtBin, const Bool_t bIsD0);
+  void RunDstarJet(AliEmcalJet const *pJet, const Int_t iJetPtBin);
+
+  TClonesArray *fUsedDzeros;  //! input Dzero candidates array
+  TClonesArray *fUsedD0bars;  //! input D0bar candidates array
+  TClonesArray *fUsedDstars;  //! input Dstar candidates array
+
+  TList *fListControlHistos;  //! list of output contral histograms
+  TList *fListAnDzeroHistos;  //! list of output Dzero - jet correlation histograms
+  TList *fListAnDstarHistos;  //! list of output Dstar - jet correlation histograms
+
+  ClassDef(AliAnalysisTaskFlavourJetCorrelations, 1);
+};
+
+#endif
diff --git a/PWGJE/FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.cxx b/PWGJE/FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.cxx
new file mode 100644 (file)
index 0000000..91efe0f
--- /dev/null
@@ -0,0 +1,451 @@
+// $Id$
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, 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.                  *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////
+//
+// AliAnalysisTaskSE for Dmesons - jet correlations analysis
+//
+// Author: Xiaoming Zhang, xmzhang@lbl.gov
+///////////////////////////////////////////////////////////////
+
+#include <TMath.h>
+#include <TH1D.h>
+#include <TH2D.h>
+#include <TList.h>
+#include <TClonesArray.h>
+#include <TDatabasePDG.h>
+
+#include "AliAnalysisManager.h"
+#include "AliAODTrack.h"
+#include "AliAODEvent.h"
+#include "AliAODHandler.h"
+#include "AliAODExtension.h"
+#include "AliAODRecoDecayHF.h"
+#include "AliAODRecoDecayHF2Prong.h"
+#include "AliAODRecoCascadeHF.h"
+#include "AliRDHFCuts.h"
+#include "AliRDHFCutsD0toKpi.h"
+#include "AliRDHFCutsDStartoKpipi.h"
+#include "AliAnalysisTaskSEDmesonsFilterCJ.h"
+
+ClassImp(AliAnalysisTaskSEDmesonsFilterCJ)
+
+//_____________________________________________________________________________
+AliAnalysisTaskSEDmesonsFilterCJ::AliAnalysisTaskSEDmesonsFilterCJ() :
+AliAnalysisTaskSE(),
+fEventAOD(0),
+fCutDzero(0),
+fCutDstar(0),
+fDzeroClArr(0),
+fDstarClArr(0),
+fUsedDzeros(0),
+fUsedD0bars(0),
+fUsedDstars(0),
+fIsNotExecOnce(kTRUE),
+fListCutsDmesons(0),
+fListDzeroHistos(0),
+fListDstarHistos(0)
+{
+//
+// Default constructor
+//
+}
+
+//_____________________________________________________________________________
+AliAnalysisTaskSEDmesonsFilterCJ::AliAnalysisTaskSEDmesonsFilterCJ(const char *name) :
+AliAnalysisTaskSE(name),
+fEventAOD(0),
+fCutDzero(0),
+fCutDstar(0),
+fDzeroClArr(0),
+fDstarClArr(0),
+fUsedDzeros(0),
+fUsedD0bars(0),
+fUsedDstars(0),
+fIsNotExecOnce(kTRUE),
+fListCutsDmesons(0),
+fListDzeroHistos(0),
+fListDstarHistos(0)
+{
+//
+// Constructor
+//
+
+  DefineOutput(1, TList::Class());
+  DefineOutput(2, TList::Class());
+  DefineOutput(3, TList::Class());
+}
+
+//_____________________________________________________________________________
+AliAnalysisTaskSEDmesonsFilterCJ::~AliAnalysisTaskSEDmesonsFilterCJ()
+{
+//
+// Default destructor
+//
+
+  if (fEventAOD)   { delete fEventAOD;   fEventAOD  =0; }
+
+  if (fCutDzero)   { delete fCutDzero;   fCutDzero  =0; }
+  if (fCutDstar)   { delete fCutDstar;   fCutDstar  =0; }
+
+  if (fDzeroClArr) { delete fDzeroClArr; fDzeroClArr=0; }
+  if (fDstarClArr) { delete fDstarClArr; fDstarClArr=0; }
+
+  if (fUsedDzeros) { delete fUsedDzeros; fUsedDzeros=0; }
+  if (fUsedD0bars) { delete fUsedD0bars; fUsedD0bars=0; }
+  if (fUsedDstars) { delete fUsedDstars; fUsedDstars=0; }
+
+  if (fListCutsDmesons) { delete fListCutsDmesons; fListCutsDmesons=0; }
+  if (fListDzeroHistos) { delete fListDzeroHistos; fListDzeroHistos=0; }
+  if (fListDstarHistos) { delete fListDstarHistos; fListDstarHistos=0; }
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::Init()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::Init()
+//
+
+  if (fListCutsDmesons) return;
+  fListCutsDmesons = new TList(); fListCutsDmesons->SetOwner();
+
+  if (fCutDzero) {
+    AliRDHFCutsD0toKpi *cutDzero = new AliRDHFCutsD0toKpi(*fCutDzero);
+    cutDzero->SetName("AnalysisCutsDzero"); 
+    fListCutsDmesons->Add(cutDzero);
+  }
+
+  if (fCutDstar) {
+    AliRDHFCutsDStartoKpipi *cutDstar = new AliRDHFCutsDStartoKpipi(*fCutDstar);
+    cutDstar->SetName("AnalysisCutsDstar"); 
+    fListCutsDmesons->Add(cutDstar);
+  }
+
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::UserCreateOutputObjects()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::UserCreateOutputObjects
+//
+
+  if (fCutDzero) { fUsedDzeros = new TClonesArray("AliAODRecoDecayHF2Prong",0); fUsedDzeros->SetName("AnaUsedDzero");}
+  if (fCutDzero) { fUsedD0bars = new TClonesArray("AliAODRecoDecayHF2Prong",0); fUsedD0bars->SetName("AnaUsedD0bar");}
+  if (fCutDstar) { fUsedDstars = new TClonesArray("AliAODRecoCascadeHF",    0); fUsedDstars->SetName("AnaUsedDstar"); }
+
+  if (!fListDzeroHistos) fListDzeroHistos = new TList(); fListDzeroHistos->SetOwner();
+  if (!fListDstarHistos) fListDstarHistos = new TList(); fListDstarHistos->SetOwner();
+
+  if (fCutDzero) CreateDzeroHistograms();
+  if (fCutDstar) CreateDstarHistograms();
+
+  PostData(1, fListCutsDmesons);
+  PostData(2, fListDzeroHistos);
+  PostData(3, fListDstarHistos);
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::UserExec(Option_t *)
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::UserExec
+//
+
+  if (fIsNotExecOnce) {
+    fIsNotExecOnce=ExecOnce();
+    if (fIsNotExecOnce) return;
+  }
+
+  if (ExecEach()) ExecAnas();
+
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::Terminate(Option_t *)
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::Terminate
+//
+
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::NotifyRun()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::NotifyRun
+//
+
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::ExecAnas()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::ExecAnas
+//
+
+  if (fUsedDzeros) fUsedDzeros->Delete();
+  if (fUsedD0bars) fUsedD0bars->Delete();
+  if (fUsedDstars) fUsedDstars->Delete();
+
+  if (fDzeroClArr) ExecAnasDzero();
+  if (fDstarClArr) ExecAnasDstar();
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::ExecAnasDzero()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::ExecAnasDzero
+//
+
+  if (!fCutDzero->IsEventSelected(fEventAOD)) return;
+  const Int_t nCands = fDzeroClArr->GetEntriesFast(); if (nCands==0) return;
+
+  ((TH1D*)fListDzeroHistos->FindObject("hDzero_candi"))->Fill(nCands);
+
+  Int_t countN = 0;
+  AliAODRecoDecayHF2Prong *candi = 0;
+  for (Int_t iCand=0; iCand<nCands; iCand++) {
+    candi = dynamic_cast<AliAODRecoDecayHF2Prong*>(fDzeroClArr->At(iCand)); if (!candi) continue;
+
+    Double_t dPt = candi->Pt();
+    if (!fCutDzero->IsInFiducialAcceptance(dPt,candi->YD0())) continue;
+    Int_t mask = fCutDzero->IsSelected(candi,AliRDHFCuts::kAll,fEventAOD); if (mask==0) continue;
+
+    Double_t dMass = 0.; 
+    if ((mask==1) || (mask==3)) dMass = candi->InvMassD0();
+    if  (mask==2)               dMass = candi->InvMassD0bar();
+    ((TH2D*)fListDzeroHistos->FindObject("hDzero_Mass_Pt"))->Fill(dMass,dPt);
+
+    if ((mask==1) || (mask==3)) new((*fUsedDzeros)[countN++]) AliAODRecoDecayHF2Prong(*candi);
+    if  (mask==2)               new((*fUsedD0bars)[countN++]) AliAODRecoDecayHF2Prong(*candi);
+    candi = 0;
+  }
+
+  ((TH1D*)fListDzeroHistos->FindObject("hDzero_seled"))->Fill(countN);
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::ExecAnasDstar()
+{
+//
+//  AliAnalysisTaskSEDmesonsFilterCJ::ExecAnasDstar
+//
+
+  if (!fCutDstar->IsEventSelected(fEventAOD)) return;
+  const Int_t nCands = fDstarClArr->GetEntriesFast(); if (nCands==0) return;
+
+  Double_t dMassDzero = TDatabasePDG::Instance()->GetParticle(421)->Mass();
+  Double_t dMassDstar = TDatabasePDG::Instance()->GetParticle(413)->Mass();
+  Double_t dMassDelta = dMassDstar - dMassDzero;
+  Double_t dSigmaD0Pt[13]={ 0.012, 0.012, 0.012, 0.015, 0.015, 0.018, 0.018, 0.020, 0.020, 0.030, 0.030, 0.037, 0.040 };
+
+  ((TH1D*)fListDstarHistos->FindObject("hDstar_candi"))->Fill(nCands);
+
+  Int_t countN = 0;
+  AliAODRecoCascadeHF *candi = 0;
+  for (Int_t iCand=0; iCand<nCands; iCand++) {
+    candi = dynamic_cast<AliAODRecoCascadeHF*>(fDstarClArr->At(iCand)); if (!candi) continue;
+
+    Double_t dPt = candi->Pt();
+    if (!fCutDstar->IsInFiducialAcceptance(dPt,candi->YDstar()))   continue;
+    if (!fCutDstar->IsSelected(candi,AliRDHFCuts::kAll)) continue;
+
+    Int_t iBin = fCutDzero->PtBin(dPt);
+    if ((iBin<0) || (iBin>=fCutDzero->GetNPtBins())) { AliWarning(Form("pT(D*)=%f out of bounds!!!",dPt)); continue; }
+
+    Double_t dMassResD0 = TMath::Abs(candi->InvMassD0() - dMassDzero); if (dMassResD0>3.*dSigmaD0Pt[iBin]) continue;
+
+    Double_t deltaM = candi->DeltaInvMass();
+    ((TH2D*)fListDstarHistos->FindObject("hDstar_deltaMass_Pt"))->Fill(deltaM,dPt);
+
+    if (TMath::Abs(deltaM-dMassDelta)) ((TH1D*)fListDstarHistos->FindObject("hDstar_SoftPiPt"))->Fill(((AliAODTrack*)candi->GetBachelor())->Pt());
+
+    new((*fUsedDstars)[countN++]) AliAODRecoCascadeHF(*candi);
+    candi = 0;
+  }
+
+  ((TH1D*)fListDstarHistos->FindObject("hDstar_seled"))->Fill(countN);
+  return;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskSEDmesonsFilterCJ::ExecOnce()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::ExecOnce
+//
+
+  if (!InputEvent())  return kTRUE;
+  fEventAOD = dynamic_cast<AliAODEvent*>(InputEvent());
+
+  if (fEventAOD) {
+    if (fCutDzero) fDzeroClArr = dynamic_cast<TClonesArray*>(fEventAOD->FindListObject("D0toKpi"));
+    if (fCutDstar) fDstarClArr = dynamic_cast<TClonesArray*>(fEventAOD->FindListObject("Dstar"));
+  } else if (AODEvent() && IsStandardAOD()) {
+    fEventAOD = dynamic_cast<AliAODEvent*>(AODEvent());
+    AliAODHandler* aodH = dynamic_cast<AliAODHandler*>((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
+
+    if(aodH->GetExtensions()) {
+      AliAODExtension    *aodExt = dynamic_cast<AliAODExtension*>(aodH->GetExtensions()->FindObject("AliAOD.VertexingHF.root"));
+      if (fCutDzero) fDzeroClArr = dynamic_cast<TClonesArray*>(aodExt->GetAOD()->FindListObject("D0toKpi"));
+      if (fCutDstar) fDstarClArr = dynamic_cast<TClonesArray*>(aodExt->GetAOD()->FindListObject("Dstar"));
+    }
+  }
+
+  if (!fEventAOD)                { AliError("No AOD Event!!!");    return kTRUE; }
+  if (!fDzeroClArr && fCutDzero) { AliError("No Dzero Branch!!!"); return kTRUE; }
+  if (!fDstarClArr && fCutDstar) { AliError("No Dstar Branch!!!"); return kTRUE; }
+
+  if (fDzeroClArr && fUsedDzeros) {
+    fUsedDzeros->Delete();
+    if (!(InputEvent()->FindListObject("AnaUsedDzero"))) InputEvent()->AddObject(fUsedDzeros);
+  }
+
+  if (fDzeroClArr && fUsedD0bars) {
+    fUsedD0bars->Delete();
+    if (!(InputEvent()->FindListObject("AnaUsedD0bar"))) InputEvent()->AddObject(fUsedD0bars);
+  }
+
+  if (fDstarClArr && fUsedDstars) {
+    fUsedDstars->Delete();
+    if (!(InputEvent()->FindListObject("AnaUsedDstar"))) InputEvent()->AddObject(fUsedDstars);
+  }
+
+  return kFALSE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskSEDmesonsFilterCJ::ExecEach()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::ExecEach
+//
+
+  if (!fEventAOD) {
+    AliWarning("No Input Event, Skip Event!!!");
+    return kFALSE;
+  }
+
+  if ((!fDzeroClArr) && (!fDstarClArr)) {
+    AliWarning("No D meson Branch, Skip Event!!!");
+    return kFALSE;
+  }
+
+  if ((!fEventAOD->GetPrimaryVertex()) || (TMath::Abs(fEventAOD->GetMagneticField())<1e-3)) return kFALSE;
+
+  Bool_t bIsDmeson = kTRUE;
+  if (fDzeroClArr) bIsDmeson = ((fDzeroClArr->GetEntriesFast()==0) && bIsDmeson);
+  if (fDstarClArr) bIsDmeson = ((fDstarClArr->GetEntriesFast()==0) && bIsDmeson);
+  if (bIsDmeson)   return kFALSE;
+
+  return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::CreateDzeroHistograms()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::CreateDzeroHistograms
+//
+
+  if (!fListDzeroHistos) return;
+  Bool_t bStatusTmpH = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+
+  TH1D *h1D = 0;
+  h1D = new TH1D("hDzero_candi", "", 100, -0.5, 99.5); h1D->Sumw2(); fListDzeroHistos->Add(h1D); h1D=0;
+  h1D = new TH1D("hDzero_seled", "", 100, -0.5, 99.5); h1D->Sumw2(); fListDzeroHistos->Add(h1D); h1D=0;
+
+  TH2D *h2D = 0;
+  Double_t dMass = TDatabasePDG::Instance()->GetParticle(421)->Mass();
+  h2D = new TH2D("hDzero_Mass_Pt", "", 200, dMass-0.15, dMass+0.15, 100, 0., 50.);
+  h2D->Sumw2(); fListDzeroHistos->Add(h2D); h2D=0;
+
+  TH1::AddDirectory(bStatusTmpH);
+  return;
+}
+
+//_____________________________________________________________________________
+void AliAnalysisTaskSEDmesonsFilterCJ::CreateDstarHistograms()
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::CreateDstarHistograms
+//
+
+  if (!fListDstarHistos) return;
+  Bool_t bStatusTmpH = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+
+  TH1D *h1D = 0;
+  h1D = new TH1D("hDstar_candi",    "", 100, -0.5, 99.5); h1D->Sumw2(); fListDstarHistos->Add(h1D); h1D=0;
+  h1D = new TH1D("hDstar_seled",    "", 100, -0.5, 99.5); h1D->Sumw2(); fListDstarHistos->Add(h1D); h1D=0;
+  h1D = new TH1D("hDstar_SoftPiPt", "", 500,  0.,  10.0); h1D->Sumw2(); fListDstarHistos->Add(h1D); h1D=0;
+
+  TH2D *h2D = 0;
+  Double_t dMassDzero = TDatabasePDG::Instance()->GetParticle(421)->Mass();
+  Double_t dMassDstar = TDatabasePDG::Instance()->GetParticle(413)->Mass();
+  Double_t dMassDelta = dMassDstar - dMassDzero;
+  h2D = new TH2D("hDstar_deltaMass_Pt", "", 200, dMassDelta-0.015, dMassDelta+0.015, 100, 0., 50.);
+  h2D->Sumw2(); fListDstarHistos->Add(h2D); h2D=0;
+
+  TH1::AddDirectory(bStatusTmpH);
+  return;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskSEDmesonsFilterCJ::SetCutDzero(AliRDHFCutsD0toKpi *cut)
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::SetCutDzero
+//
+
+  if (!cut) return kTRUE;
+
+  if (fCutDzero) { delete fCutDzero; fCutDzero=0; }
+  fCutDzero = new AliRDHFCutsD0toKpi(*cut);
+  if (!fCutDzero) { AliError("No Dzero Cuts!!!"); return kTRUE; }
+
+  return kFALSE;
+}
+
+//_____________________________________________________________________________
+Bool_t AliAnalysisTaskSEDmesonsFilterCJ::SetCutDstar(AliRDHFCutsDStartoKpipi *cut)
+{
+//
+// AliAnalysisTaskSEDmesonsFilterCJ::SetCutDstar
+//
+
+  if (!cut) return kTRUE;
+
+  if (fCutDstar) { delete fCutDstar; fCutDstar=0; }
+  fCutDstar = new AliRDHFCutsDStartoKpipi(*cut);
+  if (!fCutDstar)  { AliError("No Dstar Cuts!!!"); return kTRUE; }
+
+  return kFALSE;
+}
diff --git a/PWGJE/FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.h b/PWGJE/FlavourJetTasks/AliAnalysisTaskSEDmesonsFilterCJ.h
new file mode 100644 (file)
index 0000000..9f26ca9
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef ALIANALYSISTASKSEDMESONSFILTERCJ_H
+#define ALIANALYSISTASKSEDMESONSFILTERCJ_H
+
+// $Id$
+
+/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//*************************************************************************
+// Class AliAnalysisTaskSEDmesonsCJ
+// AliAnalysisTaskSE for Dmesons - jet correlations analysis
+// Author: Xiaoming Zhang, xmzhang@lbl.gov
+//*************************************************************************
+
+#include "AliAnalysisTaskSE.h"
+
+class TList;
+class AliRDHFCutsD0toKpi;
+class AliRDHFCutsDStartoKpipi;
+
+class AliAnalysisTaskSEDmesonsFilterCJ : public AliAnalysisTaskSE {
+
+ public :
+
+  AliAnalysisTaskSEDmesonsFilterCJ();
+  AliAnalysisTaskSEDmesonsFilterCJ(const char *name);
+  virtual ~AliAnalysisTaskSEDmesonsFilterCJ();
+
+  virtual void Init();
+  virtual void LocalInit() { Init(); }
+  virtual void UserCreateOutputObjects();
+  virtual void UserExec(Option_t *opt);
+  virtual void Terminate(Option_t *opt);
+  virtual void NotifyRun();
+
+  Bool_t SetCutDzero(AliRDHFCutsD0toKpi      *cut);
+  Bool_t SetCutDstar(AliRDHFCutsDStartoKpipi *cut);
+
+ private :
+
+  AliAnalysisTaskSEDmesonsFilterCJ(const AliAnalysisTaskSEDmesonsFilterCJ &);
+  AliAnalysisTaskSEDmesonsFilterCJ& operator=(const AliAnalysisTaskSEDmesonsFilterCJ &);
+
+  Bool_t ExecOnce();
+  Bool_t ExecEach();
+
+  void ExecAnas();
+  void ExecAnasDzero();
+  void ExecAnasDstar();
+
+  void CreateDzeroHistograms();
+  void CreateDstarHistograms();
+//=============================================================================
+
+  AliAODEvent *fEventAOD;  //! in put AOD event
+
+  AliRDHFCutsD0toKpi      *fCutDzero;  //! Dzero selection cut
+  AliRDHFCutsDStartoKpipi *fCutDstar;  //! Dstar selection cut
+
+  TClonesArray *fDzeroClArr;  //! intput Dzero candidates array
+  TClonesArray *fDstarClArr;  //! intput Dstar candidates array
+
+  TClonesArray *fUsedDzeros;  //! selected Dzero candidates array
+  TClonesArray *fUsedD0bars;  //! selected D0bar candidates array
+  TClonesArray *fUsedDstars;  //! selected Dstar candidates array
+
+  Bool_t fIsNotExecOnce;  // flag for ExecOnce
+
+  TList *fListCutsDmesons;  //! list of Dmeson selection cuts
+  TList *fListDzeroHistos;  //! list of Dzero output control histrograms
+  TList *fListDstarHistos;  //! list of Dstar output control histrograms
+
+  ClassDef(AliAnalysisTaskSEDmesonsFilterCJ, 1);
+};
+
+#endif
diff --git a/PWGJE/FlavourJetTasks/macros/AddTaskFlavourJetCorrelations.C b/PWGJE/FlavourJetTasks/macros/AddTaskFlavourJetCorrelations.C
new file mode 100644 (file)
index 0000000..477c07a
--- /dev/null
@@ -0,0 +1,52 @@
+// $Id$
+
+AliAnalysisTaskFlavourJetCorrelations *AddTaskFlavourJetCorrelations(
+  TString sUsedTrks    = "",
+  TString sUsedClus    = "",
+  TString sUsedJets    = "",
+  TString sUsedRho     = "",
+  TString sTaskName    = "AliAnalysisTaskFlavourJetCorrelations",
+  Bool_t  bIsMakeHisto = kTRUE)
+{
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+
+  if (!mgr) {
+    ::Error("AddTaskFlavourJetCorrelations.C::AddTaskFlavourJetCorrelations", "No analysis manager to connect to.");
+    return NULL;
+  }
+
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskFlavourJetCorrelations.C::AddTaskFlavourJetCorrelations", "This task requires an input event handler");
+    return NULL;
+  }
+
+  TString type = mgr->GetInputEventHandler()->GetDataType();
+  if (!type.Contains("ESD") && !type.Contains("AOD")) {
+    ::Error("AddTaskFlavourJetCorrelations.C::AddTaskFlavourJetCorrelations", "Task manager to have an ESD or AOD input handler.");
+    return NULL;
+  }
+//=============================================================================
+
+  AliAnalysisTaskFlavourJetCorrelations *taskFlavourCJ = new AliAnalysisTaskFlavourJetCorrelations(sTaskName.Data(),bIsMakeHisto);
+  taskFlavourCJ->SetClusName(sUsedClus.Data());
+  taskFlavourCJ->SetTracksName(sUsedTrks.Data());
+  taskFlavourCJ->SetJetsName(sUsedJets.Data());
+  taskFlavourCJ->SetRhoName(sUsedRho.Data());
+
+  mgr->AddTask(taskFlavourCJ);
+  mgr->ConnectInput( taskFlavourCJ, 0, mgr->GetCommonInputContainer());
+//mgr->ConnectOutput(taskFlavourCJ, 0, mgr->GetCommonOutputContainer());
+
+  TString sOutput0 = sTaskName + "_" + sUsedJets;
+  TString sOutput1 = sOutput0  + "_GeneralHistograms";
+  TString sOutput2 = sOutput0  + "_ControlHistograms";
+  TString sOutput3 = sOutput0  + "_AnDzeroHistograms";
+  TString sOutput4 = sOutput0  + "_AnDstarHistograms";
+  TString sCommon  = AliAnalysisManager::GetCommonFileName();
+  mgr->ConnectOutput(taskFlavourCJ, 1, mgr->CreateContainer(sOutput1.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,sCommon.Data()));
+  mgr->ConnectOutput(taskFlavourCJ, 2, mgr->CreateContainer(sOutput2.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,sCommon.Data()));
+  mgr->ConnectOutput(taskFlavourCJ, 3, mgr->CreateContainer(sOutput3.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,sCommon.Data()));
+  mgr->ConnectOutput(taskFlavourCJ, 4, mgr->CreateContainer(sOutput4.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,sCommon.Data()));
+
+  return taskFlavourCJ;
+}
diff --git a/PWGJE/FlavourJetTasks/macros/AddTaskSEDmesonsFilterCJ.C b/PWGJE/FlavourJetTasks/macros/AddTaskSEDmesonsFilterCJ.C
new file mode 100644 (file)
index 0000000..d1f5fff
--- /dev/null
@@ -0,0 +1,57 @@
+// $Id$
+
+AliAnalysisTaskSEDmesonsFilterCJ *AddTaskSEDmesonsFilterCJ(TString sCutDzero = "", TString sCutDstar = "")
+{
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+
+  if (!mgr) {
+    ::Error("AddTaskSEDmesonsFilterCJ.C::AddTaskSEDmesonsFilterCJ", "No analysis manager to connect to.");
+    return NULL;
+  }
+
+  TString type = mgr->GetInputEventHandler()->GetDataType();
+  if (!type.Contains("ESD") && !type.Contains("AOD")) {
+    ::Error("AddTaskSEDmesonsFilterCJ.C::AddTaskSEDmesonsFilterCJ", "Task manager to have an ESD or AOD input handler.");
+    return NULL;
+  }
+
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTaskSEEAddTaskSEDmesonsFilterCJ.C::AddTaskSEEAddTaskSEDmesonsFilterCJ", "This task requires an input event handler");
+    return NULL;
+  }
+//=============================================================================
+
+  TFile *file = 0;
+  AliRDHFCutsD0toKpi      *cutDzero = 0;
+  AliRDHFCutsDStartoKpipi *cutDstar = 0;
+
+  if (!sCutDzero.IsNull()) {
+    file = TFile::Open(sCutDzero.Data(), "READ");
+    cutDzero = dynamic_cast<AliRDHFCutsD0toKpi*>(file->Get("D0toKpiCuts"));
+    file->Close();
+  }
+
+  if (!sCutDstar.IsNull()) {
+    file = TFile::Open(sCutDstar.Data(), "READ");
+    cutDstar = dynamic_cast<AliRDHFCutsDStartoKpipi*>(file->Get("DStartoKpipiCuts"));
+    file->Close();
+  }
+
+  AliAnalysisTaskSEDmesonsFilterCJ *taskDemsonFilterCJ = new AliAnalysisTaskSEDmesonsFilterCJ("AliAnalysisTaskSEDmesonsFilterCJ");
+  taskDemsonFilterCJ->SetCutDzero(cutDzero);
+  taskDemsonFilterCJ->SetCutDstar(cutDstar);
+  mgr->AddTask(taskDemsonFilterCJ);
+
+  mgr->ConnectInput( taskDemsonFilterCJ, 0, mgr->GetCommonInputContainer());
+//mgr->ConnectOutput(taskDemsonFilterCJ, 0, mgr->GetCommonOutputContainer());
+
+  TString sCommon  = AliAnalysisManager::GetCommonFileName();
+  TString sCutName = "AnalysisCutsDmeson.root";
+  TString sOutput1 = "AliAnalysisTaskSEDmesonsFilterCJ_ListDmesonCuts";
+  TString sOutput2 = "AliAnalysisTaskSEDmesonsFilterCJ_Dzero_ControlHistograms";
+  TString sOutput3 = "AliAnalysisTaskSEDmesonsFilterCJ_Dstar_ControlHistograms";
+  mgr->ConnectOutput(taskDemsonFilterCJ, 1, mgr->CreateContainer(sOutput1.Data(),TList::Class(),AliAnalysisManager::kOutputContainer,sCutName.Data()));
+  mgr->ConnectOutput(taskDemsonFilterCJ, 2, mgr->CreateContainer(sOutput2.Data(),TList::Class(),AliAnalysisManager::kOutputContainer, sCommon.Data()));
+  mgr->ConnectOutput(taskDemsonFilterCJ, 3, mgr->CreateContainer(sOutput3.Data(),TList::Class(),AliAnalysisManager::kOutputContainer, sCommon.Data()));
+  return taskDemsonFilterCJ;
+}
diff --git a/PWGJE/FlavourJetTasks/macros/AddTasksFlavourJet.C b/PWGJE/FlavourJetTasks/macros/AddTasksFlavourJet.C
new file mode 100644 (file)
index 0000000..610c15d
--- /dev/null
@@ -0,0 +1,84 @@
+// $Id$
+
+void AddTasksFlavourJet()
+{
+  const UInt_t uTriggerMask = AliVEvent::kMB;
+
+  const TString sCutDzero = "cutsHF/D0toKpiCutsppRecVtxNoPileupRejNoEMCAL.root";
+  const TString sCutDstar = "cutsHF/DStartoKpipiCuts.root"; 
+
+  const TString sInputTrk  = "tracks";
+  const TString sUsedTrks  = "PicoTracks";
+  const TString sUsedClus  = "";
+  const TString sRunPeriod = "-1:-1";
+
+  const Int_t iJetAlgo = 1;
+  const Int_t iJetType = 1;
+
+  const Int_t    uBeamType   = 0; 
+  const Double_t dJetPtCut   = 0.;
+  const Double_t dJetAreaCut = 0.;
+
+  const Int_t    nRadius = 3;
+  const Double_t aRadius[] = {  0.2,   0.4,   0.6  };
+  const TString  sRadius[] = { "R02", "R04", "R06" };
+//=============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+
+  if (!mgr) {
+    ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "No analysis manager to connect to.");
+    return NULL;
+  }
+
+  TString type = mgr->GetInputEventHandler()->GetDataType();
+  if (!type.Contains("ESD") && !type.Contains("AOD")) {
+    ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "Task manager to have an ESD or AOD input handler.");
+    return NULL;
+  }
+
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "This task requires an input event handler");
+    return NULL;
+  }
+//=============================================================================
+
+  UInt_t uAnaType = (((iJetType==0) ||     (iJetType==2)) ? 1 : 0);
+  Int_t  iLeading =  ((iJetType==0) ? 3 : ((iJetType==1)  ? 0 : 1));
+
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+  AliAnalysisTaskSE *taskRespPID = AddTaskPIDResponse(bIsMC);
+  taskRespPID->SelectCollisionCandidates(uTriggerMask);
+
+  gROOT->LoadMacro("AddTaskSEDmesonsFilterCJ.C");
+  AliAnalysisTaskSEDmesonsFilterCJ *taskDmesonsFilter = AddTaskSEDmesonsFilterCJ(sCutDzero,sCutDstar);
+  taskDmesonsFilter->SelectCollisionCandidates(uTriggerMask);
+
+  gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
+  AliEmcalSetupTask *taskSetupEMCal = AddTaskEmcalSetup();
+  taskSetupEMCal->SetGeoPath("$ALICE_ROOT/OADB/EMCAL");
+  taskSetupEMCal->SelectCollisionCandidates(uTriggerMask);
+
+  gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPicoTrackMaker.C");
+  AliEmcalPicoTrackMaker *taskPicoTrack = AddTaskEmcalPicoTrackMaker(sUsedTrks.Data(),sInputTrk.Data(),sRunPeriod.Data());
+  taskPicoTrack->SelectCollisionCandidates(uTriggerMask);
+
+  gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");
+  gROOT->LoadMacro("AddTaskFlavourJetCorrelations.C");
+
+  for (Int_t i=0; i<nRadius; i++) {
+    AliEmcalJetTask *taskFJ = AddTaskEmcalJet(sUsedTrks.Data(),sUsedClus.Data(),iJetAlgo,aRadius[i],iJetType);
+    taskFJ->SelectCollisionCandidates(uTriggerMask);
+
+    AliAnalysisTaskFlavourJetCorrelations *taskFlavourCJ = AddTaskFlavourJetCorrelations(sUsedTrks,sUsedClus,taskFJ->GetName());
+    taskFlavourCJ->SetName(Form("AliAnalysisTaskFlavourJetCorrelations_%s",sRadius[i].Data()));
+    taskFlavourCJ->SetForceBeamType(uBeamType);
+    taskFlavourCJ->SetAnaType(uAnaType);
+    taskFlavourCJ->SetLeadingHadronType(iLeading);
+    taskFlavourCJ->SetJetRadius(aRadius[i]);
+    taskFlavourCJ->SetJetPtCut(dJetPtCut);
+    taskFlavourCJ->SetPercAreaCut(dJetAreaCut);
+    taskFlavourCJ->SelectCollisionCandidates(uTriggerMask);
+  }
+
+  return;
+}
diff --git a/PWGJE/FlavourJetTasks/macros/AnalysisTrainCorrJetsLocal.C b/PWGJE/FlavourJetTasks/macros/AnalysisTrainCorrJetsLocal.C
new file mode 100644 (file)
index 0000000..5f8da5d
--- /dev/null
@@ -0,0 +1,216 @@
+// $Id$
+
+const Int_t  mode   = 0; // 0-->Local, 1-->Grid interactive
+const Bool_t bIsAOD = kTRUE;
+const Bool_t bIsMC  = kFALSE;
+
+const Bool_t bIsPhysSel = kFALSE;
+const Bool_t bIsCentSel = kFALSE;
+const Bool_t bIsEvnPSel = kFALSE;
+const Bool_t bIsRespPID = kFALSE;
+
+const TString setData = "dataset.txt";
+//=============================================================================
+
+const Bool_t bIsEMCalAna = kFALSE;
+
+const Bool_t   bFastOnly   = kTRUE;
+const Bool_t   bHistoW     = kTRUE;
+const Double_t dMinEclus   =  5.;
+const Double_t dMinPtClus  =  5.;
+const Double_t dVz         = 10.;
+const Bool_t   bVzDiff     = kTRUE;
+const Double_t dCentMin    = -1.;
+const Double_t dCentMax    = -1.;
+const Double_t dMinScaleCT = -1.;
+const Double_t dMaxScaleCT = -1.;
+//=============================================================================
+
+void AnalysisTrainCorrJetsLocal()
+{
+  if (mode==1 && !TGrid::Connect("alien://")) {
+    ::Error("AnalysisTrainCorrJetsLocal.C::AnalysisTrainCorrJetsLocal", "Can not connect to the Grid!");
+    return;
+  }
+  if (LoadLibraries()) {
+    ::Error("AnalysisTrainCorrJetsLocal.C::AnalysisTrainCorrJetsLocal", "Load libraries failed!");
+    return;
+  }
+//=============================================================================
+
+  TChain *chain = CreateAODFriendChain(setData);
+  if (!chain) {
+    ::Error("AnalysisTrainCorrJetsLocal.C::AnalysisTrainCorrJetsLocal", "Creating input chain failed!");
+    return;
+  }
+//=============================================================================
+
+  const UInt_t triggerMask = AliVEvent::kMB;
+  AliAnalysisManager *mgr  = new AliAnalysisManager("AnalysisTrainCorrJetsLocal", "Analysis Train Jet Correlation Local");
+
+  if (bIsAOD) {
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODHandler.C");
+    AliAODInputHandler *aodIH = AddAODHandler();
+  } else {
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddESDHandler.C");
+    AliESDInputHandler *esdIH = AddESDHandler();
+//  esdIH->SetReadFriends(kFALSE);
+  }
+  if (bIsMC && !bIsAOD) {
+    AliMCEventHandler *mctEH = new AliMCEventHandler();
+    mcH->SetPreReadMode(AliMCEventHandler::kLmPreRead);
+    mcH->SetReadTR(kTRUE);
+    mgr->SetMCtruthEventHandler(mcH);
+  }
+//=============================================================================
+
+  if (bIsPhysSel && !bIsAOD && !bIsEMCalAna) {
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
+    AliPhysicsSelectionTask *taskPhysSel = AddTaskPhysicsSelection(bIsMC);
+  }
+
+  if (bIsCentSel && !bIsAOD) {
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
+    AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
+    if (bIsMC) taskCentrality->SetMCInput();
+  }
+
+  if (bIsEvnPSel) {
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskEventplane.C");
+    AliEPSelectionTask *taskEventPlane = AddTaskEventplane();
+    if (bIsMC) taskEventPlane->SetUseMCRP();
+  }
+
+  if (bIsRespPID) {
+    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+    AliAnalysisTaskSE *taskRespPID = AddTaskPIDResponse(bIsMC);
+  }
+//=============================================================================
+
+  if (bIsEMCalAna) {
+    if (bIsEvnPSel) {
+      gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPhysicsSelection.C");
+      AliPhysicsSelectionTask *taskPhysSel = AddTaskEmcalPhysicsSelection(bFastOnly,   bHistoW, triggerMask,
+                                                                          dMinEclus,   dMinPtClus,
+                                                                          dVz,         bVzDiff,
+                                                                          bIsCentSel ? dCentMin : -1.,
+                                                                          bIsCentSel ? dCentMax : -1.,
+                                                                          dMinScaleCT, dMaxScaleCT);
+    }
+
+    gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
+    AliEmcalSetupTask *taskSetupEMCal = AddTaskEmcalSetup();
+    taskSetupEMCal->SetGeoPath("$ALICE_ROOT/OADB/EMCAL");
+
+    gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskJetPreparation.C");
+    AddTaskJetPreparation(bIsAOD ? "AOD" : "ESD"); //TODO
+  }
+//=============================================================================
+
+  gROOT->LoadMacro("AddTasksFlavorJet.C"); AddTasksFlavorJet();
+  if (mgr->InitAnalysis()) { mgr->PrintStatus(); mgr->StartAnalysis("local",chain); }
+  return;
+}
+
+//=============================================================================
+TChain *CreateAODFriendChain(TString setData)
+{ 
+  if (!setData.EndsWith(".txt")) return 0;
+
+  TChain *chain = new TChain("aodTree");
+  TChain *cFrid = new TChain("aodTree");
+
+  TString dataFile;
+  ifstream dataList(setData.Data(), ios::in); 
+  while (!dataList.eof()) {
+    dataFile.ReadLine(dataList,kFALSE);
+    if (!dataFile.EndsWith("AliAOD.root")) continue;
+    if (!gSystem->AccessPathName(dataFile.Data())) chain->Add(dataFile.Data());
+
+    dataFile.ReplaceAll("AliAOD.root","AliAOD.VertexingHF.root");
+    if (!gSystem->AccessPathName(dataFile.Data())) cFrid->Add(dataFile.Data());
+  } dataList.close();
+
+  chain->AddFriend(cFrid);
+  return chain;
+}
+
+//=============================================================================
+Bool_t LoadLibraries()
+{
+  if (gSystem->Load("libTree")       <0) return kTRUE;
+  if (gSystem->Load("libGeom")       <0) return kTRUE;
+  if (gSystem->Load("libPhysics")    <0) return kTRUE;
+  if (gSystem->Load("libVMC")        <0) return kTRUE;
+  if (gSystem->Load("libMinuit")     <0) return kTRUE;
+  if (gSystem->Load("libMinuit2")    <0) return kTRUE;
+
+  if (gSystem->Load("libCore")       <0) return kTRUE;
+  if (gSystem->Load("libXMLIO")      <0) return kTRUE;
+  if (gSystem->Load("libXMLParser")  <0) return kTRUE;
+  if (gSystem->Load("libProof")      <0) return kTRUE;
+  if (gSystem->Load("libProofPlayer")<0) return kTRUE;
+  if (gSystem->Load("libGui")        <0) return kTRUE;
+//=============================================================================
+
+  gSystem->AddIncludePath("-Wno-deprecated");
+  gSystem->AddIncludePath("-I$ALICE_ROOT/include");
+  gSystem->AddIncludePath("-I$ALICE_ROOT/PWGHF/vertexingHF");
+  gSystem->AddIncludePath("-I$ALICE_ROOT/EMCAL");
+  gSystem->AddIncludePath("-I$ALICE_ROOT/JETAN");
+  gSystem->AddIncludePath("-I$ALICE_ROOT/JETAN/fastjet");
+
+  if (gSystem->Load("libSTEERBase")         <0) return kTRUE;
+  if (gSystem->Load("libESD")               <0) return kTRUE;
+  if (gSystem->Load("libAOD")               <0) return kTRUE;
+  if (gSystem->Load("libANALYSIS")          <0) return kTRUE;
+  if (gSystem->Load("libOADB")              <0) return kTRUE;
+  if (gSystem->Load("libANALYSISalice")     <0) return kTRUE;
+  if (gSystem->Load("libCORRFW")            <0) return kTRUE;
+
+  if (gSystem->Load("libPWGTools")          <0) return kTRUE;
+  if (gSystem->Load("libPWGflowBase")       <0) return kTRUE;
+  if (gSystem->Load("libPWGflowTasks")      <0) return kTRUE;
+  if (gSystem->Load("libPWGHFbase")         <0) return kTRUE;
+  if (gSystem->Load("libPWGHFvertexingHF")  <0) return kTRUE;
+
+  if (gSystem->Load("libSTAT")              <0) return kTRUE;
+  if (gSystem->Load("libEMCALUtils")        <0) return kTRUE;
+//if (gSystem->Load("libPHOSUtils")         <0) return kTRUE;
+
+  if (gSystem->Load("libCDB")               <0) return kTRUE;
+  if (gSystem->Load("libRAWDatabase")       <0) return kTRUE;
+  if (gSystem->Load("libRAWDatarec")        <0) return kTRUE;
+  if (gSystem->Load("libSTEER")             <0) return kTRUE;
+  if (gSystem->Load("libITSbase")           <0) return kTRUE;
+  if (gSystem->Load("libITSrec")            <0) return kTRUE;
+  if (gSystem->Load("libTPCbase")           <0) return kTRUE;
+  if (gSystem->Load("libTPCrec")            <0) return kTRUE;
+  if (gSystem->Load("libTRDbase")           <0) return kTRUE;
+  if (gSystem->Load("libTRDrec")            <0) return kTRUE;
+  if (gSystem->Load("libTOFbase")           <0) return kTRUE;
+//if (gSystem->Load("libTOFrec")            <0) return kTRUE;
+  if (gSystem->Load("libHMPIDbase")         <0) return kTRUE;
+  if (gSystem->Load("libEMCALraw")          <0) return kTRUE;
+  if (gSystem->Load("libEMCALbase")         <0) return kTRUE;
+  if (gSystem->Load("libEMCALrec")          <0) return kTRUE;
+  if (gSystem->Load("libVZERObase")         <0) return kTRUE;
+  if (gSystem->Load("libVZEROrec")          <0) return kTRUE;
+  if (gSystem->Load("libTENDER")            <0) return kTRUE;
+  if (gSystem->Load("libTENDERSupplies")    <0) return kTRUE;
+
+  if (gSystem->Load("libCGAL")              <0) return kTRUE;
+  if (gSystem->Load("libfastjet")           <0) return kTRUE;
+  if (gSystem->Load("libsiscone")           <0) return kTRUE;
+  if (gSystem->Load("libSISConePlugin")     <0) return kTRUE;
+
+  if (gSystem->Load("libJETAN")             <0) return kTRUE;
+  if (gSystem->Load("libFASTJETAN")         <0) return kTRUE;
+  if (gSystem->Load("libPWGEMCAL")          <0) return kTRUE;
+  if (gSystem->Load("libPWGGAEMCALTasks")   <0) return kTRUE;
+  if (gSystem->Load("libPWGJEEMCALJetTasks")<0) return kTRUE;
+
+  if (gROOT->LoadMacro("AliAnalysisTaskSEDmesonsFilterCJ.cxx+")  <0) return kTRUE;
+  if (gROOT->LoadMacro("AliAnalysisTaskFlavorJetCorrelations.cxx+")<0) return kTRUE;
+  return kFALSE;
+}
diff --git a/PWGJE/PWGJEFlavourJetTasksLinkDef.h b/PWGJE/PWGJEFlavourJetTasksLinkDef.h
new file mode 100644 (file)
index 0000000..239535f
--- /dev/null
@@ -0,0 +1,12 @@
+// $Id$
+
+#ifdef __CINT__
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliAnalysisTaskSEDmesonsFilterCJ+;
+#pragma link C++ class AliAnalysisTaskFlavourJetCorrelations+;
+
+#endif