Improve use of JetContainers, fix cluster name in AddTasks
[u/mrichter/AliRoot.git] / PWGJE / FlavourJetTasks / macros / AddTaskFlavourJetCorrelations.C
CommitLineData
c683985a 1AliAnalysisTaskFlavourJetCorrelations *AddTaskFlavourJetCorrelations(
c683985a 2 Bool_t theMCon = kFALSE,
3 Bool_t reco = kTRUE /*must be true if theMCon is false*/,
4 TString jetArrname = "",
0455d618 5 UInt_t pSel=AliVEvent::kAny,
6 TString trigClass="",
c683985a 7 TString suffix = "",
cc5dbb3b 8 TString trackArrname = "PicoTracks",
c683985a 9 Bool_t triggerOnLeadingJet = kFALSE,
10 Int_t leadingHadType = 0 /*0 = charged, 1 = neutral, 2 = both*/,
11 Float_t R = 0.4,
12 Float_t jptcut = 10.,
13 const char *cutType = "TPC",
0455d618 14 Double_t percjetareacut = 1.,
15 Bool_t bJetOnly=kTRUE
16 )
c683985a 17{
18 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
19 if (!mgr) {
0455d618 20 ::Error("AddTaskFlavourJetCorrelations::AddTaskFlavourJetCorrelations", "No analysis manager to connect to.");
21 return NULL;
c683985a 22 }
0455d618 23 if(bJetOnly){//only jet histograms, no correlation with D mesons
24
25 //used for event selection
26 AliRDHFCuts *dummyDcut=new AliRDHFCutsD0toKpi("dummy");
27 dummyDcut->SetTriggerMask(pSel);
28 dummyDcut->SetTriggerClass(trigClass);
29 AliAODPidHF *pidHF=new AliAODPidHF();
30 dummyDcut->SetPidHF(pidHF);
31
32 Int_t dummycand=AliAnalysisTaskFlavourJetCorrelations::kD0toKpi;
33
34 // create the task
35 AliAnalysisTaskFlavourJetCorrelations *task = new AliAnalysisTaskFlavourJetCorrelations("AnaTaskFlavourJetCorrelations",
a8b2b672 36 dummyDcut, dummycand, bJetOnly);
cc5dbb3b 37 task->SetJetArrayName(jetArrname);
38 task->SetTrackArrayName(trackArrname);
0455d618 39 task->SetMC(theMCon);
40 task->SetUseReco(reco);
41 task->SetTriggerOnLeadingJet(triggerOnLeadingJet);
42 task->SetJetAcceptanceType(cutType);
43 task->SetJetPtCut(jptcut);
44 task->SetPercAreaCut(percjetareacut);
0455d618 45 mgr->AddTask(task);
c683985a 46
0455d618 47 if(theMCon) {
48 suffix+="MC";
49 if(reco) suffix+="rec";
50 }
51
52 // Create and connect containers for input/output
53 TString outputfile = AliAnalysisManager::GetCommonFileName();
54 outputfile += ":PWGJE_HF_DEmcalJet";
55 outputfile += jetArrname;
56 outputfile += trigClass;
57 TString nameContainer1="listJets";
58 TString nameContainer2="evselCut";
59 //nameContainer1 += candname;
60
61 nameContainer1 += suffix;
62 nameContainer2 += suffix;
63
64 // ------ input data ------
65 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
66
67 // ----- output data -----
68 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(nameContainer1, TList::Class(),AliAnalysisManager::kOutputContainer,outputfile.Data());
69 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(nameContainer2, AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, outputfile.Data());
c683985a 70
0455d618 71 mgr->ConnectInput(task,0,mgr->GetCommonInputContainer());
72 mgr->ConnectOutput(task,1,coutput1);
73 mgr->ConnectOutput(task,2,coutput2);
c683985a 74
0455d618 75
76 } else{
77 AliFatal("ERROR: Use AddTaskDFilterAndCorrelations instead");
78
c683985a 79 }
80
c683985a 81 Printf("Input and Output connected to the manager");
82 return task ;
83}