several updates for HFEv2 by TPC-EMCal EP
[u/mrichter/AliRoot.git] / PWGHF / hfe / macros / AddTaskFlowTPCEMCalEP.C
CommitLineData
0f3a6a57 1AliAnalysisTask *AddTaskFlowTPCEMCalEP(Double_t openingAngle = 0.1,
2 Double_t invMass = 0.01,
3 TString nonHFEalgorithm = "KF")
4a8938c9 4{
5 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
6 if (!mgr) {
7 Error("AddTaskFlowTPCEMCalEP", "No analysis manager found.");
8 return NULL;
9 }
10
11 if (!mgr->GetInputEventHandler()) {
12 ::Error("AddTaskFlowTPCEMCalEP", "This task requires an input event handler");
13 return NULL;
14 }
15 TString type = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
16 if (type=="AOD"){
17 ::Error("AddTaskFlowTPCEMCalEP", "The tasks exits because AODs are in input");
18 return NULL;
19 }
20 Bool_t MCthere=kFALSE;
21 AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*>(mgr->GetMCtruthEventHandler());
22 if(!mcH){
23 MCthere=kFALSE;
24 }else{
25 MCthere=kTRUE;
26 }
27
28
29 //Event plane task
30 AliEPSelectionTask *eventplaneTask = new AliEPSelectionTask("EventplaneSelection");
31 eventplaneTask->SelectCollisionCandidates(AliVEvent::kMB | AliVEvent::kSemiCentral | AliVEvent::kCentral | AliVEvent::kEMCEGA | AliVEvent::kEMCEJE);
32
33 eventplaneTask->SetTrackType("TPC");
34 eventplaneTask->SetUsePtWeight();
35 eventplaneTask->SetUsePhiWeight();
36 eventplaneTask->SetSaveTrackContribution();
37
38 mgr->AddTask(eventplaneTask);
39
40 TString containerName3 = mgr->GetCommonFileName();
41 containerName3 += ":PWGHF_hfeCalEventPlane";
42
43 AliAnalysisDataContainer *cinput0 = mgr->GetCommonInputContainer();
44 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("EPStat",TList::Class(), AliAnalysisManager::kOutputContainer,containerName3.Data());
45 mgr->ConnectInput(eventplaneTask, 0, mgr->GetCommonInputContainer());
46 mgr->ConnectOutput(eventplaneTask,1,coutput1);
47
48 //analysis task
49// gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/AliAnalysisTaskFlowTPCEMCalEP.cxx++g");
50 gROOT->LoadMacro("$ALICE_ROOT/PWGHF/hfe/macros/configs/PbPb/ConfigHFE_FLOW_TPCEMCal_EP.C");
51
0f3a6a57 52 AliAnalysisTaskFlowTPCEMCalEP *taskMB = ConfigHFE_FLOW_TPCEMCal_EP(MCthere,openingAngle,invMass,nonHFEalgorithm);
53 AliAnalysisTaskFlowTPCEMCalEP *taskTR = ConfigHFE_FLOW_TPCEMCal_EP(MCthere,openingAngle,invMass,nonHFEalgorithm);
4a8938c9 54
55 mgr->AddTask(taskMB);
56 mgr->AddTask(taskTR);
57
58 // Central trigger
0f3a6a57 59 taskMB->SelectCollisionCandidates(AliVEvent::kSemiCentral | AliVEvent::kCentral);
60
4a8938c9 61 TString containerName = mgr->GetCommonFileName();
62 containerName += ":PWGHF_hfeCalCentralV2";
63
64 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
65 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histMB", TList::Class(),AliAnalysisManager::kOutputContainer, containerName.Data());
66 mgr->ConnectInput(taskMB, 0, cinput);
67 mgr->ConnectOutput(taskMB, 1, coutput1);
68
69 //L1 gamma and jet trigger
0f3a6a57 70 taskTR->SelectCollisionCandidates(AliVEvent::kEMCEGA);
71
4a8938c9 72 TString containerName2 = mgr->GetCommonFileName();
73 containerName2 += ":PWGHF_hfeCalL1GammaV2";
74
75 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
76 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histTR", TList::Class(),AliAnalysisManager::kOutputContainer, containerName2.Data());
77 mgr->ConnectInput(taskTR, 0, cinput);
78 mgr->ConnectOutput(taskTR, 1, coutput1);
79
80 if(MCthere){
81
0f3a6a57 82 AliAnalysisTaskFlowTPCEMCalEP *taskMC = ConfigHFE_FLOW_TPCEMCal_EP(MCthere,openingAngle,invMass,nonHFEalgorithm);
4a8938c9 83 mgr->AddTask(taskMC);
84
85 taskMC->SelectCollisionCandidates(AliVEvent::kMB);
86
87 TString containerName3 = mgr->GetCommonFileName();
88 containerName3 += ":PWGHF_hfeCalMCV2";
89
90 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
91 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("histMC", TList::Class(),AliAnalysisManager::kOutputContainer, containerName3.Data());
92 mgr->ConnectInput(taskMC, 0, cinput);
93 mgr->ConnectOutput(taskMC, 1, coutput1);
94 }
95
96
97 return NULL;
98}
0f3a6a57 99