This commit has two major parts:
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskForwardMultDists.C
CommitLineData
bfab35d9 1/**
2 * @file AddTaskForwarddNdeta.C
3 * @author Christian Holm Christensen <cholm@nbi.dk>
4 * @date Fri Jan 28 10:22:26 2011
5 *
6 * @brief Script to add a multiplicity task for the central
7 * @f$\eta@f$ region
8 *
9 *
10 * @ingroup pwglf_forward_scripts_tasks
11 */
12/**
13 * Create the Forward @f$ dN/d\eta@f$ analysis task
14 *
15 * @param trig Trigger to use
16 * @param vzMin Smallest @f$ v_z@f$
17 * @param vzMax Biggest @f$ v_z@f$
18 * @param maxN Maximum Nch
19 * @param usePhiAcc Use stored phi acceptance
20 * @param useAsymm Make asymmetric bins
21 *
22 * @return Newly created and configured task
23 *
24 * @ingroup pwglf_forward_dndeta
25 */
26AliAnalysisTask*
27AddTaskForwardMultDists(const char* trig = "V0AND",
28 Double_t vzMin = -4,
29 Double_t vzMax = +4,
30 UShort_t maxN = 150,
31 Bool_t usePhiAcc = true,
32 Bool_t useAsymm = false)
33{
34 // --- Load libraries ----------------------------------------------
35 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
36
37 // --- Analysis manager --------------------------------------------
38 AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
39
40 // --- Check that we have an AOD input handler ---------------------
41 UShort_t aodInput = 0;
42 if (!(aodInput = AliForwardUtil::CheckForAOD()))
43 Fatal("","Cannot proceed without and AOD handler");
44 if (aodInput == 2 &&
45 !AliForwardUtil::CheckForTask("AliForwardMultiplicityBase"))
46 Fatal("","The relevant task wasn't added to the train");
47
48
49 // --- Make our object ---------------------------------------------
50 AliForwardMultDists* task = new AliForwardMultDists("Forward");
51
52 // Set the vertex range to use
53 task->SetIpZRange(vzMin, vzMax);
54 // Set the trigger mask to use (INEL,INEL>0,NSD)
55 task->SetTriggerMask(trig);
56 // Set the maximum number of charged particles
57 task->SetMaxN(maxN);
58 // Set whether to use stored phi acceptance
59 task->SetUsePhiAcc(usePhiAcc);
60 // add the task
61 mgr->AddTask(task);
62
63 // Add bins
64 Double_t limits[] = { 1, 1.5, 2, 3, 0 };
65 Double_t* plimit = limits;
66 while (*plimit) {
67 Double_t eta = *plimit;
68 task->AddBin(-eta, +eta);
69 if (useAsymm) {
70 task->AddBin(-eta, 0);
71 task->AddBin(0, +eta);
72 }
73 plimit++;
74 }
75
76 // --- create containers for input/output --------------------------
77 AliAnalysisDataContainer *sums =
78 mgr->CreateContainer("ForwardMultSums", TList::Class(),
79 AliAnalysisManager::kOutputContainer,
80 AliAnalysisManager::GetCommonFileName());
81 AliAnalysisDataContainer *output =
82 mgr->CreateContainer("ForwardMultResults", TList::Class(),
83 AliAnalysisManager::kParamContainer,
84 AliAnalysisManager::GetCommonFileName());
85
86 // --- connect input/output ----------------------------------------
87 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
88 mgr->ConnectOutput(task, 1, sums);
89 mgr->ConnectOutput(task, 2, output);
90
91 return task;
92}
93
94
95//________________________________________________________________________
96//
97// EOF
98//