Small fixes
[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,
281a2bf8 31 UShort_t nDiv = 1,
bfab35d9 32 Bool_t usePhiAcc = true,
33 Bool_t useAsymm = false)
34{
35 // --- Load libraries ----------------------------------------------
36 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
37
38 // --- Analysis manager --------------------------------------------
39 AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
40
41 // --- Check that we have an AOD input handler ---------------------
42 UShort_t aodInput = 0;
43 if (!(aodInput = AliForwardUtil::CheckForAOD()))
44 Fatal("","Cannot proceed without and AOD handler");
45 if (aodInput == 2 &&
46 !AliForwardUtil::CheckForTask("AliForwardMultiplicityBase"))
47 Fatal("","The relevant task wasn't added to the train");
48
49
50 // --- Make our object ---------------------------------------------
51 AliForwardMultDists* task = new AliForwardMultDists("Forward");
52
53 // Set the vertex range to use
54 task->SetIpZRange(vzMin, vzMax);
55 // Set the trigger mask to use (INEL,INEL>0,NSD)
56 task->SetTriggerMask(trig);
57 // Set the maximum number of charged particles
58 task->SetMaxN(maxN);
281a2bf8 59 // Set number of divisions per particle number
60 task->SetNDivisions(nDiv);
bfab35d9 61 // Set whether to use stored phi acceptance
62 task->SetUsePhiAcc(usePhiAcc);
63 // add the task
64 mgr->AddTask(task);
65
66 // Add bins
67 Double_t limits[] = { 1, 1.5, 2, 3, 0 };
68 Double_t* plimit = limits;
69 while (*plimit) {
70 Double_t eta = *plimit;
71 task->AddBin(-eta, +eta);
72 if (useAsymm) {
73 task->AddBin(-eta, 0);
74 task->AddBin(0, +eta);
75 }
76 plimit++;
77 }
78
79 // --- create containers for input/output --------------------------
80 AliAnalysisDataContainer *sums =
81 mgr->CreateContainer("ForwardMultSums", TList::Class(),
82 AliAnalysisManager::kOutputContainer,
83 AliAnalysisManager::GetCommonFileName());
84 AliAnalysisDataContainer *output =
85 mgr->CreateContainer("ForwardMultResults", TList::Class(),
86 AliAnalysisManager::kParamContainer,
87 AliAnalysisManager::GetCommonFileName());
88
89 // --- connect input/output ----------------------------------------
90 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
91 mgr->ConnectOutput(task, 1, sums);
92 mgr->ConnectOutput(task, 2, output);
93
94 return task;
95}
96
97
98//________________________________________________________________________
99//
100// EOF
101//