664a775e9d8bd75f1061001ae1271fa78ae2d191
[u/mrichter/AliRoot.git] / PWGJE / FlavourJetTasks / macros / AddTasksFlavourJet.C
1 // $Id$
2
3 void AddTasksFlavourJet(const Int_t iCandType = 1 /*0 = D0, 1=Dstar...*/,
4                         const TString sCutFile = "cutsHF/D0toKpiCutsppRecVtxNoPileupRejNoEMCAL.root",
5                         const Double_t dJetPtCut   = 1.,
6                         const Double_t dJetAreaCut = 0.,
7                         const Int_t iAccCut = 1,
8                         const TString sRunPeriod = "LHC10b",
9                         const Int_t    uBeamType = 0,
10                         const UInt_t uTriggerMask = AliVEvent::kMB, /*for jets; the D mesons trigger is defined in the cut object*/
11                         const Bool_t bIsMC = kFALSE,
12                         TString sText=""/*completes the name of the candidate task lists*/
13 )
14 {
15   const TString sInputTrk  = "tracks";
16   const TString sUsedTrks  = "PicoTracks";
17   const TString sUsedClus  = "";
18
19   const Int_t iJetAlgo = 1;
20   const Int_t iJetType = 1;
21
22   const Int_t    nRadius = 3;
23   const Double_t aRadius[] = {  0.2,   0.4,   0.6  };
24   const TString  sRadius[] = { "R02", "R04", "R06" };
25 //=============================================================================
26
27   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
28
29   if (!mgr) {
30     ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "No analysis manager to connect to.");
31     return;
32   }
33
34   TString type = mgr->GetInputEventHandler()->GetDataType();
35   if (!type.Contains("ESD") && !type.Contains("AOD")) {
36     ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "Task manager to have an ESD or AOD input handler.");
37     return;
38   }
39
40   if (!mgr->GetInputEventHandler()) {
41     ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "This task requires an input event handler");
42     return;
43   }
44 //=============================================================================
45
46   UInt_t uAnaType = (((iJetType==0) ||     (iJetType==2)) ? 1 : 0);
47   Int_t  iLeading =  ((iJetType==0) ? 3 : ((iJetType==1)  ? 0 : 1));
48
49   //D mesons -- PID
50   gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
51   AliAnalysisTaskSE *taskRespPID = AddTaskPIDResponse(bIsMC);
52
53   // -- D meson selection
54   gROOT->LoadMacro("AliAnalysisTaskSEDmesonsForJetCorrelations.cxx++g");
55   gROOT->LoadMacro("AddTaskDmesonsForJetCorrelations.C");
56   AliAnalysisTaskSEDmesonsForJetCorrelations *taskDmesonsFilter = AddTaskDmesonsForJetCorrelations(iCandType,sCutFile,bIsMC,sText);
57
58   // EMCal framework
59   // -- Physics selection task
60   gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPhysicsSelection.C");
61   AliPhysicsSelectionTask *physSelTask = AddTaskEmcalPhysicsSelection(kTRUE, kTRUE, uTriggerMask, 5, 5, 10, kTRUE, -1, -1, -1, -1);
62
63   if (!physSelTask) {
64     cout << "no physSelTask"; 
65     return; 
66   }
67
68   // -- 
69   gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
70   AliEmcalSetupTask *taskSetupEMCal = AddTaskEmcalSetup();
71   taskSetupEMCal->SetGeoPath("$ALICE_ROOT/OADB/EMCAL");
72   taskSetupEMCal->SelectCollisionCandidates(uTriggerMask);
73
74   // Jet preparation
75   gROOT->LoadMacro("/data/Work/jets/testEMCalJetFramework/code/v4/AddTaskJetPreparation.C");
76   AddTaskJetPreparation(type,bIsMC,sRunPeriod);
77
78 /*gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPicoTrackMaker.C");
79   AliEmcalPicoTrackMaker *taskPicoTrack = AddTaskEmcalPicoTrackMaker(sUsedTrks.Data(),sInputTrk.Data(),sRunPeriod.Data());
80   taskPicoTrack->SelectCollisionCandidates(uTriggerMask);*/
81
82   gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");
83   gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJetSample.C");
84   gROOT->LoadMacro("AliAnalysisTaskRecoJetCorrelations.cxx++g");
85   gROOT->LoadMacro("AddTaskRecoJetCorrelations.C");
86
87   for (Int_t i=0; i<nRadius; i++) {
88     AliEmcalJetTask *taskFJ = AddTaskEmcalJet(sUsedTrks.Data(),sUsedClus.Data(),iJetAlgo,aRadius[i],iJetType);
89     taskFJ->SelectCollisionCandidates(uTriggerMask);
90
91     AliAnalysisTaskFlavourJetCorrelations *taskDmesonCJ = AddTaskFlavourJetCorrelations(iCandType,
92                                                                                         sCutFile,
93                                                                                         bIsMC,
94                                                                                         taskFJ->GetName(),
95                                                                                         Form("JetR%s",sRadius[i].Data()),
96                                                                                         iLeading,
97                                                                                         aRadius[i],
98                                                                                         dJetPtCut,
99                                                                                         iAccCut,
100                                                                                         dJetAreaCut);
101
102     taskDmesonCJ->SetName(Form("AliAnalysisTaskSEEmcalJetDmesonsCJ_%s",sRadius[i].Data()));
103     taskDmesonCJ->SetForceBeamType(uBeamType);
104     taskDmesonCJ->SetAnaType(uAnaType);
105     taskDmesonCJ->SetLeadingHadronType(iLeading);
106 //  taskDmesonCJ->SelectCollisionCandidates(uTriggerMask);
107   }
108
109   return;
110 }