]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AddTaskForwardFlow.C
Updates to DebugGuard
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskForwardFlow.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 AddTaskForwardFlow(TString type = "", 
28                         Bool_t mc = kFALSE,
29                         TString addFlow = "",
30                         Int_t addFType = 0,
31                         Int_t addFOrder = 0)
32 {
33   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
34   if (!mgr) {
35     Error("AddFMDFlowTask", "No analysis manager to connect to.");
36     return NULL;
37   }   
38
39   AliAODInputHandler* aodInput = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
40    
41   Bool_t aod = kFALSE;
42   if (aodInput) aod = kTRUE;
43   if (!aod) {
44     Error("AddTaskForwardFlow", "No analysis manager to connect to.");
45     return NULL;
46   }
47
48   // --- Check which harmonics to calculate --- //
49
50   Bool_t v1 = kTRUE;
51   Bool_t v2 = kTRUE;
52   Bool_t v3 = kTRUE;
53   Bool_t v4 = kTRUE;
54   Bool_t v5 = kTRUE;
55   Bool_t v6 = kTRUE;
56
57   if (type.Length() > 0) {
58     if (!type.Contains("1")) v1 = kFALSE;
59     if (!type.Contains("2")) v2 = kFALSE;
60     if (!type.Contains("3")) v3 = kFALSE;
61     if (!type.Contains("4")) v4 = kFALSE;
62     if (!type.Contains("5")) v5 = kFALSE;
63     if (!type.Contains("6")) v6 = kFALSE;
64   }
65
66   // --- Create containers for output --- //
67   AliAnalysisDataContainer* sums = 
68     mgr->CreateContainer("FlowQCSums", TList::Class(), 
69                          AliAnalysisManager::kOutputContainer, 
70                          AliAnalysisManager::GetCommonFileName());
71   AliAnalysisDataContainer* output = 
72     mgr->CreateContainer("FlowQCResults", TList::Class(), 
73                          AliAnalysisManager::kParamContainer, 
74                          AliAnalysisManager::GetCommonFileName());
75
76   // --- For the selected flow tasks the input and output is set --- //
77   
78   AliForwardFlowTaskQC* task = 0;
79   if (mc) 
80     task = new AliForwardMCFlowTaskQC("QCumulants");
81   else
82     task = new AliForwardFlowTaskQC("QCumulants");
83   mgr->AddTask(task); 
84
85   // Set which harmonics to do
86   task->SetDoHarmonics(v1, v2, v3, v4, v5, v6);
87   // Set non-default axis for vertices
88   TAxis* a = new TAxis(20, -10, 10);
89   task->SetVertexAxis(a);
90   // Set debug flag
91   task->SetDebugLevel(0);
92   // Set up adding flow to MC input
93   if (mc) {
94     AliForwardMCFlowTaskQC* mcTask = 
95       static_cast<AliForwardMCFlowTaskQC*>task;
96     mcTask->SetUseImpactParameter(true);
97     mcTask->AddFlow(addFlow);
98     mcTask->AddFlowType(addFType);
99     mcTask->AddFlowOrder(addFOrder);
100   }
101   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
102   mgr->ConnectOutput(task, 1, sums);
103   mgr->ConnectOutput(task, 2, output);
104
105   return;
106 }