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