Adding AOD task for FMDEventPlaneFinder
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskFMDEventPlane.C
1 /**
2  * @file   AddTaskForwardFlow.C
3  * @author Alexander Hansen alexander.hansen@cern.ch 
4  * @date   Wed Sep 07 12:14:17 2011
5  * 
6  * @brief  
7  * 
8  * 
9  * @ingroup pwglf_forward_scripts_tasks
10  */
11 /** 
12  * @defgroup pwglf_forward_flow Flow 
13  * @ingroup pwglf_forward_topical
14  */
15 /** 
16  * Add Flow task to train 
17  * 
18  * @param type 
19  * @param etabins 
20  * @param mc 
21  * @param addFlow 
22  * @param addFType 
23  * @param addFOrder 
24  *
25  * @ingroup pwglf_forward_flow
26  */
27 void AddTaskFMDEventPlane(Bool_t mc = kFALSE)
28 {
29   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
30   if (!mgr) {
31     Error("AddTaskFMDEventPlane", "No analysis manager to connect to.");
32     return NULL;
33   }   
34
35   AliAODInputHandler* aodInput = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
36    
37   Bool_t aod = kFALSE;
38   if (aodInput) aod = kTRUE;
39   if (!aod) {
40     Error("AddTaskFMDEventPlane", "No analysis manager to connect to.");
41     return NULL;
42   }
43
44   // --- Create containers for output --- //
45   AliAnalysisDataContainer* sums = 
46     mgr->CreateContainer("FMDEventPlaneSums", TList::Class(), 
47                          AliAnalysisManager::kOutputContainer, 
48                          AliAnalysisManager::GetCommonFileName());
49   AliAnalysisDataContainer* output = 
50     mgr->CreateContainer("FMDEventPlaneResults", TList::Class(), 
51                          AliAnalysisManager::kParamContainer, 
52                          AliAnalysisManager::GetCommonFileName());
53
54   // --- For the selected flow tasks the input and output is set --- //
55   
56   AliFMDEventPlaneTask* task = new AliFMDEventPlaneTask("FMDEventPlane");
57   task->GetEventPlaneFinder().SetUsePhiWeights(false);
58
59   if (mc) task->SetMCInput(true);
60
61   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
62   mgr->ConnectOutput(task, 1, sums);
63   mgr->ConnectOutput(task, 2, output);
64
65   return;
66 }