2 * @file AddTaskForwardFlowQC.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 maxMom Max moment to do
21 * @param useEtaGap Whehter to use @f$\eta@f$ gaps
22 * @param mc Monte-carlo input
23 * @param outlierCutFMD Cut to remove events with outliers
24 * @param outlierCutSPD Cut to remove events with outliers
25 * @param etaGap Size of @f$\eta@f$ gap
26 * @param useCent Whether to use centrality or impact parameter for MC
27 * @param useMCVtx Whether to use vertex info from MC header
28 * @param satVtx Use satellite interactions
29 * @param addFlow Afterburn what (MC only)
30 * @param addFType Afterburner parameterization
31 * @param addFOrder Afterburder order
33 * @ingroup pwglf_forward_flow
35 void AddTaskForwardFlowQC(Int_t maxMom = 5,
36 TString fwdDet = "FMD",
37 Bool_t useEtaGap = kFALSE,
38 Bool_t use3cor = kFALSE,
40 Double_t outlierCutFMD = 4.0,
41 Double_t outlierCutSPD = 4.0,
42 Double_t etaGap = 2.0,
43 Bool_t useTPCForRef = kFALSE,
44 Bool_t useCent = kFALSE,
45 Bool_t useMCVtx = kFALSE,
46 Bool_t satVtx = kFALSE,
51 // --- Get analysis manager ----------------------------------------
52 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
54 Fatal("","No analysis manager to connect to.");
56 // --- Check that we have an AOD input handler ---------------------
57 UShort_t aodInput = 0;
58 if (!(aodInput = AliForwardUtil::CheckForAOD()))
59 Fatal("","Cannot proceed without and AOD handler");
61 (!AliForwardUtil::CheckForTask("AliForwardMultiplicityBase") ||
62 !AliForwardUtil::CheckForTask("AliCentralMultiplicityTask")))
63 Fatal("","The relevant tasks weren't added to the train");
65 // --- For the selected flow tasks the input and output is set -----
68 // --- Set flow flags --------------------------------------------
69 if (useEtaGap && use3cor)
70 Fatal("", "You're doing it wrong! Cannot do both eta-gap and 3-sub");
71 UShort_t flags = AliForwardFlowTaskQC::kStdQC|AliForwardFlowTaskQC::kSymEta;
72 if (useEtaGap) flags = AliForwardFlowTaskQC::kEtaGap;
73 if (use3cor) flags = AliForwardFlowTaskQC::k3Cor;
74 if (satVtx) flags |= AliForwardFlowTaskQC::kSatVtx;
75 if (fwdDet.Contains("FMD")) flags |= AliForwardFlowTaskQC::kNUAcorr;
76 if (fwdDet.Contains("FMD")) flags |= AliForwardFlowTaskQC::kFMD;
77 else if (fwdDet.Contains("VZERO")) flags |= AliForwardFlowTaskQC::kVZERO;
78 if (useTPCForRef) flags |= AliForwardFlowTaskQC::kTPC;
80 const char* name = Form("ForwardFlowQC%s%s", fwdDet.Data(), AliForwardFlowTaskQC::GetQCType(flags, false));
81 AliForwardFlowTaskQC* task = 0;
82 // --- Set up adding flow to MC input ----------------------------
84 AliForwardMCFlowTaskQC* mcTask = new AliForwardMCFlowTaskQC(name);
85 mcTask->SetUseImpactParameter(!useCent);
86 mcTask->SetUseMCHeaderVertex(useMCVtx);
87 if (addFlow.Data()[0] != '\0') {
88 mcTask->AddFlow(addFlow);
89 mcTask->AddFlowType(addFType);
90 mcTask->AddFlowOrder(addFOrder);
94 // --- Or use normal task ----------------------------------------
96 task = new AliForwardFlowTaskQC(name);
99 // mgr->SetSkipTerminate(true);
100 // task->SelectCollisionCandidates(AliVEvent::kCentral);
101 task->SetFlowFlags(flags);
103 // --- Set eta gap value -----------------------------------------
104 task->SetEtaGapValue(etaGap);
106 // --- Check which harmonics to calculate --------------------------
107 task->SetMaxFlowMoment(maxMom);
109 // --- Set non-default axis for vertices ---------------------------
112 a = new TAxis(6, 93.75, 318.75);
115 a = new TAxis(20, -10, 10);
116 // a = new TAxis(10, -5, 5);
117 task->SetVertexAxis(a);
119 // --- Set non-default axis for centrality -------------------------
120 Double_t cent[] = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100 };
121 //Double_t cent[] = {0, 2.5, 15, 25, 50, 100 };
122 //Double_t cent[] = {0, 100};
123 Int_t nBins = sizeof(cent)/sizeof(Double_t) -1;
124 TAxis* centAxis = new TAxis(nBins, cent);
125 task->SetCentralityAxis(centAxis);
127 // --- Set sigma cuts for outliers ---------------------------------
128 task->SetDetectorCuts(outlierCutFMD, outlierCutSPD);
130 // --- Create containers for output --------------------------------
131 const char* sumName = Form("FlowQCSums%s%s", fwdDet.Data(), AliForwardFlowTaskQC::GetQCType(flags, false));
132 const char* resName = Form("FlowQCResults%s%s", fwdDet.Data(), AliForwardFlowTaskQC::GetQCType(flags, false));
133 AliAnalysisDataContainer* sums =
134 mgr->CreateContainer(sumName, TList::Class(),
135 AliAnalysisManager::kOutputContainer,
136 AliAnalysisManager::GetCommonFileName());
137 AliAnalysisDataContainer* output =
138 mgr->CreateContainer(resName, TList::Class(),
139 AliAnalysisManager::kParamContainer,
140 AliAnalysisManager::GetCommonFileName());
141 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
142 mgr->ConnectOutput(task, 1, sums);
143 mgr->ConnectOutput(task, 2, output);