2 * @file AddTaskForwardFlow.C
3 * @author Alexander Hansen alexander.hansen@cern.ch
8 * @ingroup pwglf_forward_scripts_tasks
11 * @defgroup pwglf_forward_flow Flow
13 * Code to deal with flow
15 * @ingroup pwglf_forward_topical
18 * Add Flow task to train
20 * @param type Which moments to do
21 * @param useEtaGap Whehter to use @f$\eta@f$ gaps
22 * @param etaGap Size of @f$\eta@f$ gap
23 * @param useCent Whether to use centrality
24 * @param mc Monte-carlo input
25 * @param satVtx Use satellite interactions
26 * @param outlierCutFMD Cut to remove events with outliers
27 * @param outlierCutSPD Cut to remove events with outliers
28 * @param addFlow Afterburn what (MC only)
29 * @param addFType Afterburner parameterization
30 * @param addFOrder Afterburder order
32 * @ingroup pwglf_forward_flow
34 void AddTaskForwardFlow(TString type = "234",
35 Bool_t useEtaGap = kFALSE,
37 Double_t outlierCutFMD = 4.0,
38 Double_t outlierCutSPD = 0,
39 Double_t etaGap = 2.0,
40 Bool_t useCent = kFALSE,
41 Bool_t satVtx = kFALSE,
46 // --- Get analysis manager ----------------------------------------
47 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
49 Fatal("","No analysis manager to connect to.");
51 // --- Check that we have an AOD input handler ---------------------
52 UShort_t aodInput = 0;
53 if (!(aodInput = AliForwardUtil::CheckForAOD()))
54 Fatal("","Cannot proceed without and AOD handler");
56 (!AliForwardUtil::CheckForTask("AliForwardMultiplicityBase") ||
57 !AliForwardUtil::CheckForTask("AliCentralMultiplicityTask")))
58 Fatal("","The relevant tasks weren't added to the train");
60 // --- For the selected flow tasks the input and output is set -----
61 const char* name = (useEtaGap ? "ForwardQCumulantsEtaGap", "ForwardQCumulants");
62 AliForwardFlowTaskQC* task = 0;
63 // --- Set up adding flow to MC input ----------------------------
65 AliForwardMCFlowTaskQC* mcTask = new AliForwardMCFlowTaskQC(name);
66 mcTask->SetUseImpactParameter(!useCent);
67 if (addFlow.Data()[0] != '\0') {
68 mcTask->AddFlow(addFlow);
69 mcTask->AddFlowType(addFType);
70 mcTask->AddFlowOrder(addFOrder);
74 // --- Or use normal task ----------------------------------------
76 task = new AliForwardFlowTaskQC(name);
80 // --- Set flow flags --------------------------------------------
81 UShort_t flags = AliForwardFlowTaskQC::kSymEta;
82 if (useEtaGap) flags |= AliForwardFlowTaskQC::kEtaGap;
83 if (satVtx) flags |= AliForwardFlowTaskQC::kSatVtx;
84 if (useEtaGap || satVtx) flags ^= AliForwardFlowTaskQC::kSymEta;
85 task->SetFlowFlags(flags);
87 // --- Set eta gap value -----------------------------------------
88 task->SetEtaGapValue(etaGap);
90 // --- Check which harmonics to calculate --------------------------
91 const char* harm = type.Data();
93 std::cout << "Type string: " << type.Data();
94 std::cout << "\t harm string: " << harm << std::endl;
95 while (i < type.Length()) {
97 std::cout << "Adding moment: " << c << std::endl;
99 std::cout << "Adding moment: " << n << std::endl;
100 task->AddFlowMoment(n);
104 // --- Set non-default axis for vertices ---------------------------
107 a = new TAxis(6, 93.75, 318.75);
110 a = new TAxis(20, -10, 10);
111 task->SetVertexAxis(a);
113 // --- Set sigma cuts for outliers ---------------------------------
114 task->SetDetectorCuts(outlierCutFMD, outlierCutSPD);
116 // --- Create containers for output --------------------------------
117 const char* sumName = (useEtaGap ? "FlowQCSumsEtaGap" : "FlowQCSums");
118 const char* resName = (useEtaGap ? "FlowQCResultsEtaGap" : "FlowQCResults");
119 AliAnalysisDataContainer* sums =
120 mgr->CreateContainer(sumName, TList::Class(),
121 AliAnalysisManager::kOutputContainer,
122 AliAnalysisManager::GetCommonFileName());
123 AliAnalysisDataContainer* output =
124 mgr->CreateContainer(resName, TList::Class(),
125 AliAnalysisManager::kParamContainer,
126 AliAnalysisManager::GetCommonFileName());
127 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
128 mgr->ConnectOutput(task, 1, sums);
129 mgr->ConnectOutput(task, 2, output);