]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/AddTaskForwardFlow.C
Coverity fixes
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AddTaskForwardFlow.C
CommitLineData
ffca499d 1/**
2 * @file AddTaskForwardFlow.C
3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Wed Mar 23 12:14:17 2011
5 *
6 * @brief
7 *
8 *
9 * @ingroup pwg2_forward_scripts_tasks
10 */
11/**
12 * @defgroup pwg2_forward_flow Flow
13 * @ingroup pwg2_forward_topical
14 */
15/**
16 * Add Flow task to train
17 *
18 * @param type
19 * @param etabins
20 * @param zVertex
21 * @param addFlow
22 * @param addFType
23 * @param addFOrder
24 *
25 * @ingroup pwg2_forward_flow
26 */
58f5fae2 27void AddTaskForwardFlow(TString type = "",
28 Int_t etabins = 40,
29 Int_t zVertex = 2,
30 TString addFlow = "",
31 Int_t addFType = 0,
32 Int_t addFOrder = 0)
d2bea14e 33{
34 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
35 if (!mgr) {
36 Error("AddFMDFlowTask", "No analysis manager to connect to.");
37 return NULL;
38 }
39
40 AliAODInputHandler* aodInput = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
41
42 Bool_t aod = kFALSE;
43 if (aodInput) aod = kTRUE;
44 if (!aod) {
45 Error("AddTaskForwardFlow", "No analysis manager to connect to.");
46 return NULL;
47 }
48
49 // --- Check which harmonics to calculate --- //
50
51 Bool_t v1 = kTRUE;
52 Bool_t v2 = kTRUE;
53 Bool_t v3 = kTRUE;
54 Bool_t v4 = kTRUE;
55
56 if (type.Length() > 0) {
57 if (!type.Contains("1")) v1 = kFALSE;
58 if (!type.Contains("2")) v2 = kFALSE;
59 if (!type.Contains("3")) v3 = kFALSE;
60 if (!type.Contains("4")) v4 = kFALSE;
61 }
62
63 // --- Create output containers and find input from fmd task --- //
64
65 TString outputFile = AliAnalysisManager::GetCommonFileName();
66 outputFile += ":FlowResults";
67
68 AliAnalysisDataContainer* qcout = mgr->CreateContainer("QCumulants", TList::Class(), AliAnalysisManager::kOutputContainer, outputFile);
69
70 // --- For the selected flow tasks the input and output is set --- //
71
72 AliForwardFlowTaskQC* qc = new AliForwardFlowTaskQC("QCumulants");
73
74 qc->SetDoHarmonics(v1, v2, v3, v4);
75 qc->SetUseNEtaBins(etabins);
58f5fae2 76 qc->AddFlow(addFlow);
77 qc->AddFlowType(addFType);
78 qc->AddFlowOrder(addFOrder);
79 qc->SetVertexRange(zVertex);
d2bea14e 80
58f5fae2 81 mgr->ConnectInput(qc, 0, mgr->GetCommonInputContainer());
d2bea14e 82 mgr->ConnectOutput(qc, 0, mgr->GetCommonOutputContainer());
83 mgr->ConnectOutput(qc, 1, qcout);
84
85 return;
86}